Why HL7 FHIR Matters for Modern Healthcare
Healthcare interoperability has been a challenge for decades. HL7 FHIR (Fast Healthcare Interoperability Resources) provides a modern standard for exchanging healthcare information electronically. Unlike older HL7v2 messages, FHIR uses RESTful APIs and JSON, making it far easier for developers to implement.
In this article, we walk through what it takes to build a production-grade FHIR R4 platform. We cover the decisions that matter most: how to model resources, how to design the API and search, how to handle security and compliance, and what we would tell a team starting the same journey today.
FHIR in One Page: The Concepts That Shape Your Design
Before writing any code, every engineer on the team needs a shared vocabulary. These five concepts drive almost every architectural decision in a FHIR platform:
- Resources: the modular data units of FHIR, such as
Patient,Encounter,Observation,ConditionandMedicationRequest. Each has a published structure and a stable identity. - References: resources point to each other (an
Observationreferences itsPatientandEncounter). Your storage and search must resolve these links efficiently. - Profiles: constraints on top of base resources. National and regional implementation guides, such as US Core, define which fields are mandatory and which code systems must be used.
- Terminologies: clinical meaning lives in codes, not free text: LOINC for lab results and vitals, SNOMED CT for clinical findings, RxNorm for medications, ICD-10 for diagnoses.
- Bundles: the container for search results, batches and transactions. Many real workflows (admitting a patient with their first observations) arrive as a single transaction bundle.
Architecture Overview
A common approach is a microservices architecture with dedicated services for patient management, observations, appointments, and clinical documents. For a platform of this kind, a typical set of components looks like this, with a thin API gateway exposing one consistent FHIR endpoint to the outside world:
| Component | Responsibility |
|---|---|
| API gateway | Authentication, rate limiting, routing and the CapabilityStatement |
| Resource services | Create, read, update and search for a group of related resource types |
| Validation service | Checks every incoming resource against base FHIR and the required profiles |
| Terminology service | Validates and translates codes (LOINC, SNOMED CT, RxNorm, ICD-10) |
| Audit service | Records every read and write of patient data as an immutable event |
| Integration layer | Connects to existing EHRs over FHIR APIs and HL7v2 feeds |
1. Resource-Based Design
FHIR organizes data into "resources": modular building blocks like Patient, Observation, and MedicationRequest. This makes API design clean and predictable. Each resource has a standard schema, which means less custom code and better interoperability.
The key discipline is to resist inventing your own fields. When a requirement is not covered by the base resource, first check the relevant implementation guide; only then add a properly defined extension. Custom fields that bypass the standard are exactly what makes systems hard to integrate later.
2. RESTful API Layer
FHIR APIs follow REST principles: GET for reading, POST for creating, PUT for updating, and DELETE for removing resources. A typical platform implements the full set of CRUD operations for Patient, Observation, Condition, and MedicationRequest resources.
GET /fhir/Patient/123 read one patient
GET /fhir/Observation?patient=123&code=http://loinc.org|8867-4
POST /fhir/Observation create
PUT /fhir/Observation/456 update (with If-Match)
GET /fhir/Patient/123/_history version history
POST /fhir batch / transaction BundleTwo details deserve attention from the start:
- Versioning and optimistic locking. Every update increments
meta.versionIdand returns anETag. Clients sendIf-Matchon updates, so two clinicians editing the same record cannot silently overwrite each other. - Transactions. A transaction bundle either succeeds completely or not at all. Supporting it early means integrations can send a patient and their related resources in one call without leaving half-written records behind.
3. Search That Clinicians Can Rely On
Search is where most of the real engineering effort goes. FHIR defines search parameters per resource, plus modifiers and result controls such as _count, _sort, _include and _revinclude. Implement the parameters your implementation guide requires first, then add others only when a real workflow needs them. Declare each supported parameter in the server's CapabilityStatement, so client developers know exactly what will work.
4. Security and HIPAA Compliance
HIPAA compliance is non-negotiable. Use OAuth 2.0 with SMART on FHIR for authorization, field-level encryption for PHI, and comprehensive audit logging for every data access.
- SMART on FHIR scopes limit each app to the data it needs, for example read-only access to one patient's observations instead of the whole database.
- Field-level encryption protects the most sensitive identifiers even from someone with direct database access.
- Audit events record who accessed which resource, when, from where and why. FHIR's own
AuditEventandProvenanceresources are a good model for this data.
For a deeper look at the safeguards themselves, see our HIPAA compliance guide for developers.
Database Design with MongoDB
A document database such as MongoDB is a natural fit, because its flexible schema maps directly to FHIR's resource model. Give each FHIR resource type its own collection, with indexes on common search parameters like patient ID, date, and status.
A few practices keep a FHIR document store fast and trustworthy:
- Store the resource as FHIR JSON, unchanged, so what you return is exactly what was validated.
- Extract search values into dedicated indexed fields (patient reference, codes, dates) instead of querying deep into nested structures.
- Keep history in a separate collection, so the current version stays small and fast to read while every previous version remains available for
_historyand audits. - Normalise dates and references at write time, so searches by date range or patient do not need to parse anything at read time.
Validation and Terminology
A FHIR server that accepts anything is only a JSON store. Every resource should pass through validation before it is saved: structure against the base specification, constraints against the required profiles, and codes against the terminology service. Rejected resources should return an OperationOutcome that tells the sender precisely which field failed and why, which shortens integration testing dramatically.
Testing and Going Live
- Conformance testing: run the official FHIR validator and public test suites against your server before any partner touches it.
- Realistic synthetic data: generate synthetic patient records for load and integration tests. Never copy real patient data into development or test environments.
- Performance budgets: set response-time targets for the most common searches and test them under realistic volumes.
- Phased rollout: go live with one department or one hospital first, then expand once monitoring shows stable behaviour.
Measuring Success
Set measurable targets before launch and track them from day one: availability (for example, a 99.9% uptime target), API response times, validation error rates, and how long it takes to onboard a new EHR integration. These numbers tell you when the platform is ready to take on more sites.
Lessons We Would Share With Any Team
- Pick your implementation guide before your database. The profiles you must support decide your data model.
- Treat terminology as a first-class service, not a lookup table added later.
- Build audit logging on day one. Retrofitting it is far harder than designing for it.
- Publish an accurate
CapabilityStatement. It is the contract every integration partner reads first. - Plan for HL7v2 as well. Many hospital systems still send v2 messages, so your platform will need to translate them. Our EHR integration best practices cover this in detail.
Conclusion
FHIR makes healthcare interoperability achievable with modern web engineering, but only when the standard is respected end to end: standard resources, validated profiles, coded data, strict security and complete auditability. Get those foundations right and new integrations stop being projects measured in months.
Planning a FHIR platform or connecting to hospital systems? Talk to our healthcare engineering team.