FHIR Extensions Pack
5.1.0 - 5.1.0 (April 2024) International flag

This page is part of the FHIR Core Extensions Registry (v5.1.0: Release 5.1) based on FHIR (HL7® FHIR® Standard) v5.0.0. This is the current published version. For a full list of available versions, see the Directory of published versions

StructureMap: FML Conversion for CodeableConcept: R5 to R4B

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

FMLConversionforCodeableConceptR5toR4B

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

uses "http://hl7.org/fhir/4.3/StructureDefinition/CodeableConcept" alias CodeableConceptR4B as target
uses "http://hl7.org/fhir/4.3/StructureDefinition/CodeableReference" alias CodeableReferenceR4B as target
uses "http://hl7.org/fhir/4.3/StructureDefinition/Coding" alias CodingR4B as target
uses "http://hl7.org/fhir/4.3/StructureDefinition/code" alias codeR4B as target
uses "http://hl7.org/fhir/4.3/StructureDefinition/string" alias stringR4B as target
uses "http://hl7.org/fhir/StructureDefinition/CodeableConcept" alias CodeableConceptR5 as source
uses "http://hl7.org/fhir/StructureDefinition/CodeableReference" alias CodeableReferenceR5 as source
uses "http://hl7.org/fhir/StructureDefinition/Coding" alias CodingR5 as source
uses "http://hl7.org/fhir/StructureDefinition/code" alias codeR5 as source

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

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

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

group CodeableReference2Coding(source src : CodeableReferenceR5, target tgt : CodingR4B) extends Element <<types>> {
  src.concept as s -> tgt then {
    s.coding as v -> tgt then Coding(v, tgt);
  };
}

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

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

group CodeableReference2string(source src : CodeableReferenceR5, target tgt : stringR4B) extends Element <<types>> {
  src.concept as s -> tgt as t then CodeableConcept2string(s, t);
}

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

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

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

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