SGHI FHIR Profile Implementation Guide
0.1.0 - ci-build
SGHI FHIR Profile Implementation Guide, published by Kathurima Kimathi. This guide is not an authorized publication; it is the continuous build for version 0.1.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/savannahghi/sil_fhir_profile_ig/ and changes regularly. See the Directory of published versions
| Official URL: https://fhir.slade360.co.ke/fhir/StructureMap/DiagnosticReportSGHI5 | Version: 0.1.0 | |||
| Active as of 2025-09-17 | Computable Name: DiagnosticReportSGHI5 | |||
DiagnosticReportTransformsR4SGHIR5
/// url = 'https://fhir.slade360.co.ke/fhir/StructureMap/DiagnosticReportSGHI5' /// name = 'DiagnosticReportSGHI5' /// title = 'DiagnosticReport Transforms: R4 → SGHI R5' /// status = 'active' uses "http://hl7.org/fhir/4.0/StructureDefinition/DiagnosticReport" alias DiagnosticReportR4 as source uses "https://fhir.slade360.co.ke/fhir/StructureDefinition/sghi-diagnosticreport" alias SGHIDiagnosticReport as target imports "http://hl7.org/fhir/StructureMap/*4to5" group SGHIDiagnosticReport(source src : DiagnosticReportR4, target tgt : SGHIDiagnosticReport) <<type+>> { src.id as uuid -> tgt.id = uuid; src.active -> tgt.active; src.language -> tgt.language; src -> tgt.meta as t_meta then { src -> t_meta.profile = 'https://fhir.slade360.co.ke/fhir/StructureDefinition/sghi-diagnosticreport' "addsghiprofile"; } "addtometa"; src where text.exists().not() -> tgt.text = create('Narrative') as t_text then { src -> t_text.status = 'generated' "settextstatus"; src -> t_text.div = '<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Generated text</h1></div>' "settextdiv"; } "createhardcodedtext"; src -> tgt.text = create('Narrative') as ttt then { src.text as st then { st.status as s -> ttt.status = s; st.div as d -> ttt.div = ('<div xmlns=\"http://www.w3.org/1999/xhtml\"><p>' + d + '</p></div>') "wraptextinhtml"; }; } "setting text"; src.id as s_id -> tgt.identifier = create('Identifier') as t_ident then { s_id as uuid -> t_ident.value = uuid "copyid"; src -> t_ident.use = 'official' "setuse"; src -> t_ident.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/sghi-identifier-codesystem' "setsystem"; src -> t_ident.type = create('CodeableConcept') as t_type then { src -> t_type.coding = create('Coding') as t_code then { src -> t_code.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/sghi-identifier-codesystem' "typesystem"; src -> t_code.code = 'fhir-id' "typecode"; src -> t_code.display = 'FHIR Id' "typedisplay"; } "initcoding"; } "inittype"; src.meta as sm then { sm.tag last as st -> t_ident.assigner = create('Reference') as ta then TransformAssigner(st, ta); } "setting owner"; } "addfhirididentifier"; src.code as sc -> tgt.code as tc then { sc.coding as scc -> tc.coding = create('Coding') as tcode then { scc.code as d -> tcode.code = translate(d, 'https://fhir.slade360.co.ke/fhir/ConceptMap/CIELtoLOINCServiceRequestMap', 'code'); scc.code as d -> tcode.system = translate(d, 'https://fhir.slade360.co.ke/fhir/ConceptMap/CIELtoLOINCServiceRequestMap', 'system'); scc.code as d -> tcode.display = translate(d, 'https://fhir.slade360.co.ke/fhir/ConceptMap/CIELtoLOINCServiceRequestMap', 'display'); scc.code as d -> tc.text = translate(d, 'https://fhir.slade360.co.ke/fhir/ConceptMap/CIELtoLOINCServiceRequestMap', 'display'); }; }; src.category as sg -> tgt.category as tg then { sg.coding as sc -> tg.coding as tc then TransformCoding(sc, tc); sg.text -> tg.text; }; src.subject as sb -> tgt.subject as tb then TransformReference(sb, tb); src.encounter as se -> tgt.encounter as te then TransformReference(se, te); src.performer as sp -> tgt.performer as tp then TransformReference(sp, tp); src.results as sr -> tgt.results as tr then TransformReference(sr, tr); src.basedOn as sb -> tgt.basedOn as tb then TransformReference(sb, tb); src.issued -> tgt.issued; src.resultsInterpreter as sip -> tgt.resultsInterpreter as tip then TransformReference(sip, tip); src.status -> tgt.status; src.effectiveDateTime -> tgt.effectiveDateTime; src where effectiveDateTime.exists().not() then { src.issued as si -> tgt.effectiveDateTime = cast(si, 'dateTime'); } "setting a effective"; src.note as sn -> tgt.note as tn then { sn.time -> tn.time; sn.text -> tn.text; }; } group TransformAssigner(source src, target tgt) <<types>> { src.code as code -> tgt.reference = append('Organization/', code); src where display.exists().not() -> tgt.display = 'Unknown display' "setting default display"; src.display -> tgt.display; src.code -> tgt.id; } group TransformReference(source src, target tgt) <<types>> { src.id -> tgt.id; src.reference -> tgt.reference; src.display -> tgt.display; src.text -> tgt.display; src where display.exists().not() -> tgt.display = 'Unknown display' "setting display"; } group TransformCoding(source src, target tgt) <<types>> { src.code -> tgt.code; src.display -> tgt.display; src where display.exists().not() -> tgt.display = 'Unknown display' "settingdefaultdisplay"; src.system -> tgt.system; }