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 Question to an Observation

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

Generated Narrative: StructureMap QRBreastfeedingStatusToObservation

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

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

group QRBreastfeedingStatusToObservation(source src : QuestionnaireResponse, 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 -> tgt.status = 'final' "SetObservationStatus";
  src -> tgt.code = cc('http://loinc.org', '63895-7') "SetObservationCode";
  src ->  tgt.code as code,  code.text = 'Breastfeeding status' "SetObservationCodeText";
  src.authored as authored -> tgt.effective = authored "SetObservationEffectiveDateTime";
  src -> tgt.category = cc('http://terminology.hl7.org/CodeSystem/observation-category', 'exam') "SetObservationCategory";
  src.subject as patient -> tgt.subject = patient "SetObservationSubjectReference";
  src.author as author -> tgt.performer = author "SetObservationPerfomerReference";
  src.encounter as encounter -> tgt.encounter = encounter "SetObservationEncounterReference";
  src.item as item where (linkId = '1.1') then {
    item.answer first as ans then {
      ans.value : Coding as breastfeeding -> tgt.value = create('CodeableConcept') as obsValue then {
        breastfeeding -> obsValue.coding = create('Coding') as coding then {
          breastfeeding -> coding.system = translate(breastfeeding, 'http://jembi.org/fhir/ConceptMap/LOINCCodesToProprietary', 'system') "SetObservationValueCodingSystem";
          breastfeeding -> coding.code = translate(breastfeeding, 'http://jembi.org/fhir/ConceptMap/LOINCCodesToProprietary', 'code') "SetObservationValueCodingCode";
        } "SetObservationValueCoding";
      };
    };
  };
}