FHIR / HL7 Interoperability
Last updated: 2026-02-18
This document describes the implemented FHIR integration surface and healthcare interoperability constraints.
1. Standard and scope
- FHIR version: R4 (
4.0.1) - Content type:
application/fhir+json - Capability statement endpoint:
GET /api/fhir/metadata
Supported resources:
PatientCarePlanObservationDiagnosticReportMedicationRequest
2. Authentication and authorization
FHIR routes support:
- Clerk session auth for eligible employer roles, or
- API key auth with:
fhir:readfor reads/searchfhir:writefor creates/updates
Routes are employer-scoped and tenant-isolated.
3. Endpoints
GET /api/fhir/metadataGET /api/fhir/PatientPOST /api/fhir/PatientGET /api/fhir/Patient/{id}GET /api/fhir/CarePlanGET /api/fhir/ObservationGET /api/fhir/DiagnosticReportGET /api/fhir/MedicationRequestPOST /api/fhir/smart/launchGET|POST /api/fhir/$exportGET /api/fhir/Group/{id}/$exportGET /api/fhir/bulk-export/{exportId}GET /api/fhir/bulk-export/{exportId}/downloadGET /.well-known/smart-configurationGET /api/cds-servicesPOST /api/cds-services/patient-view
4. Search parameters
Patient
_id: internal patient user idemail: patient email_count: page size (bounded server-side)
CarePlan
patient=Patient/{id}_count
Observation
patient=Patient/{id}code(matches test name text)_count
DiagnosticReport
patient=Patient/{id}_count
MedicationRequest
patient=Patient/{id}_count
5. Resource mapping summary
Patient mapping
- Local
User(role=PATIENT) maps to FHIRPatient - Primary identifier is local user id
- Telecom email is required for create mapping
CarePlan mapping
- Tapering logs map to FHIR
CarePlan - Current medication and dosage change history map into plan narrative metadata
Observation mapping
LabReport.testResultsrows map to FHIRObservation- Numeric results map to
valueQuantity - Non-numeric results map to
valueString - Lab flags map to interpretation codes when provided
DiagnosticReport mapping
- Each
LabReportmaps to oneDiagnosticReport - Associated
Observationresources are exposed viaresultreferences - Abnormal and critical findings map to
conclusion
MedicationRequest mapping
- Current patient medication profile maps to
MedicationRequest - Current dosage maps to
dosageInstruction
6. Error model
FHIR route validation errors return OperationOutcome.
Examples:
400 invalidfor wrong resource type404 not-foundfor missing patient resource409 duplicatewhen creating patient with existing employer-scoped email422 invalidfor payload mapping/validation failures
OperationOutcome responses are also written to audit telemetry (fhir.operation_outcome) for
spike monitoring and incident alerting.
7. Example request
Search observations for one patient:
bash
curl "https://<host>/api/fhir/Observation?patient=Patient/<patient_id>&_count=25" \
-H "x-api-key: mt_live_***" \
-H "accept: application/fhir+json"
8. HL7 integration note
Current implementation is FHIR-first. Teams needing legacy HL7 v2 exchange should implement a translation layer outside Bounded Health (for example, an interface engine translating v2 messages to FHIR REST calls).
9. Remaining limitations
- Current SMART launch implementation uses platform-signed bearer tokens and does not expose a full OAuth authorization code flow.
- CDS Hooks currently includes
patient-viewonly; additional hooks can be added as required. - Bulk FHIR export currently emits Patient NDJSON; additional resource types can be added incrementally.
- US Core validation runs in CI using fixture validation plus optional HL7 validator execution.
10. Production checklist
- Validate resources with R4 validators in CI before import (
npm run fhir:validate-us-core) - Treat local IDs as authoritative keys for follow-up reads
- Implement retry handling for 5xx and network failures
- Track and alert on
OperationOutcomeerror spikes- Automated hourly alerting route:
GET /api/cron/integration-alerts
- Automated hourly alerting route: