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 CodeSystem: R5 to R4B

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

FMLConversionforCodeSystemR5toR4B

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

conceptmap "CodeSystemContentMode" {
  prefix s = "http://hl7.org/fhir/codesystem-content-mode"
  prefix t = "http://hl7.org/fhir/4.3/codesystem-content-mode"

  s:"not-present" - t:"not-present"
  s:example - t:example
  s:fragment - t:fragment
  s:complete - t:complete
  s:supplement - t:supplement
}

conceptmap "CodeSystemHierarchyMeaning" {
  prefix s = "http://hl7.org/fhir/codesystem-hierarchy-meaning"
  prefix t = "http://hl7.org/fhir/4.3/codesystem-hierarchy-meaning"

  s:"grouped-by" - t:"grouped-by"
  s:"is-a" - t:"is-a"
  s:"part-of" - t:"part-of"
  s:"classified-with" - t:"classified-with"
}

conceptmap "FilterOperator" {
  prefix s = "http://hl7.org/fhir/filter-operator"
  prefix t = "http://hl7.org/fhir/4.3/filter-operator"

  s:"=" - t:"="
  s:"is-a" - t:"is-a"
  s:"descendent-of" - t:"descendent-of"
  s:"is-not-a" - t:"is-not-a"
  s:regex - t:regex
  s:in - t:in
  s:"not-in" - t:"not-in"
  s:generalizes - t:generalizes
  s:exists - t:exists
}

conceptmap "PropertyType" {
  prefix s = "http://hl7.org/fhir/concept-property-type"
  prefix t = "http://hl7.org/fhir/4.3/concept-property-type"

  s:code - t:code
  s:Coding - t:Coding
  s:string - t:string
  s:integer - t:integer
  s:boolean - t:boolean
  s:dateTime - t:dateTime
  s:decimal - t:decimal
}

conceptmap "PublicationStatus" {
  prefix s = "http://hl7.org/fhir/publication-status"
  prefix t = "http://hl7.org/fhir/4.3/publication-status"

  s:draft - t:draft
  s:active - t:active
  s:retired - t:retired
  s:unknown - t:unknown
}

uses "http://hl7.org/fhir/StructureDefinition/CodeSystem" alias CodeSystemR5 as source
uses "http://hl7.org/fhir/4.3/StructureDefinition/CodeSystem" alias CodeSystemR4B as target

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

group CodeSystem(source src : CodeSystemR5, target tgt : CodeSystemR4B) extends DomainResource <<type+>> {
  src.url -> tgt.url;
  src.identifier -> tgt.identifier;
  src.version -> tgt.version;
  src.name -> tgt.name; // src.versionAlgorithm : string -> tgt.versionAlgorithm;
  src.title -> tgt.title;
  src.status as v -> tgt.status = translate(v, '#PublicationStatus', 'code');
  src.experimental -> tgt.experimental;
  src.date -> tgt.date;
  src.publisher -> tgt.publisher;
  src.contact -> tgt.contact;
  src.description -> tgt.description;
  src.useContext -> tgt.useContext;
  src.jurisdiction -> tgt.jurisdiction;
  src.purpose -> tgt.purpose;
  src.copyright -> tgt.copyright;
  src.caseSensitive -> tgt.caseSensitive; // src.copyrightLabel -> tgt.copyrightLabel;
  src.valueSet -> tgt.valueSet;
  src.hierarchyMeaning as v -> tgt.hierarchyMeaning = translate(v, '#CodeSystemHierarchyMeaning', 'code');
  src.compositional -> tgt.compositional;
  src.versionNeeded -> tgt.versionNeeded;
  src.content as v -> tgt.content = translate(v, '#CodeSystemContentMode', 'code');
  src.supplements -> tgt.supplements;
  src.count -> tgt.count;
  src.filter as s -> tgt.filter as t then CodeSystemFilter(s, t);
  src.property as s -> tgt.property as t then CodeSystemProperty(s, t);
  src.concept as s -> tgt.concept as t then CodeSystemConcept(s, t);
}

group CodeSystemFilter(source src, target tgt) extends BackboneElement {
  src.code -> tgt.code;
  src.description -> tgt.description;
  src.operator as v -> tgt.operator = translate(v, '#FilterOperator', 'code');
  src.value -> tgt.value;
}

group CodeSystemProperty(source src, target tgt) extends BackboneElement {
  src.code -> tgt.code;
  src.uri -> tgt.uri;
  src.description -> tgt.description;
  src.type as v -> tgt.type = translate(v, '#PropertyType', 'code');
}

group CodeSystemConcept(source src, target tgt) extends BackboneElement {
  src.code -> tgt.code;
  src.display -> tgt.display;
  src.definition -> tgt.definition;
  src.designation as s -> tgt.designation as t then CodeSystemConceptDesignation(s, t);
  src.property as s -> tgt.property as t then CodeSystemConceptProperty(s, t);
  src.concept as s -> tgt.concept as t then CodeSystemConcept(s, t);
}

group CodeSystemConceptDesignation(source src, target tgt) extends BackboneElement {
  src.language -> tgt.language;
  src.use -> tgt.use;
  src.value -> tgt.value; // src.additionalUse -> tgt.additionalUse;
}

group CodeSystemConceptProperty(source src, target tgt) extends BackboneElement {
  src.code -> tgt.code;
  src.value : code -> tgt.value;
  src.value : Coding -> tgt.value;
  src.value : string -> tgt.value;
  src.value : integer -> tgt.value;
  src.value : boolean -> tgt.value;
  src.value : dateTime -> tgt.value;
  src.value : decimal -> tgt.value;
}