FHIR Release 3 (STU) 4

This page is part of the FHIR Specification (v3.0.2: (v4.0.1: R4 - Mixed Normative and STU 3). ) 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 R4 R3

Patient Care Work Group Maturity Level : N/A Ballot Standards Status : Informative Security Category : Patient Compartments : Patient , Practitioner , RelatedPerson

R2 : R3 Converson : R4 Conversion maps for AllergyIntolerance.

Functional status for this map: 5 3 tests that all execute ok. 2 fail All tests pass round-trip testing and 4 all r3 resources are invalid (6 errors). valid. ( see documentation)

map "http://hl7.org/fhir/StructureMap/AllergyIntolerance2to3" = "R2 to R3 Conversions for AllergyIntolerance"

conceptmap "AllergyIntoleranceVerificationStatus" {
  prefix s = "http://hl7.org/fhir/allergy-intolerance-status"
  prefix t = "http://hl7.org/fhir/allergy-verification-status"

  s:unconfirmed = t:unconfirmed
  s:confirmed = t:confirmed
  s:inactive = t:unconfirmed
  s:refuted = t:refuted
  s:"entered-in-error" = t:"entered-in-error"
}

conceptmap "AllergyIntoleranceClinicalStatus" {
  prefix s = "http://hl7.org/fhir/allergy-intolerance-status"
  prefix t = "	http://hl7.org/fhir/allergy-clinical-status"

map "http://hl7.org/fhir/StructureMap/AllergyIntolerance3to4" = "R3 to R4 Conversions for AllergyIntolerance"


  s:active = t:active
  s:unconfirmed = t:active
  s:confirmed = t:active
  s:inactive = t:inactive
  s:resolved = t:resolved
}

uses "http://hl7.org/fhir/3.0/StructureDefinition/AllergyIntolerance" alias AllergyIntoleranceR3 as source
uses "http://hl7.org/fhir/StructureDefinition/AllergyIntolerance" alias AllergyIntolerance as target


conceptmap "AllergyIntoleranceCriticality" {
  prefix s = "http://hl7.org/fhir/allergy-intolerance-criticality"
  prefix t = "http://hl7.org/fhir/allergy-intolerance-criticality"

imports "http://hl7.org/fhir/StructureMap/*3to4"


  s:CRITL = t:low
  s:CRITH = t:high
  s:CRITU = t:"unable-to-assess"

group AllergyIntolerance(source src : AllergyIntoleranceR3, target tgt : AllergyIntolerance) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.clinicalStatus as vs ->  tgt.clinicalStatus as vt,  vt.coding as c,  c.system = 'http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical',  c.code = vs;
  src.verificationStatus as vs ->  tgt.verificationStatus as vt,  vt.coding as c,  c.system = 'http://terminology.hl7.org/CodeSystem/allergyintolerance-verification',  c.code = vs;
  src.type -> tgt.type;
  src.category -> tgt.category;
  src.criticality -> tgt.criticality;
  src.code -> tgt.code;
  src.patient -> tgt.patient;
  src.onset : dateTime as vs -> tgt.onset = create('dateTime') as vt then dateTime(vs, vt);
  src.onset : Age as vs -> tgt.onset = create('Age') as vt then Age(vs, vt);
  src.onset : Period as vs -> tgt.onset = create('Period') as vt then Period(vs, vt);
  src.onset : Range as vs -> tgt.onset = create('Range') as vt then Range(vs, vt);
  src.onset : string as vs -> tgt.onset = create('string') as vt then string(vs, vt);
  src.assertedDate -> tgt.recordedDate "recordedDate";
  src.recorder -> tgt.recorder;
  src.asserter -> tgt.asserter;
  src.lastOccurrence -> tgt.lastOccurrence;
  src.note -> tgt.note;
  src.reaction as vs0 -> tgt.reaction as vt0 then {
    vs0.substance -> vt0.substance;
    vs0.manifestation -> vt0.manifestation;
    vs0.description -> vt0.description;
    vs0.onset -> vt0.onset;
    vs0.severity -> vt0.severity;
    vs0.exposureRoute -> vt0.exposureRoute;
    vs0.note -> vt0.note;
  };

}

uses "http://hl7.org/fhir/DSTU2/StructureDefinition/AllergyIntolerance" alias AllergyIntoleranceR2 as source
uses "http://hl7.org/fhir/StructureDefinition/AllergyIntolerance" alias AllergyIntolerance as target

imports "http://hl7.org/fhir/StructureMap/*to3"



