Starter FHIR Implementation Guide
1.0.1 - draft International flag

Starter FHIR Implementation Guide, published by Jembi Health Systems. This guide is not an authorized publication; it is the continuous build for version 1.0.1 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/jembi/Starter-FHIR-IG/ and changes regularly. See the Directory of published versions

StructureMap: Map Breastfeeding Proprietary Structure to an Observation

Official URL: http://jembi.org/fhir/StructureMap/ProprietaryBreastfeedingStatusToObservation Version: 1.0.1
Draft as of 2024-11-17 Computable Name: ProprietaryBreastfeedingStatusToObservation

Generated Narrative: StructureMap ProprietaryBreastfeedingStatusToObservation

map "http://jembi.org/fhir/StructureMap/ProprietaryBreastfeedingStatusToObservation" = "ProprietaryBreastfeedingStatusToObservation"

uses "http://jembi.org/fhir/StructureDefinition/BreastfeedingStatusProprietaryLogicalModel" as source
uses "http://jembi.org/fhir/StructureDefinition/breastfeeding-status-observation" as target

group ProprietaryBreastfeedingStatusToObservation(source src : BreastfeedingStatusProprietaryLogicalModel, target tgt : Observation) {
  src -> tgt.id = uuid() "SetObservationId";
  src -> tgt.meta as meta then {
    src -> meta.profile = 'http://jembi.org/fhir/StructureDefinition/breastfeeding-status-observation' "SetObservationMetaProfile";
  } "SetObservationMeta";
  src.observationStatus as status -> tgt.status = status "SetObservationStatus";
  src.code as code -> tgt.code = cc('http://loinc.org', code) "SetObservationCode";
  src ->  tgt.code as code,  code.text = 'Breastfeeding status' "SetObservationCodeText";
  src.date as authored -> tgt.effective = create('dateTime') as obsDate then {
    authored -> obsDate.value = authored "SetObservationEffectiveDateTime";
  };
  src -> tgt.category = cc('http://terminology.hl7.org/CodeSystem/observation-category', 'exam') "SetObservationCategory";
  src.patient as patient -> tgt.subject as subject then {
    patient -> subject.reference = append('Patient/', 'Some FHIR ID generated at the time of CREATE') "SetPatientReference";
    patient -> subject.extension as ext then {
      patient -> ext.value = patient "SetOriginalPatientReferenceValue";
      patient -> ext.url = 'http://jembi.org/fhir/StructureDefinition/source-system-resource-reference' "SetOriginalPatientReferenceUrl";
    } "ProcessPatientReferenceExtension";
  } "SetObservationPatientReference";
  src.performer as author -> tgt.performer as practitioner then {
    author -> practitioner.reference = append('Practitioner/', 'Some FHIR ID generated at the time of CREATE') "ProcessPerformerReference";
    author -> practitioner.extension as ext then {
      author -> ext.value = author "SetOriginalPractitionerReferenceValue";
      author -> ext.url = 'http://jembi.org/fhir/StructureDefinition/source-system-resource-reference' "SetOriginalPractitionerReferenceUrl";
    } "ProcessPractitionerReferenceExtension";
  } "SetObservationPerformerReference";
  src.encounter as encounter -> tgt.encounter as enc then {
    encounter -> enc.reference = append('Encounter/', 'Some FHIR ID generated at the time of CREATE') "ProcessEncounterReference";
    encounter -> enc.extension as ext then {
      encounter -> ext.value = encounter "SetOriginalEncounterReferenceValue";
      encounter -> ext.url = 'http://jembi.org/fhir/StructureDefinition/source-system-resource-reference' "SetOriginalEncounterReferenceUrl";
    } "ProcessEncounterReferenceExtension";
  } "SetObservationEncounterReference";
  src.breastFeedingStatus as breastfeeding -> tgt.value = create('CodeableConcept') as obsValue then {
    breastfeeding -> obsValue.coding = create('Coding') as coding then {
      breastfeeding -> coding.system = 'http://loinc.org' "SetObservationValueCodingSystem";
      breastfeeding -> coding.code = breastfeeding "SetObservationValueCodingCode";
    } "SetObservationValueCoding";
  };
}