FHIR Extensions Pack
1.0.0 - Working Copy International flag

This page is part of the FHIR Core Extensions Registry (v1.0.0: Releases) based on FHIR v5.0.0. This is the current published version in its permanent home (it will always be available at this URL). For a full list of available versions, see the Directory of published versions

StructureMap: FML Conversion for CodeableConcept: R4 to R5

Official URL: http://hl7.org/fhir/StructureMap/CodeableConcept4to5 Version: 1.0.0
Standards status: Trial-use Maturity Level: 1 Computable Name: CodeableConcept4to5

FMLConversionforCodeableConceptR4toR5

/// url = 'http://hl7.org/fhir/StructureMap/CodeableConcept4to5'
/// name = 'CodeableConcept4to5'
/// title = 'FML Conversion for CodeableConcept: R4 to R5'
/// status = 'active'

uses "http://hl7.org/fhir/4.0/StructureDefinition/CodeableConcept" alias CodeableConceptR4 as source
uses "http://hl7.org/fhir/4.0/StructureDefinition/Coding" alias CodingR4 as source
uses "http://hl7.org/fhir/4.0/StructureDefinition/code" alias codeR4 as source
uses "http://hl7.org/fhir/4.0/StructureDefinition/string" alias stringR4 as source
uses "http://hl7.org/fhir/StructureDefinition/CodeableConcept" alias CodeableConceptR5 as target
uses "http://hl7.org/fhir/StructureDefinition/CodeableReference" alias CodeableReferenceR5 as target
uses "http://hl7.org/fhir/StructureDefinition/Coding" alias CodingR5 as target
uses "http://hl7.org/fhir/StructureDefinition/code" alias codeR5 as target

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

group CodeableConcept(source src : CodeableConceptR4, target tgt : CodeableConceptR5) extends Element <<type+>> {
  src.coding -> tgt.coding;
  src.text -> tgt.text;
}

group CodeableConcept2Coding(source src : CodeableConceptR4, target tgt : CodingR5) extends Element <<types>> {
  src.coding as s -> tgt as t then Coding(s, t);
}

group CodeableConcept2CodeableReference(source src : CodeableConceptR4, target tgt : CodeableReferenceR5) extends Element <<types>> {
  src as s -> tgt.concept as t then CodeableConcept(s, t) "CodeableConcept2CodeableReference";
}

group string2CodeableConcept(source src : stringR4, target tgt : CodeableConceptR5) extends Element <<types>> {
  src.value as v -> tgt.text = v "string2CodeableConcept";
}

group string2CodeableReference(source src : stringR4, target tgt : CodeableReferenceR5) extends Element <<types>> {
  src as s -> tgt.concept as t then string2CodeableConcept(s, t) "string2CodeableConcept";
}

group Coding2CodeableConcept(source src : CodingR4, target tgt : CodeableConceptR5) extends Element <<types>> {
  src as s -> tgt.coding as t then Coding(s, t) "Coding";
}

group Coding2CodeableReference(source src : CodingR4, target tgt : CodeableReferenceR5) extends Element <<types>> {
  src as s ->  tgt.concept = create('CodeableConcept') as t,  t.coding as tc then Coding(s, tc) "Coding"; // src as s -> tgt.concept = create('CodeableConcept') as tc, tc.coding = create ('Coding') as tcc, tcc.system = (s.system), tcc.code = (s.code), tcc.display = (s.display) "Coding2CodeableReference";
}

group CodeableConcept2code(source src : CodeableConceptR4, target tgt : codeR5, source sysUrl : string) extends Element <<types>> {
  src.coding as s where s.system = sysUrl -> tgt then {
    s.code -> tgt.value;
  };
}

group code2CodeableConcept(source src : codeR4, target tgt : CodeableConceptR5, source sysUrl : string) extends Element <<types>> {
  src.value as s ->  tgt.coding = create('Coding') as t,  t.system = sysUrl,  t.code = s;
}