Social Care Interoperability Platform FHIR Implementation Guide
Version: 0.1.0, Status: draft

Social Care Interoperability Platform FHIR Implementation Guide - Local Development build (v0.1.0) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions

StructureMap: RiskToObservationRisk

Official URL: https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureMap/Risk-Observation-Risk Version: 0.1.0
Draft as of 2026-06-10 Computable Name: RiskToObservationRisk

map "https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureMap/Risk-Observation-Risk" = "RiskToObservationRisk"

uses "https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/MODS-Risk" alias Risk as source
uses "https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/MODS-RiskObservation" alias RiskObservation as target

group RiskObservation(source src : Risk, target tgt : RiskObservation) {
  src -> tgt.id = evaluate(src, id) "6bc58530-f614-43e0-89fc-4c4ec4935b4a";
  src.involved as involved then {
    src ->  src.extension as participantExt,  participantExt.url = 'https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/Extension-MODS-ParticipantCareActor' then {
      involved -> participantExt.extension as participantRoleExt then {
        involved -> participantRoleExt.url = 'participantRole' "49f3f6ee-9fed-4c51-8f10-f9d0b2ef4403";
        involved -> participantRoleExt.valueCode = 'involved' "ee1cf7e6-a5be-4a4e-9bca-5b7621edc391";
      } "ab42636f-301b-4f50-b744-b8021ec77016";
      involved -> participantExt.extension as participantRefExt then {
        involved -> participantRefExt.url = 'participantReference' "47e84ad6-9d4c-4466-b976-336450226bdc";
        involved -> participantRefExt.valueReference as participantReference then {
          involved -> participantReference.reference = evaluate(involved, 'Practitioner/'+id) "211d2141-9f98-4eb9-a075-755307eeb3ab";
          involved -> participantReference.display = evaluate(involved, display) "fa83c451-e1bd-4d1c-9eb1-824c47f0bbc2";
        } "a731022f-f6f5-48f3-a591-c8ffbfb15d76";
      } "4bee6209-f759-4869-8fdf-8ce989eb8935";
      participantExt -> tgt.extension "c849d689-aa67-4a00-bf47-ef6c65ad6d0a";
    } "457fc392-d28d-4b1d-9564-d523735116b2";
  } "setObservationInvolved";
  src.informed as informed then {
    src ->  src.extension as participantExt,  participantExt.url = 'https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/Extension-MODS-ParticipantCareActor' then {
      informed -> participantExt.extension as participantRoleExt then {
        informed -> participantRoleExt.url = 'participantRole' "862b6d51-b8a4-4e3f-a47e-fea7d7aefb6b";
        informed -> participantRoleExt.valueCode = 'informed' "e9c8eae9-ef72-4d23-96d1-404b54fef310";
      } "471b4a2c-2c68-4132-a9c2-bbd6ef6bbe7c";
      informed -> participantExt.extension as participantRefExt then {
        informed -> participantRefExt.url = 'participantReference' "df7862a4-5ba6-45bf-84e6-9352593f1dbd";
        informed -> participantRefExt.valueReference as participantReference then {
          informed -> participantReference.reference = evaluate(informed, 'Practitioner/'+id) "ee5b8299-6327-4557-90d1-25a94f4b9e6c";
          informed -> participantReference.display = evaluate(informed, display) "6e698e5c-172f-41cb-98a8-2f4c9d419424";
        } "8bd58cc5-b6dc-458c-bb8a-d1bd549fe314";
      } "676d634f-77d3-4108-ae5c-c59e62dba268";
      participantExt -> tgt.extension "897a8d7d-33c3-468a-99db-0357814181a7";
    } "02f92146-d873-471f-9ccf-ba73354ed5f2";
  } "setObservationInformed";
  src ->  tgt.meta as meta,  meta.tag as tag then {
    src -> tag.system = 'https://metadata.phase2.scip.synanetics.cloud/fhir/r4/CodeSystem/MODS-FhirStructureMapCatalog-1' "010c3239-f386-4244-81ec-41d55e67265a";
    src -> tag.code = 'https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureMap/Observation-Risk-Risk' "153e822d-6e19-4f62-bb39-b41d5b27c5c3";
  } "setMetaTag";
  src -> tgt.status = 'final' "setObservationStatus";
  src.subjectOfCare as subjectOfCare then {
    src -> tgt.subject as subject then {
      src -> subject.reference = evaluate(subjectOfCare, 'Patient/'+id) "3886e9b2-4824-44fd-b5ff-3fe6a6e7836a";
      src -> subject.display = evaluate(subjectOfCare, display) "3423d944-1e84-411c-a768-e5868373ff75";
    } "db6e3e00-1991-420b-b864-d67d021d21c1";
  } "setObservationSubject";
  src.careWorker as careWorker then {
    src -> tgt.performer as performer then {
      src -> performer.reference = evaluate(careWorker, 'Practitioner/'+id) "7d053e9f-ea67-4b9e-ada0-c1e244884741";
      src -> performer.display = evaluate(careWorker, display) "521cf575-1681-4cd7-8bd7-a3b95dd589f4";
    } "951f5ccb-b284-4b00-9261-ea2a1c9ffa3a";
  } "setObservationPerformer";
  src -> tgt.category = cc('https://metadata.phase2.scip.synanetics.cloud/fhir/r4/CodeSystem/MODS-ObservationCategory-1', '3', 'Observations') "setObservationCategory";
  src -> tgt.code = cc('https://metadata.phase2.scip.synanetics.cloud/fhir/r4/CodeSystem/MODS-ObservationCode-1', '6', 'Risk') "setObservationCode";
  src -> src.period as period then {
    src.startDate as start then {
      src -> period.start = evaluate(src, startDate) "baa21f40-e6fe-46fa-a88e-135f85c52aef";
    };
    src.endDate as end then {
      src -> period.end = evaluate(src, end) "07caa3e9-4bf9-4a07-8033-0d1e9e77b629";
    };
    period where $this.start.empty().not()or$this.end.empty().not() -> tgt.effectivePeriod "87e77f46-bca2-4cd7-872c-f0ce48843ef1";
  } "setObservationPeriod";
  src.category as category then {
    src -> tgt.component as coded then {
      src -> coded.code = cc('https://metadata.phase2.scip.synanetics.cloud/fhir/r4/CodeSystem/MODS-ObservationComponentCode-1', 'coded', 'Coded') "ed9c89f6-b2f3-4862-bf81-99a10d8288e3";
      src -> coded.valueCodeableConcept = cc('https://metadata.phase2.scip.synanetics.cloud/fhir/r4/CodeSystem/MODS-RiskCategory-1', '', '') as vcc then {
        vcc.coding as coding then {
          vcc -> coding.code = evaluate(category, code) "ea26ec35-8ffc-4809-9208-bf3e8adb2302";
          vcc -> coding.display = evaluate(category, display) "23e2eccf-78a5-48cf-84de-097e88cd2c23";
        };
      } "04e0130a-6e5d-4765-89a0-641775d5ea9b";
    } "e2f50a69-9736-4a38-b254-1dfc41cdf374";
  } "setObservationRiskCategoryComponent";
  src.text as text then {
    src -> tgt.component as freeText then {
      src -> freeText.code = cc('https://metadata.phase2.scip.synanetics.cloud/fhir/r4/CodeSystem/MODS-ObservationComponentCode-1', 'text', 'Free-text') "e065273d-b64d-49a5-981a-372cc5812db9";
      src -> freeText.valueString = evaluate(src, text) "20591a2c-de51-4803-95d5-297116748d83";
    } "setObservationTextComponent";
    src.trigger as trigger then {
      src -> tgt.component as freeText then {
        src -> freeText.code = cc('https://metadata.phase2.scip.synanetics.cloud/fhir/r4/CodeSystem/MODS-RiskComponentCode-1', 'triggers', 'Triggers') "fa395101-149f-4317-abc1-a4069803f4c0";
        src -> freeText.valueString = evaluate(src, trigger) "b0ab0441-6f35-4bdb-ab36-d2215a6f696d";
      } "setObservationTriggerComponent";
      src.relapseIndicators as relapseIndicators then {
        src -> tgt.component as freeText then {
          src -> freeText.code = cc('https://metadata.phase2.scip.synanetics.cloud/fhir/r4/CodeSystem/MODS-RiskComponentCode-1', 'relapse-indicators', 'Relapse Indicators') "6e604ccc-b79d-4868-b68b-df0cd7bc658a";
          src -> freeText.valueString = evaluate(src, relapseIndicators) "81dd47ae-6312-435c-bc58-5fe2eade788e";
        } "setObservationRelapseIndicatorsComponent";
        src.comment as comment then {
          src -> tgt.component as freeText then {
            src -> freeText.code = cc('https://metadata.phase2.scip.synanetics.cloud/fhir/r4/CodeSystem/MODS-RiskComponentCode-1', 'comment', 'Comment') "1434e938-f312-4985-a08e-1465e36adb5c";
            src -> freeText.valueString = evaluate(src, comment) "d23f4ce4-86fc-4186-93f5-89606a229451";
          } "setObservationCommentComponent";
        };
      };
    };
  };
}