R4 Ballot #1 (Mixed Normative/Trial use)

This page is part of the FHIR Specification (v3.3.0: R4 Ballot 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 GroupMaturity Level: N/ABallot Status: Informative Compartments: Patient, Practitioner, RelatedPerson

R2 : R3 Conversion maps for AllergyIntolerance.

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

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/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

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

  "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

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)