FHIR IG analytics| Package | silfhirprofileig |
| Resource Type | StructureMap |
| Id | StructureMap-ExtractDischargeClearancePatientEducation.json |
| FHIR Version | R5 |
| Source | https://build.fhir.org/ig/savannahghi/sil_fhir_profile_ig/StructureMap-ExtractDischargeClearancePatientEducation.html |
| URL | https://fhir.slade360.co.ke/fhir/StructureMap/ExtractDischargeClearancePatientEducation |
| Version | 0.1.0 |
| Status | active |
| Date | 2026-09-11T12:18:36+00:00 |
| Name | ExtractDischargeClearancePatientEducation |
| Title | Discharge Clearance: Patient Education Extraction |
| Description | Turns the record of what the patient and their family were told into three survey Observations: the danger signs explained, who was briefed alongside the patient, and whether the take-home medicines were gone through. Communication would be the truer resource for a briefing, and this IG has no Communication profile and no map that creates one, so the briefing is recorded as an assertion that it happened rather than as the message itself. Name and relationship ride on one Observation as value and component, the way a blood pressure carries systolic and diastolic, rather than minting a RelatedPerson per discharge for a relative the record may already know. The follow-up arrangement rides as a note: the discharge note already raises a ServiceRequest for the follow-up it arranges, and a second request from here would leave one patient with two. |
No resources found
No resources found
Note: links and images are rebased to the (stated) source
Generated Narrative: StructureMap ExtractDischargeClearancePatientEducation
/// url = 'https://fhir.slade360.co.ke/fhir/StructureMap/ExtractDischargeClearancePatientEducation' /// name = 'ExtractDischargeClearancePatientEducation' /// title = 'Discharge Clearance: Patient Education Extraction' /// status = 'active' /// description = """Turns the record of what the patient and their family were told into three survey Observations: the danger signs explained, who was briefed alongside the patient, and whether the take-home medicines were gone through. Communication would be the truer resource for a briefing, and this IG has no Communication profile and no map that creates one, so the briefing is recorded as an assertion that it happened rather than as the message itself. Name and relationship ride on one Observation as value and component, the way a blood pressure carries systolic and diastolic, rather than minting a RelatedPerson per discharge for a relative the record may already know. The follow-up arrangement rides as a note: the discharge note already raises a ServiceRequest for the follow-up it arranges, and a second request from here would leave one patient with two.""" uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QR as source uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias Bundle as target uses "http://hl7.org/fhir/StructureDefinition/Observation" alias Observation as target group ExtractDischargeClearancePatientEducation(source qr : QR, target bundle : Bundle) { qr -> bundle.type = 'transaction' "setBundleType"; // linkId 369703222200 — "Danger signs explained". The substance of the // briefing, and the Observation the follow-up note hangs on. qr.item as it where ((linkId = '369703222200') and answer.value.exists()) then { it.answer first as a then { a -> bundle.entry as entry, entry.resource = create('Observation') as obs then { qr -> obs, entry then BuildClearanceObs(qr, obs, entry) "dangerSignsBase"; qr -> obs.code as dangerSignsCodeCc then { qr -> dangerSignsCodeCc.coding as dangerSignsCodeCoding then { qr -> dangerSignsCodeCoding.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/inpatient-clinical-concept-codesystem' "dangerSignsCodeSystem"; qr -> dangerSignsCodeCoding.code = 'danger-signs-explained' "dangerSignsCodeCode"; qr -> dangerSignsCodeCoding.display = 'Danger signs explained at discharge' "dangerSignsCodeDisplay"; } "dangerSignsCodeCodingRule"; } "dangerSignsCode"; a.value as v -> obs.value = v "dangerSignsValue"; // linkId 286776232661 — "Follow-up arrangement given" qr.item as itFollowUp where ((linkId = '286776232661') and answer.value.exists()) then { itFollowUp.answer first as aFollowUp then { aFollowUp.value as fv -> obs.note as note then { fv -> note.text = fv "followUpNoteText"; qr.authored as t -> note.time = t "followUpNoteTime"; } "followUpNote"; } "followUpAnswer"; } "followUpRule"; } "dangerSignsObs"; } "dangerSignsAnswer"; } "dangerSignsRule"; // linkId 526135349614 — "Next of kin briefed, name", with linkId 747571800699 // — "Relationship" — as its component. qr.item as it where ((linkId = '526135349614') and answer.value.exists()) then { it.answer first as a then { a -> bundle.entry as entry, entry.resource = create('Observation') as obs then { qr -> obs, entry then BuildClearanceObs(qr, obs, entry) "kinBase"; qr -> obs.code as kinCodeCc then { qr -> kinCodeCc.coding as kinCodeCoding then { qr -> kinCodeCoding.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/inpatient-clinical-concept-codesystem' "kinCodeSystem"; qr -> kinCodeCoding.code = 'next-of-kin-briefed' "kinCodeCode"; qr -> kinCodeCoding.display = 'Next of kin briefed at discharge' "kinCodeDisplay"; } "kinCodeCodingRule"; } "kinCode"; a.value as v -> obs.value = v "kinNameValue"; qr.item as itRelation where ((linkId = '747571800699') and answer.value.exists()) then { itRelation.answer first as aRelation -> obs.component as comp then { aRelation -> comp.code as relationCodeCc then { aRelation -> relationCodeCc.coding as relationCodeCoding then { aRelation -> relationCodeCoding.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/inpatient-clinical-concept-codesystem' "relationCodeSystem"; aRelation -> relationCodeCoding.code = 'relationship-to-patient' "relationCodeCode"; aRelation -> relationCodeCoding.display = 'Relationship to the patient' "relationCodeDisplay"; } "relationCodeCodingRule"; } "relationCode"; aRelation.value as cv -> comp.value = create('CodeableConcept') as concept then { cv -> concept.coding = cv "relationCoding"; cv.display as d -> concept.text = d "relationText"; } "relationValue"; } "relationComponent"; } "relationRule"; } "kinObs"; } "kinAnswer"; } "kinRule"; // linkId 331980677989 — "Take-home medicines explained" qr.item as it where ((linkId = '331980677989') and answer.value.exists()) then { it.answer first as a then { a -> bundle.entry as entry, entry.resource = create('Observation') as obs then { qr -> obs, entry then BuildClearanceObs(qr, obs, entry) "medicinesBase"; qr -> obs.code as medicinesCodeCc then { qr -> medicinesCodeCc.coding as medicinesCodeCoding then { qr -> medicinesCodeCoding.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/inpatient-clinical-concept-codesystem' "medicinesCodeSystem"; qr -> medicinesCodeCoding.code = 'medicines-explained-at-discharge' "medicinesCodeCode"; qr -> medicinesCodeCoding.display = 'Take-home medicines explained at discharge' "medicinesCodeDisplay"; } "medicinesCodeCodingRule"; } "medicinesCode"; a -> obs then SetCodedValue(a, obs) "medicinesValue"; } "medicinesObs"; } "medicinesAnswer"; } "medicinesRule"; } // ───────────────────────────────────────────────────────────────────────────── // Shared scaffolding. Repeated in each clearance map rather than imported: the // transform engine resolves `imports` against whatever StructureMaps happen to // be on the server, and a clearance that stops extracting because a shared map // was not uploaded is a worse failure than a duplicated group. // Source parameters are left untyped on purpose. Writing `: Element` makes the // publisher's StructureMap validator compare QuestionnaireResponse.item against // the literal 'Element' and report them as incompatible, which is noise. // ───────────────────────────────────────────────────────────────────────────── group BuildClearanceObs(source qr : QR, target obs : Observation, target entry) { qr -> obs.id = uuid() then SetObservationFullUrl(obs, entry) "idAndFullUrl"; qr -> entry.request as request then { qr -> request.method = 'POST' "requestMethod"; qr -> request.url = 'Observation' "requestUrl"; } "entryRequest"; qr -> obs.status = 'final' "status"; qr -> obs.category as categoryCc then { qr -> categoryCc.coding as categoryCoding then { qr -> categoryCoding.system = 'http://terminology.hl7.org/CodeSystem/observation-category' "categorySystem"; qr -> categoryCoding.code = 'survey' "categoryCode"; qr -> categoryCoding.display = 'Survey' "categoryDisplay"; } "categoryCodingRule"; } "category"; qr.subject as s -> obs.subject = s; qr.encounter as e -> obs.encounter = e; // `effective`, not `effectiveInstant`: the R5 transform engine writes choice // elements by their base name and rejects the typed form. // Advantage stamps `authored` when the clearances are submitted, not when each // was signed, so a clearance signed at two in the morning and submitted at the // handover carries the handover time. Sending the signature time on the // response would fix it at the source; there is nothing on the response for a // map to read it from. qr.authored as t -> obs.effective = t "effective"; qr.authored as t -> obs.issued = cast(t, 'instant') "issued"; // The facility, not the person who signed: SGHIObservation admits only an // Organization or a Patient as performer, and the form's signature is a typed // name that resolves to neither. qr.source as src -> obs.performer = create('Reference') as perf then { src.reference as ref -> perf.reference = ref "performerRef"; src.display as disp -> perf.display = disp "performerDisplay"; } "performer"; // One identifier per resource. Copying the response's own would give every // Observation from a single form the same business identity. qr -> obs.identifier as ident then { qr -> ident.use = 'official' "identifierUse"; qr -> ident.type as identifierTypeCc then { qr -> identifierTypeCc.coding as identifierTypeCoding then { qr -> identifierTypeCoding.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/default-identifier-codesystem' "identifierTypeSystem"; qr -> identifierTypeCoding.code = 'default-id' "identifierTypeCode"; qr -> identifierTypeCoding.display = 'Default Resource Identifier' "identifierTypeDisplay"; } "identifierTypeCodingRule"; } "identifierType"; qr -> ident.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/default-identifier-codesystem' "identifierSystem"; qr -> ident.value = uuid() "identifierValue"; qr.source as src -> ident.assigner = src "identifierAssigner"; } "identifier"; // No append: under this engine `qr.id` already resolves to the type-qualified // relative reference, so prefixing it again produces a reference to nothing. qr -> obs.derivedFrom = create('Reference') as ref then { qr.id as qid -> ref.reference = qid "derivedFromRef"; } "linkQuestionnaireResponse"; } group SetCodedValue(source a, target obs : Observation) { a.value as cv -> obs.value = create('CodeableConcept') as concept then { cv -> concept.coding = cv "valueCoding"; cv.display as d -> concept.text = d "valueText"; } "codedValue"; } group SetObservationFullUrl(source obs : Observation, target entry) { obs.id as id -> entry.fullUrl = append('https://fhir.slade360.co.ke/fhir/Observation/', id) "assignFullUrl"; }
{
"resourceType": "StructureMap",
"id": "ExtractDischargeClearancePatientEducation",
"text": {
"status": "generated",
"div": "<!-- snip (see above) -->"
},
"url": "https://fhir.slade360.co.ke/fhir/StructureMap/ExtractDischargeClearancePatientEducation",
"version": "0.1.0",
"name": "ExtractDischargeClearancePatientEducation",
"title": "Discharge Clearance: Patient Education Extraction",
"status": "active",
"date": "2026-09-11T12:18:36+00:00",
"publisher": "Kathurima Kimathi",
"contact": [
{
"name": "Kathurima Kimathi",
"telecom": [
{
"system": "url",
"value": "https://www.linkedin.com/in/kathurima-kimathi/"
},
{
"system": "email",
"value": "kathurimakimathi415@gmail.com"
}
]
},
{
"name": "Oscar John",
"telecom": [
{
"system": "email",
"value": "oscarjohnotieno@gmail.com",
"use": "work"
}
]
},
{
"name": "Kennedy Omondi",
"telecom": [
{
"system": "email",
"value": "kennankole@gmail.com",
"use": "work"
}
]
}
],
"description": "Turns the record of what the patient and their family were told into three survey Observations: the danger signs explained, who was briefed alongside the patient, and whether the take-home medicines were gone through. \nCommunication would be the truer resource for a briefing, and this IG has no Communication profile and no map that creates one, so the briefing is recorded as an assertion that it happened rather than as the message itself.\nName and relationship ride on one Observation as value and component, the way a blood pressure carries systolic and diastolic, rather than minting a RelatedPerson per discharge for a relative the record may already know. The follow-up arrangement rides as a note: the discharge note already raises a ServiceRequest for the follow-up it arranges, and a second request from here would leave one patient with two.",
"structure": [
{
"url": "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse",
"mode": "source",
"alias": "QR"
},
{
"url": "http://hl7.org/fhir/StructureDefinition/Bundle",
"mode": "target",
"alias": "Bundle"
},
{
"url": "http://hl7.org/fhir/StructureDefinition/Observation",
"mode": "target",
"alias": "Observation"
}
],
"group": [
{
"name": "ExtractDischargeClearancePatientEducation",
"input": [
{
"name": "qr",
"type": "QR",
"mode": "source"
},
{
"name": "bundle",
"type": "Bundle",
"mode": "target"
}
],
"rule": [
{
"name": "setBundleType",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "bundle",
"element": "type",
"transform": "copy",
"parameter": [
{
"valueString": "transaction"
}
]
}
]
},
{
"name": "dangerSignsRule",
"source": [
{
"context": "qr",
"element": "item",
"variable": "it",
"condition": "(linkId = '369703222200') and answer.value.exists()"
}
],
"rule": [
{
"name": "dangerSignsAnswer",
"source": [
{
"context": "it",
"element": "answer",
"listMode": "first",
"variable": "a"
}
],
"rule": [
{
"name": "dangerSignsObs",
"source": [
{
"context": "a"
}
],
"target": [
{
"context": "bundle",
"element": "entry",
"variable": "entry"
},
{
"context": "entry",
"element": "resource",
"variable": "obs",
"transform": "create",
"parameter": [
{
"valueString": "Observation"
}
]
}
],
"rule": [
{
"name": "dangerSignsBase",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "obs"
},
{
"context": "entry"
}
],
"dependent": [
{
"name": "BuildClearanceObs",
"parameter": [
{
"valueId": "qr"
},
{
"valueId": "obs"
},
{
"valueId": "entry"
}
]
}
]
},
{
"name": "dangerSignsCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "obs",
"element": "code",
"variable": "dangerSignsCodeCc"
}
],
"rule": [
{
"name": "dangerSignsCodeCodingRule",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "dangerSignsCodeCc",
"element": "coding",
"variable": "dangerSignsCodeCoding"
}
],
"rule": [
{
"name": "dangerSignsCodeSystem",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "dangerSignsCodeCoding",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/inpatient-clinical-concept-codesystem"
}
]
}
]
},
{
"name": "dangerSignsCodeCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "dangerSignsCodeCoding",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "danger-signs-explained"
}
]
}
]
},
{
"name": "dangerSignsCodeDisplay",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "dangerSignsCodeCoding",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "Danger signs explained at discharge"
}
]
}
]
}
]
}
]
},
{
"name": "dangerSignsValue",
"source": [
{
"context": "a",
"element": "value",
"variable": "v"
}
],
"target": [
{
"context": "obs",
"element": "value",
"transform": "copy",
"parameter": [
{
"valueId": "v"
}
]
}
]
},
{
"name": "followUpRule",
"source": [
{
"context": "qr",
"element": "item",
"variable": "itFollowUp",
"condition": "(linkId = '286776232661') and answer.value.exists()"
}
],
"rule": [
{
"name": "followUpAnswer",
"source": [
{
"context": "itFollowUp",
"element": "answer",
"listMode": "first",
"variable": "aFollowUp"
}
],
"rule": [
{
"name": "followUpNote",
"source": [
{
"context": "aFollowUp",
"element": "value",
"variable": "fv"
}
],
"target": [
{
"context": "obs",
"element": "note",
"variable": "note"
}
],
"rule": [
{
"name": "followUpNoteText",
"source": [
{
"context": "fv"
}
],
"target": [
{
"context": "note",
"element": "text",
"transform": "copy",
"parameter": [
{
"valueId": "fv"
}
]
}
]
},
{
"name": "followUpNoteTime",
"source": [
{
"context": "qr",
"element": "authored",
"variable": "t"
}
],
"target": [
{
"context": "note",
"element": "time",
"transform": "copy",
"parameter": [
{
"valueId": "t"
}
]
}
]
}
]
}
]
}
],
"documentation": "linkId 286776232661 — \"Follow-up arrangement given\""
}
]
}
]
}
],
"documentation": "linkId 369703222200 — \"Danger signs explained\". The substance of the\r\nbriefing, and the Observation the follow-up note hangs on."
},
{
"name": "kinRule",
"source": [
{
"context": "qr",
"element": "item",
"variable": "it",
"condition": "(linkId = '526135349614') and answer.value.exists()"
}
],
"rule": [
{
"name": "kinAnswer",
"source": [
{
"context": "it",
"element": "answer",
"listMode": "first",
"variable": "a"
}
],
"rule": [
{
"name": "kinObs",
"source": [
{
"context": "a"
}
],
"target": [
{
"context": "bundle",
"element": "entry",
"variable": "entry"
},
{
"context": "entry",
"element": "resource",
"variable": "obs",
"transform": "create",
"parameter": [
{
"valueString": "Observation"
}
]
}
],
"rule": [
{
"name": "kinBase",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "obs"
},
{
"context": "entry"
}
],
"dependent": [
{
"name": "BuildClearanceObs",
"parameter": [
{
"valueId": "qr"
},
{
"valueId": "obs"
},
{
"valueId": "entry"
}
]
}
]
},
{
"name": "kinCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "obs",
"element": "code",
"variable": "kinCodeCc"
}
],
"rule": [
{
"name": "kinCodeCodingRule",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "kinCodeCc",
"element": "coding",
"variable": "kinCodeCoding"
}
],
"rule": [
{
"name": "kinCodeSystem",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "kinCodeCoding",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/inpatient-clinical-concept-codesystem"
}
]
}
]
},
{
"name": "kinCodeCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "kinCodeCoding",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "next-of-kin-briefed"
}
]
}
]
},
{
"name": "kinCodeDisplay",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "kinCodeCoding",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "Next of kin briefed at discharge"
}
]
}
]
}
]
}
]
},
{
"name": "kinNameValue",
"source": [
{
"context": "a",
"element": "value",
"variable": "v"
}
],
"target": [
{
"context": "obs",
"element": "value",
"transform": "copy",
"parameter": [
{
"valueId": "v"
}
]
}
]
},
{
"name": "relationRule",
"source": [
{
"context": "qr",
"element": "item",
"variable": "itRelation",
"condition": "(linkId = '747571800699') and answer.value.exists()"
}
],
"rule": [
{
"name": "relationComponent",
"source": [
{
"context": "itRelation",
"element": "answer",
"listMode": "first",
"variable": "aRelation"
}
],
"target": [
{
"context": "obs",
"element": "component",
"variable": "comp"
}
],
"rule": [
{
"name": "relationCode",
"source": [
{
"context": "aRelation"
}
],
"target": [
{
"context": "comp",
"element": "code",
"variable": "relationCodeCc"
}
],
"rule": [
{
"name": "relationCodeCodingRule",
"source": [
{
"context": "aRelation"
}
],
"target": [
{
"context": "relationCodeCc",
"element": "coding",
"variable": "relationCodeCoding"
}
],
"rule": [
{
"name": "relationCodeSystem",
"source": [
{
"context": "aRelation"
}
],
"target": [
{
"context": "relationCodeCoding",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/inpatient-clinical-concept-codesystem"
}
]
}
]
},
{
"name": "relationCodeCode",
"source": [
{
"context": "aRelation"
}
],
"target": [
{
"context": "relationCodeCoding",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "relationship-to-patient"
}
]
}
]
},
{
"name": "relationCodeDisplay",
"source": [
{
"context": "aRelation"
}
],
"target": [
{
"context": "relationCodeCoding",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "Relationship to the patient"
}
]
}
]
}
]
}
]
},
{
"name": "relationValue",
"source": [
{
"context": "aRelation",
"element": "value",
"variable": "cv"
}
],
"target": [
{
"context": "comp",
"element": "value",
"variable": "concept",
"transform": "create",
"parameter": [
{
"valueString": "CodeableConcept"
}
]
}
],
"rule": [
{
"name": "relationCoding",
"source": [
{
"context": "cv"
}
],
"target": [
{
"context": "concept",
"element": "coding",
"transform": "copy",
"parameter": [
{
"valueId": "cv"
}
]
}
]
},
{
"name": "relationText",
"source": [
{
"context": "cv",
"element": "display",
"variable": "d"
}
],
"target": [
{
"context": "concept",
"element": "text",
"transform": "copy",
"parameter": [
{
"valueId": "d"
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
],
"documentation": "linkId 526135349614 — \"Next of kin briefed, name\", with linkId 747571800699\r\n— \"Relationship\" — as its component."
},
{
"name": "medicinesRule",
"source": [
{
"context": "qr",
"element": "item",
"variable": "it",
"condition": "(linkId = '331980677989') and answer.value.exists()"
}
],
"rule": [
{
"name": "medicinesAnswer",
"source": [
{
"context": "it",
"element": "answer",
"listMode": "first",
"variable": "a"
}
],
"rule": [
{
"name": "medicinesObs",
"source": [
{
"context": "a"
}
],
"target": [
{
"context": "bundle",
"element": "entry",
"variable": "entry"
},
{
"context": "entry",
"element": "resource",
"variable": "obs",
"transform": "create",
"parameter": [
{
"valueString": "Observation"
}
]
}
],
"rule": [
{
"name": "medicinesBase",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "obs"
},
{
"context": "entry"
}
],
"dependent": [
{
"name": "BuildClearanceObs",
"parameter": [
{
"valueId": "qr"
},
{
"valueId": "obs"
},
{
"valueId": "entry"
}
]
}
]
},
{
"name": "medicinesCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "obs",
"element": "code",
"variable": "medicinesCodeCc"
}
],
"rule": [
{
"name": "medicinesCodeCodingRule",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "medicinesCodeCc",
"element": "coding",
"variable": "medicinesCodeCoding"
}
],
"rule": [
{
"name": "medicinesCodeSystem",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "medicinesCodeCoding",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/inpatient-clinical-concept-codesystem"
}
]
}
]
},
{
"name": "medicinesCodeCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "medicinesCodeCoding",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "medicines-explained-at-discharge"
}
]
}
]
},
{
"name": "medicinesCodeDisplay",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "medicinesCodeCoding",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "Take-home medicines explained at discharge"
}
]
}
]
}
]
}
]
},
{
"name": "medicinesValue",
"source": [
{
"context": "a"
}
],
"target": [
{
"context": "obs"
}
],
"dependent": [
{
"name": "SetCodedValue",
"parameter": [
{
"valueId": "a"
},
{
"valueId": "obs"
}
]
}
]
}
]
}
]
}
],
"documentation": "linkId 331980677989 — \"Take-home medicines explained\""
}
]
},
{
"name": "BuildClearanceObs",
"documentation": "─────────────────────────────────────────────────────────────────────────────\r\nShared scaffolding. Repeated in each clearance map rather than imported: the\r\ntransform engine resolves `imports` against whatever StructureMaps happen to\r\nbe on the server, and a clearance that stops extracting because a shared map\r\nwas not uploaded is a worse failure than a duplicated group.\r\nSource parameters are left untyped on purpose. Writing `: Element` makes the\r\npublisher's StructureMap validator compare QuestionnaireResponse.item against\r\nthe literal 'Element' and report them as incompatible, which is noise.\r\n─────────────────────────────────────────────────────────────────────────────",
"input": [
{
"name": "qr",
"type": "QR",
"mode": "source"
},
{
"name": "obs",
"type": "Observation",
"mode": "target"
},
{
"name": "entry",
"mode": "target"
}
],
"rule": [
{
"name": "idAndFullUrl",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "obs",
"element": "id",
"transform": "uuid"
}
],
"dependent": [
{
"name": "SetObservationFullUrl",
"parameter": [
{
"valueId": "obs"
},
{
"valueId": "entry"
}
]
}
]
},
{
"name": "entryRequest",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "entry",
"element": "request",
"variable": "request"
}
],
"rule": [
{
"name": "requestMethod",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "request",
"element": "method",
"transform": "copy",
"parameter": [
{
"valueString": "POST"
}
]
}
]
},
{
"name": "requestUrl",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "request",
"element": "url",
"transform": "copy",
"parameter": [
{
"valueString": "Observation"
}
]
}
]
}
]
},
{
"name": "status",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "obs",
"element": "status",
"transform": "copy",
"parameter": [
{
"valueString": "final"
}
]
}
]
},
{
"name": "category",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "obs",
"element": "category",
"variable": "categoryCc"
}
],
"rule": [
{
"name": "categoryCodingRule",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "categoryCc",
"element": "coding",
"variable": "categoryCoding"
}
],
"rule": [
{
"name": "categorySystem",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "categoryCoding",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "http://terminology.hl7.org/CodeSystem/observation-category"
}
]
}
]
},
{
"name": "categoryCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "categoryCoding",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "survey"
}
]
}
]
},
{
"name": "categoryDisplay",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "categoryCoding",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "Survey"
}
]
}
]
}
]
}
]
},
{
"name": "subject",
"source": [
{
"context": "qr",
"element": "subject",
"variable": "s"
}
],
"target": [
{
"context": "obs",
"element": "subject",
"transform": "copy",
"parameter": [
{
"valueId": "s"
}
]
}
]
},
{
"name": "encounter",
"source": [
{
"context": "qr",
"element": "encounter",
"variable": "e"
}
],
"target": [
{
"context": "obs",
"element": "encounter",
"transform": "copy",
"parameter": [
{
"valueId": "e"
}
]
}
]
},
{
"name": "effective",
"source": [
{
"context": "qr",
"element": "authored",
"variable": "t"
}
],
"target": [
{
"context": "obs",
"element": "effective",
"transform": "copy",
"parameter": [
{
"valueId": "t"
}
]
}
],
"documentation": "`effective`, not `effectiveInstant`: the R5 transform engine writes choice\r\nelements by their base name and rejects the typed form.\r\nAdvantage stamps `authored` when the clearances are submitted, not when each\r\nwas signed, so a clearance signed at two in the morning and submitted at the\r\nhandover carries the handover time. Sending the signature time on the\r\nresponse would fix it at the source; there is nothing on the response for a\r\nmap to read it from."
},
{
"name": "issued",
"source": [
{
"context": "qr",
"element": "authored",
"variable": "t"
}
],
"target": [
{
"context": "obs",
"element": "issued",
"transform": "cast",
"parameter": [
{
"valueId": "t"
},
{
"valueString": "instant"
}
]
}
]
},
{
"name": "performer",
"source": [
{
"context": "qr",
"element": "source",
"variable": "src"
}
],
"target": [
{
"context": "obs",
"element": "performer",
"variable": "perf",
"transform": "create",
"parameter": [
{
"valueString": "Reference"
}
]
}
],
"rule": [
{
"name": "performerRef",
"source": [
{
"context": "src",
"element": "reference",
"variable": "ref"
}
],
"target": [
{
"context": "perf",
"element": "reference",
"transform": "copy",
"parameter": [
{
"valueId": "ref"
}
]
}
]
},
{
"name": "performerDisplay",
"source": [
{
"context": "src",
"element": "display",
"variable": "disp"
}
],
"target": [
{
"context": "perf",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueId": "disp"
}
]
}
]
}
],
"documentation": "The facility, not the person who signed: SGHIObservation admits only an\r\nOrganization or a Patient as performer, and the form's signature is a typed\r\nname that resolves to neither."
},
{
"name": "identifier",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "obs",
"element": "identifier",
"variable": "ident"
}
],
"rule": [
{
"name": "identifierUse",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "ident",
"element": "use",
"transform": "copy",
"parameter": [
{
"valueString": "official"
}
]
}
]
},
{
"name": "identifierType",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "ident",
"element": "type",
"variable": "identifierTypeCc"
}
],
"rule": [
{
"name": "identifierTypeCodingRule",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "identifierTypeCc",
"element": "coding",
"variable": "identifierTypeCoding"
}
],
"rule": [
{
"name": "identifierTypeSystem",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "identifierTypeCoding",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/default-identifier-codesystem"
}
]
}
]
},
{
"name": "identifierTypeCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "identifierTypeCoding",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "default-id"
}
]
}
]
},
{
"name": "identifierTypeDisplay",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "identifierTypeCoding",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "Default Resource Identifier"
}
]
}
]
}
]
}
]
},
{
"name": "identifierSystem",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "ident",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/default-identifier-codesystem"
}
]
}
]
},
{
"name": "identifierValue",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "ident",
"element": "value",
"transform": "uuid"
}
]
},
{
"name": "identifierAssigner",
"source": [
{
"context": "qr",
"element": "source",
"variable": "src"
}
],
"target": [
{
"context": "ident",
"element": "assigner",
"transform": "copy",
"parameter": [
{
"valueId": "src"
}
]
}
]
}
],
"documentation": "One identifier per resource. Copying the response's own would give every\r\nObservation from a single form the same business identity."
},
{
"name": "linkQuestionnaireResponse",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "obs",
"element": "derivedFrom",
"variable": "ref",
"transform": "create",
"parameter": [
{
"valueString": "Reference"
}
]
}
],
"rule": [
{
"name": "derivedFromRef",
"source": [
{
"context": "qr",
"element": "id",
"variable": "qid"
}
],
"target": [
{
"context": "ref",
"element": "reference",
"transform": "copy",
"parameter": [
{
"valueId": "qid"
}
]
}
]
}
],
"documentation": "No append: under this engine `qr.id` already resolves to the type-qualified\r\nrelative reference, so prefixing it again produces a reference to nothing."
}
]
},
{
"name": "SetCodedValue",
"input": [
{
"name": "a",
"mode": "source"
},
{
"name": "obs",
"type": "Observation",
"mode": "target"
}
],
"rule": [
{
"name": "codedValue",
"source": [
{
"context": "a",
"element": "value",
"variable": "cv"
}
],
"target": [
{
"context": "obs",
"element": "value",
"variable": "concept",
"transform": "create",
"parameter": [
{
"valueString": "CodeableConcept"
}
]
}
],
"rule": [
{
"name": "valueCoding",
"source": [
{
"context": "cv"
}
],
"target": [
{
"context": "concept",
"element": "coding",
"transform": "copy",
"parameter": [
{
"valueId": "cv"
}
]
}
]
},
{
"name": "valueText",
"source": [
{
"context": "cv",
"element": "display",
"variable": "d"
}
],
"target": [
{
"context": "concept",
"element": "text",
"transform": "copy",
"parameter": [
{
"valueId": "d"
}
]
}
]
}
]
}
]
},
{
"name": "SetObservationFullUrl",
"input": [
{
"name": "obs",
"type": "Observation",
"mode": "source"
},
{
"name": "entry",
"mode": "target"
}
],
"rule": [
{
"name": "assignFullUrl",
"source": [
{
"context": "obs",
"element": "id",
"variable": "id"
}
],
"target": [
{
"context": "entry",
"element": "fullUrl",
"transform": "append",
"parameter": [
{
"valueString": "https://fhir.slade360.co.ke/fhir/Observation/"
},
{
"valueId": "id"
}
]
}
]
}
]
}
]
}