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: R4 to R3 Conversion for DataRequirement

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

R4toR3ConversionforDataRequirement

/// url = 'http://hl7.org/fhir/StructureMap/DataRequirement4to3'
/// name = 'Requirement4to3'
/// title = 'R4 to R3 Conversion for DataRequirement'
/// status = 'active'

uses "http://hl7.org/fhir/4.0/DataRequirement" alias DataRequirement as source
uses "http://hl7.org/fhir/3.0/DataRequirement" alias DataRequirementR3 as target

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

group DataRequirement(source src : DataRequirement, target tgt : DataRequirementR3) extends Element <<type+>> {
  src.type -> tgt.type;
  src.profile -> tgt.profile;
  src.mustSupport -> tgt.mustSupport;
  src.codeFilter as vs0 -> tgt.codeFilter as vt0 then codeFiter(vs0, vt0);
  src.dateFilter as vs0 -> tgt.dateFilter as vt0 then dateFilter(vs0, vt0);
}

group codeFiter(source src, target tgt) extends Element {
  src.path -> tgt.path;
  src.valueSet as vs -> tgt.valueSet = create('string') as vt then canonical2string(vs, vt);
  src.code as vs where system.empty() then {
    vs.code -> tgt.valueCode;
  };
  src.code as vs where system.exists() -> tgt.valueCoding;
}

group dateFilter(source src, target tgt) extends Element {
  src.path -> tgt.path;
  src.value : dateTime as vs -> tgt.value = create('dateTime') as vt then dateTime(vs, vt);
  src.value : Period as vs -> tgt.value = create('Period') as vt then Period(vs, vt);
  src.value : Duration as vs -> tgt.value = create('Duration') as vt then Duration(vs, vt);
}