FHIR Extensions Pack v5.1.0-cibuild (2024-04-15)

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

FHIR Infrastructure Work GroupMaturity Level: N/AStandards Status: InformativeSecurity Category: N/A Compartments: N/A

Reference

FHIR Infrastructure Work GroupMaturity Level: 5Standards Status: Normative

See also Base Definition, Detailed Descriptions, Profiles and Extensions

Maps to Reference

FML Conversion for Reference: R5 to R4 (Ready for Use/Trial Use)

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

uses "http://hl7.org/fhir/StructureDefinition/Reference" alias ReferenceR5 as source
uses "http://hl7.org/fhir/StructureDefinition/CodeableReference" alias CodeableReferenceR5 as source
uses "http://hl7.org/fhir/4.0/StructureDefinition/Reference" alias ReferenceR4 as target
uses "http://hl7.org/fhir/StructureDefinition/canonical" alias canonicalR5 as source
uses "http://hl7.org/fhir/4.0/StructureDefinition/url" alias urlR4 as target
uses "http://hl7.org/fhir/StructureDefinition/url" alias urlR5 as source

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

group Reference(source src : ReferenceR5, target tgt : ReferenceR4) extends Element <<type+>> {
  src.reference -> tgt.reference;
  src.type -> tgt.type;
  src.identifier -> tgt.identifier;
  src.display -> tgt.display;
}

group canonical(source src : canonicalR5, target tgt : ReferenceR4) extends Element <<type+>> {
  src.value as v -> tgt.reference = v "canonicalValue";
}

group Reference2Url(source src : ReferenceR5, target tgt : urlR4) extends Element <<type+>> {
  src.reference as v -> tgt.value = v "canonicalValue";
}

group url2Reference(source src : urlR5, target tgt : ReferenceR4) extends Element <<type+>> {
  src.value as v -> tgt.reference = v "canonicalValue";
}

group CodeableReference2Reference(source src : CodeableReferenceR5, target tgt : ReferenceR4) extends Element <<type+>> {
  src.reference as v -> tgt then {
    v.reference -> tgt.reference;
    v.type -> tgt.type;
    v.identifier -> tgt.identifier;
    v.display -> tgt.display;
  };
}

FML Conversion for Reference: R5 to R4B (Ready for Use/Trial Use)

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

uses "http://hl7.org/fhir/StructureDefinition/Reference" alias ReferenceR5 as source
uses "http://hl7.org/fhir/StructureDefinition/CodeableReference" alias CodeableReferenceR5 as source
uses "http://hl7.org/fhir/4.3/StructureDefinition/Reference" alias ReferenceR4B as target
uses "http://hl7.org/fhir/StructureDefinition/canonical" alias canonicalR5 as source
uses "http://hl7.org/fhir/4.3/StructureDefinition/url" alias urlR4B as target
uses "http://hl7.org/fhir/StructureDefinition/url" alias urlR5 as source

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

group Reference(source src : ReferenceR5, target tgt : ReferenceR4B) extends Element <<type+>> {
  src.reference -> tgt.reference;
  src.type -> tgt.type;
  src.identifier -> tgt.identifier;
  src.display -> tgt.display;
}

group canonical(source src : canonicalR5, target tgt : ReferenceR4B) extends Element <<type+>> {
  src.value as v -> tgt.reference = v "canonicalValue";
}

group Reference2Url(source src : ReferenceR5, target tgt : urlR4B) extends Element <<type+>> {
  src.reference as v -> tgt.value = v "canonicalValue";
}

group url2Reference(source src : urlR5, target tgt : ReferenceR4B) extends Element <<type+>> {
  src.value as v -> tgt.reference = v "canonicalValue";
}

group CodeableReference2Reference(source src : CodeableReferenceR5, target tgt : ReferenceR4B) extends Element <<type+>> {
  src.reference as v -> tgt then {
    v.reference -> tgt.reference;
    v.type -> tgt.type;
    v.identifier -> tgt.identifier;
    v.display -> tgt.display;
  };
}

Maps from Reference

FML Conversion for Reference: R4B to R5 (Ready for Use/Trial Use)

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

uses "http://hl7.org/fhir/4.3/StructureDefinition/Reference" alias ReferenceR4B as source
uses "http://hl7.org/fhir/StructureDefinition/CodeableReference" alias CodeableReferenceR5 as target
uses "http://hl7.org/fhir/StructureDefinition/Reference" alias ReferenceR5 as target
uses "http://hl7.org/fhir/StructureDefinition/canonical" alias canonicalR5 as target
uses "http://hl7.org/fhir/4.3/StructureDefinition/url" alias urlR4B as source
uses "http://hl7.org/fhir/StructureDefinition/url" alias urlR5 as target

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

