FHIR Schema Structure: Practical Guide for Integration Engineers

FHIR Schema — How It's Revolutionizing Healthcare Connectivity

FHIR Schema Structure: Practical Guide for Integration Engineers

The FHIR schema — the structure of resources and their relationships — is well-documented but has practical patterns worth understanding for integration engineers.

Base schema elements

Every resource has:

1. resourceType — resource name. 2. id — server-assigned identifier. 3. meta — versionId, lastUpdated, profile, tag, security. 4. extension[] — custom fields via Extension. 5. modifierExtension[] — extensions changing adjacent element meaning. 6. Type-specific fields.

Common data types

1. Primitives. string, integer, dateTime, decimal, boolean. 2. Complex types. HumanName, Address, ContactPoint, Quantity, Reference, CodeableConcept. 3. Special types. Bundle, OperationOutcome.

Reference discipline

1. Reference by type: Observation.subject.reference: 'Patient/123'. 2. Reference by absolute URL: 'https://external-server.com/Patient/456'. 3. Reference by placeholder: 'urn:uuid:tmp-1' (in Bundle transactions).

Profile constraints

Profiles constrain the base schema:

1. Cardinality (0..1 → 1..1). 2. Terminology bindings (ValueSet references). 3. Fixed values. 4. Extensions required or forbidden. 5. Slicing on repeating elements.

Extension structure

Extensions have:

1. url — canonical URL identifying the extension. 2. value[x] — value in appropriate type. 3. Optional nested extension[].

Common schema tricks

1. Slicing for categorized repeating elements. Address entries sliced by use (home, work). 2. Nested extensions for complex custom fields. Race extension has nested category, detail sub-extensions. 3. Reference type constraints via profile. Reference limited to specific resource types.

Validation tools

1. `$validate` operation — server-side. 2. Inferno — conformance testing. 3. FHIR Validator (Java) — command-line. 4. Vendor SDK validators (HAPI, Firely, fhir.resources).

Common schema mistakes

1. Missing required elements per profile. 2. Wrong data type. 3. Custom extensions without StructureDefinition. 4. Reference to wrong resource type. 5. Slicing without proper discriminator.

FHIR schema, once understood, makes integration engineering predictable. Get the base concepts right and specific implementations follow.