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

## StructureMap: Organization Transforms: R4 → SGHI R5

Official URL: https://fhir.slade360.co.ke/fhir/StructureMap/Organization4toSGHI5 | Version: 0.1.0
Active as of 2026-05-21 | Computable Name: Organization4toSGHI5

OrganizationTransformsR4SGHIR5

    /// url = 'https://fhir.slade360.co.ke/fhir/StructureMap/Organization4toSGHI5'
    /// name = 'Organization4toSGHI5'
    /// title = 'Organization Transforms: R4 → SGHI R5'
    /// status = 'active'

    uses "http://hl7.org/fhir/4.0/StructureDefinition/Organization" alias OrganizationR4 as source
    uses "https://fhir.slade360.co.ke/fhir/StructureDefinition/organization" alias SGHIOrganization as target

    imports "http://hl7.org/fhir/StructureMap/*4to5"

    group SGHIOrganization(source src : OrganizationR4, target tgt : SGHIOrganization) extends DomainResource <<type+>> {
      src.text -> tgt.text;
      src.identifier as s where (s.system = 'SladeCode') and s.value.exists() -> tgt.identifier as t then {
        s.use -> t.use "copyuse";
        s.value -> t.value "copyvalue";
        s.period -> t.period "copyperiod";
        s.type as st -> t.type as tt then {
          st.coding as sc where (sc.system = 'SladeCode') ->  tt.coding = create('CodeableConcept') as tc,  tc.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/identifier-codesystem',  tc.code = 'slade-code',  tc.display = 'Slade360 Code';
        };
        s -> t.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/identifier-codesystem' "SetFixedIdentifierSystem";
      } "processoneidentifier";
      src.identifier as s_id -> tgt.identifier as t_id then {
        s_id.use -> t_id.use "copyuse";
        src.id as uuid -> t_id.value = uuid;
        s_id.period -> t_id.period;
        s_id.type as st -> t_id.type as tt then {
          st.coding ->  tt.coding = create('CodeableConcept') as tt,  tt.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/identifier-codesystem',  tt.code = 'fhir-id',  tt.display = 'FHIR Id';
        };
        s_id -> t_id.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/identifier-codesystem' "SetFixedIdentifierSystem";
      } "create the default FHIR ID identifier type";
      src.active -> tgt.active;
      src.name -> tgt.name;
      src -> tgt.contact = create('ExtendedContactDetail') as t_contact then {
        src.telecom as s_contact -> t_contact.telecom as t_contact then SGHIContactPointMap(s_contact, t_contact) "setcontact";
      } "createcontact";
      src -> tgt.text = create('Narrative') as tgt_n then {
        src -> tgt_n.status = 'generated' "settextstatus";
        src -> tgt_n.div = '<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Generated text</h1></div>' "settextdiv";
      } "createhardcodedtext";
      src -> tgt.meta = create('Meta') as tm then {
        src -> tm.profile = 'https://fhir.slade360.co.ke/fhir/StructureDefinition/organization' "setprofileinmeta";
      } "createhardcodedprofile";
    }

    group SGHIContactPointMap(source src, target tgt) extends ContactPoint {
      src.system -> tgt.system;
      src.value -> tgt.value;
      src.use -> tgt.use;
      src.rank -> tgt.rank;
      src.period -> tgt.period;
    }