group Reference(source src : ReferenceR4B, target tgt : ReferenceR5) extends Element <<type+>> {
  src.reference -> tgt.reference;
  src.type -> tgt.type;
  src.identifier -> tgt.identifier;
  src.display -> tgt.display;
}

group Reference2canonical(source src : ReferenceR4B, target tgt : canonicalR5) extends Element <<type+>> {
  src.reference as v -> tgt.value = v "canonicalValue";
}

group Reference2Url(source src : ReferenceR4B, target tgt : urlR5) extends Element <<type+>> {
  src.reference as v -> tgt.value = v "canonicalValue";
}

group url2Reference(source src : urlR4B, target tgt : ReferenceR5) extends Element <<type+>> {
  src.value as v -> tgt.reference = v "canonicalValue";
}

group Reference2CodeableReference(source src : ReferenceR4B, target tgt : CodeableReferenceR5) extends Element <<type+>> {
  src.reference as v ->  tgt.reference as t,  t.reference = v;
  src.type as v ->  tgt.reference as t,  t.type = v;
  src.identifier as v ->  tgt.reference as t,  t.identifier = v;
  src.display as v ->  tgt.reference as t,  t.display = v;
}

FML Conversion for Reference: R4 to R5 (Ready for Use/Trial Use)

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

uses "http://hl7.org/fhir/4.0/StructureDefinition/Reference" alias ReferenceR4 as source
uses "http://hl7.org/fhir/StructureDefinition/CodeableReference" alias CodeableReferenceR5 as target
uses "http://hl7.org/fhir/StructureDefinition/Reference" alias ReferenceR5 as target
uses "http://hl7.org/fhir/StructureDefinition/canonical" alias canonicalR5 as target
uses "http://hl7.org/fhir/4.0/StructureDefinition/url" alias urlR4 as source
uses "http://hl7.org/fhir/StructureDefinition/url" alias urlR5 as target

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

group Reference(source src : ReferenceR4, target tgt : ReferenceR5) extends Element <<type+>> {
  src.reference -> tgt.reference;
  src.type -> tgt.type;
  src.identifier -> tgt.identifier;
  src.display -> tgt.display;
}

group Reference2canonical(source src : ReferenceR4, target tgt : canonicalR5) extends Element <<type+>> {
  src.reference as v -> tgt.value = v "canonicalValue";
}

group Reference2Url(source src : ReferenceR4, target tgt : urlR5) extends Element <<type+>> {
  src.reference as v -> tgt.value = v "canonicalValue";
}

group url2Reference(source src : urlR4, target tgt : ReferenceR5) extends Element <<type+>> {
  src.value as v -> tgt.reference = v "canonicalValue";
}

group Reference2CodeableReference(source src : ReferenceR4, target tgt : CodeableReferenceR5) extends Element <<type+>> {
  src.reference as v ->  tgt.reference as t,  t.reference = v;
  src.type as v ->  tgt.reference as t,  t.type = v;
  src.identifier as v ->  tgt.reference as t,  t.identifier = v;
  src.display as v ->  tgt.reference as t,  t.display = v;
}

CodeableReference

FHIR Infrastructure Work GroupMaturity Level: 5Standards Status: Trial Use

See also Base Definition, Detailed Descriptions, Profiles and Extensions.

Maps to CodeableReference

FML Conversion for CodeableConcept: R5 to R4 (Ready for Use/Trial Use)

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

