Coded Values

FHIR data types for coded values - code, Coding, and CodeableConcept with examples and use cases

FHIR provides three specialized data types for representing coded values, each designed for specific use cases and levels of complexity.

Healthcare systems need different approaches for coded data depending on context. Sometimes you need a simple fixed value from a predefined list. Other times you need to specify exactly which terminology system a code comes from. And occasionally you need to represent the same concept using multiple coding systems simultaneously for maximum interoperability.

FHIR's coded data types address these scenarios systematically, ensuring both precision and flexibility in how healthcare data is exchanged.

Data Types

Code

A simple string value strictly bound to a predefined ValueSet. Used for fixed vocabularies where the meaning is well-established and the possible values are constrained by the FHIR specification itself.

{
  "resourceType": "Patient", 
  "gender": "female"
}

In this example, the gender element is bound to http://hl7.org/fhir/ValueSet/administrative-gender. The concept Female is represented by the simple code female.

See definition

Coding

A complex structure that pairs a code with its source system, providing precise identification of concepts from specific terminologies. Essential when you need to specify exactly which terminology system defines the code's meaning.

{
  "resourceType": "Observation",
  "code": {
    "system": "http://loinc.org",
    "code": "1751-7", 
    "display": "Albumin [Mass/volume] in Serum or Plasma"
  }
}

In this example, the Coding specifies not only the code 1751-7 (which has no meaning by itself), but also identifies LOINC as the source vocabulary that defines this code. The display element provides human-readable text for validation and user interfaces.

See definition

CodeableConcept

A CodeableConcept represents a value that is usually supplied by providing a reference to one or more terminologies or ontologies but may also be defined by the provision of text. This is a common pattern in healthcare data.

This is the most flexible option, containing multiple Coding elements plus optional human-readable text. It allows the same concept to be represented using different terminology systems simultaneously, supporting both local and standard codes.

{
  "resourceType": "Observation",
  "code": {
    "coding": [
      {
        "system": "http://loinc.org",
        "code": "8310-5",
        "display": "Body temperature"
      },
      {
        "system": "http://snomed.info/sct", 
        "code": "386725007",
        "display": "Body temperature (observable entity)"
      }
    ],
    "text": "Body temperature"
  }
}

See definition

Note: The progression from code to Coding to CodeableConcept reflects increasing complexity and flexibility, allowing implementers to choose the appropriate level of semantic precision for their use case.

Last updated

Was this helpful?