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: RiskAssessment Transforms: R4 → SGHI R5

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

RiskAssessmentTransformsR4SGHIR5

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

    uses "http://hl7.org/fhir/4.0/StructureDefinition/RiskAssessment" alias RiskAssessmentR4 as source
    uses "https://fhir.slade360.co.ke/fhir/StructureDefinition/riskassessment" alias RiskAssessmentR5 as target

    group RiskAssessment(source src : RiskAssessmentR4, target tgt : RiskAssessmentR5) <<type+>> {
      src.id as v -> tgt.id = v;
      src.meta as m -> tgt.meta = m;
      src.language as l -> tgt.language = (l.lower());
      src.text as n -> tgt.text = n;
      src.status as s -> tgt.status = s;
      src.code as c -> tgt.code = c;
      src.subject as sbj -> tgt.subject = sbj;
      src.encounter as enc -> tgt.encounter = enc;
      src.occurrence as occ -> tgt.occurrence = occ;
      src.condition as cond -> tgt.condition = cond;
      src.performer as perf -> tgt.performer = perf;
      src.reasonCode as rc ->  tgt.reason as r,  r.concept = rc "reasonCodeToReason"; // R4 reasonCode + reasonReference → R5 reason (CodeableReference)
      src.reasonReference as rr ->  tgt.reason as r2,  r2.reference = rr "reasonRefToReason";
      src.basis as b -> tgt.basis = b;
      src.prediction as p -> tgt.prediction as tp then {
        p.outcome as o -> tp.outcome = o;
        p.probabilityDecimal as d -> tp.probability = d;
        p.probabilityRange as pr -> tp.probability = pr;
        p.qualitativeRisk as qr -> tp.qualitativeRisk = qr;
        p.relativeRisk as rr -> tp.relativeRisk = rr;
        p.whenPeriod as wp -> tp.when = wp;
        p.whenRange as wr -> tp.when = wr;
        p.rationale as ra -> tp.rationale = ra;
      };
      src.mitigation as mit -> tgt.mitigation = mit;
      src.note as notes -> tgt.note = notes;
    }