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: FlagToAlert

Official URL: https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureMap/Flag-Alert Version: 0.1.0
Draft as of 2026-03-24 Computable Name: FlagToAlert

map "https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureMap/Flag-Alert" = "FlagToAlert"

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

group Alert(source src : Flag, target tgt : Alert) {
  src -> tgt.id = evaluate(src, id) "c0fcca6c-950a-4f90-9e6f-fa29e64db905";
  src ->  tgt.meta as meta,  meta.dataClass as dataClass then {
    src -> dataClass.name = 'Alert' "576b6ce6-40e5-47e6-aff3-6fbf0d0ef447";
  } "setDataClassName";
  src.subject as subject then {
    src -> tgt.subjectOfCare as subjectOfCare then {
      src -> subjectOfCare.id = evaluate(subject, reference.replace('Patient/','')) "5d2ea79e-7d68-4b50-a0f3-e33471c0449b";
      src -> subjectOfCare.type = 'SubjectOfCare' "d2c51a86-1eb5-4883-9b3f-0d605248ff31";
      src -> subjectOfCare.display = evaluate(subject, display) "3f51cd07-77ff-4ad0-b238-0d689c53efae";
    } "3dc9e53e-25d7-434c-9d2c-6b069b0d9854";
  } "setAlertSubject";
  src.status as status then {
    src -> src.statusCode as statusCode then {
      src -> statusCode.code = status "947b98f0-d6f1-4d35-8182-6319719455ba";
      src -> statusCode.system = 'http://hl7.org/fhir/flag-status' "f7cd9c45-4358-4f38-83fb-e11d23ad96d7";
      src -> tgt.status = translate(statusCode, 'https://metadata.phase2.scip.synanetics.cloud/fhir/r4/ConceptMap/MODS-FHIRStatus-1', 'Coding') "d1cf7d9c-bcf7-4ae1-b03d-033b4411a7dc";
    } "setAlertStatus";
    src.category as category -> src.cats as cats then {
      cats as c then {
        category -> c.code = evaluate(category, coding.code) "5bff2e81-dfb6-448e-9cf8-7a58b6cfeaaf";
        category -> c.display = evaluate(category, coding.display) "f6e8c484-b76a-487b-a1e1-b055e0e15f7f";
      } "854bf53c-950f-45e7-9145-b973d81da837";
      cats -> tgt.category "73e8c8ed-67c6-4155-b052-50b4c67be23b";
    } "setAlertCategory";
    src.extension as participantsExt where $this.url='https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/Extension-MODS-ParticipantCareActor' -> tgt.informed as informed then {
      participantsExt.extension as informedParticipants where $this.url='participantRole'and$this.valueCode='informed' then {
        participantsExt.extension as informedParticipantReferences where $this.url='participantReference' then {
          informedParticipantReferences.valueReference as informedParticipantRef then {
            src -> informed.id = evaluate(informedParticipantRef, reference.replace('Practitioner/','')) "7533ea08-2f0b-43b4-897c-590ee042debb";
            src -> informed.type = 'CareWorker' "383f91f1-4568-475a-b826-3dedc62863c6";
            src -> informed.display = evaluate(informedParticipantRef, display) "c5262397-1ecc-4e04-8f67-f5772f20b289";
          };
        };
      };
    } "setAlertInformed";
    src.code as code then {
      src -> tgt.text = evaluate(src, code.text) "d4d20b11-e4b0-4a91-8e1b-1543a23c7e72";
    } "setAlertCodedText";
    src.period as period then {
      period.start as start then {
        src -> tgt.startDate = evaluate(period, start) "c85f9689-b541-482d-8007-c37e250b56f3";
      };
      period.end as end then {
        src -> tgt.endDate = evaluate(period, end) "0015de12-b08e-49a2-8863-d96cc44eef6e";
      };
    } "setAlertStartEndDates";
    src.extension as participantsExt where $this.url='https://metadata.phase2.scip.synanetics.cloud/fhir/r4/StructureDefinition/Extension-MODS-ParticipantCareActor' -> tgt.involved as involved then {
      participantsExt.extension as involvedParticipants where $this.url='participantRole'and$this.valueCode='involved' then {
        participantsExt.extension as involvedParticipantReferences where $this.url='participantReference' then {
          involvedParticipantReferences.valueReference as involvedParticipantRef then {
            src -> involved.id = evaluate(involvedParticipantRef, reference.replace('Practitioner/','')) "c32f149a-eeb4-4ca7-ac27-23e50a0b9190";
            src -> involved.type = 'CareWorker' "401b1e0f-6655-4376-a7e7-0585af85a2c7";
            src -> involved.display = evaluate(involvedParticipantRef, display) "252c06fa-3f77-4f40-8b96-6d7bf5bfd1f8";
          };
        };
      };
    } "setAlertInvolved";
  };
}