Healthcare pack
Encounters CSV import API
Map ADT and visit exports from any CSV to FHIR R4 Encounter: admission and discharge, class, status, ward. DE/FR/IT/ES headers handled.
curl -X POST https://api.adaptivmapr.com/v1/uploads \
-H "Authorization: Bearer $ADAPTIVMAPR_API_KEY" \
-F "template=encounters_v1" \
-F "file=@your_data.csv"Canonical columns
The whole schema, printed as it ships.
Every canonical column, the type each row carries, whether it is required, the field-level validators that fire on commit, and the multilingual header hints the cascade resolves against. This is the shipped definition, not a summary of it.
encounters_v1FHIR · Encounter- fields
- 9
- required
- 3
- validated
- 0
- hints
- 62
| Canonical column | Type | Required | Validators | Header hints the cascade matches |
|---|---|---|---|---|
encounter_id | string | yes | — | fallnummerfall-nrbesuchsnummernuméro de séjournumero di casovisit idcase idnúmero de episodio |
patient_id | string | yes | — | patientpatient_idpidpatienten-idid patient |
encounter_class | enumoutpatientinpatientemergencyhomevirtualday case | — | — | fallartbehandlungsarttype de séjourtipo di ricoverosettingvisit typetipo de atención |
status | enumplannedarrivedin-progressfinishedcancelled | — | — | statusstatutstatoestadofallstatus |
start_time | date | yes | — | eintritteintrittsdatumaufnahmeaufnahmedatumdate d'admissiondata di ricoveroadmission dateadmittedfecha de ingreso |
end_time | date | — | — | austrittaustrittsdatumentlassungdate de sortiedata di dimissionedischarge datedischargedfecha de alta |
encounter_type | string | — | — | grundeintrittsgrundmotifmotivoreason for visitreason |
practitioner_id | string | — | — | arztbehandelnder arztmédecinmedicoproviderdoctormédico |
location_id | string | — | — | stationabteilungservicerepartowardunitlocation |
Read the same definition as JSON at GET /v1/templates/encounters_v1. A hint match resolves on layer 2 — no LLM call, no token spend, just the flat per-map fee. Hover a validator id to see what it checks.
- 9 canonical fields
- 3 required
- 0 validated
- 62 header hints, 5 languages
- FHIR Encounter
Why it exists
Written for the file you actually receive.
The Encounters template is the schema for the question every clinical dataset eventually asks: when was this patient seen, where, and in what setting? One row is one contact — an outpatient consultation, an emergency attendance, a multi-day inpatient stay, a video call. encounter_id, patient_id and start_time are required; class, status, discharge time, reason, treating practitioner and ward are optional, because ADT extracts rarely agree on which of those they carry. On FHIR output each row becomes an R4 Encounter: the stay number lands in identifier, the patient becomes a Patient/ reference in subject, admission and discharge fill period.start and period.end, the practitioner becomes a participant and the ward a Location/ reference. The template is `medium` risk — a dated visit tied to a patient identifier is health information — so in production a commit is refused until a workspace member approves that exact mapping in the dashboard.
encounter_class takes six plain-language values — outpatient, inpatient, emergency, home, virtual, day case — and the FHIR emitter translates them into the v3 ActCode codes R4 binds Encounter.class to (AMB, IMP, EMER, HH, VR, SS). status follows the R4 lifecycle subset planned / arrived / in-progress / finished / cancelled. A row with no status is emitted as finished, which suits a discharge extract but not a live bed board, so map the column whenever the source has one. The reason column is free text and lands in Encounter.type as text, not as a code.
Migration scenarios & the foreign headers they ship
Encounter files usually come out of a hospital information system's ADT feed, a practice-management scheduler, or a case-mix extract assembled for billing. Typical jobs: a hospital group consolidating the case lists of two sites after a merger, a research data warehouse pulling a year of stays for a cohort, a telehealth provider reporting video consultations to a partner clinic, and a payer reconciling claimed stays against the hospital's own record. The headers we meet look like "Fallnummer / Fall-Nr / Numéro de séjour / Numero di caso / Case ID / Visit ID / Fallart / Type de séjour / Tipo di ricovero / Eintrittsdatum / Aufnahme / Date d'admission / Austritt / Entlassung / Date de sortie / Data di dimissione / Station / Abteilung / Reparto / Ward". Every one of them is a registered hint, so a stay list in any of those languages maps on the deterministic layers alone.
The cascade
Six layers, and the cheapest one wins.
Layers run in order and stop the moment a column resolves. That is the single biggest cost lever in the system: a column caught on layer 2 never reaches the metered layer 5.
- L1Statisticsno LLM
Auto-accepts a header that past confirmations already resolved the same way, at {minN:100, minRatio:0.95} or {minN:20, minRatio:1.00}.
- L2Heuristicno LLM
Normalises accents, punctuation and whitespace, then compares against the column name, the label, and every registered hint (DE / FR / IT / EN / ES).
- L3Fuzzyno LLM
Token-set ratio plus Levenshtein over the normalised strings. Auto-accepts at 0.80 — it absorbs typos and reordered words.
- L4Semanticcheap, cached
Embedding cosine between the header and the field’s label + hints. Catches the long tail of paraphrases.
- L5LLMmetered
Everything still unresolved goes up in ONE batched, collision-aware call, constrained to this template’s column set so it cannot invent a field.
Try it
One template id, two ways in.
REST for your import pipeline, MCP for your editor. Both run the same cascade and both honour the same schema-only clamp.
REST · POST /v1/uploads
Name the template; the cascade picks up the rest. The canonical definition is read-only at GET /v1/templates/encounters_v1.
curl -X POST https://api.adaptivmapr.com/v1/uploads \
-H "Authorization: Bearer $ADAPTIVMAPR_API_KEY" \
-F "template=encounters_v1" \
-F "file=@your_data.csv"MCP · Cursor / Claude Desktop
Drop AdaptivMapr into your editor and call the same cascade as a tool. Schema-only calls leave only column names and a few example values.
// In Cursor or Claude Desktop with the AdaptivMapr MCP server installed:
adaptivmapr.match_headers({
template_id: "encounters_v1",
headers: ["encounter_id", "patient_id", "encounter_class", "status"]
})The mappings response comes back flagged. PATCH /uploads/:id/mappings returns requires_hitl: true and hitl_status: "pending_review" and on the hosted API a commit waits until a workspace member records an approval. Schema-only mode (column names and a few example values, never the full file) is a data-minimization mode enforced at the HTTP edge. Full-data mode routes the metered layer-5 call to phi-cloud in-region under a BAA, costs 20% more on the whole map charge, and stays locked until the workspace accepts the BAA/NDA in Settings → Security & Data.
Questions








