Release 4 R5 Final QA

This page is part of the FHIR Specification (v4.0.1: R4 (v5.0.0-draft-final: Final QA Preview for R5 - Mixed Normative and STU see ballot notes ) in it's permanent home (it will always be available at this URL). ). The current version which supercedes this version is 5.0.0 . For a full list of available versions, see the Directory of published versions . Page versions: R5 R4B R4 R3 R2 R3

Using Codes Code Systems Value Sets Concept Maps Identifier Systems 4.1 Using Codes in Resources

Example MedicationRequest/medrx0325 (XML)

FHIR Infrastructure The instance carries a string. In some cases, applications may wish to control the set of valid strings for a particular element, so the string value can be treated as a coded element (like code ) uri Like string , URIs can be treated as a coded element
Pharmacy Work Group Maturity Level : Normative N/A Standards Status : Normative Informative This page has been approved as part of an ANSI standard. See the Infrastructure Package for further details. Many elements in the FHIR resources have a coded value : some fixed string (a sequence of characters) assigned elsewhere that identifies some defined "concept". The sequence of characters and its meaning may be defined in one of several places: As one of a set of fixed values defined in this specification In an internet RFC (e.g. mime type, language) An HL7 specification ( HL7 v3 code system, or HL7 v2 table) Some external terminology or ontology such as LOINC Compartments : Encounter , or SNOMED CT A locally maintained dictionary, look up table or enumeration in an application (for further discussion of locally defined value sets, see "Profiling FHIR" These methods of defining codes are collectively called "code systems". This list is far from complete; there are many ways to define code systems, and they vary widely in sophistication and size. Throughout this specification, coded values are always treated as a pair composed of "system" and "code", where the system is a URL that identifies the code system that defines the codes. Note that system values are always case sensitive. Different code systems make their own rules as to whether the codes they define are case sensitive or not. Note that all the codes defined by FHIR itself are case sensitive and SHALL be used in the provided case (usually, but not always, lowercase). The FHIR framework for using coded values is based on the fundamental framework defined in section 5 of the HL7 v3 Core Principles document, including the separation between code systems and value sets. The general pattern for representing coded elements is using the following four elements: system A URI that identifies the system (see below ) version Identifies the version of the system (see Code System Versioning ) code A string pattern that identifies a concept as defined by the code system display A description of the concept as defined by the code system The Coding data type represents this pattern. This example shows a LOINC code with the LOINC system, the version of LOINC used for the definition, and the display assigned by LOINC: { "system" : "http://loinc.org", "version" : "2.62", "code" : "55423-8", "display" : "Number of steps in unspecified time Pedometer" } When codes are carried in resources, one of several different data types is used: code The instance represents the code only. The system is implicit - it is defined as part of the definition of the element, and not carried in the instance. Coding A data type that has a code and a system element that identifies where the definition of the code comes from CodeableConcept A type that represents a concept by plain text and/or one or more coding elements (See the datatype notes for a discussion of code translations and using text in CodeableConcept) In addition, the following data types also carry coded values, or content that can be treated as a code and bound to a valueset: Quantity The instance has system and code elements for carrying a code for the type of unit, and these can be bound to a value set string Patient , Practitioner
Notes: Generally, the choice of data type is dictated by the resource itself. When choosing a data type for an extension , see the FHIR Confluence pages for advice about data type choice . See below for more information about binding the types string and uri to a value set. 4.1.1 Coded Values, Code Systems, and Value Sets The set of coded values that is allowed in an element is known as a "value set" . Anywhere these data types are used, the specification "binds" a value set to the element, and for the types code, Coding, and CodeableConcept, always does. Code Systems

There are many others. Any expression defined by the code system is still regarded as a 'code' and represented as such. This example shows a SNOMED CT expression: { "system" : "http://snomed.info/sct", "code" : "128045006:{363698007=56459004}" } Note that there is no display defined for SNOMED CT expressions. Raw XML 4.1.4 Controlling the use of Coded Values ( canonical form When an element is bound to a value set, the binding has these properties: Name A descriptive name used when presenting information about the binding Strength How the binding should be understood - + also see below Reference A URL that defines the value set. Usually, this is a direct reference to a ValueSet resource, but can be a more indirect reference, where the value set is inferred Description A text description of the use of the codes. If there is no reference, this must be populated. When there is a reference, this can be used to make additional notes about the use and implementation of the value set A binding is always represented using an ElementDefinition.binding . 4.1.4.1 Value Set References There are a number of places in the specification where value sets are referenced in order to bind a coded value to a value set: ElementDefinition .binding.valueSet Used to bind a defined element to a value set ConceptMap .source[x] and .target[x] Used to indicate the scope of the mapping in the Concept Map - from one value set to another Questionnaire .item.answerValueSet Indicates that answers to a set of questions come from a value set ValueSet .compose.include.valueSet The content of a value set includes the content in the imported value set too OperationDefinition .parameter.binding.valueSet Used to bind a defined parameter to a value set ValueSet Reference Extension Indicates that a coded value was chosen from the specified value set When referencing value sets, the reference is usually made to the definition of a value set - that is, a value set that defines what codes are in the value set. A terminology server is required to convert this definition to the actual expansion that specifies what codes are in the value set XML Format Specification in the context of operation. )

There are two types of value set references in this list, direct and logical. 4.1.4.1.1 Direct Value Set references Jump past Narrative A direct value set reference has the type Reference , and refers directly to a ValueSet based on a URL, usually to a terminology server running a FHIR RESTful API . When accessing a value set based on this kind of reference, a system should access the URL directly (after converting a relative reference to an absolute reference according to the local context). If this process fails, the system is unable to resolve the value set and must handle the error appropriately.

Example: GET fhir/Questionnaire/234 <Questionnaire> ... <question> <options> <reference value="ValueSet/234234"/> </options> </question> .... </Questionnaire> This specifies that the values for a questionnaire come from the ValueSet with id 234234 on the same FHIR end-point. To resolve this, the system would GET fhir/ValueSet/234234 Typically, a direct reference like this is good for in-process references, in closed or carefully managed eco-systems. In a more general context, these references tend to be fragile over time because web URLs - including RESTful API URLS - are easily reassigned. For this reason, systems are encouraged to use logical value set references. 4.1.4.1.2 Logical Value Set references A logical value set reference has the type uri , where an absolute URI is provided that matches the one in ValueSet.url. The value set URL can - and is preferred to be - a web address that resolves directly to a fixed web address that serves as the authoritative source Request using Medication Code for that value set. Alternatively, the system can query its terminology server(s) to resolve a value set with that URL as its identity. Example: <StructureDefinition> ... <element> ... <binding> ... <valueSet value="http://hl7.org/fhir/ValueSet/clinical-findings"/> </binding> ... </element> .... </StructureDefinition> This specifies that the element is bound to the value set with a ValueSet.url of http://hl7.org/fhir/ValueSet/clinical-findings . One way to access this value set is to try GET http://hl7.org/fhir/ValueSet/clinical-findings Topical Ointment - which works, for this value set Nystatin - http://hl7.org/fhir/ValueSet/clinical-findings returns the authoritative value set for this URL. Alternatively, the value set could be resolved using a local terminology server. If that's running a FHIR Terminology Server , then this would work like this: GET fhir/ValueSet?url=http://hl7.org/fhir/ValueSet/clinical-findings if the terminology server knows the value set, then it will return the value set. If the URL doesn't resolve to an authoritative value set, and the terminology server(s) don't know the value set, the system is unable to resolve the value set and must handle the error appropriately. The value set URL is allowed to be a URI such as a UUID (e.g. urn:uuid:c0e0d027-1250-4278-8f44-33a49dc67916). These value sets can never be accessed directly, and must come from a terminology server. Note that this specification defines many value sets that have a logical URL that is not resolvable (examples for SNOMED CT , RxNorm , LOINC ) Using a logical reference which is a direct reference to the authoritative value set is the easiest and most reliable approach. However, this requires suitable hosting arrangements, and cannot always be guaranteed, so it is not required. Version specific Logical References A value set has a two-part identifier: a url, and a version. Some value sets only ever have a single 'version'; a revision of the value set contents will cause a new url to be assigned. Others, however, maintain the same URL, and change the version. A terminology server may have multiple value sets for the same ValueSet.url with different versions. To be precise about which version of a value set is being referred to in a value set reference, append the version to the canonical URL with a '|' like this: <valueSet value="http://hl7.org/fhir/ValueSet/clinical-findings|0.8"/> This is a version specific reference to a value set. Searching for this on a terminology server would look like this: GET fhir/ValueSet?url=http://hl7.org/fhir/ValueSet/clinical-findings&version=0.8 Note that if a value set reference does not have a version, and the server finds multiple versions for the value set, the system using the value set should pick the latest version of the value set and use that. Note that this applies to all conformance resources . 4.1.4.1.3 Unbound Note that as a matter of ongoing development, a few elements that have coded data types are not bound to any value set at all. Bindings are to be provided for these elements. 4.1.5 Binding Strengths Almost all the elements that have a coded data type are bound to a value set. The bindings are associated with various degrees of flexibility as to how closely the value set should be followed: required To be conformant, the concept in this element SHALL be from the specified value set. extensible To be conformant, the concept in this element SHALL be from the specified value set if any of the codes within the value set can apply to the concept being communicated. If the value set does not cover the concept (based on human review), alternate codings (or, data type allowing, text) may be included instead. preferred Instances are encouraged to draw from the specified codes for interoperability purposes but are not required to do so to be considered conformant. example Instances are not expected or even encouraged to draw from the specified value set. The value set merely provides examples of the types of concepts intended to be included. The precise conformance criteria for 'required' and 'extensible' binding strengths vary by the data type to which they are applied, as described in the paragraphs below. Irrespective of the binding strength, when a StructureDefinition is used to describe local usage, it can bind the element to a different value set in order to be much more precise about exactly which coded values can be used for these elements, and/or increase the strength of the binding. There are different rules for this, depending on the binding strength, as discussed below. Generally it is expected that jurisdictions, projects hold and vendors will work together to choose actual working value sets. 4.1.5.1 Required To be conformant, codes in this element SHALL be from the specified value set. In the standard, this is generally used for elements where the value needs to be strictly controlled so that everyone can interpret it with confidence. Generally, this is used for elements with type code : dispense request (id = "medrx0325")

the element is bound to a value set that contains a list of distinct codes with a specified system (and version, where required) the element is bound to some external standard that defines the set of valid codes that can be used (typical examples are Mime Types , Language Codes , UCUM
<?xml version="1.0" encoding="UTF-8"?>

<MedicationRequest xmlns="http://hl7.org/fhir">
    <id value="medrx0325"/> 
    <text> <status value="generated"/> <div xmlns="http://www.w3.org/1999/xhtml"><p> <b> Generated Narrative: MedicationRequest</b> <a name="medrx0325"> </a> </p> <div style="display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border:

       1px solid #8da1b4; border-radius: 5px; line-height: 60%"><p style="margin-bottom: 0px">Resource MedicationRequest &quot;medrx0325&quot; </p> </div> <p> <b> identifier</b> : id: 12345689 (use: OFFICIAL)</p> <p> <b> status</b> : on-hold</p> <p> <b> intent</b> : order</p> <h3> Medications</h3> <table class="grid"><tr> <td> -</td> <td> <b> Concept</b> </td> </tr> <tr> <td> *</td> <td> Nystatin 100UNT/MG Topical Ointment <span style="background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki"> (<a href="http://terminology.hl7.org/4.0.0/CodeSystem-v3-rxNorm.html">RxNorm</a> #884308)</span> </td> </tr> </table> <p> <b> subject</b> : <a href="patient-example-a.html">Patient/pat1: Donald Duck</a>  &quot;Donald DUCK&quot;</p> <p> <b> authoredOn</b> : 2015-01-15</p> <p> <b> requester</b> : <a href="practitioner-example-f007-sh.html">Practitioner/f007: Patrick Pump</a>  &quot;Simone HEPS&quot;</p> <blockquote> <p> <b> dosageInstruction</b> </p> <p> <b> sequence</b> : 1</p> <p> <b> text</b> : Apply to affected areas four times daily</p> <p> <b> timing</b> : 4 per 1 days</p> <blockquote> <p> <b> doseAndRate</b> </p> </blockquote> </blockquote> <blockquote> <p> <b> dispenseRequest</b> </p> <p> <b> validityPeriod</b> : 2015-01-15 --&gt; 2016-01-15</p> <p> <b> numberOfRepeatsAllowed</b> : 3</p> <p> <b> quantity</b> : 30 g<span style="background: LightGoldenRodYellow"> (Details: UCUM code g = 'g')</span> </p> <h3> ExpectedSupplyDurations</h3> <table class="grid"><tr> <td> -</td> <td> <b> Value</b> </td> <td> <b> Unit</b> </td> <td> <b> System</b> </td> <td> <b> Code</b> </td> </tr> <tr> <td> *</td> <td> 10</td> <td> days</td> <td> <a href="http://terminology.hl7.org/4.0.0/CodeSystem-v3-ucum.html">Unified Code for Units of Measure (UCUM)</a> </td> <td> d</td> </tr> </table> </blockquote> <h3> Substitutions</h3> <table class="grid"><tr> <td> -</td> <td> <b> Allowed[x]</b> </td> <td> <b> Reason</b> </td> </tr> <tr> <td> *</td> <td> true</td> <td> formulary policy <span style="background: LightGoldenRodYellow; margin: 4px; border: 1px solid khaki"> (<a href="http://terminology.hl7.org/4.0.0/CodeSystem-v3-ActReason.html">ActReason</a> #FP)</span> </td> </tr> </table> </div> </text> <identifier> 
        <use value="official"/> 
        <system value="http://www.bmc.nl/portal/prescriptions"/> 
        <value value="12345689"/> 
    </identifier> 
    <status value="on-hold"/> 
    <intent value="order"/> 
    <medication> 
    <concept> 
        <coding> 
            <system value="http://www.nlm.nih.gov/research/umls/rxnorm"/> 
        <code value="884308"/> 
        <display value="Nystatin 100UNT/MG Topical Ointment"/> 
        </coding> 
    </concept> 
    </medication> 
    <subject> 
            <!--    Linked to the resource patient who needs the medication    -->
        <reference value="Patient/pat1"/> 
        <display value="Donald Duck"/>    
    </subject> 
    <authoredOn value="2015-01-15"/> 
    <requester> 
        <reference value="Practitioner/f007"/> 
        <display value="Patrick Pump"/> 
    </requester> 

   
    <dosageInstruction> 
        <sequence value="1"/> 
        <text value="Apply to affected areas four times daily"/> 
        <timing> 
            <repeat> 
                <frequency value="4"/> 
                <period value="1"/> 
                <periodUnit value="d"/> 
            </repeat> 
        </timing> 
        <doseAndRate> 
            <type> 
                <coding> 
                    <system value="http://terminology.hl7.org/CodeSystem/dose-rate-type"/> 
                <code value="ordered"/> 
                <display value="Ordered"/> 
            </coding> 
            </type> 


            <doseQuantity> 
                <value value="1"/> 
                <unit value="ea"/> 
                <system value="http://terminology.hl7.org/CodeSystem/v3-orderableDrugForm"/> 
                <code value="OINT"/> 
            </doseQuantity> 
        </doseAndRate> 

        
    </dosageInstruction> 

    
    <dispenseRequest> 
        <validityPeriod> 
            <start value="2015-01-15"/> 
            <end value="2016-01-15"/> 
        </validityPeriod> 
        <numberOfRepeatsAllowed value="3"/> 
        <quantity> 
            <value value="30"/> 
            <unit value="g"/> 
            <system value="http://unitsofmeasure.org"/> 
            <code value="g"/>  
        </quantity> 
        <expectedSupplyDuration> 
            <value value="10"/> 
            <unit value="days"/> 
            <system value="http://unitsofmeasure.org"/> 
            <code value="d"/>  
        </expectedSupplyDuration> 
    </dispenseRequest>    
    <substitution> 
        <allowedBoolean value="true"/> 
        <reason> 
            <coding> 
                <system value="http://terminology.hl7.org/CodeSystem/v3-ActReason"/> 
                <code value="FP"/> 
                <display value="formulary policy"/>              
            </coding> 
        </reason> 
    </substitution> 

,
etc.)
The
other
place
where
this
is
used
is
when
profiling
resources
,
and
there
is
agreement
within
a
context
of
use
that
a
specified
set
of
codes
are
the
only
ones
that
can
be
used.
In
these
cases,
the
data
type
SHALL
contain
one
of
the
values
in
the
value
set.
The
following
rules
apply
when
required
bindings
are
used
with
the
CodeableConcept


</

MedicationRequest


data
type:
at
least
one
Coding
element
SHALL
be
present
one
of
the
Coding
values
SHALL
be
from
the
specified
value
set
text
can
be
provided
as
well,
and
is
always
recommended,
but
is
not
an
acceptable
substitute
for
the
required
code
If
a
required
binding
is
applied
to
an
element
with
maximum
cardinality

>
1,
the
binding
applies
to
all
the
elements.
The
following
rules
apply
when
required
bindings
are
used
with
the
code
data
type:
Where
the
value
set
is
defined
by
FHIR,
the
list
of
allowed
codes
will
be
fixed
in
the
XML
schema
Comparison
between
codes
is
always
case
sensitive
unless
the
codes
are
selected
by
reference
(e.g.
ValueSet.compose),
and
the
referenced
specification
clearly
states
otherwise
The
list
of
codes
that
can
be
used
can
only
be
extended
in
subsequent
releases
of
the
FHIR
specification
When
an
element
is
bound
to
a
required
value
set,
derived
profiles
may
state
rules
on
which
codes
can
be
used,
including
removing
codes
from
allowed
use,
but
cannot
specify
new
or
additional
codes
for
these
elements.
4.1.5.2


Extensible



To
be
conformant,
codes
in
this
element
SHALL
be
from
the
specified
value
set
if
any
of
the
codes
within
the
value
set
can
apply
to
the
concept
being
communicated.
Note
that
it
is
the
value
set
binding
that
is
extensible,
not
the
value
set
itself.
If
there
is
no
applicable
concept
in
value
set
(based
on
human
review),
an
alternate
concept
(either
system
/
code
pair,
or
text
)
may
be
used
instead.
The
alternate
concept
can
have
any
level
of
specificity
in
an
is-a
hierarchy
(see
Condition
instance
#2
).
If
there
is
at
least
one
applicable
concept
in
the
extensibly-bound
value
set
with
a
meaning
which
includes
but
is
more
general
than
the
meaning
that
is
intended
to
be
represented
by
the
element
in
the
resource
instance,
then
the
code
that
is
used
in
the
instance
SHALL
be
taken
from
the
value
set
and
should
be
the
closest
available
match
for
the
intended
element
instance
meaning
(i.e.
neither
more
general
or
more
specific).
However,
a
more
specific
code
that
more
completely
represents
the
intended
meaning
may
also
be
included
in
the
instance
as
an
additional
Coding
if
the
data
type
is
CodeableConcept,
but
it
cannot
be
used
instead
of
the
code
from
the
value
set.
This
helps
ensure
that
systems
know
which
codes
they
should
expect
to
receive
and
build
logic
for
and
it
facilitates
interoperability.

When a code for an applicable concept in the extensibly-bound value set is used it should always be the closest available match for the intended element instance meaning, regardless of hierarchical (i.e. "is-a") relationships in the underlying code system(s) or hierarchical "level" of the concept. However, as noted above, a code for a concept that is outside of the extensibly-bound value set with a meaning which is "covered by" (i.e. is more specific than or Usage note: every effort has an "is-a" relationship to) a concept that is included in the value set cannot be used. In that case a code for a concept that is in the extensibly-bound value set SHALL be used in the element instance and it should be the code for the concept that most closely matches the intended element instance meaning. If the data type is CodeableConcept , then, as noted above, one of the Coding values SHALL be from the specified extensibly-bound value set if a code in that value set applies, but if no applicable code exists in the value set alternate code(s) from outside the value set may be used instead. If no codes, including local codes, are available, then text alone (in CodeableConcept.text) may be used. If the data type is Coding , then the code/system SHALL be from the specified value set if a code applies, but if no suitable code exists in the value set, an alternate code may be provided in its place. If an extensible binding is applied to an element with maximum cardinality > 1, the binding applies to all the elements. Identified gaps in value sets should be submitted to the organization administering the value set in order to improve interoperability in the future. Extensible bindings are used when there is consensus at the specification or profiling level about the coded values that should be used, but it is impossible to create a bounded list of codes that are known to cover all use cases, including ones that are yet to arise. When an element is extensibly-bound been made to a value set, derived profiles may state rules on which codes can be used, but cannot select new or additional codes for these elements unless no codes with appropriate meanings are found in the base value set. Note that if the valueset-reference extension is being used and the code in the element instance is from outside the extensibly-bound value set, the extension must reference a different value set ensure that the code was chosen from (or if no other value set reference is available the extension cannot be used in that instance). 4.1.5.2.1 Examples for Extensible Bindings See examples to help explain the difficult but important subject of Extensible bindings. 4.1.5.3 Preferred Instances are encouraged to draw from the specified codes for interoperability purposes but are not required to do so to be considered conformant. If the data type is CodeableConcept , then one of the Coding values SHOULD be from the specified value set, but another code and/or text can be used in its place. Preferred bindings are used when there is consensus at the specification level about the coded values that are the best to be used, correct and useful, but there is recognition that some implementation contexts are unable to use the recommended codes for a variety of reasons. Applications should consider adopting the preferred value set wherever possible, as these preferred value sets are the most likely to serve interoperability purposes in the future. When an element is bound to a preferred value set, derived profiles may bind the element to any value set they choose. 4.1.5.3.1 Examples for Preferred Bindings See examples of how Preferred bindings work. 4.1.5.3.2 Example Bindings Instances are not expected or even encouraged to draw from the specified value set. The value set merely provides examples of the types of concepts intended to be included. Example bindings are used when an element has a very broad meaning (such as List .code), or there is no consensus over the correct codes to be used. For these bindings: Coding : the system / code values MAY be one of the codes in the value set. CodeableConcept : one of the coding elements MAY contain a system / code that is in the value set. Some other coded value MAY be used, or (for a CodeableConcept), a text alternative MAY be provided. Example value sets are provided to assist implementers to understand the correct use of an element. Value sets based on code systems such as SNOMED CT that have restrictive license terms will only be used as example bindings in the base FHIR specification, though implementation guides for particular jurisdictions may adopt value sets that require licenses. In addition, well-specified realm-specific ValueSets may also be used as example bindings in the base specification. When an element is bound to an example value set, derived profiles may bind the element to any value set they choose. 4.1.6 Other notes Subsequent versions of FHIR may replace example value sets with preferred bindings if enough consensus emerges in the relevant sphere. Bindings to value sets provided as normative part of the specification are always specific to the version of the value set published with the specification. The value set may be sealed by defining a simple list of enumerated codes, or it may include codes by their properties, along with a non-version specific reference to an underlying code system, in which case the list of valid concepts may change over time. 4.1.6.1 Binding String Values In a few special cases, humans customarily use codes directly for elements that have type "string". A typical case is codes for states, and there are several places where a URI must come from a set of controlled values. An element of type string or uri can also be bound to a value set. When a string or URI is bound to a value set, the value property SHALL contain the code specified by the value set, and the system and display values are ignored. 4.1.6.2 Terminology Service FHIR has defined a Terminology Service specification which sets requirements for systems that support the use of codes, value sets and code systems.