Hi, I'm Anton


FHIR resource models are defined using structure definitions that can be quite complex due to the use of type choice elements, content references, slicing, etc. While trying to get my head around all these details, I created an interactive explorer for these models (see below) that works directly off the structure definitions.


FHIR (Fast Healthcare Interoperability Resources) is a standard for exchanging healthcare information electronically. It is designed to be easy to implement and use, with the ultimate goal of improving the interoperability of healthcare systems.

The building blocks of FHIR—FHIR resources—are the individual pieces of data that are exchanged between systems. Examples of FHIR resources are Patient, Observation, and MedicationRequest.

Each FHIR resource is a tree structure made of individual fields/data elements. These structures are formally defined using FHIR structure definition resources.

Structure definitions for FHIR resources

Structure definitions are FHIR's core infrastructure/conformance resources. They provide the mechanism for defining all FHIR types, including resources.

If you read the full docs on structure definitions, you'll see that they are both very powerful and complex—which is necessary if the goal is to be able to define FHIR structures/models in a flexible, reusable, and machine-processable way. To me, some of the most notable and cool features of structure/element definitions include type choice elements, content references, FHIRPath-based constraints, and slicing.

As I was trying to get my head around all these details, I started experimenting with programmatically parsing/interpreting structure definitions and visualizing the encoded FHIR resource models. As a result, I created an interactive tree view/explorer for these models that you can play with below.

Building the demo

The demo below works directly off the structure definitions from the base FHIR specifications (multiple FHIR versions).

There are some interesting cases in which you can go infinitely deep into the tree. For example, the PlanDefinition resource has an element called action which has sub-actions which has sub-actions and so on. In such cases, the structure definitions are traversed recursively as you expand the tree nodes.

Another tricky part of rendering the tree is the handling of type choice elements. An example of type choice element is value[x] in the Observation resource.

The icons!

The official FHIR specification provides a similar tree view for FHIR resource models that uses icons to help visually distinguish the different types of elements.

Instead of using the same raster icons, I created my own vector versions to give them a more modern, fresh look. I made them optically consistent with the icons used in Visual Studio Code.

Demo: FHIR resource model browser

The version of the FHIR specification to use.
The resource type to view.
An identifier for this patient
identifier: Identifier
Whether this patient's record is in active use
active: boolean
A name associated with the patient
name: HumanName
A contact detail for the individual
telecom: ContactPoint
male | female | other | unknown
gender: code
The date of birth for the individual
birthDate: date
Indicates if the individual is deceased or not
deceased: choice type
An address for the individual
address: Address
Marital (civil) status of a patient
maritalStatus: CodeableConcept
Whether patient is part of a multiple birth
multipleBirth: choice type
Image of the patient
photo: Attachment
A contact party (e.g. guardian, partner, friend) for the patient
contact: BackboneElement
A language which may be used to communicate with the patient about his or her health
communication: BackboneElement
Patient's nominated primary care provider
generalPractitioner: Reference
Organization that is the custodian of the patient record
managingOrganization: Reference
Link to another patient resource that concerns the same actual person
link: BackboneElement

See also

Made by Anton Vasetenkov.

If you want to say hi, you can reach me on LinkedIn or via email. If you like my work, you can support me by buying me a coffee.