Generated Narrative: StructureMap AppointmentSGHI5 #xD; /// url = 'https://fhir.slade360.co.ke/fhir/StructureMap/AppointmentSGHI5'#xD; /// name = 'AppointmentSGHI5'#xD; /// title = 'Appointment Transforms: R4 → SGHI R5'#xD; /// status = 'active'#xD; #xD; uses "http://hl7.org/fhir/4.0/StructureDefinition/Appointment" alias AppointmentR4 as source#xD; uses "https://fhir.slade360.co.ke/fhir/StructureDefinition/appointment" alias SGHIAppointment as target#xD; #xD; imports "http://hl7.org/fhir/StructureMap/*4to5"#xD; #xD; group SGHIAppointment(source src : AppointmentR4, target tgt : SGHIAppointment) <<type+>> {#xD; src.id as uuid -> tgt.id = uuid;#xD; src.active -> tgt.active;#xD; src.language -> tgt.language;#xD; src -> tgt.meta as t_meta then {#xD; src -> t_meta.profile = 'https://fhir.slade360.co.ke/fhir/StructureDefinition/appointment' "addprofile";#xD; } "addtometa";#xD; src where text.exists().not() -> tgt.text = create('Narrative') as t_text then {#xD; src -> t_text.status = 'generated' "settextstatus";#xD; src -> t_text.div = ' Generated text ' "settextdiv";#xD; } "createhardcodedtext";#xD; src -> tgt.text = create('Narrative') as ttt then {#xD; src.text as st then {#xD; st.status as s -> ttt.status = s;#xD; st.div as d -> ttt.div = (' ' + d + ' ') "wraptextinhtml";#xD; };#xD; } "setting text";#xD; src.id as s_id -> tgt.identifier = create('Identifier') as t_ident then {#xD; s_id as uuid -> t_ident.value = uuid "copyid";#xD; src -> t_ident.use = 'official' "setuse";#xD; src -> t_ident.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/identifier-codesystem' "setsystem";#xD; src -> t_ident.type = create('CodeableConcept') as t_type then {#xD; src -> t_type.coding = create('Coding') as t_code then {#xD; src -> t_code.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/identifier-codesystem' "typesystem";#xD; src -> t_code.code = 'fhir-id' "typecode";#xD; src -> t_code.display = 'FHIR Id' "typedisplay";#xD; } "initcoding";#xD; } "inittype";#xD; src.meta as sm then {#xD; sm.tag last as st -> t_ident.assigner = create('Reference') as ta then TransformAssigner(st, ta);#xD; } "setting owner";#xD; } "addfhirididentifier";#xD; src.verificationStatus as sv -> tgt.verificationStatus as tv then {#xD; sv.coding as sc -> tv.coding as tc then TransformCoding(sc, tc);#xD; sv.text -> tv.text;#xD; };#xD; src where created.exists() then {#xD; src.created as sd -> tgt.created = sd;#xD; } "settingcreated";#xD; src where created.exists().not() then {#xD; src.start as sd -> tgt.created = sd;#xD; } "settingcreated";#xD; src.start -> tgt.start;#xD; src.end -> tgt.end;#xD; src where participant.exists().not() -> tgt.participant = create('BackboneElement') as tb then {#xD; src.patient as sp -> tb.actor = create('Reference') as trf then TransformReference(sp, trf);#xD; } "setting participant";#xD; src.participant as sp then {#xD; sp.actor as sa -> tgt.subject = create('Reference') as trf then TransformReference(sa, trf);#xD; };#xD; src.participant as sp -> tgt.participant as tp then {#xD; sp.actor as sa -> tp.actor as ta then TransformReference(sa, ta);#xD; sp.status -> tp.status;#xD; sp where status.exists().not() -> tp.status = 'needs-action' "settingparticipantstatus";#xD; };#xD; src where reasonCode.exists().not() -> tgt.reason = create('CodeableReference') as tcf then {#xD; src -> tcf.concept = create('Concept') as tcc then {#xD; src.reasonCode as sc then {#xD; sc.coding as scode -> tcc.coding = create('Coding') as tcoding then {#xD; scode.code as d -> tcoding.code = translate(d, 'https://fhir.slade360.co.ke/fhir/ConceptMap/CIELtoLOINCObservationMap', 'code');#xD; scode.code as d -> tcoding.system = translate(d, 'https://fhir.slade360.co.ke/fhir/ConceptMap/CIELtoLOINCObservationMap', 'system');#xD; scode.code as d -> tcoding.display = translate(d, 'https://fhir.slade360.co.ke/fhir/ConceptMap/CIELtoLOINCObservationMap', 'display');#xD; scode.code as d -> tcc.text = translate(d, 'https://fhir.slade360.co.ke/fhir/ConceptMap/CIELtoLOINCObservationMap', 'display');#xD; };#xD; };#xD; } "settingconcept";#xD; } "setting reason code";#xD; src -> tgt.reason = create('CodeableReference') as tcrf then {#xD; src.reasonCode as sc -> tcrf.concept = create('CodeableConcept') as tcc then {#xD; sc.coding as scode -> tcc.coding = create('Coding') as tcoding then {#xD; scode.code as d -> tcoding.code = translate(d, 'https://fhir.slade360.co.ke/fhir/ConceptMap/CIELtoLOINCObservationMap', 'code');#xD; scode.code as d -> tcoding.system = translate(d, 'https://fhir.slade360.co.ke/fhir/ConceptMap/CIELtoLOINCObservationMap', 'system');#xD; scode.code as d -> tcoding.display = translate(d, 'https://fhir.slade360.co.ke/fhir/ConceptMap/CIELtoLOINCObservationMap', 'display');#xD; scode.code as d -> tcc.text = translate(d, 'https://fhir.slade360.co.ke/fhir/ConceptMap/CIELtoLOINCObservationMap', 'display');#xD; };#xD; };#xD; } "settingappointmenttype";#xD; src.status -> tgt.status;#xD; src.specialty -> tgt.specialty;#xD; src where specialty.exists().not() then {#xD; src -> tgt.specialty = create('CodeableConcept') as tcc then {#xD; src -> tcc.coding = create('Coding') as tc, tc.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/specialtycodesystem', tc.code = 'general-practitioner', tc.display = 'General Practitioner' "setspecialtycoding";#xD; } "settingspeciality";#xD; } "settingdefaultspecialty";#xD; src -> tgt.priority = cc('http://terminology.hl7.org/CodeSystem/v3-ActPriority', 'R', 'routine') "setpriority";#xD; src.appointmentType -> tgt.appointmentType;#xD; src where appointmentType.exists().not() -> tgt.appointmentType = cc('http://terminology.hl7.org/CodeSystem/v2-0276', 'ROUTINE', 'Routine appointment - default if not valued') "setting appointment type";#xD; }#xD; #xD; group TransformAssigner(source src, target tgt) <<types>> {#xD; src.code as code -> tgt.reference = append('Organization/', code);#xD; src where display.exists().not() -> tgt.display = 'Unknown display' "setting default display";#xD; src.display -> tgt.display;#xD; src.code -> tgt.id;#xD; }#xD; #xD; group TransformReference(source src, target tgt) <<types>> {#xD; src.id -> tgt.id;#xD; src.reference -> tgt.reference;#xD; src.display -> tgt.display;#xD; src where display.exists().not() -> tgt.display = 'Unknown display' "setting display";#xD; }#xD; #xD; group TransformCoding(source src, target tgt) <<types>> {#xD; src.code -> tgt.code;#xD; src.display -> tgt.display;#xD; src where display.exists().not() -> tgt.display = 'Unknown display' "settingdefaultdisplay";#xD; src.system -> tgt.system;#xD; }#xD; #xD;
Generated text
Routine appointment - default if not valued