Healthcare pack
Allergies CSV import API
Map allergy and intolerance lists to FHIR R4 AllergyIntolerance: substance, criticality, clinical status, onset. Multilingual headers handled.
curl -X POST https://api.adaptivmapr.com/v1/uploads \
-H "Authorization: Bearer $ADAPTIVMAPR_API_KEY" \
-F "template=allergies_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.
allergies_v1FHIR · AllergyIntolerance- fields
- 8
- required
- 2
- validated
- 0
- hints
- 46
| Canonical column | Type | Required | Validators | Header hints the cascade matches |
|---|---|---|---|---|
allergy_id | string | — | — | allergie-idallergy idid allergieid allergiaid alergia |
patient_id | string | yes | — | patientpatient_idpidpatienten-idid patient |
substance | string | yes | — | allergenauslösersubstanzallergèneallergenesubstancesustanciaalérgenoallergy |
allergy_code | string | — | — | allergiecodecode allergènecodice allergenesubstance codecódigo |
criticality | enumlowhighunable-to-assess | — | — | schweregradkritikalitätgravitégravitàseveritygravedad |
clinical_status | enumactiveinactiveresolved | — | — | statusstatutstatoestadoclinical status |
onset_date | date | — | — | erstmalsbeginndate d'apparitiondata di insorgenzaonsetfecha de aparición |
recorded_date | date | — | — | erfasst amdate de saisiedata di registrazionerecordedfecha de registro |
Read the same definition as JSON at GET /v1/templates/allergies_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.
- 8 canonical fields
- 2 required
- 0 validated
- 46 header hints, 5 languages
- FHIR AllergyIntolerance
Why it exists
Written for the file you actually receive.
The Allergies template holds what a patient reacts to — drugs, foods, latex, environmental triggers — in the shape FHIR R4 calls AllergyIntolerance. patient_id and substance are required; a substance code, criticality, clinical status, onset date, recorded date and a row id are optional. Each row emits one AllergyIntolerance: the substance and its code form the code element, criticality is written as low, high or unable-to-assess, clinical status uses the narrower allergyintolerance-clinical set (active, inactive, resolved), and the patient becomes a Patient/ reference. Allergy lists are copied between systems at almost every hand-over — referral, admission, discharge, pharmacy — and an incomplete copy is hard to spot afterwards. That, and the fact that each row describes an identifiable person, puts the template at `medium` risk: a production commit is held until a workspace member approves the mapping in the dashboard.
Criticality is not severity. In FHIR, criticality is the potential for a serious future reaction; severity describes a reaction that already happened. Source files often title the column "Severity" or "Schweregrad" and fill it with mild / moderate / severe — the template maps the header to criticality but refuses values outside its three, so those rows surface as invalid instead of being quietly reinterpreted. allergy_code is passed through without a code system: an ATC code stays an ATC code, but the coding does not say so.
Migration scenarios & the foreign headers they ship
Allergy lists travel with every transition of care: an admission pulls the GP's list, a discharge letter sends the updated one back, a pharmacy chain merges records after buying a competitor, and an EMR migration has to carry every patient's list across without dropping the inactive and resolved entries. Headers we encounter: "Allergy / Allergen / Auslöser / Substanz / Allergène / Allergene / Sustancia / Alérgeno / Schweregrad / Kritikalität / Gravité / Gravità / Severity / Status / Statut / Stato / Erstmals / Beginn / Date d'apparition / Onset / Erfasst am / Date de saisie / Recorded". A column simply titled "Allergy" — the commonest English header — is a registered hint on substance, so the most frequent shape maps without help.
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/allergies_v1.
curl -X POST https://api.adaptivmapr.com/v1/uploads \
-H "Authorization: Bearer $ADAPTIVMAPR_API_KEY" \
-F "template=allergies_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: "allergies_v1",
headers: ["allergy_id", "patient_id", "substance", "allergy_code"]
})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








