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

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

FMLConversionforIngredientR5toR4B

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

conceptmap "IngredientManufacturerRole" {
  prefix s = "http://hl7.org/fhir/ingredient-manufacturer-role"
  prefix t = "http://hl7.org/fhir/4.3/ingredient-manufacturer-role"

  s:allowed - t:allowed
  s:possible - t:possible
  s:actual - t:actual
}

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/Ingredient" alias IngredientR5 as source
uses "http://hl7.org/fhir/4.3/StructureDefinition/Ingredient" alias IngredientR4B as target

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

group Ingredient(source src : IngredientR5, target tgt : IngredientR4B) extends DomainResource <<type+>> {
  src.identifier -> tgt.identifier;
  src.status as v -> tgt.status = translate(v, '#PublicationStatus', 'code');
  src.for -> tgt.for;
  src.role -> tgt.role;
  src.function -> tgt.function;
  src.allergenicIndicator -> tgt.allergenicIndicator; // src.group -> tgt.group;
  src.manufacturer as s -> tgt.manufacturer as t then IngredientManufacturer(s, t); // src.comment -> tgt.comment;
  src.substance as s -> tgt.substance as t then IngredientSubstance(s, t);
}

group IngredientManufacturer(source src, target tgt) extends BackboneElement {
  src.role as v -> tgt.role = translate(v, '#IngredientManufacturerRole', 'code');
  src.manufacturer -> tgt.manufacturer;
}

group IngredientSubstance(source src, target tgt) extends BackboneElement {
  src.code -> tgt.code;
  src.strength as s -> tgt.strength as t then IngredientSubstanceStrength(s, t);
}

group IngredientSubstanceStrength(source src, target tgt) extends BackboneElement {
  src.presentation : Ratio -> tgt.presentation;
  src.presentation : RatioRange -> tgt.presentation;
  src.textPresentation -> tgt.textPresentation; // src.presentation : CodeableConcept -> tgt.presentation;
  src.concentration : Ratio -> tgt.concentration;
  src.concentration : RatioRange -> tgt.concentration;
  src.textConcentration -> tgt.textConcentration; // src.concentration : CodeableConcept -> tgt.concentration;
  src.measurementPoint -> tgt.measurementPoint; // src.basis -> tgt.basis;
  src.country -> tgt.country;
  src.referenceStrength as s -> tgt.referenceStrength as t then IngredientSubstanceStrengthReferenceStrength(s, t);
}

group IngredientSubstanceStrengthReferenceStrength(source src, target tgt) extends BackboneElement {
  src.substance -> tgt.substance;
  src.strength : Ratio -> tgt.strength;
  src.strength : RatioRange -> tgt.strength;
  src.measurementPoint -> tgt.measurementPoint; // src.strength : Quantity -> tgt.strength;
  src.country -> tgt.country;
}