group for type+types  AllergyIntolerance extends DomainResource
  input src : AllergyIntoleranceR2 as source
  input tgt : AllergyIntolerance as target

  "AllergyIntolerance-identifier" : for src.identifier make tgt.identifier
  "AllergyIntolerance-onset" : for src.onset make tgt.onset
  "AllergyIntolerance-recordedDate" : for src.recordedDate make tgt.assertedDate
  "AllergyIntolerance-recorder" : for src.recorder make tgt.recorder
  "AllergyIntolerance-patient" : for src.patient make tgt.patient
  "AllergyIntolerance-reporter" : for src.reporter make tgt.asserter
  "AllergyIntolerance-substance" : for src.substance make tgt.code

  "AllergyIntolerance-status-clinical" :     for src.status as v where $this != 'refuted' and $this != 'entered-in-error' make tgt.clinicalStatus  = translate(v, "#AllergyIntoleranceClinicalStatus", "code")
  "AllergyIntolerance-Status-verification" : for src.status as v where $this != 'active' and $this != 'resolved' make tgt.verificationStatus = translate(v, "#AllergyIntoleranceVerificationStatus", "code")

  "AllergyIntolerance-criticality" : for src.criticality as v make tgt.criticality = translate(v, "#AllergyIntoleranceCriticality", "code")
  "AllergyIntolerance-type" : for src.type make tgt.type
  "AllergyIntolerance-category" : for src.category make tgt.category
  "AllergyIntolerance-lastOccurrence" : for src.lastOccurence make tgt.lastOccurrence
  "AllergyIntolerance-note" : for src.note make tgt.note
  "AllergyIntolerance-reaction" : for src.reaction as vs0 make tgt.reaction as vt0 then algReaction(vs0, vt0)
  
endgroup

group algReaction extends BackboneElement
  input src as source
  input tgt as target

  "AllergyIntolerance.reaction-substance" : for src.substance make tgt.substance
  "AllergyIntolerance.reaction-certainty" : for src.certainty as v make tgt.extension as t, t.url = 'http://hl7.org/fhir/AllergyIntolerance-r2-certainty', t.value = v
  "AllergyIntolerance.reaction-manifestation" : for src.manifestation make tgt.manifestation
  "AllergyIntolerance.reaction-description" : for src.description make tgt.description
  "AllergyIntolerance.reaction-onset" : for src.onset make tgt.onset
  "AllergyIntolerance.reaction-severity" : for src.severity make tgt.severity
  "AllergyIntolerance.reaction-exposureRoute" : for src.exposureRoute make tgt.exposureRoute
  "AllergyIntolerance.reaction-note" : for src.note make tgt.note
endgroup


map "http://hl7.org/fhir/StructureMap/AllergyIntolerance3to2" = "R3 to R2 Conversion for AllergyIntolerance"

conceptmap "AllergyIntoleranceCriticality" {
  prefix s = "http://hl7.org/fhir/allergy-intolerance-criticality"
  prefix t = "http://hl7.org/fhir/allergy-intolerance-criticality"

  s:low = t:CRITL
  s:high = t:CRITH
  s:"unable-to-assess" = t:CRITU
}

uses "http://hl7.org/fhir/StructureDefinition/AllergyIntolerance" alias AllergyIntolerance as source
uses "http://hl7.org/fhir/DSTU2/StructureDefinition/AllergyIntolerance" alias AllergyIntoleranceR2 as target

imports "http://hl7.org/fhir/StructureMap/*3to2"

group for type+types  AllergyIntolerance extends DomainResource
  input src : AllergyIntolerance as source
  input tgt : AllergyIntoleranceR2 as target

  "AllergyIntolerance-identifier" : for src.identifier make tgt.identifier
  "AllergyIntolerance-onset" : for src.onset make tgt.onset
  "AllergyIntolerance-recordedDate" : for src.assertedDate make tgt.recordedDate
  "AllergyIntolerance-recorder" : for src.recorder make tgt.recorder
  "AllergyIntolerance-patient" : for src.patient make tgt.patient
  "AllergyIntolerance-reporter" : for src.asserter make tgt.reporter
  "AllergyIntolerance-substance" : for src.code make tgt.substance

map "http://hl7.org/fhir/StructureMap/AllergyIntolerance4to3" = "R4 to R3 Conversion for AllergyIntolerance"


  "AllergyIntolerance-status-active" :           for src where src.clinicalStatus = 'active' and src.verificationStatus.empty() make tgt.status = 'active'
  "AllergyIntolerance-status-unconfirmed" :      for src where src.clinicalStatus = 'active' and src.verificationStatus = 'confirmed' make tgt.status = 'confirmed'
  "AllergyIntolerance-status-confirmed" :        for src where src.clinicalStatus = 'active' and src.verificationStatus = 'unconfirmed' make tgt.status = 'unconfirmed'
  "AllergyIntolerance-status-inactive" :         for src where src.clinicalStatus = 'inactive' make tgt.status = 'inactive'
  "AllergyIntolerance-status-resolved" :         for src where src.clinicalStatus = 'resolved' make tgt.status = 'resolved'
  "AllergyIntolerance-status-refuted" :          for src where src.verificationStatus = 'refuted' make tgt.status = 'refuted'
  "AllergyIntolerance-status-entered-in-error" : for src where src.verificationStatus = 'entered-in-error' make tgt.status = 'entered-in-error'

