Healthcare pack

Lab results CSV import API

Import patient-linked lab results from CSV. LOINC-validated, emits FHIR Observation. Schema-only mode.

medium riskFHIR · Observationlab_results_v1
30-second curl
curl -X POST https://api.adaptivmapr.com/v1/uploads \
  -H "Authorization: Bearer $ADAPTIVMAPR_API_KEY" \
  -F "template=lab_results_v1" \
  -F "file=@your_data.csv"
→ 5 canonical fields · 1 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.

lab_results_v1FHIR · Observation
fields
5
required
4
validated
1
hints
13
Canonical columnTypeRequiredValidatorsHeader hints the cascade matches
patient_idstringyespatientpatient_idpid
loinc_codestringyesloinc_codeloinc
valuenumberyeswertvaleurvalor
unitstringeinheitunitéunidad
taken_atdateyesentnahmeprélèvementfecha

Read the same definition as JSON at GET /v1/templates/lab_results_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.

  • 5 canonical fields
  • 4 required
  • 1 validated
  • 13 header hints, 5 languages
  • FHIR Observation

Why it exists

Written for the file you actually receive.

The Lab results template is the patient-linked counterpart to lab_result_catalog_v1 — each row is one observation for one patient at one point in time. patient_id links back to the demographics row, loinc_code identifies the test (and runs through the resolver fallback if free-text), value is the numeric result, unit is the human-readable unit, and taken_at is the sample collection timestamp. The template is `medium` risk because the row carries PHI (a result tied to a patient on a date is identifying), so full-data mode requires the AdaptivMapr subscription. Each row emits a FHIR Observation resource — code goes into Observation.code, value goes into Observation.valueQuantity.value, unit goes into Observation.valueQuantity.unit, and effectiveDateTime is taken_at. The cascade picks up "valeur", "valor", "wert" without escalation.

value is required and number-typed; results that come in as strings ("positive", "negative") need either a separate field or a custom enum — the canonical template is quantitative. Reference ranges live on the catalog row, not here, so downstream interpretation joins on loinc_code.

Migration scenarios & the foreign headers they ship

Migration scenarios for Lab results: backfilling a brand-new EMR with historical lab results from a reference-lab archive, building a population-health dashboard that needs years of HbA1c trajectories, feeding a clinical-trial registry with longitudinal lab data for enrolled patients, and migrating between LIS vendors at hospital-system level. Foreign headers seen routinely: "Patient ID / Patientennr / PID / LOINC / Code LOINC / Wert / Valeur / Valor / Valore / Einheit / Unité / Unidad / Unità / Entnahme / Prélèvement / Toma / Prelievo / Datum". Because lab results are PHI under HIPAA, GDPR, and nFADP, the schema-only mode is the default ingress and the cascade has been tuned so the headers alone are enough to make a confident mapping decision without seeing row content.

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.

  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/lab_results_v1.

bash
curl -X POST https://api.adaptivmapr.com/v1/uploads \
  -H "Authorization: Bearer $ADAPTIVMAPR_API_KEY" \
  -F "template=lab_results_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 up to three clamped sample rows.

mcp
// In Cursor or Claude Desktop with the AdaptivMapr MCP server installed:
adaptivmapr.match_headers({
  template_id: "lab_results_v1",
  headers: ["patient_id", "loinc_code", "value", "unit"]
})
schema-only · headers and ≤3 rows, 80 chars each
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" 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.

How the wallet is charged

Questions

Lab results CSV import — FAQ

Fork the template and replace value (number) with an enum field. The canonical row is quantitative because most lab volume is quantitative — qualitative is a separate template.
Yes — ISO-8601 with offset parses cleanly. The validator does not enforce a timezone; pick one per workspace and normalise upstream if mixed.
Add an `interpretation` field via a fork. The canonical row is bare quantity; clinical interpretation belongs alongside or downstream.
In schema-only mode, yes — only headers and three clamped sample rows (≤80 chars each) leave the customer. Full-data mode requires the AdaptivMapr subscription; the layer-5 LLM call goes to a PHI-eligible provider in your region.

Ready when you are

Map lab results 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.

No free tier · $10 prepaid wallet to start · every map draws a small flat fee, deterministic ones included