FHIR IG analytics| Package | silfhirprofileig |
| Resource Type | StructureMap |
| Id | StructureMap-ExtractInpatientSurgicalPreoperativeAssessment.json |
| FHIR Version | R5 |
| Source | https://build.fhir.org/ig/savannahghi/sil_fhir_profile_ig/StructureMap-ExtractInpatientSurgicalPreoperativeAssessment.html |
| URL | https://fhir.slade360.co.ke/fhir/StructureMap/ExtractInpatientSurgicalPreoperativeAssessment |
| Version | 0.1.0 |
| Status | active |
| Date | 2026-09-11T12:18:36+00:00 |
| Name | ExtractInpatientSurgicalPreoperativeAssessment |
| Title | Inpatient Surgical Pre-operative Assessment Extraction |
| Description | The planned procedure becomes a ServiceRequest, the ASA grade and the last oral intake become Observations, and the clinician who took consent becomes a Consent verified by them. The procedure carries the surgeon's wording rather than a procedure code -- the form is free text and matching prose to a code system would guess at what is being operated on. Consent.decision is `permit` because the form only exists once consent has been obtained; a refusal is not something this assessment records. |
No resources found
No resources found
Note: links and images are rebased to the (stated) source
Generated Narrative: StructureMap ExtractInpatientSurgicalPreoperativeAssessment
/// url = 'https://fhir.slade360.co.ke/fhir/StructureMap/ExtractInpatientSurgicalPreoperativeAssessment' /// name = 'ExtractInpatientSurgicalPreoperativeAssessment' /// title = 'Inpatient Surgical Pre-operative Assessment Extraction' /// status = 'active' /// description = 'The planned procedure becomes a ServiceRequest, the ASA grade and the last oral intake become Observations, and the clinician who took consent becomes a Consent verified by them. The procedure carries the surgeon\'s wording rather than a procedure code -- the form is free text and matching prose to a code system would guess at what is being operated on. Consent.decision is `permit` because the form only exists once consent has been obtained; a refusal is not something this assessment records.' 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 uses "http://hl7.org/fhir/StructureDefinition/ServiceRequest" alias ServiceRequest as target uses "http://hl7.org/fhir/StructureDefinition/Consent" alias Consent as target group ExtractInpatientSurgicalPreoperativeAssessment(source qr : QR, target bundle : Bundle) { qr -> bundle.type = 'transaction' "setBundleType"; // ── Planned procedure ────────────────────────────────────────────────────── qr.item as itP where ((linkId = 'procedure') and answer.value.exists()) then { itP.answer first as aP then { aP -> bundle.entry as entryP, entryP.resource = create('ServiceRequest') as sr then { qr -> sr.id = uuid() then SetServiceRequestFullUrl(sr, entryP) "idAndFullUrl"; qr -> entryP.request as request then { qr -> request.method = 'POST' "requestMethod"; qr -> request.url = 'ServiceRequest' "requestUrl"; } "entryRequest"; qr -> sr.status = 'active' "status"; qr -> sr.intent = 'plan' "intent"; qr -> sr.priority = 'routine' "priority"; // R5 ServiceRequest.code is a CodeableReference, so the concept sits one // level down. aP.value as v -> sr.code as codeRef then { aP -> codeRef.concept as concept then { aP -> concept.coding as coding then { aP -> coding.system = 'https://fhir.slade360.co.ke/fhir/CodeSystem/inpatient-clinical-concept-codesystem' "codeSystem"; aP -> coding.code = 'planned-procedure' "codeCode"; aP -> coding.display = 'Planned procedure' "codeDisplay"; } "codeCoding"; v -> concept.text = v "codeText"; } "codeConcept"; } "serviceRequestCode"; qr.subject as s -> sr.subject = s; qr.encounter as e -> sr.encounter = e; qr.authored as t -> sr.authoredOn = t "authoredOn"; qr.author as a -> sr.requester = a "requesterFromAuthor"; qr where (author.exists().not()) then { qr.source as src -> sr.requester = src "requesterFromSource"; } "requesterFallback"; qr -> sr.supportingInfo as si then { qr -> si.reference = create('Reference') as ref then { qr.id as qid -> ref.reference = qid "supportingInfoRef"; } "supportingInfoTarget"; } "linkQuestionnaireResponse"; } "serviceRequest"; } "procedureAnswer"; } "procedureRule"; // ── ASA grade ────────────────────────────────────────────────────────────── qr.item as itA where ((linkId = 'asa') and answer.value.exists()) then { itA.answer first as aA then { aA -> bundle.entry as entryA, entryA.resource = create('Observation') as obsA then { qr -> obsA, entryA then BuildObsBase(qr, obsA, entryA) "asaBase"; qr -> obsA then SetSurveyCategory(qr, obsA) "asaCategory"; qr -> obsA.code as code then { qr -> code.coding as coding then { qr -> coding.system = 'http://loinc.org' "codeSystem"; qr -> coding.code = '97816-3' "codeCode"; qr -> coding.display = 'American society of anesthesiologists morbidity state' "codeDisplay"; } "codeCoding"; } "asaCode"; aA -> obsA then SetCodedValue(aA, obsA) "asaValue"; } "asaObservation"; } "asaAnswer"; } "asaRule"; // ── Last oral intake ─────────────────────────────────────────────────────── // Reported by the patient rather than measured, hence `social-history`. The // answer is a dateTime and goes through as one: LOINC 67517-3 is defined as a // date and time, so no Quantity is involved. qr.item as itN where ((linkId = 'nbm') and answer.value.exists()) then { itN.answer first as aN then { aN -> bundle.entry as entryN, entryN.resource = create('Observation') as obsN then { qr -> obsN, entryN then BuildObsBase(qr, obsN, entryN) "nbmBase"; qr -> obsN then SetSocialHistoryCategory(qr, obsN) "nbmCategory"; qr -> obsN.code as code then { qr -> code.coding as coding then { qr -> coding.system = 'http://loinc.org' "codeSystem"; qr -> coding.code = '67517-3' "codeCode"; qr -> coding.display = 'Last oral intake [Date and time]' "codeDisplay"; } "codeCoding"; } "nbmCode"; aN.value as v -> obsN.value = v "nbmValue"; } "nbmObservation"; } "nbmAnswer"; } "nbmRule"; // ── Consent ──────────────────────────────────────────────────────────────── // The person named on the form is the person who took the consent, which is // verification.verifiedBy: the patient is the grantor, and the clinician // attests that the conversation happened. qr.item as itC where ((linkId = 'consentBy') and answer.value.exists()) then { itC.answer first as aC then { aC -> bundle.entry as entryC, entryC.resource = create('Consent') as consent then { qr -> consent.id = uuid() then SetConsentFullUrl(consent, entryC) "idAndFullUrl"; qr -> entryC.request as request then { qr -> request.method = 'POST' "requestMethod"; qr -> request.url = 'Consent' "requestUrl"; } "entryRequest"; qr -> consent.status = 'active' "status"; qr -> consent.category as cat then { qr -> cat.coding as coding then { qr -> coding.system = 'http://loinc.org' "categorySystem"; qr -> coding.code = '59284-0' "categoryCode"; qr -> coding.display = 'Consent Document' "categoryDisplay"; } "categoryCoding"; qr -> cat.text = 'Consent for the planned procedure' "categoryText"; } "category"; qr.subject as s -> consent.subject = s; // Consent.date is a `date`, not a dateTime, so the day is taken off the // front of the authored timestamp rather than assigned whole. qr -> consent.date = evaluate(qr, authored.toString().substring(0, 10)) "date"; qr.subject as s -> consent.grantor = s "grantor"; qr -> consent.decision = 'permit' "decision"; aC.value as cv -> consent.verification as ver then { aC -> ver.verified = true "verified"; cv -> ver.verifiedBy = cv "verifiedBy"; qr.authored as t -> ver.verificationDate = t "verificationDate"; } "verification"; qr -> consent.sourceReference = create('Reference') as ref then { qr.id as qid -> ref.reference = qid "sourceReferenceRef"; } "linkQuestionnaireResponse"; } "consent"; } "consentByAnswer"; } "consentRule"; } // ───────────────────────────────────────────────────────────────────────────── // Shared scaffolding. Repeated in each map rather than imported: the transform // engine resolves `imports` against whatever StructureMaps happen to be on the // server, and a form that stops extracting because a shared map was not // uploaded is a worse failure than a duplicated group. // ───────────────────────────────────────────────────────────────────────────── // Two notes on what the publisher's StructureMap validator says about this file. // Source parameters below are left untyped on purpose. Writing `: Element` makes // the validator compare QuestionnaireResponse.item against the literal 'Element' // and report them as incompatible with each other, which is noise, not a finding. // Untyped, it says only that it cannot check the paths. // `evaluate(context, expression)` is flagged as "takes 1 parameter but 2 were // found". Leave it. The FML parser in the same jar refuses the one-argument form // outright -- it wants a parameter, a comma, then the FHIRPath -- so the publisher // is objecting to what its own compiler emits. Two arguments is the only form that // compiles, and it is what the R5 transform engine executes. group BuildObsBase(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.subject as s -> obs.subject = s; qr.encounter as e -> obs.encounter = e; qr.authored as t -> obs.effective = t "effective"; qr.source as src -> obs.performer = src "performerFromSource"; qr where (source.exists().not()) then { qr.author as a -> obs.performer = a "performerFromAuthor"; } "performerFallback"; 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 cc then { cv -> cc.coding = cv "valueCoding"; cv.display as d -> cc.text = d "valueText"; } "codedValue"; } group SetSurveyCategory(source qr : QR, target obs : Observation) { qr -> obs.category as cat then { qr -> cat.coding as coding then { qr -> coding.system = 'http://terminology.hl7.org/CodeSystem/observation-category' "categorySystem"; qr -> coding.code = 'survey' "categoryCode"; qr -> coding.display = 'Survey' "categoryDisplay"; } "categoryCoding"; } "category"; } group SetSocialHistoryCategory(source qr : QR, target obs : Observation) { qr -> obs.category as cat then { qr -> cat.coding as coding then { qr -> coding.system = 'http://terminology.hl7.org/CodeSystem/observation-category' "categorySystem"; qr -> coding.code = 'social-history' "categoryCode"; qr -> coding.display = 'Social History' "categoryDisplay"; } "categoryCoding"; } "category"; } group SetObservationFullUrl(source obs : Observation, target entry) { obs.id as id -> entry.fullUrl = append('https://fhir.slade360.co.ke/fhir/Observation/', id) "assignFullUrl"; } group SetServiceRequestFullUrl(source sr : ServiceRequest, target entry) { sr.id as id -> entry.fullUrl = append('https://fhir.slade360.co.ke/fhir/ServiceRequest/', id) "assignFullUrl"; } group SetConsentFullUrl(source consent : Consent, target entry) { consent.id as id -> entry.fullUrl = append('https://fhir.slade360.co.ke/fhir/Consent/', id) "assignFullUrl"; }
{
"resourceType": "StructureMap",
"id": "ExtractInpatientSurgicalPreoperativeAssessment",
"text": {
"status": "generated",
"div": "<!-- snip (see above) -->"
},
"url": "https://fhir.slade360.co.ke/fhir/StructureMap/ExtractInpatientSurgicalPreoperativeAssessment",
"version": "0.1.0",
"name": "ExtractInpatientSurgicalPreoperativeAssessment",
"title": "Inpatient Surgical Pre-operative Assessment 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": "The planned procedure becomes a ServiceRequest, the ASA grade and the last oral intake become Observations, and the clinician who took consent becomes a Consent verified by them. The procedure carries the surgeon's wording rather than a procedure code -- the form is free text and matching prose to a code system would guess at what is being operated on. Consent.decision is `permit` because the form only exists once consent has been obtained; a refusal is not something this assessment records.",
"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"
},
{
"url": "http://hl7.org/fhir/StructureDefinition/ServiceRequest",
"mode": "target",
"alias": "ServiceRequest"
},
{
"url": "http://hl7.org/fhir/StructureDefinition/Consent",
"mode": "target",
"alias": "Consent"
}
],
"group": [
{
"name": "ExtractInpatientSurgicalPreoperativeAssessment",
"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": "procedureRule",
"source": [
{
"context": "qr",
"element": "item",
"variable": "itP",
"condition": "(linkId = 'procedure') and answer.value.exists()"
}
],
"rule": [
{
"name": "procedureAnswer",
"source": [
{
"context": "itP",
"element": "answer",
"listMode": "first",
"variable": "aP"
}
],
"rule": [
{
"name": "serviceRequest",
"source": [
{
"context": "aP"
}
],
"target": [
{
"context": "bundle",
"element": "entry",
"variable": "entryP"
},
{
"context": "entryP",
"element": "resource",
"variable": "sr",
"transform": "create",
"parameter": [
{
"valueString": "ServiceRequest"
}
]
}
],
"rule": [
{
"name": "idAndFullUrl",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "sr",
"element": "id",
"transform": "uuid"
}
],
"dependent": [
{
"name": "SetServiceRequestFullUrl",
"parameter": [
{
"valueId": "sr"
},
{
"valueId": "entryP"
}
]
}
]
},
{
"name": "entryRequest",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "entryP",
"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": "ServiceRequest"
}
]
}
]
}
]
},
{
"name": "status",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "sr",
"element": "status",
"transform": "copy",
"parameter": [
{
"valueString": "active"
}
]
}
]
},
{
"name": "intent",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "sr",
"element": "intent",
"transform": "copy",
"parameter": [
{
"valueString": "plan"
}
]
}
]
},
{
"name": "priority",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "sr",
"element": "priority",
"transform": "copy",
"parameter": [
{
"valueString": "routine"
}
]
}
]
},
{
"name": "serviceRequestCode",
"source": [
{
"context": "aP",
"element": "value",
"variable": "v"
}
],
"target": [
{
"context": "sr",
"element": "code",
"variable": "codeRef"
}
],
"rule": [
{
"name": "codeConcept",
"source": [
{
"context": "aP"
}
],
"target": [
{
"context": "codeRef",
"element": "concept",
"variable": "concept"
}
],
"rule": [
{
"name": "codeCoding",
"source": [
{
"context": "aP"
}
],
"target": [
{
"context": "concept",
"element": "coding",
"variable": "coding"
}
],
"rule": [
{
"name": "codeSystem",
"source": [
{
"context": "aP"
}
],
"target": [
{
"context": "coding",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "https://fhir.slade360.co.ke/fhir/CodeSystem/inpatient-clinical-concept-codesystem"
}
]
}
]
},
{
"name": "codeCode",
"source": [
{
"context": "aP"
}
],
"target": [
{
"context": "coding",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "planned-procedure"
}
]
}
]
},
{
"name": "codeDisplay",
"source": [
{
"context": "aP"
}
],
"target": [
{
"context": "coding",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "Planned procedure"
}
]
}
]
}
]
},
{
"name": "codeText",
"source": [
{
"context": "v"
}
],
"target": [
{
"context": "concept",
"element": "text",
"transform": "copy",
"parameter": [
{
"valueId": "v"
}
]
}
]
}
]
}
],
"documentation": "R5 ServiceRequest.code is a CodeableReference, so the concept sits one\r\nlevel down."
},
{
"name": "subject",
"source": [
{
"context": "qr",
"element": "subject",
"variable": "s"
}
],
"target": [
{
"context": "sr",
"element": "subject",
"transform": "copy",
"parameter": [
{
"valueId": "s"
}
]
}
]
},
{
"name": "encounter",
"source": [
{
"context": "qr",
"element": "encounter",
"variable": "e"
}
],
"target": [
{
"context": "sr",
"element": "encounter",
"transform": "copy",
"parameter": [
{
"valueId": "e"
}
]
}
]
},
{
"name": "authoredOn",
"source": [
{
"context": "qr",
"element": "authored",
"variable": "t"
}
],
"target": [
{
"context": "sr",
"element": "authoredOn",
"transform": "copy",
"parameter": [
{
"valueId": "t"
}
]
}
]
},
{
"name": "requesterFromAuthor",
"source": [
{
"context": "qr",
"element": "author",
"variable": "a"
}
],
"target": [
{
"context": "sr",
"element": "requester",
"transform": "copy",
"parameter": [
{
"valueId": "a"
}
]
}
]
},
{
"name": "requesterFallback",
"source": [
{
"context": "qr",
"condition": "author.exists().not()"
}
],
"rule": [
{
"name": "requesterFromSource",
"source": [
{
"context": "qr",
"element": "source",
"variable": "src"
}
],
"target": [
{
"context": "sr",
"element": "requester",
"transform": "copy",
"parameter": [
{
"valueId": "src"
}
]
}
]
}
]
},
{
"name": "linkQuestionnaireResponse",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "sr",
"element": "supportingInfo",
"variable": "si"
}
],
"rule": [
{
"name": "supportingInfoTarget",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "si",
"element": "reference",
"variable": "ref",
"transform": "create",
"parameter": [
{
"valueString": "Reference"
}
]
}
],
"rule": [
{
"name": "supportingInfoRef",
"source": [
{
"context": "qr",
"element": "id",
"variable": "qid"
}
],
"target": [
{
"context": "ref",
"element": "reference",
"transform": "copy",
"parameter": [
{
"valueId": "qid"
}
]
}
]
}
]
}
]
}
]
}
]
}
],
"documentation": "── Planned procedure ──────────────────────────────────────────────────────"
},
{
"name": "asaRule",
"source": [
{
"context": "qr",
"element": "item",
"variable": "itA",
"condition": "(linkId = 'asa') and answer.value.exists()"
}
],
"rule": [
{
"name": "asaAnswer",
"source": [
{
"context": "itA",
"element": "answer",
"listMode": "first",
"variable": "aA"
}
],
"rule": [
{
"name": "asaObservation",
"source": [
{
"context": "aA"
}
],
"target": [
{
"context": "bundle",
"element": "entry",
"variable": "entryA"
},
{
"context": "entryA",
"element": "resource",
"variable": "obsA",
"transform": "create",
"parameter": [
{
"valueString": "Observation"
}
]
}
],
"rule": [
{
"name": "asaBase",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "obsA"
},
{
"context": "entryA"
}
],
"dependent": [
{
"name": "BuildObsBase",
"parameter": [
{
"valueId": "qr"
},
{
"valueId": "obsA"
},
{
"valueId": "entryA"
}
]
}
]
},
{
"name": "asaCategory",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "obsA"
}
],
"dependent": [
{
"name": "SetSurveyCategory",
"parameter": [
{
"valueId": "qr"
},
{
"valueId": "obsA"
}
]
}
]
},
{
"name": "asaCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "obsA",
"element": "code",
"variable": "code"
}
],
"rule": [
{
"name": "codeCoding",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "code",
"element": "coding",
"variable": "coding"
}
],
"rule": [
{
"name": "codeSystem",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "http://loinc.org"
}
]
}
]
},
{
"name": "codeCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "97816-3"
}
]
}
]
},
{
"name": "codeDisplay",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "American society of anesthesiologists morbidity state"
}
]
}
]
}
]
}
]
},
{
"name": "asaValue",
"source": [
{
"context": "aA"
}
],
"target": [
{
"context": "obsA"
}
],
"dependent": [
{
"name": "SetCodedValue",
"parameter": [
{
"valueId": "aA"
},
{
"valueId": "obsA"
}
]
}
]
}
]
}
]
}
],
"documentation": "── ASA grade ──────────────────────────────────────────────────────────────"
},
{
"name": "nbmRule",
"source": [
{
"context": "qr",
"element": "item",
"variable": "itN",
"condition": "(linkId = 'nbm') and answer.value.exists()"
}
],
"rule": [
{
"name": "nbmAnswer",
"source": [
{
"context": "itN",
"element": "answer",
"listMode": "first",
"variable": "aN"
}
],
"rule": [
{
"name": "nbmObservation",
"source": [
{
"context": "aN"
}
],
"target": [
{
"context": "bundle",
"element": "entry",
"variable": "entryN"
},
{
"context": "entryN",
"element": "resource",
"variable": "obsN",
"transform": "create",
"parameter": [
{
"valueString": "Observation"
}
]
}
],
"rule": [
{
"name": "nbmBase",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "obsN"
},
{
"context": "entryN"
}
],
"dependent": [
{
"name": "BuildObsBase",
"parameter": [
{
"valueId": "qr"
},
{
"valueId": "obsN"
},
{
"valueId": "entryN"
}
]
}
]
},
{
"name": "nbmCategory",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "obsN"
}
],
"dependent": [
{
"name": "SetSocialHistoryCategory",
"parameter": [
{
"valueId": "qr"
},
{
"valueId": "obsN"
}
]
}
]
},
{
"name": "nbmCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "obsN",
"element": "code",
"variable": "code"
}
],
"rule": [
{
"name": "codeCoding",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "code",
"element": "coding",
"variable": "coding"
}
],
"rule": [
{
"name": "codeSystem",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "http://loinc.org"
}
]
}
]
},
{
"name": "codeCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "67517-3"
}
]
}
]
},
{
"name": "codeDisplay",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "Last oral intake [Date and time]"
}
]
}
]
}
]
}
]
},
{
"name": "nbmValue",
"source": [
{
"context": "aN",
"element": "value",
"variable": "v"
}
],
"target": [
{
"context": "obsN",
"element": "value",
"transform": "copy",
"parameter": [
{
"valueId": "v"
}
]
}
]
}
]
}
]
}
],
"documentation": "── Last oral intake ───────────────────────────────────────────────────────\r\nReported by the patient rather than measured, hence `social-history`. The\r\nanswer is a dateTime and goes through as one: LOINC 67517-3 is defined as a\r\ndate and time, so no Quantity is involved."
},
{
"name": "consentRule",
"source": [
{
"context": "qr",
"element": "item",
"variable": "itC",
"condition": "(linkId = 'consentBy') and answer.value.exists()"
}
],
"rule": [
{
"name": "consentByAnswer",
"source": [
{
"context": "itC",
"element": "answer",
"listMode": "first",
"variable": "aC"
}
],
"rule": [
{
"name": "consent",
"source": [
{
"context": "aC"
}
],
"target": [
{
"context": "bundle",
"element": "entry",
"variable": "entryC"
},
{
"context": "entryC",
"element": "resource",
"variable": "consent",
"transform": "create",
"parameter": [
{
"valueString": "Consent"
}
]
}
],
"rule": [
{
"name": "idAndFullUrl",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "consent",
"element": "id",
"transform": "uuid"
}
],
"dependent": [
{
"name": "SetConsentFullUrl",
"parameter": [
{
"valueId": "consent"
},
{
"valueId": "entryC"
}
]
}
]
},
{
"name": "entryRequest",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "entryC",
"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": "Consent"
}
]
}
]
}
]
},
{
"name": "status",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "consent",
"element": "status",
"transform": "copy",
"parameter": [
{
"valueString": "active"
}
]
}
]
},
{
"name": "category",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "consent",
"element": "category",
"variable": "cat"
}
],
"rule": [
{
"name": "categoryCoding",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "cat",
"element": "coding",
"variable": "coding"
}
],
"rule": [
{
"name": "categorySystem",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "http://loinc.org"
}
]
}
]
},
{
"name": "categoryCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "59284-0"
}
]
}
]
},
{
"name": "categoryDisplay",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "Consent Document"
}
]
}
]
}
]
},
{
"name": "categoryText",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "cat",
"element": "text",
"transform": "copy",
"parameter": [
{
"valueString": "Consent for the planned procedure"
}
]
}
]
}
]
},
{
"name": "subject",
"source": [
{
"context": "qr",
"element": "subject",
"variable": "s"
}
],
"target": [
{
"context": "consent",
"element": "subject",
"transform": "copy",
"parameter": [
{
"valueId": "s"
}
]
}
]
},
{
"name": "date",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "consent",
"element": "date",
"transform": "evaluate",
"parameter": [
{
"valueId": "qr"
},
{
"valueString": "authored.toString().substring(0, 10)"
}
]
}
],
"documentation": "Consent.date is a `date`, not a dateTime, so the day is taken off the\r\nfront of the authored timestamp rather than assigned whole."
},
{
"name": "grantor",
"source": [
{
"context": "qr",
"element": "subject",
"variable": "s"
}
],
"target": [
{
"context": "consent",
"element": "grantor",
"transform": "copy",
"parameter": [
{
"valueId": "s"
}
]
}
]
},
{
"name": "decision",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "consent",
"element": "decision",
"transform": "copy",
"parameter": [
{
"valueString": "permit"
}
]
}
]
},
{
"name": "verification",
"source": [
{
"context": "aC",
"element": "value",
"variable": "cv"
}
],
"target": [
{
"context": "consent",
"element": "verification",
"variable": "ver"
}
],
"rule": [
{
"name": "verified",
"source": [
{
"context": "aC"
}
],
"target": [
{
"context": "ver",
"element": "verified",
"transform": "copy",
"parameter": [
{
"valueBoolean": true
}
]
}
]
},
{
"name": "verifiedBy",
"source": [
{
"context": "cv"
}
],
"target": [
{
"context": "ver",
"element": "verifiedBy",
"transform": "copy",
"parameter": [
{
"valueId": "cv"
}
]
}
]
},
{
"name": "verificationDate",
"source": [
{
"context": "qr",
"element": "authored",
"variable": "t"
}
],
"target": [
{
"context": "ver",
"element": "verificationDate",
"transform": "copy",
"parameter": [
{
"valueId": "t"
}
]
}
]
}
]
},
{
"name": "linkQuestionnaireResponse",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "consent",
"element": "sourceReference",
"variable": "ref",
"transform": "create",
"parameter": [
{
"valueString": "Reference"
}
]
}
],
"rule": [
{
"name": "sourceReferenceRef",
"source": [
{
"context": "qr",
"element": "id",
"variable": "qid"
}
],
"target": [
{
"context": "ref",
"element": "reference",
"transform": "copy",
"parameter": [
{
"valueId": "qid"
}
]
}
]
}
]
}
]
}
]
}
],
"documentation": "── Consent ────────────────────────────────────────────────────────────────\r\nThe person named on the form is the person who took the consent, which is\r\nverification.verifiedBy: the patient is the grantor, and the clinician\r\nattests that the conversation happened."
}
]
},
{
"name": "BuildObsBase",
"documentation": "─────────────────────────────────────────────────────────────────────────────\r\nShared scaffolding. Repeated in each map rather than imported: the transform\r\nengine resolves `imports` against whatever StructureMaps happen to be on the\r\nserver, and a form that stops extracting because a shared map was not\r\nuploaded is a worse failure than a duplicated group.\r\n─────────────────────────────────────────────────────────────────────────────\r\nTwo notes on what the publisher's StructureMap validator says about this file.\r\nSource parameters below are left untyped on purpose. Writing `: Element` makes\r\nthe validator compare QuestionnaireResponse.item against the literal 'Element'\r\nand report them as incompatible with each other, which is noise, not a finding.\r\nUntyped, it says only that it cannot check the paths.\r\n`evaluate(context, expression)` is flagged as \"takes 1 parameter but 2 were\r\nfound\". Leave it. The FML parser in the same jar refuses the one-argument form\r\noutright -- it wants a parameter, a comma, then the FHIRPath -- so the publisher\r\nis objecting to what its own compiler emits. Two arguments is the only form that\r\ncompiles, and it is what the R5 transform engine executes.",
"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": "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"
}
]
}
]
},
{
"name": "performerFromSource",
"source": [
{
"context": "qr",
"element": "source",
"variable": "src"
}
],
"target": [
{
"context": "obs",
"element": "performer",
"transform": "copy",
"parameter": [
{
"valueId": "src"
}
]
}
]
},
{
"name": "performerFallback",
"source": [
{
"context": "qr",
"condition": "source.exists().not()"
}
],
"rule": [
{
"name": "performerFromAuthor",
"source": [
{
"context": "qr",
"element": "author",
"variable": "a"
}
],
"target": [
{
"context": "obs",
"element": "performer",
"transform": "copy",
"parameter": [
{
"valueId": "a"
}
]
}
]
}
]
},
{
"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"
}
]
}
]
}
]
}
]
},
{
"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": "cc",
"transform": "create",
"parameter": [
{
"valueString": "CodeableConcept"
}
]
}
],
"rule": [
{
"name": "valueCoding",
"source": [
{
"context": "cv"
}
],
"target": [
{
"context": "cc",
"element": "coding",
"transform": "copy",
"parameter": [
{
"valueId": "cv"
}
]
}
]
},
{
"name": "valueText",
"source": [
{
"context": "cv",
"element": "display",
"variable": "d"
}
],
"target": [
{
"context": "cc",
"element": "text",
"transform": "copy",
"parameter": [
{
"valueId": "d"
}
]
}
]
}
]
}
]
},
{
"name": "SetSurveyCategory",
"input": [
{
"name": "qr",
"type": "QR",
"mode": "source"
},
{
"name": "obs",
"type": "Observation",
"mode": "target"
}
],
"rule": [
{
"name": "category",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "obs",
"element": "category",
"variable": "cat"
}
],
"rule": [
{
"name": "categoryCoding",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "cat",
"element": "coding",
"variable": "coding"
}
],
"rule": [
{
"name": "categorySystem",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "http://terminology.hl7.org/CodeSystem/observation-category"
}
]
}
]
},
{
"name": "categoryCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "survey"
}
]
}
]
},
{
"name": "categoryDisplay",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "Survey"
}
]
}
]
}
]
}
]
}
]
},
{
"name": "SetSocialHistoryCategory",
"input": [
{
"name": "qr",
"type": "QR",
"mode": "source"
},
{
"name": "obs",
"type": "Observation",
"mode": "target"
}
],
"rule": [
{
"name": "category",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "obs",
"element": "category",
"variable": "cat"
}
],
"rule": [
{
"name": "categoryCoding",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "cat",
"element": "coding",
"variable": "coding"
}
],
"rule": [
{
"name": "categorySystem",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "http://terminology.hl7.org/CodeSystem/observation-category"
}
]
}
]
},
{
"name": "categoryCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "social-history"
}
]
}
]
},
{
"name": "categoryDisplay",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "Social History"
}
]
}
]
}
]
}
]
}
]
},
{
"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"
}
]
}
]
}
]
},
{
"name": "SetServiceRequestFullUrl",
"input": [
{
"name": "sr",
"type": "ServiceRequest",
"mode": "source"
},
{
"name": "entry",
"mode": "target"
}
],
"rule": [
{
"name": "assignFullUrl",
"source": [
{
"context": "sr",
"element": "id",
"variable": "id"
}
],
"target": [
{
"context": "entry",
"element": "fullUrl",
"transform": "append",
"parameter": [
{
"valueString": "https://fhir.slade360.co.ke/fhir/ServiceRequest/"
},
{
"valueId": "id"
}
]
}
]
}
]
},
{
"name": "SetConsentFullUrl",
"input": [
{
"name": "consent",
"type": "Consent",
"mode": "source"
},
{
"name": "entry",
"mode": "target"
}
],
"rule": [
{
"name": "assignFullUrl",
"source": [
{
"context": "consent",
"element": "id",
"variable": "id"
}
],
"target": [
{
"context": "entry",
"element": "fullUrl",
"transform": "append",
"parameter": [
{
"valueString": "https://fhir.slade360.co.ke/fhir/Consent/"
},
{
"valueId": "id"
}
]
}
]
}
]
}
]
}