FHIR Architecture and Core Concepts

Section 3 of 18
17% complete

Resource-Based Architecture

FHIR is built around the concept of Resources - modular, reusable components representing healthcare concepts.

Resource Categories

FHIR resources are organized into five main categories:

  1. Clinical Resources: Patient, Observation, Condition, Procedure, MedicationRequest
  2. Administrative Resources: Organization, Practitioner, Location, Encounter
  3. Financial Resources: Claim, Coverage, ExplanationOfBenefit
  4. Infrastructure Resources: Bundle, OperationOutcome, Subscription
  5. Conformance Resources: StructureDefinition, ValueSet, CodeSystem

Core FHIR Concepts

1. Resources

Every resource has these common elements:

  • Metadata: id, meta (versionId, lastUpdated, profile, security, tag)
  • Human-readable narrative: text element
  • Structured data: Resource-specific elements
  • Extensions: For additional data not in base specification

2. References

Resources can reference other resources in several ways. References are fundamental to FHIR’s data model, allowing you to link related clinical information together. You can use logical references (pointing to resource IDs), literal references (embedding resources), or identifier-based references (using business identifiers). Choose the appropriate reference type based on whether the referenced resource exists on the same server and how tightly coupled the data needs to be.

// Logical reference
reference.setReference("Patient/123");

// Literal reference (contained resource)
reference.setResource(patientResource);

// Identifier-based reference
reference.setIdentifier(new Identifier()
    .setSystem("http://hospital.org/mrn")
    .setValue("MRN-12345"));

3. Data Types

FHIR defines both primitive and complex data types:

Primitive Types:

  • boolean, integer, decimal, string
  • date, dateTime, time, instant
  • uri, url, canonical, oid, uuid, base64Binary

Complex Types:

  • Identifier, CodeableConcept, Coding, Quantity
  • Range, Period, HumanName, Address
  • ContactPoint, Attachment

4. Bundles

A Bundle is a container for multiple resources:

Bundle Types:

TypeDescription
documentComposed document
messageMessage-based exchange
transactionAtomic transaction
transaction-responseResponse to transaction
batchBatch processing
batch-responseResponse to batch
historyHistory list
searchsetSearch results
collectionGeneral collection

RESTful API Paradigm

FHIR uses standard HTTP methods for all operations:

OperationHTTP MethodDescription
CreatePOSTCreate new resource
ReadGETRetrieve resource by ID
UpdatePUTUpdate entire resource
PatchPATCHPartial update
DeleteDELETERemove resource
SearchGETQuery for resources
HistoryGETGet version history

Resource URLs

Standard FHIR URL patterns follow a consistent structure. Understanding these URL patterns is essential for interacting with FHIR servers, as they form the foundation of all RESTful operations. The URL structure includes the server base, resource type, resource ID, and optional version or history paths. Mastering these patterns enables you to construct proper API calls for any FHIR operation.

[base]/[type]/[id]
[base]/[type]?[search parameters]
[base]/[type]/[id]/_history
[base]/[type]/[id]/_history/[version]

Examples:

  • https://fhir.example.com/Patient/123 - Read patient with ID 123
  • https://fhir.example.com/Patient?family=Smith - Search for patients named Smith
  • https://fhir.example.com/Patient/123/_history - Get all versions of patient 123

Content Negotiation

FHIR supports multiple formats via HTTP headers. Content negotiation allows clients to specify their preferred data format when communicating with FHIR servers. The Accept header declares the desired response format, while Content-Type specifies the request body format. This flexibility enables FHIR to work seamlessly with systems that prefer JSON, XML, or RDF Turtle representations.

Accept: application/fhir+json          # JSON format
Accept: application/fhir+xml           # XML format
Accept: application/fhir+turtle        # RDF Turtle
Content-Type: application/fhir+json    # Request body format

Understanding Resource Structure

Every FHIR resource follows this general structure. The structure includes mandatory elements like resourceType and id, along with optional metadata, human-readable narrative, and resource-specific content. Understanding this structure is crucial because it applies universally across all FHIR resources, making it easier to work with any resource type once you understand the pattern.

{
  "resourceType": "Patient",
  "id": "123",
  "meta": {
    "versionId": "1",
    "lastUpdated": "2024-01-15T10:30:00Z"
  },
  "text": {
    "status": "generated",
    "div": "<div>Human readable summary</div>"
  },
  // Resource-specific content
  "name": [{ "family": "Smith", "given": ["John"] }],
  "gender": "male",
  "birthDate": "1980-06-15"
}

Quiz: FHIR Architecture and Core Concepts

Question 1 of 4

Which of the following is NOT a category of FHIR resources?