R4 Ballot #1 #2 (Mixed Normative/Trial use)

This page is part of the FHIR Specification (v3.3.0: (v3.5.0: R4 Ballot 2). #2). 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

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

R2 : R3 : R4 Conversion maps for AllergyIntolerance.

Functional status for this map: 5 3 tests that all execute ok. 2 3 fail round-trip testing and 4 3 r3 resources are invalid (6 (0 errors). ( 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"

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

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


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


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

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

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

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

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

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




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

group AllergyIntolerance extends DomainResource
  input src : AllergyIntoleranceR3 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)
  

  "AllergyIntolerance.identifier" : for src.identifier as vs make tgt.identifier as vt
  "AllergyIntolerance.clinicalStatus" : for src.clinicalStatus as vs make tgt.clinicalStatus as vt
  "AllergyIntolerance.verificationStatus" : for src.verificationStatus as vs make tgt.verificationStatus as vt
  "AllergyIntolerance.type" : for src.type as vs make tgt.type as vt
  "AllergyIntolerance.criticality" : for src.criticality as vs make tgt.criticality as vt
  "AllergyIntolerance.code" : for src.code as vs make tgt.code as vt
  "AllergyIntolerance.patient" : for src.patient as vs make tgt.patient as vt
  "AllergyIntolerance.onset-dateTime" : for src.onset  : dateTime as vs make tgt.onset = create("dateTime") as vt then dateTime(vs,vt)
  "AllergyIntolerance.onset-Age" : for src.onset  : Age as vs make tgt.onset = create("Age") as vt then Age(vs,vt)
  "AllergyIntolerance.onset-Period" : for src.onset  : Period as vs make tgt.onset = create("Period") as vt then Period(vs,vt)
  "AllergyIntolerance.onset-Range" : for src.onset  : Range as vs make tgt.onset = create("Range") as vt then Range(vs,vt)
  "AllergyIntolerance.onset-string" : for src.onset  : string as vs make tgt.onset = create("string") as vt then string(vs,vt)
  "AllergyIntolerance.recordedDate" : for src.assertedDate as vs make tgt.recordedDate as vt
  "AllergyIntolerance.recorder" : for src.recorder as vs make tgt.recorder as vt
  "AllergyIntolerance.asserter" : for src.asserter as vs make tgt.asserter as vt
  "AllergyIntolerance.lastOccurrence" : for src.lastOccurrence as vs make tgt.lastOccurrence as vt
  "AllergyIntolerance.note" : for src.note as vs make tgt.note as vt
  "AllergyIntolerance.reaction" : for src.reaction as vs0 make tgt.reaction as vt0 then {
    "AllergyIntolerance.reaction.substance" : for vs0.substance as vs make vt0.substance as vt
    "AllergyIntolerance.reaction.manifestation" : for vs0.manifestation as vs make vt0.manifestation as vt
    "AllergyIntolerance.reaction.description" : for vs0.description as vs make vt0.description as vt
    "AllergyIntolerance.reaction.onset" : for vs0.onset as vs make vt0.onset as vt
    "AllergyIntolerance.reaction.severity" : for vs0.severity as vs make vt0.severity as vt
    "AllergyIntolerance.reaction.exposureRoute" : for vs0.exposureRoute as vs make vt0.exposureRoute as vt
    "AllergyIntolerance.reaction.note" : for vs0.note as vs make vt0.note as vt
  }

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"

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


  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

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


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

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


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


  "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'

group AllergyIntolerance extends DomainResource
  input src : AllergyIntolerance as source
  input tgt : 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)
  

  "AllergyIntolerance.identifier" : for src.identifier as vs make tgt.identifier as vt
  "AllergyIntolerance.clinicalStatus" : for src.clinicalStatus as vs make tgt.clinicalStatus as vt
  "AllergyIntolerance.verificationStatus" : for src.verificationStatus as vs make tgt.verificationStatus as vt
  "AllergyIntolerance.type" : for src.type as vs make tgt.type as vt
  "AllergyIntolerance.criticality" : for src.criticality as vs make tgt.criticality as vt
  "AllergyIntolerance.code" : for src.code as vs make tgt.code as vt
  "AllergyIntolerance.patient" : for src.patient as vs make tgt.patient as vt
  "AllergyIntolerance.onset-dateTime" : for src.onset  : dateTime as vs make tgt.onset = create("dateTime") as vt then dateTime(vs,vt)
  "AllergyIntolerance.onset-Age" : for src.onset  : Age as vs make tgt.onset = create("Age") as vt then Age(vs,vt)
  "AllergyIntolerance.onset-Period" : for src.onset  : Period as vs make tgt.onset = create("Period") as vt then Period(vs,vt)
  "AllergyIntolerance.onset-Range" : for src.onset  : Range as vs make tgt.onset = create("Range") as vt then Range(vs,vt)
  "AllergyIntolerance.onset-string" : for src.onset  : string as vs make tgt.onset = create("string") as vt then string(vs,vt)
  "AllergyIntolerance.assertedDate" : for src.recordedDate as vs make tgt.assertedDate as vt
  "AllergyIntolerance.recorder" : for src.recorder as vs make tgt.recorder as vt
  "AllergyIntolerance.asserter" : for src.asserter as vs make tgt.asserter as vt
  "AllergyIntolerance.lastOccurrence" : for src.lastOccurrence as vs make tgt.lastOccurrence as vt
  "AllergyIntolerance.note" : for src.note as vs make tgt.note as vt
  "AllergyIntolerance.reaction" : for src.reaction as vs0 make tgt.reaction as vt0 then {
    "AllergyIntolerance.reaction.substance" : for vs0.substance as vs make vt0.substance as vt
    "AllergyIntolerance.reaction.manifestation" : for vs0.manifestation as vs make vt0.manifestation as vt
    "AllergyIntolerance.reaction.description" : for vs0.description as vs make vt0.description as vt
    "AllergyIntolerance.reaction.onset" : for vs0.onset as vs make vt0.onset as vt
    "AllergyIntolerance.reaction.severity" : for vs0.severity as vs make vt0.severity as vt
    "AllergyIntolerance.reaction.exposureRoute" : for vs0.exposureRoute as vs make vt0.exposureRoute as vt
    "AllergyIntolerance.reaction.note" : for vs0.note as vs make vt0.note as vt
  }

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.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)