uses "http://hl7.org/fhir/4.0/StructureDefinition/CodeableConcept" alias CodeableConceptR4 as target
uses "http://hl7.org/fhir/4.0/StructureDefinition/Coding" alias CodingR4 as target
uses "http://hl7.org/fhir/4.0/StructureDefinition/code" alias codeR4 as target
uses "http://hl7.org/fhir/4.0/StructureDefinition/string" alias stringR4 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/*5to4"

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

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

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

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

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

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

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

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

FML Conversion for CodeableConcept: R5 to R4B (Ready for Use/Trial Use)

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

FML Conversion for CodeableReference: R5 to R4B (Ready for Use/Trial Use)

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

uses "http://hl7.org/fhir/StructureDefinition/CodeableReference" alias CodeableReferenceR5 as source
uses "http://hl7.org/fhir/4.3/StructureDefinition/CodeableReference" alias CodeableReferenceR4B as target

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

group CodeableReference(source src : CodeableReferenceR5, target tgt : CodeableReferenceR4B) extends Element <<type+>> {
  src.concept -> tgt.concept;
  src.reference -> tgt.reference;
}

FML Conversion for Reference: R5 to R4 (Ready for Use/Trial Use)

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

uses "http://hl7.org/fhir/StructureDefinition/Reference" alias ReferenceR5 as source
uses "http://hl7.org/fhir/StructureDefinition/CodeableReference" alias CodeableReferenceR5 as source
uses "http://hl7.org/fhir/4.0/StructureDefinition/Reference" alias ReferenceR4 as target
uses "http://hl7.org/fhir/StructureDefinition/canonical" alias canonicalR5 as source
uses "http://hl7.org/fhir/4.0/StructureDefinition/url" alias urlR4 as target
uses "http://hl7.org/fhir/StructureDefinition/url" alias urlR5 as source

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

group Reference(source src : ReferenceR5, target tgt : ReferenceR4) extends Element <<type+>> {
  src.reference -> tgt.reference;
  src.type -> tgt.type;
  src.identifier -> tgt.identifier;
  src.display -> tgt.display;
}

group canonical(source src : canonicalR5, target tgt : ReferenceR4) extends Element <<type+>> {
  src.value as v -> tgt.reference = v "canonicalValue";
}

group Reference2Url(source src : ReferenceR5, target tgt : urlR4) extends Element <<type+>> {
  src.reference as v -> tgt.value = v "canonicalValue";
}

group url2Reference(source src : urlR5, target tgt : ReferenceR4) extends Element <<type+>> {
  src.value as v -> tgt.reference = v "canonicalValue";
}

group CodeableReference2Reference(source src : CodeableReferenceR5, target tgt : ReferenceR4) extends Element <<type+>> {
  src.reference as v -> tgt then {
    v.reference -> tgt.reference;
    v.type -> tgt.type;
    v.identifier -> tgt.identifier;
    v.display -> tgt.display;
  };
}

FML Conversion for Reference: R5 to R4B (Ready for Use/Trial Use)

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

uses "http://hl7.org/fhir/StructureDefinition/Reference" alias ReferenceR5 as source
uses "http://hl7.org/fhir/StructureDefinition/CodeableReference" alias CodeableReferenceR5 as source
uses "http://hl7.org/fhir/4.3/StructureDefinition/Reference" alias ReferenceR4B as target
uses "http://hl7.org/fhir/StructureDefinition/canonical" alias canonicalR5 as source
uses "http://hl7.org/fhir/4.3/StructureDefinition/url" alias urlR4B as target
uses "http://hl7.org/fhir/StructureDefinition/url" alias urlR5 as source

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

group Reference(source src : ReferenceR5, target tgt : ReferenceR4B) extends Element <<type+>> {
  src.reference -> tgt.reference;
  src.type -> tgt.type;
  src.identifier -> tgt.identifier;
  src.display -> tgt.display;
}

group canonical(source src : canonicalR5, target tgt : ReferenceR4B) extends Element <<type+>> {
  src.value as v -> tgt.reference = v "canonicalValue";
}

group Reference2Url(source src : ReferenceR5, target tgt : urlR4B) extends Element <<type+>> {
  src.reference as v -> tgt.value = v "canonicalValue";
}

group url2Reference(source src : urlR5, target tgt : ReferenceR4B) extends Element <<type+>> {
  src.value as v -> tgt.reference = v "canonicalValue";
}

group CodeableReference2Reference(source src : CodeableReferenceR5, target tgt : ReferenceR4B) extends Element <<type+>> {
  src.reference as v -> tgt then {
    v.reference -> tgt.reference;
    v.type -> tgt.type;
    v.identifier -> tgt.identifier;
    v.display -> tgt.display;
  };
}

Maps from CodeableReference

FML Conversion for CodeableConcept: R4B to R5 (Ready for Use/Trial Use)

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

uses "http://hl7.org/fhir/4.3/StructureDefinition/string" alias stringR4B as source
uses "http://hl7.org/fhir/4.3/StructureDefinition/CodeableConcept" alias CodeableConceptR4B as source
uses "http://hl7.org/fhir/4.3/StructureDefinition/CodeableReference" alias CodeableReferenceR4B as source
uses "http://hl7.org/fhir/4.3/StructureDefinition/Coding" alias CodingR4B as source
uses "http://hl7.org/fhir/4.3/StructureDefinition/code" alias codeR4B 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/*4Bto5"

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

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

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

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

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

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

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

group Coding2CodeableReference(source src : CodingR4B, 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 = (a.system), tcc.code = (s.code), tcc.display = s.display "Coding2CodeableReference";
}

group CodeableConcept2code(source src : CodeableConceptR4B, 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 : codeR4B, 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;
}

FML Conversion for CodeableConcept: R4 to R5 (Ready for Use/Trial Use)

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

FML Conversion for CodeableReference: R4B to R5 (Ready for Use/Trial Use)

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

uses "http://hl7.org/fhir/4.3/StructureDefinition/CodeableReference" alias CodeableReferenceR4B as source
uses "http://hl7.org/fhir/StructureDefinition/CodeableReference" alias CodeableReferenceR5 as target

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

group CodeableReference(source src : CodeableReferenceR4B, target tgt : CodeableReferenceR5) extends Element <<type+>> {
  src.concept -> tgt.concept;
  src.reference -> tgt.reference;
}

FML Conversion for Reference: R4B to R5 (Ready for Use/Trial Use)

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

uses "http://hl7.org/fhir/4.3/StructureDefinition/Reference" alias ReferenceR4B as source
uses "http://hl7.org/fhir/StructureDefinition/CodeableReference" alias CodeableReferenceR5 as target
uses "http://hl7.org/fhir/StructureDefinition/Reference" alias ReferenceR5 as target
uses "http://hl7.org/fhir/StructureDefinition/canonical" alias canonicalR5 as target
uses "http://hl7.org/fhir/4.3/StructureDefinition/url" alias urlR4B as source
uses "http://hl7.org/fhir/StructureDefinition/url" alias urlR5 as target

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

group Reference(source src : ReferenceR4B, target tgt : ReferenceR5) extends Element <<type+>> {
  src.reference -> tgt.reference;
  src.type -> tgt.type;
  src.identifier -> tgt.identifier;
  src.display -> tgt.display;
}

group Reference2canonical(source src : ReferenceR4B, target tgt : canonicalR5) extends Element <<type+>> {
  src.reference as v -> tgt.value = v "canonicalValue";
}

group Reference2Url(source src : ReferenceR4B, target tgt : urlR5) extends Element <<type+>> {
  src.reference as v -> tgt.value = v "canonicalValue";
}

group url2Reference(source src : urlR4B, target tgt : ReferenceR5) extends Element <<type+>> {
  src.value as v -> tgt.reference = v "canonicalValue";
}

group Reference2CodeableReference(source src : ReferenceR4B, target tgt : CodeableReferenceR5) extends Element <<type+>> {
  src.reference as v ->  tgt.reference as t,  t.reference = v;
  src.type as v ->  tgt.reference as t,  t.type = v;
  src.identifier as v ->  tgt.reference as t,  t.identifier = v;
  src.display as v ->  tgt.reference as t,  t.display = v;
}

FML Conversion for Reference: R4 to R5 (Ready for Use/Trial Use)

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

uses "http://hl7.org/fhir/4.0/StructureDefinition/Reference" alias ReferenceR4 as source
uses "http://hl7.org/fhir/StructureDefinition/CodeableReference" alias CodeableReferenceR5 as target
uses "http://hl7.org/fhir/StructureDefinition/Reference" alias ReferenceR5 as target
uses "http://hl7.org/fhir/StructureDefinition/canonical" alias canonicalR5 as target
uses "http://hl7.org/fhir/4.0/StructureDefinition/url" alias urlR4 as source
uses "http://hl7.org/fhir/StructureDefinition/url" alias urlR5 as target

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

group Reference(source src : ReferenceR4, target tgt : ReferenceR5) extends Element <<type+>> {
  src.reference -> tgt.reference;
  src.type -> tgt.type;
  src.identifier -> tgt.identifier;
  src.display -> tgt.display;
}

group Reference2canonical(source src : ReferenceR4, target tgt : canonicalR5) extends Element <<type+>> {
  src.reference as v -> tgt.value = v "canonicalValue";
}

group Reference2Url(source src : ReferenceR4, target tgt : urlR5) extends Element <<type+>> {
  src.reference as v -> tgt.value = v "canonicalValue";
}

group url2Reference(source src : urlR4, target tgt : ReferenceR5) extends Element <<type+>> {
  src.value as v -> tgt.reference = v "canonicalValue";
}

group Reference2CodeableReference(source src : ReferenceR4, target tgt : CodeableReferenceR5) extends Element <<type+>> {
  src.reference as v ->  tgt.reference as t,  t.reference = v;
  src.type as v ->  tgt.reference as t,  t.type = v;
  src.identifier as v ->  tgt.reference as t,  t.identifier = v;
  src.display as v ->  tgt.reference as t,  t.display = v;
}