Healthcare pack

Allergies CSV import API

Map allergy and intolerance lists to FHIR R4 AllergyIntolerance: substance, criticality, clinical status, onset. Multilingual headers handled.

30-second curl
curl -X POST https://api.adaptivmapr.com/v1/uploads \
  -H "Authorization: Bearer $ADAPTIVMAPR_API_KEY" \
  -F "template=allergies_v1" \
  -F "file=@your_data.csv"
→ 8 canonical fields · 0 validated · medium risk

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 columnTypeRequiredValidatorsHeader hints the cascade matches
allergy_idstring——allergie-idallergy idid allergieid allergiaid alergia
patient_idstringyes—patientpatient_idpidpatienten-idid patient
substancestringyes—allergenauslösersubstanzallergèneallergenesubstancesustanciaalérgenoallergy
allergy_codestring——allergiecodecode allergènecodice allergenesubstance codecódigo
criticalityenumlowhighunable-to-assess——schweregradkritikalitätgravitégravitàseveritygravedad
clinical_statusenumactiveinactiveresolved——statusstatutstatoestadoclinical status
onset_datedate——erstmalsbeginndate d'apparitiondata di insorgenzaonsetfecha de aparición
recorded_datedate——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.

  1. 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}.

  2. L2Heuristicno LLM

    Normalises accents, punctuation and whitespace, then compares against the column name, the label, and every registered hint (DE / FR / IT / EN / ES).

  3. L3Fuzzyno LLM

    Token-set ratio plus Levenshtein over the normalised strings. Auto-accepts at 0.80 — it absorbs typos and reordered words.

  4. L4Semanticcheap, cached

    Embedding cosine between the header and the field’s label + hints. Catches the long tail of paraphrases.

  5. 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.

bash
curl -X POST https://api.adaptivmapr.com/v1/uploads \
  -H "Authorization: Bearer $ADAPTIVMAPR_API_KEY" \
  -F "template=allergies_v1" \
  -F "file=@your_data.csv"
→ upload created · mappings ready · confirm before commit

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.

mcp
// 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"]
})
schema-only · column names and a few examples only
MCP install instructions
medium-risk template

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.

How the wallet is charged

Questions

Allergies CSV import — FAQ

Can one cell list several allergens?
It maps, but "penicillin, latex" becomes one AllergyIntolerance whose text is the whole string. Split such cells into one row per substance before import if your destination needs them separately.
Which coding system does allergy_code carry?
None. The value lands in code.coding with the substance as its display and no system URI, so a consumer has to know which vocabulary your file uses. Leave the column unmapped if it mixes vocabularies.
Are reactions recorded?
No. Reaction manifestations and their severity are not in the canonical row, and AllergyIntolerance.reaction is not emitted. The template carries the allergy itself, not the history of reactions to it.
Does an allergies mapping need approval before commit?
In production, yes. Allergies is medium risk, so POST /v1/uploads/:id/commit returns 428 hitl_approval_required until a workspace member approves that exact mapping in the dashboard.

Map allergies in production — without shipping raw records.

Minimal data mode sends only column names and a few example values — never the full file. Add full-data when you need row-level AI, routed in-region under a BAA.