Overview
In Mirobody, “data mapping” is three separate concerns:- Domain mapping — a vendor maps its endpoints onto the normalized
DataDomainenum so callers request data by category. - Unit normalization — free-text units are folded to canonical UCUM (shipped).
- FHIR representation — the canonical resource shape everything converges on is FHIR R4 (
Observationfor measurements).
fetch returns the vendor’s own JSON (or FHIR JSON for FHIR-native sources); the canonical store is the embedded FHIR R4 endpoint.1 — Domain mapping
Everyfetch takes a DataDomain, and each vendor maps it onto the endpoint(s) it actually brokers:
Observation category token instead (the ehr SMART-on-FHIR client):
2 — Unit normalization (UCUM)
The terminology engine insrc/fhir/units/ turns a free-text “value + unit” string into a canonical UCUM unit plus the LOINC PROPERTY family that disambiguates it. Pure local computation — no DB, no embedding API.
tests/fhir/units_test.cpp.
3 — FHIR R4 representation
The canonical store is FHIR R4 (src/fhir/). FHIR-native vendors — the generic ehr client, plus Vitalera / HealthConnect / Redox / Particle Health / Metriport-Medical — already return FHIR resources; on-device stores POST Observations. A measurement is an Observation with a normalized (UCUM) valueQuantity:
/fhir (see Data Flow).
Mapping an indicator to a coded
Observation.code (SNOMED CT / LOINC / RxNorm) — i.e. terminology resolve and the document → coded-FHIR write-back — is in progress. UCUM normalization and the RESTful FHIR store are shipped; full terminology mapping is planned (see src/fhir/README.md phases 3–4). Until then, Observation.code may carry a text rather than a resolved code. (verify)Mapping a new source
When you add avendor::Vendor (Provider Integration):
- Decide which
DataDomains the source brokers; list them inVendorInfo.domains. - In
fetch, map each domain onto the source’s endpoint (REST path) or FHIRcategory(FHIR source); throw for unsupported domains. - Return the source’s JSON (or FHIR JSON). Don’t pre-normalize — normalization/FHIR conversion is a downstream, shared concern.
- If you surface units, run them through
parse_value_unit/normalize_unitso they land as UCUM.
Next steps
Provider Integration
Implement
fetch and domain mappingData Flow
From vendor JSON to the FHIR store
File Processing
UCUM normalization for document values
Provider Testing
Verify your fetch output