Extending FHIR Resources

Ivan Bagrov
April 11, 2025
4 min

FHIR Resources

The FHIR specification includes many resources that describe various medical data. Sometimes, however, the basic resources are insufficient to describe the data, and in such cases, FHIR provides the following mechanisms for extending the basic resources.‍

A FHIR Extension is a mechanism that allows adding additional elements to FHIR resources beyond the base specification. This is necessary to meet the specific requirements of various implementations while maintaining the simplicity and universality of the base FHIR model.

FHIR provides its own set of extensions. For example, to indicate a patient’s place of birth, the following extension is proposed:

‍

resourceType: Patient
extension:
  - url: http://hl7.org/fhir/StructureDefinition/patient-birthPlace
    valueAddress: 
      city: Springfield
      district: Sangamon 
      state: Illinois

FHIR provides comprehensive extensions that allow for describing more complex objects. For example:

resourceType: Patient
extension:
  - url: http://hl7.org/fhir/StructureDefinition/geolocation
    extension:
      - url: latitude
        valueDecimal: 39.7817
      - url: longitude
        valueDecimal: -89.6501

Extensions can be specified at the root of a resource, as well as on complex (HumanName, Address, etc.) and primitive (string, decimal, code, etc.) FHIR types.

An example of how to specify an extension on a complex type:

resourceType: Patient
name:
  - use: official
    family: Doe
    given:
      - John
    extension:
      - url: http://hl7.org/fhir/StructureDefinition/humanname-assembly-order
    	 valueCode: F

An example of how to specify an extension on a primitive:

resourceType: Patient
birthDate: '1985-06-15'
_birthDate:
  extension:
    - url: 'http://hl7.org/fhir/StructureDefinition/patient-birthTime'
      valueDateTime: '1985-06-15T08:30:00-04:00'

If a field containing a primitive type value is an array and specifying an extension on a specific element of this array is necessary:

resourceType: Patient
name:
  - use: official
    family: Doe
    given:
      - John
      - Michael
    _given:
      extension:
        - null
        - url: http://hl7.org/fhir/StructureDefinition/humanname-assembly-order
    	    valueCode: F

Test it on your local FHIR server

How did you like the article?
Be the first to know!
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

contact us

Get in touch with us today!

By submitting the form you agree to Privacy Policy and Cookie Policy.
Thank you!
We’ll be in touch soon.

In the meantime, you can:
Oops! Something went wrong while submitting the form.

Never miss a thing
Subscribe for more content!

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
By clicking “Subscribe” you agree to Health Samurai Privacy Policy and consent to Health Samurai using your contact data for newsletter purposes