Monthly Archives: July 2017

Question: Validity of AllergyIntolerance extension in #FHIR

Question:

How to extend severity in AllergyIntolerance resource.  Is the following resource where severity is extended done correctly?

<AllergyIntolerance xmlns="http://hl7.org/fhir">
  <id value="uWErIN0G0" />
  <recordedDate value="05/10/1980" />
  <patient>
    <reference value="Patient/DFQA_ghn000003" />
    <display value="Newman, Alice Jones" />
  </patient>
  <substance>
    <coding>
      <system value="RxNorm" />
      <code value="1659592" />
    </coding>
    <text value="ampicillin-sulbactam" />
  </substance>
  <status value="confirmed" />
  <event>
    <manifestation>
      <coding />
      <text value="urticaria (hives)" />
    </manifestation>
    <severity>
      <extension url="http://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.113883.3.88.12.3221.6.8">
        <valueCodeableConcept>
          <coding>
            <system value="" />
            <code value="371923003" />
            <display value="mild to moderate" />
          </coding>
        </valueCodeableConcept>
      </extension>
    </severity>
  </event>
</AllergyIntolerance>

Answer:

Severity is a code, with cardinality 0..1 and a required binding to mild | moderate | severe. You can replace the code with an extension, as is done here, so that part is valid. But it’s much better to provide both a code out of the defined choices, so that systems that only know those choices can process the information correctly, while those that know the refined list can process the refined list:

    <severity value="mild">
      <extension url="http://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.113883.3.88.12.3221.6.8">
        <valueCodeableConcept>
          <coding>
            <system value="" />
            <code value="371923003" />
            <display value="mild to moderate" />
          </coding>
        </valueCodeableConcept>
      </extension>
    </severity>

Aside: you could map this code to either mild or moderate, yes. Choosing either is better than choosing neither.

There’s several other issues here, though:

  • The URL given that identifies the extension actually identifies the value set, not the extension (aka the data element). The correct thing to do would be to define an extension that use the value set (see at the bottom of the post)
  • According to the value set definition, this is a SNOMED CT code, and the system should be filled out
  • the recorded date format is not a valid XML date
  • the system for RxNorm is not correct
  • manifestation coding can’t be empty

Here it is corrected:

<AllergyIntolerance xmlns="http://hl7.org/fhir">
  <id value="uWErIN0G0" />
  <recordedDate value="1980-10-05" />
  <patient>
    <reference value="Patient/DFQA_ghn000003" />
    <display value="Newman, Alice Jones" />
  </patient>
  <substance>
    <coding>
      <system value="http://www.nlm.nih.gov/research/umls/rxnorm" />
      <code value="1659592" />
    </coding>
    <text value="ampicillin-sulbactam" />
  </substance>
  <status value="confirmed" />
  <event>
    <manifestation>
      <text value="urticaria (hives)" />
    </manifestation>
    <severity>
      <extension url="http://example.org/fhir/StructureDefinition/my-extension">
        <valueCodeableCoding>
          <system value="http://snomed.info/sct" />
          <code value="371923003" />
          <display value="mild to moderate" />
        </valueCodeableCoding>
      </extension>
    </severity>
  </event>
</AllergyIntolerance>

With an associated Extension definition:

<?xml version="1.0" encoding="utf-8"?>
<StructureDefinition xmlns="http://hl7.org/fhir">
  <meta>
    <lastUpdated value="2017-07-12T07:05:27.311+10:00" />
  </meta>
  <url value="http://example.org/fhir/StructureDefinition/my-extension" />
  <name value="RefinedSeverity" />
  <status value="draft" />
  <date value="2017-07-12T07:02:31.9614187+10:00" />
  <publisher value="Health Intersections" />
  <description value="My definition for FHIR extension" />
  <purpose value="an extension" />
  <fhirVersion value="3.0.1" />
  <kind value="complex-type" />
  <abstract value="false" />
  <contextType value="resource"/> 
  <context value="AllergyIntolerance.event.severity"/> 
  <type value="Extension" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Extension" />
  <derivation value="constraint" />
  <differential>
    <element id="Extension">
      <path value="Extension" />
      <definition value="This is a description of the level of the severity of the problem." />
    </element>
    <element id="Extension.url">
      <path value="Extension.url" />
      <fixedUri value="http://example.org/fhir/StructureDefinition/my-extension" />
    </element>
    <element id="Extension.value[x]:valueCoding">
      <path value="Extension.valueCoding" />
      <sliceName value="Severity" />
      <type>
        <code value="Coding" />
      </type>
      <binding>
        <strength value="required" />
        <description value="This is a description of the level of the severity of the problem." />
        <valueSetUri value="http://phinvads.cdc.gov/vads/ViewValueSet.action?oid=2.16.840.1.113883.3.88.12.3221.6.8" />
      </binding>
    </element>
  </differential>
</StructureDefinition>