FHIR Cross-Version Mapping Pack
0.1.0 - Ballot for Release 5.1.0 International flag

FHIR Cross-Version Mapping Pack, published by HL7 International / FHIR Infrastructure. This guide is not an authorized publication; it is the continuous build for version 0.1.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/fhir-cross-version/ and changes regularly. See the Directory of published versions

StructureMap: AllergyIntolerance Transforms: R5 to R4B

Official URL: http://hl7.org/fhir/StructureMap/AllergyIntolerance5to4B Version: 0.1.0
Standards status: Draft Maturity Level: 1 Computable Name: AllergyIntolerance5to4B

AllergyIntoleranceTransformsR5toR4B

/// url = 'http://hl7.org/fhir/StructureMap/AllergyIntolerance5to4B'
/// name = 'AllergyIntolerance5to4B'
/// title = 'AllergyIntolerance Transforms: R5 to R4B'
/// status = 'active'

uses "http://hl7.org/fhir/5.0/AllergyIntolerance" alias AllergyIntoleranceR5 as source
uses "http://hl7.org/fhir/4.0/AllergyIntolerance" alias AllergyIntoleranceR4B as target

imports "http://hl7.org/fhir/StructureMap/*5to4B"

group AllergyIntolerance(source src : AllergyIntoleranceR5, target tgt : AllergyIntoleranceR4B) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.clinicalStatus -> tgt.clinicalStatus;
  src.verificationStatus -> tgt.verificationStatus;
  src.type as s where code = 'allergy' ->  tgt.type = create('code') as t,  t.value = 'allergy';
  src.type as s where code = 'intolerance' ->  tgt.type = create('code') as t,  t.value = 'intolerance';
  src.category as v -> tgt.category = translate(v, 'http://hl7.org/fhir/ConceptMap/AllergyIntolerance.category-R5toR4', 'code');
  src.criticality as v -> tgt.criticality = translate(v, 'http://hl7.org/fhir/ConceptMap/AllergyIntolerance.criticality-R5toR4', 'code');
  src.code -> tgt.code;
  src.patient -> tgt.patient;
  src.encounter -> tgt.encounter;
  src.onset : dateTime -> tgt.onset;
  src.onset : Age -> tgt.onset;
  src.onset : Period -> tgt.onset;
  src.onset : Range -> tgt.onset;
  src.onset : string -> tgt.onset;
  src.recordedDate -> tgt.recordedDate;
  src.participant as s where code = 'enterer' -> tgt then {
    s.actor -> tgt.recorder;
  };
  src.participant as s where code = 'author' -> tgt then {
    s.actor -> tgt.recorder;
  };
  src.lastOccurrence -> tgt.lastOccurrence;
  src.note -> tgt.note;
  src.reaction as s -> tgt.reaction as t then AllergyIntoleranceReaction(s, t);
}

// group AllergyIntoleranceParticipant(source src, target tgt) extends BackboneElement {
// src.function -> tgt.function;
// src.actor -> tgt.actor;
// }
group AllergyIntoleranceReaction(source src, target tgt) extends BackboneElement {
  src.substance -> tgt.substance;
  src.manifestation -> tgt.manifestation;
  src.description -> tgt.description;
  src.onset -> tgt.onset;
  src.severity as v -> tgt.severity = translate(v, 'http://hl7.org/fhir/ConceptMap/AllergyIntolerance.reaction.severity-R5toR4', 'code');
  src.exposureRoute -> tgt.exposureRoute;
  src.note -> tgt.note;
}