uses "http://hl7.org/fhir/StructureDefinition/AllergyIntolerance" alias AllergyIntolerance as source
uses "http://hl7.org/fhir/3.0/StructureDefinition/AllergyIntolerance" alias AllergyIntoleranceR3 as target


  "AllergyIntolerance-criticality" : for src.criticality as v make tgt.criticality = translate(v, "#AllergyIntoleranceCriticality", "code")
  "AllergyIntolerance-type" : for src.type make tgt.type
  "AllergyIntolerance-category" : for src.category make tgt.category
  "AllergyIntolerance-lastOccurrence" : for src.lastOccurrence make tgt.lastOccurence
  "AllergyIntolerance-note" : for src.note make tgt.note
  "AllergyIntolerance-reaction" : for src.reaction as vs0 make tgt.reaction as vt0 then algReaction(vs0, vt0)
  
endgroup

imports "http://hl7.org/fhir/StructureMap/*4to3"


group algReaction extends BackboneElement
  input src as source
  input tgt as target

group AllergyIntolerance(source src : AllergyIntolerance, target tgt : AllergyIntoleranceR3) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.clinicalStatus as vs then {
    vs.coding as c where system = 'http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical' then {
      c.code -> tgt.clinicalStatus;
    };
  };
  src.verificationStatus as vs then {
    vs.coding as c where system = 'http://terminology.hl7.org/CodeSystem/allergyintolerance-verification' then {
      c.code -> tgt.verificationStatus;
    };
  };
  src.type -> tgt.type;
  src.category -> tgt.category;
  src.criticality -> tgt.criticality;
  src.code -> tgt.code;
  src.patient -> tgt.patient;
  src.onset : dateTime as vs -> tgt.onset = create('dateTime') as vt then dateTime(vs, vt);
  src.onset : Age as vs -> tgt.onset = create('Age') as vt then Age(vs, vt);
  src.onset : Period as vs -> tgt.onset = create('Period') as vt then Period(vs, vt);
  src.onset : Range as vs -> tgt.onset = create('Range') as vt then Range(vs, vt);
  src.onset : string as vs -> tgt.onset = create('string') as vt then string(vs, vt);
  src.recordedDate -> tgt.assertedDate "assertedDate";
  src.recorder -> tgt.recorder;
  src.asserter -> tgt.asserter;
  src.lastOccurrence -> tgt.lastOccurrence;
  src.note -> tgt.note;
  src.reaction as vs0 -> tgt.reaction as vt0 then {
    vs0.substance -> vt0.substance;
    vs0.manifestation -> vt0.manifestation;
    vs0.description -> vt0.description;
    vs0.onset -> vt0.onset;
    vs0.severity -> vt0.severity;
    vs0.exposureRoute -> vt0.exposureRoute;
    vs0.note -> vt0.note;
  };
}


  "AllergyIntolerance.reaction-substance" : for src.substance make tgt.substance
  "AllergyIntolerance.reaction-certainty" : for src.extension as e where e.url = 'http://hl7.org/fhir/AllergyIntolerance-r2-certainty' make tgt.certainty = (e.value)
  "AllergyIntolerance.reaction-manifestation" : for src.manifestation make tgt.manifestation
  "AllergyIntolerance.reaction-description" : for src.description make tgt.description
  "AllergyIntolerance.reaction-onset" : for src.onset make tgt.onset
  "AllergyIntolerance.reaction-severity" : for src.severity make tgt.severity
  "AllergyIntolerance.reaction-exposureRoute" : for src.exposureRoute make tgt.exposureRoute
  "AllergyIntolerance.reaction-note" : for src.note make tgt.note
endgroup


allergyintolerance-example ERROR @ AllergyIntolerance.reaction[1].extension: The extension http://hl7.org/fhir/AllergyIntolerance-r2-certainty is unknown, and not allowed here (src = InstanceValidator) ERROR @ AllergyIntolerance.reaction[2].extension: The extension http://hl7.org/fhir/AllergyIntolerance-r2-certainty is unknown, and not allowed here (src = InstanceValidator) example ERROR @ AllergyIntolerance.reaction[2].extension: The extension http://hl7.org/fhir/AllergyIntolerance-r2-certainty is unknown, and not allowed here (src = InstanceValidator) allergyintolerance-example-refuted ERROR @ AllergyIntolerance: AllergyIntolerance.clinicalStatus SHALL be present if verificationStatus is not entered-in-error. [verificationStatus='entered-in-error' or clinicalStatus.exists()] (src = InstanceValidator) fishallergy ERROR @ AllergyIntolerance: AllergyIntolerance.clinicalStatus SHALL be present if verificationStatus is not entered-in-error. [verificationStatus='entered-in-error' or clinicalStatus.exists()] (src = InstanceValidator) ERROR @ AllergyIntolerance: Profile http://hl7.org/fhir/StructureDefinition/AllergyIntolerance, Element 'AllergyIntolerance.verificationStatus': minimum required = 1, but only found 0 (src = InstanceValidator) <p>No validation errors - all conversions are clean</p>