Healthcare pack
Drug formulary CSV import API
Import a drug formulary from CSV. ATC-coded, GTIN-checksum-validated, Pharmacode-aware, emits FHIR Medication.
curl -X POST https://api.adaptivmapr.com/v1/uploads \
-H "Authorization: Bearer $ADAPTIVMAPR_API_KEY" \
-F "template=drug_formulary_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.
drug_formulary_v1FHIR · Medication- fields
- 6
- required
- 2
- validated
- 3
- hints
- 16
| Canonical column | Type | Required | Validators | Header hints the cascade matches |
|---|---|---|---|---|
atc_code | string | yes | atc_code | atcwirkstoffcode |
gtin | string | — | gtin | gtineanbarcode |
pharmacode | string | — | pharmacode | pharmacodepharma-code |
name | string | yes | — | präparatpréparationmedicamento |
dosage_form | string | — | — | darreichungsformforme galéniqueforma |
strength | string | — | — | stärkedosagedosis |
Read the same definition as JSON at GET /v1/templates/drug_formulary_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.
- 6 canonical fields
- 2 required
- 3 validated
- 16 header hints, 5 languages
- FHIR Medication
Why it exists
Written for the file you actually receive.
The Drug formulary template is the canonical schema for a pharmacy's medication catalog. Each row emits a FHIR Medication resource — the ATC code lands in Medication.code with the WHO ATC coding system, the GTIN goes into Medication.identifier with the GS1 system URI, and the Swiss Pharmacode (4-7 digits) carries the local registry id. The template is `medium` risk not because it contains PHI — drugs are not patients — but because dosage-form and strength errors are downstream-dangerous; a transposed digit in a strength column produces a 100x dose error in the resulting prescription system. AdaptivMapr validates ATC against the published pattern (^[A-Z]NN[A-Z]{2}NN$), GTIN against the GS1 mod-10 checksum, and Pharmacode against the 4-7 digit shape. Customers use this template when seeding an e-prescribing system, when standardising an in-house pharmacy database, or when re-importing after a vendor migration.
GTIN supports 8 / 12 / 13 / 14 digit shapes (EAN-8, UPC-A, EAN-13, GTIN-14) with mod-10 checksum verification — the same algorithm as ITF-14 barcodes. ATC five-level codes (anatomical → therapeutic → pharmacological → chemical → substance) all validate against the same regex. Pharmacode is Swiss-specific and not enforced as a checksum because the algorithm is proprietary.
Migration scenarios & the foreign headers they ship
Migration scenarios for the Drug formulary: seeding a new e-prescribing module with a clinic's in-house formulary, importing a hospital pharmacy's catalogue after a procurement-system switch, quarterly refreshes against Swissmedic / EMA / FDA bulletins, and consolidating multiple regional formularies after a healthcare-network acquisition. Foreign headers we routinely see: "ATC / Wirkstoffcode / Code ATC / GTIN / EAN / Barcode / Codice / Pharmacode / Pharma-Code / Präparat / Préparation / Medicamento / Farmaco / Darreichungsform / Forme galénique / Forma farmacéutica / Stärke / Dosage / Dosis". Trade names rarely match ATC patterns directly, so the resolver layer carries weight on this template — most imports rely on the high-confidence trade-name → ATC fallback to clear without manual intervention.
The cascade
Five 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/drug_formulary_v1.
curl -X POST https://api.adaptivmapr.com/v1/uploads \
-H "Authorization: Bearer $ADAPTIVMAPR_API_KEY" \
-F "template=drug_formulary_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 up to three clamped sample rows.
// In Cursor or Claude Desktop with the AdaptivMapr MCP server installed:
adaptivmapr.match_headers({
template_id: "drug_formulary_v1",
headers: ["atc_code", "gtin", "pharmacode", "name"]
})The mappings response comes back flagged. PATCH /uploads/:id/mappings returns requires_hitl: true and hitl_status: "pending_review" so you can hold the commit in your own workflow — the flag is a signal, not a queue we run. Schema-only mode (headers plus at most three sample rows, each clamped to 80 characters) 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
Drug formulary CSV import — FAQ
Ready when you are
Map drug formulary in production — without shipping raw records.
Schema-only mode leaves only headers and a handful of clamped samples. Add full-data when you need row-level AI, routed in-region under a BAA.