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
| Active as of 2026-10-06 |
@prefix fhir: <http://hl7.org/fhir/> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . # - resource ------------------------------------------------------------------- <http://hl7.org/fhir/StructureMap/ExtractInpatientWardRoundNote> a fhir:StructureMap ; fhir:nodeRole fhir:treeRoot ; fhir:id [ fhir:v "ExtractInpatientWardRoundNote"] ; # fhir:text [ fhir:status [ fhir:v "generated" ] ; fhir:div [ fhir:v "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p class=\"res-header-id\"><b>Generated Narrative: StructureMap ExtractInpatientWardRoundNote</b></p><a name=\"ExtractInpatientWardRoundNote\"> </a><a name=\"hcExtractInpatientWardRoundNote\"> </a><pre class=\"fml\">\r\n<span style=\"color: #cc00cc\">/// <b>url</b> = </span><span style=\"color: blue\">'https://fhir.slade360.co.ke/fhir/StructureMap/ExtractInpatientWardRoundNote'</span>\r\n<span style=\"color: #cc00cc\">/// <b>name</b> = </span><span style=\"color: blue\">'ExtractInpatientWardRoundNote'</span>\r\n<span style=\"color: #cc00cc\">/// <b>title</b> = </span><span style=\"color: blue\">'Inpatient Ward Round Note Extraction'</span>\r\n<span style=\"color: #cc00cc\">/// <b>status</b> = </span><span style=\"color: blue\">'active'</span>\r\n<span style=\"color: #cc00cc\">/// <b>description</b> = </span><span style=\"color: blue\">'Turns a response to the inpatient ward round into a Composition with a section per heading, one attester per clinician who was on the round, and a Task carrying the jobs the round left for the team. The jobs item is a single free-text block, so it becomes a single Task: splitting it would invent boundaries the writer did not draw. Making it several Tasks means first making the form item repeat.'</span>\r\n\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R5/questionnaireresponse.html\" title=\"QuestionnaireResponse\">http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse</a><span style=\"color: navy\">" </span><b>alias </b>QR <b>as </b><b>source</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R5/bundle.html\" title=\"Bundle\">http://hl7.org/fhir/StructureDefinition/Bundle</a><span style=\"color: navy\">" </span><b>alias </b>Bundle <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R5/composition.html\" title=\"Composition\">http://hl7.org/fhir/StructureDefinition/Composition</a><span style=\"color: navy\">" </span><b>alias </b>Composition <b>as </b><b>target</b>\r\n<b>uses</b><span style=\"color: navy\"> "</span><a href=\"http://hl7.org/fhir/R5/task.html\" title=\"Task\">http://hl7.org/fhir/StructureDefinition/Task</a><span style=\"color: navy\">" </span><b>alias </b>Task <b>as </b><b>target</b>\r\n\r\n<b>group </b>ExtractInpatientWardRoundNote<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">qr</span><span style=\"color: navy\"> : </span>QR, <b>target</b> <span style=\"color: maroon\">bundle</span><span style=\"color: navy\"> : </span>Bundle<span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> qr<span style=\"color: navy\"><b> -> </b></span>bundle.type = <span style=\"color: blue\">'transaction'</span> <i>"setBundleType"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">entry</span><span style=\"color: navy\">, </span> entry.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Composition'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">comp</span><b> then</b><span style=\"color: navy\"> {\r\n</span> qr<span style=\"color: navy\"><b> -> </b></span>comp<b> then </b>CopyResponseTags<span style=\"color: navy\">(</span><span style=\"color: maroon\">qr</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">comp</span><span style=\"color: navy\">)</span> <i>"responseTags"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span> comp<span style=\"color: navy\">, </span> entry<b> then </b>BuildNoteBase<span style=\"color: navy\">(</span><span style=\"color: maroon\">qr</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">comp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">entry</span><span style=\"color: navy\">)</span> <i>"noteBase"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span>comp.name = <span style=\"color: blue\">'InpatientWardRoundNote'</span> <i>"noteName"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span>comp.title = <span style=\"color: blue\">'Ward round'</span> <i>"noteTitle"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span>comp.type<b> as </b><span style=\"color: maroon\">ty</span><b> then</b><span style=\"color: navy\"> {\r\n</span> qr<span style=\"color: navy\"><b> -> </b></span>ty.coding<b> as </b><span style=\"color: maroon\">sghi</span><b> then</b><span style=\"color: navy\"> {\r\n</span> qr<span style=\"color: navy\"><b> -> </b></span>sghi.system = <span style=\"color: blue\">'https://fhir.slade360.co.ke/fhir/CodeSystem/inpatient-document-type-codesystem'</span> <i>"sghiSystem"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span>sghi.code = <span style=\"color: blue\">'ward-round-note'</span> <i>"sghiCode"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span>sghi.display = <span style=\"color: blue\">'Ward round'</span> <i>"sghiDisplay"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"sghiCoding"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span>ty.text = <span style=\"color: blue\">'Ward round'</span> <i>"typeText"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"noteType"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">Everyone on the round attests the note. The item repeats, so this yields</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">one attester per clinician picked.</span>\r\n qr.item<b> as </b><span style=\"color: maroon\">itP</span><b> where </b><span style=\"color: navy\">(</span>linkId = 'present'<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> itP.answer<b> as </b><span style=\"color: maroon\">aP</span><b> then</b><span style=\"color: navy\"> {\r\n</span> aP.value<b> as </b><span style=\"color: maroon\">pv</span><span style=\"color: navy\"><b> -> </b></span>comp.attester<b> as </b><span style=\"color: maroon\">att</span><b> then</b><span style=\"color: navy\"> {\r\n</span> aP<span style=\"color: navy\"><b> -> </b></span>att.mode<b> as </b><span style=\"color: maroon\">mode</span><b> then</b><span style=\"color: navy\"> {\r\n</span> aP<span style=\"color: navy\"><b> -> </b></span>mode.coding<b> as </b><span style=\"color: maroon\">modec</span><b> then</b><span style=\"color: navy\"> {\r\n</span> aP<span style=\"color: navy\"><b> -> </b></span>modec.system = <span style=\"color: blue\">'http://hl7.org/fhir/composition-attestation-mode'</span> <i>"attModeSystem"</i><span style=\"color: navy\">;</span>\r\n aP<span style=\"color: navy\"><b> -> </b></span>modec.code = <span style=\"color: blue\">'professional'</span> <i>"attModeCode"</i><span style=\"color: navy\">;</span>\r\n aP<span style=\"color: navy\"><b> -> </b></span>modec.display = <span style=\"color: blue\">'Professional'</span> <i>"attModeDisplay"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"attModeCoding"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"attesterMode"</i><span style=\"color: navy\">;</span>\r\n qr.authored<b> as </b><span style=\"color: maroon\">t</span><span style=\"color: navy\"><b> -> </b></span>att.time = <span style=\"color: maroon\">t</span> <i>"attesterTime"</i><span style=\"color: navy\">;</span>\r\n pv<b> where </b><span style=\"color: navy\">(</span>(reference.exists() and (reference.startsWith('Patient/') or reference.startsWith('Organization/'))) or (reference.empty() and (type.empty() or ('/' + type).endsWith('/Patient') or ('/' + type).endsWith('/Organization')))<span style=\"color: navy\">)</span><span style=\"color: navy\"><b> -> </b></span>att.party = <span style=\"color: maroon\">pv</span> <i>"attesterParty"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"attester"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"presentAnswer"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"presentRule"</i><span style=\"color: navy\">;</span>\r\n qr.item<b> as </b><span style=\"color: maroon\">it</span><b> where </b><span style=\"color: navy\">(</span>(linkId = 'findings') and answer.value.exists()<span style=\"color: navy\">)</span><span style=\"color: navy\"><b> -> </b></span>comp.section<b> as </b><span style=\"color: maroon\">sec</span><b> then</b><span style=\"color: navy\"> {\r\n</span> it<span style=\"color: navy\"><b> -> </b></span>sec.title = <span style=\"color: blue\">'Findings'</span> <i>"findingsTitle"</i><span style=\"color: navy\">;</span>\r\n it<span style=\"color: navy\"><b> -> </b></span>sec<b> then </b>AddSectionText<span style=\"color: navy\">(</span><span style=\"color: maroon\">it</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">sec</span><span style=\"color: navy\">)</span> <i>"findingsText"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"findingsRule"</i><span style=\"color: navy\">;</span>\r\n qr.item<b> as </b><span style=\"color: maroon\">it</span><b> where </b><span style=\"color: navy\">(</span>(linkId = 'decisions') and answer.value.exists()<span style=\"color: navy\">)</span><span style=\"color: navy\"><b> -> </b></span>comp.section<b> as </b><span style=\"color: maroon\">sec</span><b> then</b><span style=\"color: navy\"> {\r\n</span> it<span style=\"color: navy\"><b> -> </b></span>sec.title = <span style=\"color: blue\">'Decisions'</span> <i>"decisionsTitle"</i><span style=\"color: navy\">;</span>\r\n it<span style=\"color: navy\"><b> -> </b></span>sec<b> then </b>AddSectionText<span style=\"color: navy\">(</span><span style=\"color: maroon\">it</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">sec</span><span style=\"color: navy\">)</span> <i>"decisionsText"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"decisionsRule"</i><span style=\"color: navy\">;</span>\r\n qr.item<b> as </b><span style=\"color: maroon\">it</span><b> where </b><span style=\"color: navy\">(</span>(linkId = 'jobs') and answer.value.exists()<span style=\"color: navy\">)</span><span style=\"color: navy\"><b> -> </b></span>comp.section<b> as </b><span style=\"color: maroon\">sec</span><b> then</b><span style=\"color: navy\"> {\r\n</span> it<span style=\"color: navy\"><b> -> </b></span>sec.title = <span style=\"color: blue\">'Jobs for the team'</span> <i>"jobsTitle"</i><span style=\"color: navy\">;</span>\r\n it<span style=\"color: navy\"><b> -> </b></span>sec<b> then </b>AddSectionText<span style=\"color: navy\">(</span><span style=\"color: maroon\">it</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">sec</span><span style=\"color: navy\">)</span> <i>"jobsText"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"jobsSectionRule"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"composition"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">The jobs are also actionable work, so they leave the document as a Task the</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">ward can pick up and close.</span>\r\n qr.item<b> as </b><span style=\"color: maroon\">itJ</span><b> where </b><span style=\"color: navy\">(</span>(linkId = 'jobs') and answer.value.exists()<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> itJ.answer first<b> as </b><span style=\"color: maroon\">aJ</span><b> then</b><span style=\"color: navy\"> {\r\n</span> aJ<span style=\"color: navy\"><b> -> </b></span> bundle.entry<b> as </b><span style=\"color: maroon\">entryT</span><span style=\"color: navy\">, </span> entryT.resource = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Task'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">task</span><b> then</b><span style=\"color: navy\"> {\r\n</span> qr<span style=\"color: navy\"><b> -> </b></span>task<b> then </b>CopyResponseTags<span style=\"color: navy\">(</span><span style=\"color: maroon\">qr</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">task</span><span style=\"color: navy\">)</span> <i>"responseTags"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span>task.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> then </b>SetTaskFullUrl<span style=\"color: navy\">(</span><span style=\"color: maroon\">task</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">entryT</span><span style=\"color: navy\">)</span> <i>"idAndFullUrl"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span>entryT.request<b> as </b><span style=\"color: maroon\">request</span><b> then</b><span style=\"color: navy\"> {\r\n</span> qr<span style=\"color: navy\"><b> -> </b></span>request.method = <span style=\"color: blue\">'POST'</span> <i>"requestMethod"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span>request.url = <span style=\"color: blue\">'Task'</span> <i>"requestUrl"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"entryRequest"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span>task.status = <span style=\"color: blue\">'requested'</span> <i>"status"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span>task.intent = <span style=\"color: blue\">'order'</span> <i>"intent"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span>task.priority = <span style=\"color: blue\">'routine'</span> <i>"priority"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span>task.code<b> as </b><span style=\"color: maroon\">code</span><b> then</b><span style=\"color: navy\"> {\r\n</span> qr<span style=\"color: navy\"><b> -> </b></span>code.coding<b> as </b><span style=\"color: maroon\">coding</span><b> then</b><span style=\"color: navy\"> {\r\n</span> qr<span style=\"color: navy\"><b> -> </b></span>coding.system = <span style=\"color: blue\">'https://fhir.slade360.co.ke/fhir/CodeSystem/inpatient-clinical-concept-codesystem'</span> <i>"codeSystem"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span>coding.code = <span style=\"color: blue\">'ward-round-job'</span> <i>"codeCode"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span>coding.display = <span style=\"color: blue\">'Job for the team from a ward round'</span> <i>"codeDisplay"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"codeCoding"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"taskCode"</i><span style=\"color: navy\">;</span>\r\n aJ.value<b> as </b><span style=\"color: maroon\">v</span><span style=\"color: navy\"><b> -> </b></span>task.description = <span style=\"color: maroon\">v</span> <i>"description"</i><span style=\"color: navy\">;</span>\r\n qr.subject<b> as </b><span style=\"color: maroon\">s</span><b> where </b><span style=\"color: navy\">(</span>(reference.exists() and (reference.startsWith('Patient/'))) or (reference.empty() and (type.empty() or ('/' + type).endsWith('/Patient')))<span style=\"color: navy\">)</span><span style=\"color: navy\"><b> -> </b></span>task.for = <span style=\"color: maroon\">s</span> <i>"for"</i><span style=\"color: navy\">;</span>\r\n qr.encounter<b> as </b><span style=\"color: maroon\">e</span><b> where </b><span style=\"color: navy\">(</span>(reference.exists() and (reference.startsWith('Encounter/'))) or (reference.empty() and (type.empty() or ('/' + type).endsWith('/Encounter')))<span style=\"color: navy\">)</span><span style=\"color: navy\"><b> -> </b></span>task.encounter = <span style=\"color: maroon\">e</span><span style=\"color: navy\">;</span>\r\n qr.authored<b> as </b><span style=\"color: maroon\">t</span><span style=\"color: navy\"><b> -> </b></span>task.authoredOn = <span style=\"color: maroon\">t</span> <i>"authoredOn"</i><span style=\"color: navy\">;</span>\r\n qr.authored<b> as </b><span style=\"color: maroon\">t</span><span style=\"color: navy\"><b> -> </b></span>task.lastModified = <span style=\"color: maroon\">t</span> <i>"lastModified"</i><span style=\"color: navy\">;</span>\r\n qr.author<b> as </b><span style=\"color: maroon\">a</span><b> where </b><span style=\"color: navy\">(</span>(reference.exists() and (reference.startsWith('Patient/') or reference.startsWith('Organization/'))) or (reference.empty() and (type.empty() or ('/' + type).endsWith('/Patient') or ('/' + type).endsWith('/Organization')))<span style=\"color: navy\">)</span><span style=\"color: navy\"><b> -> </b></span>task.requester = <span style=\"color: maroon\">a</span> <i>"requesterFromAuthor"</i><span style=\"color: navy\">;</span>\r\n qr<b> where </b><span style=\"color: navy\">(</span>author.where(((reference.exists() and (reference.startsWith('Patient/') or reference.startsWith('Organization/'))) or (reference.empty() and (type.empty() or ('/' + type).endsWith('/Patient') or ('/' + type).endsWith('/Organization'))))).exists().not()<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> qr.source<b> as </b><span style=\"color: maroon\">src</span><b> where </b><span style=\"color: navy\">(</span>(reference.exists() and (reference.startsWith('Patient/') or reference.startsWith('Organization/'))) or (reference.empty() and (type.empty() or ('/' + type).endsWith('/Patient') or ('/' + type).endsWith('/Organization')))<span style=\"color: navy\">)</span><span style=\"color: navy\"><b> -> </b></span>task.requester = <span style=\"color: maroon\">src</span> <i>"requesterFromSource"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"requesterFallback"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">basedOn, not focus: the round authorised the work, it is not the</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">thing the work acts upon.</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span>task.basedOn = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">ref</span><b> then</b><span style=\"color: navy\"> {\r\n</span> qr.id<b> as </b><span style=\"color: maroon\">qid</span><span style=\"color: navy\"><b> -> </b></span>ref.reference = <span style=\"color: maroon\">qid</span> <i>"basedOnRef"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"linkQuestionnaireResponse"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"task"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"jobsAnswer"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"jobsTaskRule"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">─────────────────────────────────────────────────────────────────────────────</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">Shared note scaffolding. Repeated in each note map rather than imported: the</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">transform engine resolves `imports` against whatever StructureMaps happen to</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">be on the server, and a note that stops extracting because a shared map was</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">not uploaded is a worse failure than a duplicated group.</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">─────────────────────────────────────────────────────────────────────────────</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">Two notes on what the publisher's StructureMap validator says about this file.</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">Source parameters below are left untyped on purpose. Writing `: Element` makes</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">the validator compare QuestionnaireResponse.item against the literal 'Element'</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">and report them as incompatible with each other, which is noise, not a finding.</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">Untyped, it says only that it cannot check the paths.</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">`evaluate(context, expression)` is flagged as "takes 1 parameter but 2 were</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">found". Leave it. The FML parser in the same jar refuses the one-argument form</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">outright -- it wants a parameter, a comma, then the FHIRPath -- so the publisher</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">is objecting to what its own compiler emits. Two arguments is the only form that</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">compiles, and it is what the R5 transform engine executes.</span>\r\n<b>group </b>BuildNoteBase<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">qr</span><span style=\"color: navy\"> : </span>QR, <b>target</b> <span style=\"color: maroon\">comp</span><span style=\"color: navy\"> : </span>Composition, <b>target</b> <span style=\"color: maroon\">entry</span><span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> qr<span style=\"color: navy\"><b> -> </b></span>comp.id = <b>uuid</b><span style=\"color: navy\">(</span><span style=\"color: navy\">)</span><b> then </b>SetCompositionFullUrl<span style=\"color: navy\">(</span><span style=\"color: maroon\">comp</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">entry</span><span style=\"color: navy\">)</span> <i>"idAndFullUrl"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span>entry.request<b> as </b><span style=\"color: maroon\">request</span><b> then</b><span style=\"color: navy\"> {\r\n</span> qr<span style=\"color: navy\"><b> -> </b></span>request.method = <span style=\"color: blue\">'POST'</span> <i>"requestMethod"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span>request.url = <span style=\"color: blue\">'Composition'</span> <i>"requestUrl"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"entryRequest"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span>comp.status = <span style=\"color: blue\">'final'</span> <i>"status"</i><span style=\"color: navy\">;</span>\r\n qr.subject<b> as </b><span style=\"color: maroon\">s</span><b> where </b><span style=\"color: navy\">(</span>(reference.exists() and (reference.contains('://').not() and reference.startsWith('#').not() and reference.startsWith('urn:').not())) or reference.empty()<span style=\"color: navy\">)</span><span style=\"color: navy\"><b> -> </b></span>comp.subject = <span style=\"color: maroon\">s</span><span style=\"color: navy\">;</span>\r\n qr.encounter<b> as </b><span style=\"color: maroon\">e</span><b> where </b><span style=\"color: navy\">(</span>(reference.exists() and (reference.startsWith('Encounter/'))) or (reference.empty() and (type.empty() or ('/' + type).endsWith('/Encounter')))<span style=\"color: navy\">)</span><span style=\"color: navy\"><b> -> </b></span>comp.encounter = <span style=\"color: maroon\">e</span><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">Composition.date is 1..1. `authored` is only 0..1 on the response, so when a</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">client sends none the extraction time stands in. It is a poor substitute for</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">when the note was written, but a document with no date at all is worse, and</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">extraction happens moments after submission in practice.</span>\r\n qr.authored<b> as </b><span style=\"color: maroon\">t</span><span style=\"color: navy\"><b> -> </b></span>comp.date = <span style=\"color: maroon\">t</span> <i>"date"</i><span style=\"color: navy\">;</span>\r\n qr<b> where </b><span style=\"color: navy\">(</span>authored.exists().not()<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> qr<span style=\"color: navy\"><b> -> </b></span>comp.date = evaluate<span style=\"color: navy\">(</span>qr<span style=\"color: navy\">, </span>now()<span style=\"color: navy\">)</span> <i>"dateFromExtractionTime"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"dateFallback"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">Composition.author is 1..1 minimum. R5 QuestionnaireResponse carries both</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">`author` (who recorded the answers) and `source` (who supplied them); the</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">author is the one who wrote the note, so it wins, and `source` only stands</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">in when the client did not send an author. If the response carries neither,</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">the note comes out unauthored -- there is nothing on a QuestionnaireResponse</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">to invent one from, and guessing at who wrote a clinical note is not a thing</span>\r\n <span style=\"color: navy\">// </span><span style=\"color: green\">a map should do.</span>\r\n qr.author<b> as </b><span style=\"color: maroon\">a</span><b> where </b><span style=\"color: navy\">(</span>(reference.exists() and (reference.startsWith('Patient/') or reference.startsWith('Organization/'))) or (reference.empty() and (type.empty() or ('/' + type).endsWith('/Patient') or ('/' + type).endsWith('/Organization')))<span style=\"color: navy\">)</span><span style=\"color: navy\"><b> -> </b></span>comp.author = <span style=\"color: maroon\">a</span> <i>"authorFromAuthor"</i><span style=\"color: navy\">;</span>\r\n qr<b> where </b><span style=\"color: navy\">(</span>author.where(((reference.exists() and (reference.startsWith('Patient/') or reference.startsWith('Organization/'))) or (reference.empty() and (type.empty() or ('/' + type).endsWith('/Patient') or ('/' + type).endsWith('/Organization'))))).exists().not()<span style=\"color: navy\">)</span><b> then</b><span style=\"color: navy\"> {\r\n</span> qr.source<b> as </b><span style=\"color: maroon\">src</span><b> where </b><span style=\"color: navy\">(</span>(reference.exists() and (reference.startsWith('Patient/') or reference.startsWith('Organization/'))) or (reference.empty() and (type.empty() or ('/' + type).endsWith('/Patient') or ('/' + type).endsWith('/Organization')))<span style=\"color: navy\">)</span><span style=\"color: navy\"><b> -> </b></span>comp.author = <span style=\"color: maroon\">src</span> <i>"authorFromSource"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"authorFallback"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span>comp.relatesTo<b> as </b><span style=\"color: maroon\">rel</span><b> then</b><span style=\"color: navy\"> {\r\n</span> qr<span style=\"color: navy\"><b> -> </b></span>rel.type = <span style=\"color: blue\">'derived-from'</span> <i>"relatesToType"</i><span style=\"color: navy\">;</span>\r\n qr<span style=\"color: navy\"><b> -> </b></span>rel.resourceReference = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'Reference'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">ref</span><b> then</b><span style=\"color: navy\"> {\r\n</span> qr.id<b> as </b><span style=\"color: maroon\">qid</span><span style=\"color: navy\"><b> -> </b></span>ref.reference = <span style=\"color: maroon\">qid</span> <i>"relatesToRef"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"relatesToTarget"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"linkQuestionnaireResponse"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>AddSectionText<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">it</span>, <b>target</b> <span style=\"color: maroon\">sec</span><span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> it.answer first<b> as </b><span style=\"color: maroon\">a</span><b> then</b><span style=\"color: navy\"> {\r\n</span> a.value<b> as </b><span style=\"color: maroon\">v</span><span style=\"color: navy\"><b> -> </b></span>sec.text<b> as </b><span style=\"color: maroon\">narrative</span><b> then</b><span style=\"color: navy\"> {\r\n</span> v<span style=\"color: navy\"><b> -> </b></span>narrative.status = <span style=\"color: blue\">'generated'</span> <i>"narrativeStatus"</i><span style=\"color: navy\">;</span>\r\n v<span style=\"color: navy\"><b> -> </b></span>narrative.div = <b>create</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'xhtml'</span><span style=\"color: navy\">)</span><b> as </b><span style=\"color: maroon\">xhtml</span><b> then</b><span style=\"color: navy\"> {\r\n</span> v<span style=\"color: navy\"><b> -> </b></span>xhtml.value = evaluate<span style=\"color: navy\">(</span>a<span style=\"color: navy\">, </span>'<div xmlns="http://www.w3.org/1999/xhtml"><p>' + value.toString().escape('html') + '</p></div>'<span style=\"color: navy\">)</span> <i>"narrativeDiv"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"narrativeXhtml"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"sectionText"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"sectionAnswer"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>SetCompositionFullUrl<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">comp</span><span style=\"color: navy\"> : </span>Composition, <b>target</b> <span style=\"color: maroon\">entry</span><span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> comp.id<b> as </b><span style=\"color: maroon\">id</span><span style=\"color: navy\"><b> -> </b></span>entry.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'https://fhir.slade360.co.ke/fhir/Composition/'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">id</span><span style=\"color: navy\">)</span> <i>"assignFullUrl"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><b>group </b>SetTaskFullUrl<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">task</span><span style=\"color: navy\"> : </span>Task, <b>target</b> <span style=\"color: maroon\">entry</span><span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> task.id<b> as </b><span style=\"color: maroon\">id</span><span style=\"color: navy\"><b> -> </b></span>entry.fullUrl = <b>append</b><span style=\"color: navy\">(</span><span style=\"color: blue\">'https://fhir.slade360.co.ke/fhir/Task/'</span><span style=\"color: navy\">, </span><span style=\"color: maroon\">id</span><span style=\"color: navy\">)</span> <i>"assignFullUrl"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span><span style=\"color: navy\">// </span><span style=\"color: green\">── Tenancy ──────────────────────────────────────────────────────────────────</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">Whose this is. The platform says which tenant a response belongs to with a</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">tag on the response, and every tag the response carries is copied onto</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">everything this map creates, as it is. Copied rather than named here, so the</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">map never has to know which tenant it is running for, nor which system the</span>\r\n<span style=\"color: navy\">// </span><span style=\"color: green\">tag is under: that system has moved more than once.</span>\r\n<b>group </b>CopyResponseTags<span style=\"color: navy\">(</span><b>source</b> <span style=\"color: maroon\">qr</span><span style=\"color: navy\"> : </span>QR, <b>target</b> <span style=\"color: maroon\">r</span><span style=\"color: navy\">)</span><span style=\"color: navy\"> {\r\n</span> qr.meta<b> as </b><span style=\"color: maroon\">qm</span><b> then</b><span style=\"color: navy\"> {\r\n</span> qm.tag<b> as </b><span style=\"color: maroon\">qt</span><span style=\"color: navy\"><b> -> </b></span> r.meta<b> as </b><span style=\"color: maroon\">m</span><span style=\"color: navy\">, </span> m.tag = <span style=\"color: maroon\">qt</span> <i>"copyTag"</i><span style=\"color: navy\">;</span>\r\n <span style=\"color: navy\">}</span> <i>"tenantTags"</i><span style=\"color: navy\">;</span>\r\n<span style=\"color: navy\">}\r\n\r\n</span></pre></div>"^^rdf:XMLLiteral ] ] ; # fhir:url [ fhir:v "https://fhir.slade360.co.ke/fhir/StructureMap/ExtractInpatientWardRoundNote"^^xsd:anyURI] ; # fhir:version [ fhir:v "0.1.0"] ; # fhir:name [ fhir:v "ExtractInpatientWardRoundNote"] ; # fhir:title [ fhir:v "Inpatient Ward Round Note Extraction"] ; # fhir:status [ fhir:v "active"] ; # fhir:date [ fhir:v "2026-10-06T18:48:22+00:00"^^xsd:dateTime] ; # fhir:publisher [ fhir:v "Kathurima Kimathi"] ; # fhir:contact ( [ fhir:name [ fhir:v "Kathurima Kimathi" ] ; fhir:telecom ( [ fhir:system [ fhir:v "url" ] ; fhir:value [ fhir:v "https://www.linkedin.com/in/kathurima-kimathi/" ] ] [ fhir:system [ fhir:v "email" ] ; fhir:value [ fhir:v "kathurimakimathi415@gmail.com" ] ] ) ] [ fhir:name [ fhir:v "Oscar John" ] ; fhir:telecom ( [ fhir:system [ fhir:v "email" ] ; fhir:value [ fhir:v "oscarjohnotieno@gmail.com" ] ; fhir:use [ fhir:v "work" ] ] ) ] [ fhir:name [ fhir:v "Kennedy Omondi" ] ; fhir:telecom ( [ fhir:system [ fhir:v "email" ] ; fhir:value [ fhir:v "kennankole@gmail.com" ] ; fhir:use [ fhir:v "work" ] ] ) ] ) ; # fhir:description [ fhir:v "Turns a response to the inpatient ward round into a Composition with a section per heading, one attester per clinician who was on the round, and a Task carrying the jobs the round left for the team. The jobs item is a single free-text block, so it becomes a single Task: splitting it would invent boundaries the writer did not draw. Making it several Tasks means first making the form item repeat."] ; # fhir:structure ( [ fhir:url [ fhir:v "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse"^^xsd:anyURI ; fhir:link <http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse> ] ; fhir:mode [ fhir:v "source" ] ; fhir:alias [ fhir:v "QR" ] ] [ fhir:url [ fhir:v "http://hl7.org/fhir/StructureDefinition/Bundle"^^xsd:anyURI ; fhir:link <http://hl7.org/fhir/StructureDefinition/Bundle> ] ; fhir:mode [ fhir:v "target" ] ; fhir:alias [ fhir:v "Bundle" ] ] [ fhir:url [ fhir:v "http://hl7.org/fhir/StructureDefinition/Composition"^^xsd:anyURI ; fhir:link <http://hl7.org/fhir/StructureDefinition/Composition> ] ; fhir:mode [ fhir:v "target" ] ; fhir:alias [ fhir:v "Composition" ] ] [ fhir:url [ fhir:v "http://hl7.org/fhir/StructureDefinition/Task"^^xsd:anyURI ; fhir:link <http://hl7.org/fhir/StructureDefinition/Task> ] ; fhir:mode [ fhir:v "target" ] ; fhir:alias [ fhir:v "Task" ] ] ) ; # fhir:group ( [ fhir:name [ fhir:v "ExtractInpatientWardRoundNote" ] ; fhir:input ( [ fhir:name [ fhir:v "qr" ] ; fhir:type [ fhir:v "QR" ] ; fhir:mode [ fhir:v "source" ] ] [ fhir:name [ fhir:v "bundle" ] ; fhir:type [ fhir:v "Bundle" ] ; fhir:mode [ fhir:v "target" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "setBundleType" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "bundle" ] ; fhir:element [ fhir:v "type" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "transaction" ] ] ) ] ) ] [ fhir:name [ fhir:v "composition" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "bundle" ] ; fhir:element [ fhir:v "entry" ] ; fhir:variable [ fhir:v "entry" ] ] [ fhir:context [ fhir:v "entry" ] ; fhir:element [ fhir:v "resource" ] ; fhir:variable [ fhir:v "comp" ] ; fhir:transform [ fhir:v "create" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "Composition" ] ] ) ] ) ; fhir:rule ( [ fhir:name [ fhir:v "responseTags" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "comp" ] ] ) ; fhir:dependent ( [ fhir:name [ fhir:v "CopyResponseTags" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "qr" ] ] [ fhir:value [ a fhir:id ; fhir:v "comp" ] ] ) ] ) ] [ fhir:name [ fhir:v "noteBase" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "comp" ] ] [ fhir:context [ fhir:v "entry" ] ] ) ; fhir:dependent ( [ fhir:name [ fhir:v "BuildNoteBase" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "qr" ] ] [ fhir:value [ a fhir:id ; fhir:v "comp" ] ] [ fhir:value [ a fhir:id ; fhir:v "entry" ] ] ) ] ) ] [ fhir:name [ fhir:v "noteName" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "comp" ] ; fhir:element [ fhir:v "name" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "InpatientWardRoundNote" ] ] ) ] ) ] [ fhir:name [ fhir:v "noteTitle" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "comp" ] ; fhir:element [ fhir:v "title" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "Ward round" ] ] ) ] ) ] [ fhir:name [ fhir:v "noteType" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "comp" ] ; fhir:element [ fhir:v "type" ] ; fhir:variable [ fhir:v "ty" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "sghiCoding" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "ty" ] ; fhir:element [ fhir:v "coding" ] ; fhir:variable [ fhir:v "sghi" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "sghiSystem" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "sghi" ] ; fhir:element [ fhir:v "system" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "https://fhir.slade360.co.ke/fhir/CodeSystem/inpatient-document-type-codesystem" ] ] ) ] ) ] [ fhir:name [ fhir:v "sghiCode" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "sghi" ] ; fhir:element [ fhir:v "code" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "ward-round-note" ] ] ) ] ) ] [ fhir:name [ fhir:v "sghiDisplay" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "sghi" ] ; fhir:element [ fhir:v "display" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "Ward round" ] ] ) ] ) ] ) ] [ fhir:name [ fhir:v "typeText" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "ty" ] ; fhir:element [ fhir:v "text" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "Ward round" ] ] ) ] ) ] ) ] [ fhir:name [ fhir:v "presentRule" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ; fhir:element [ fhir:v "item" ] ; fhir:variable [ fhir:v "itP" ] ; fhir:condition [ fhir:v "linkId = 'present'" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "presentAnswer" ] ; fhir:source ( [ fhir:context [ fhir:v "itP" ] ; fhir:element [ fhir:v "answer" ] ; fhir:variable [ fhir:v "aP" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "attester" ] ; fhir:source ( [ fhir:context [ fhir:v "aP" ] ; fhir:element [ fhir:v "value" ] ; fhir:variable [ fhir:v "pv" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "comp" ] ; fhir:element [ fhir:v "attester" ] ; fhir:variable [ fhir:v "att" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "attesterMode" ] ; fhir:source ( [ fhir:context [ fhir:v "aP" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "att" ] ; fhir:element [ fhir:v "mode" ] ; fhir:variable [ fhir:v "mode" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "attModeCoding" ] ; fhir:source ( [ fhir:context [ fhir:v "aP" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "mode" ] ; fhir:element [ fhir:v "coding" ] ; fhir:variable [ fhir:v "modec" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "attModeSystem" ] ; fhir:source ( [ fhir:context [ fhir:v "aP" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "modec" ] ; fhir:element [ fhir:v "system" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "http://hl7.org/fhir/composition-attestation-mode" ] ] ) ] ) ] [ fhir:name [ fhir:v "attModeCode" ] ; fhir:source ( [ fhir:context [ fhir:v "aP" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "modec" ] ; fhir:element [ fhir:v "code" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "professional" ] ] ) ] ) ] [ fhir:name [ fhir:v "attModeDisplay" ] ; fhir:source ( [ fhir:context [ fhir:v "aP" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "modec" ] ; fhir:element [ fhir:v "display" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "Professional" ] ] ) ] ) ] ) ] ) ] [ fhir:name [ fhir:v "attesterTime" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ; fhir:element [ fhir:v "authored" ] ; fhir:variable [ fhir:v "t" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "att" ] ; fhir:element [ fhir:v "time" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "t" ] ] ) ] ) ] [ fhir:name [ fhir:v "attesterParty" ] ; fhir:source ( [ fhir:context [ fhir:v "pv" ] ; fhir:condition [ fhir:v "(reference.exists() and (reference.startsWith('Patient/') or reference.startsWith('Organization/'))) or (reference.empty() and (type.empty() or ('/' + type).endsWith('/Patient') or ('/' + type).endsWith('/Organization')))" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "att" ] ; fhir:element [ fhir:v "party" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "pv" ] ] ) ] ) ] ) ] ) ] ) ; fhir:documentation [ fhir:v "Everyone on the round attests the note. The item repeats, so this yields\r\none attester per clinician picked." ] ] [ fhir:name [ fhir:v "findingsRule" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ; fhir:element [ fhir:v "item" ] ; fhir:variable [ fhir:v "it" ] ; fhir:condition [ fhir:v "(linkId = 'findings') and answer.value.exists()" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "comp" ] ; fhir:element [ fhir:v "section" ] ; fhir:variable [ fhir:v "sec" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "findingsTitle" ] ; fhir:source ( [ fhir:context [ fhir:v "it" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "sec" ] ; fhir:element [ fhir:v "title" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "Findings" ] ] ) ] ) ] [ fhir:name [ fhir:v "findingsText" ] ; fhir:source ( [ fhir:context [ fhir:v "it" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "sec" ] ] ) ; fhir:dependent ( [ fhir:name [ fhir:v "AddSectionText" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "it" ] ] [ fhir:value [ a fhir:id ; fhir:v "sec" ] ] ) ] ) ] ) ] [ fhir:name [ fhir:v "decisionsRule" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ; fhir:element [ fhir:v "item" ] ; fhir:variable [ fhir:v "it" ] ; fhir:condition [ fhir:v "(linkId = 'decisions') and answer.value.exists()" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "comp" ] ; fhir:element [ fhir:v "section" ] ; fhir:variable [ fhir:v "sec" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "decisionsTitle" ] ; fhir:source ( [ fhir:context [ fhir:v "it" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "sec" ] ; fhir:element [ fhir:v "title" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "Decisions" ] ] ) ] ) ] [ fhir:name [ fhir:v "decisionsText" ] ; fhir:source ( [ fhir:context [ fhir:v "it" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "sec" ] ] ) ; fhir:dependent ( [ fhir:name [ fhir:v "AddSectionText" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "it" ] ] [ fhir:value [ a fhir:id ; fhir:v "sec" ] ] ) ] ) ] ) ] [ fhir:name [ fhir:v "jobsSectionRule" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ; fhir:element [ fhir:v "item" ] ; fhir:variable [ fhir:v "it" ] ; fhir:condition [ fhir:v "(linkId = 'jobs') and answer.value.exists()" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "comp" ] ; fhir:element [ fhir:v "section" ] ; fhir:variable [ fhir:v "sec" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "jobsTitle" ] ; fhir:source ( [ fhir:context [ fhir:v "it" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "sec" ] ; fhir:element [ fhir:v "title" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "Jobs for the team" ] ] ) ] ) ] [ fhir:name [ fhir:v "jobsText" ] ; fhir:source ( [ fhir:context [ fhir:v "it" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "sec" ] ] ) ; fhir:dependent ( [ fhir:name [ fhir:v "AddSectionText" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "it" ] ] [ fhir:value [ a fhir:id ; fhir:v "sec" ] ] ) ] ) ] ) ] ) ] [ fhir:name [ fhir:v "jobsTaskRule" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ; fhir:element [ fhir:v "item" ] ; fhir:variable [ fhir:v "itJ" ] ; fhir:condition [ fhir:v "(linkId = 'jobs') and answer.value.exists()" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "jobsAnswer" ] ; fhir:source ( [ fhir:context [ fhir:v "itJ" ] ; fhir:element [ fhir:v "answer" ] ; fhir:listMode [ fhir:v "first" ] ; fhir:variable [ fhir:v "aJ" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "task" ] ; fhir:source ( [ fhir:context [ fhir:v "aJ" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "bundle" ] ; fhir:element [ fhir:v "entry" ] ; fhir:variable [ fhir:v "entryT" ] ] [ fhir:context [ fhir:v "entryT" ] ; fhir:element [ fhir:v "resource" ] ; fhir:variable [ fhir:v "task" ] ; fhir:transform [ fhir:v "create" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "Task" ] ] ) ] ) ; fhir:rule ( [ fhir:name [ fhir:v "responseTags" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "task" ] ] ) ; fhir:dependent ( [ fhir:name [ fhir:v "CopyResponseTags" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "qr" ] ] [ fhir:value [ a fhir:id ; fhir:v "task" ] ] ) ] ) ] [ fhir:name [ fhir:v "idAndFullUrl" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "task" ] ; fhir:element [ fhir:v "id" ] ; fhir:transform [ fhir:v "uuid" ] ] ) ; fhir:dependent ( [ fhir:name [ fhir:v "SetTaskFullUrl" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "task" ] ] [ fhir:value [ a fhir:id ; fhir:v "entryT" ] ] ) ] ) ] [ fhir:name [ fhir:v "entryRequest" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "entryT" ] ; fhir:element [ fhir:v "request" ] ; fhir:variable [ fhir:v "request" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "requestMethod" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "request" ] ; fhir:element [ fhir:v "method" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "POST" ] ] ) ] ) ] [ fhir:name [ fhir:v "requestUrl" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "request" ] ; fhir:element [ fhir:v "url" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "Task" ] ] ) ] ) ] ) ] [ fhir:name [ fhir:v "status" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "task" ] ; fhir:element [ fhir:v "status" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "requested" ] ] ) ] ) ] [ fhir:name [ fhir:v "intent" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "task" ] ; fhir:element [ fhir:v "intent" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "order" ] ] ) ] ) ] [ fhir:name [ fhir:v "priority" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "task" ] ; fhir:element [ fhir:v "priority" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "routine" ] ] ) ] ) ] [ fhir:name [ fhir:v "taskCode" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "task" ] ; fhir:element [ fhir:v "code" ] ; fhir:variable [ fhir:v "code" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "codeCoding" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "code" ] ; fhir:element [ fhir:v "coding" ] ; fhir:variable [ fhir:v "coding" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "codeSystem" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "coding" ] ; fhir:element [ fhir:v "system" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "https://fhir.slade360.co.ke/fhir/CodeSystem/inpatient-clinical-concept-codesystem" ] ] ) ] ) ] [ fhir:name [ fhir:v "codeCode" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "coding" ] ; fhir:element [ fhir:v "code" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "ward-round-job" ] ] ) ] ) ] [ fhir:name [ fhir:v "codeDisplay" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "coding" ] ; fhir:element [ fhir:v "display" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "Job for the team from a ward round" ] ] ) ] ) ] ) ] ) ] [ fhir:name [ fhir:v "description" ] ; fhir:source ( [ fhir:context [ fhir:v "aJ" ] ; fhir:element [ fhir:v "value" ] ; fhir:variable [ fhir:v "v" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "task" ] ; fhir:element [ fhir:v "description" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "v" ] ] ) ] ) ] [ fhir:name [ fhir:v "for" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ; fhir:element [ fhir:v "subject" ] ; fhir:variable [ fhir:v "s" ] ; fhir:condition [ fhir:v "(reference.exists() and (reference.startsWith('Patient/'))) or (reference.empty() and (type.empty() or ('/' + type).endsWith('/Patient')))" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "task" ] ; fhir:element [ fhir:v "for" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "s" ] ] ) ] ) ] [ fhir:name [ fhir:v "encounter" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ; fhir:element [ fhir:v "encounter" ] ; fhir:variable [ fhir:v "e" ] ; fhir:condition [ fhir:v "(reference.exists() and (reference.startsWith('Encounter/'))) or (reference.empty() and (type.empty() or ('/' + type).endsWith('/Encounter')))" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "task" ] ; fhir:element [ fhir:v "encounter" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "e" ] ] ) ] ) ] [ fhir:name [ fhir:v "authoredOn" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ; fhir:element [ fhir:v "authored" ] ; fhir:variable [ fhir:v "t" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "task" ] ; fhir:element [ fhir:v "authoredOn" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "t" ] ] ) ] ) ] [ fhir:name [ fhir:v "lastModified" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ; fhir:element [ fhir:v "authored" ] ; fhir:variable [ fhir:v "t" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "task" ] ; fhir:element [ fhir:v "lastModified" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "t" ] ] ) ] ) ] [ fhir:name [ fhir:v "requesterFromAuthor" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ; fhir:element [ fhir:v "author" ] ; fhir:variable [ fhir:v "a" ] ; fhir:condition [ fhir:v "(reference.exists() and (reference.startsWith('Patient/') or reference.startsWith('Organization/'))) or (reference.empty() and (type.empty() or ('/' + type).endsWith('/Patient') or ('/' + type).endsWith('/Organization')))" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "task" ] ; fhir:element [ fhir:v "requester" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "a" ] ] ) ] ) ] [ fhir:name [ fhir:v "requesterFallback" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ; fhir:condition [ fhir:v "author.where(((reference.exists() and (reference.startsWith('Patient/') or reference.startsWith('Organization/'))) or (reference.empty() and (type.empty() or ('/' + type).endsWith('/Patient') or ('/' + type).endsWith('/Organization'))))).exists().not()" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "requesterFromSource" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ; fhir:element [ fhir:v "source" ] ; fhir:variable [ fhir:v "src" ] ; fhir:condition [ fhir:v "(reference.exists() and (reference.startsWith('Patient/') or reference.startsWith('Organization/'))) or (reference.empty() and (type.empty() or ('/' + type).endsWith('/Patient') or ('/' + type).endsWith('/Organization')))" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "task" ] ; fhir:element [ fhir:v "requester" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "src" ] ] ) ] ) ] ) ] [ fhir:name [ fhir:v "linkQuestionnaireResponse" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "task" ] ; fhir:element [ fhir:v "basedOn" ] ; fhir:variable [ fhir:v "ref" ] ; fhir:transform [ fhir:v "create" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "Reference" ] ] ) ] ) ; fhir:rule ( [ fhir:name [ fhir:v "basedOnRef" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ; fhir:element [ fhir:v "id" ] ; fhir:variable [ fhir:v "qid" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "ref" ] ; fhir:element [ fhir:v "reference" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "qid" ] ] ) ] ) ] ) ; fhir:documentation [ fhir:v "basedOn, not focus: the round authorised the work, it is not the\r\nthing the work acts upon." ] ] ) ] ) ] ) ; fhir:documentation [ fhir:v "The jobs are also actionable work, so they leave the document as a Task the\r\nward can pick up and close." ] ] ) ] [ fhir:name [ fhir:v "BuildNoteBase" ] ; fhir:documentation [ fhir:v "─────────────────────────────────────────────────────────────────────────────\r\nShared note scaffolding. Repeated in each note map rather than imported: the\r\ntransform engine resolves `imports` against whatever StructureMaps happen to\r\nbe on the server, and a note that stops extracting because a shared map was\r\nnot uploaded 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." ] ; fhir:input ( [ fhir:name [ fhir:v "qr" ] ; fhir:type [ fhir:v "QR" ] ; fhir:mode [ fhir:v "source" ] ] [ fhir:name [ fhir:v "comp" ] ; fhir:type [ fhir:v "Composition" ] ; fhir:mode [ fhir:v "target" ] ] [ fhir:name [ fhir:v "entry" ] ; fhir:mode [ fhir:v "target" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "idAndFullUrl" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "comp" ] ; fhir:element [ fhir:v "id" ] ; fhir:transform [ fhir:v "uuid" ] ] ) ; fhir:dependent ( [ fhir:name [ fhir:v "SetCompositionFullUrl" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "comp" ] ] [ fhir:value [ a fhir:id ; fhir:v "entry" ] ] ) ] ) ] [ fhir:name [ fhir:v "entryRequest" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "entry" ] ; fhir:element [ fhir:v "request" ] ; fhir:variable [ fhir:v "request" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "requestMethod" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "request" ] ; fhir:element [ fhir:v "method" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "POST" ] ] ) ] ) ] [ fhir:name [ fhir:v "requestUrl" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "request" ] ; fhir:element [ fhir:v "url" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "Composition" ] ] ) ] ) ] ) ] [ fhir:name [ fhir:v "status" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "comp" ] ; fhir:element [ fhir:v "status" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "final" ] ] ) ] ) ] [ fhir:name [ fhir:v "subject" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ; fhir:element [ fhir:v "subject" ] ; fhir:variable [ fhir:v "s" ] ; fhir:condition [ fhir:v "(reference.exists() and (reference.contains('://').not() and reference.startsWith('#').not() and reference.startsWith('urn:').not())) or reference.empty()" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "comp" ] ; fhir:element [ fhir:v "subject" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "s" ] ] ) ] ) ] [ fhir:name [ fhir:v "encounter" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ; fhir:element [ fhir:v "encounter" ] ; fhir:variable [ fhir:v "e" ] ; fhir:condition [ fhir:v "(reference.exists() and (reference.startsWith('Encounter/'))) or (reference.empty() and (type.empty() or ('/' + type).endsWith('/Encounter')))" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "comp" ] ; fhir:element [ fhir:v "encounter" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "e" ] ] ) ] ) ] [ fhir:name [ fhir:v "date" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ; fhir:element [ fhir:v "authored" ] ; fhir:variable [ fhir:v "t" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "comp" ] ; fhir:element [ fhir:v "date" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "t" ] ] ) ] ) ; fhir:documentation [ fhir:v "Composition.date is 1..1. `authored` is only 0..1 on the response, so when a\r\nclient sends none the extraction time stands in. It is a poor substitute for\r\nwhen the note was written, but a document with no date at all is worse, and\r\nextraction happens moments after submission in practice." ] ] [ fhir:name [ fhir:v "dateFallback" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ; fhir:condition [ fhir:v "authored.exists().not()" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "dateFromExtractionTime" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "comp" ] ; fhir:element [ fhir:v "date" ] ; fhir:transform [ fhir:v "evaluate" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "qr" ] ] [ fhir:value [ a fhir:string ; fhir:v "now()" ] ] ) ] ) ] ) ] [ fhir:name [ fhir:v "authorFromAuthor" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ; fhir:element [ fhir:v "author" ] ; fhir:variable [ fhir:v "a" ] ; fhir:condition [ fhir:v "(reference.exists() and (reference.startsWith('Patient/') or reference.startsWith('Organization/'))) or (reference.empty() and (type.empty() or ('/' + type).endsWith('/Patient') or ('/' + type).endsWith('/Organization')))" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "comp" ] ; fhir:element [ fhir:v "author" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "a" ] ] ) ] ) ; fhir:documentation [ fhir:v "Composition.author is 1..1 minimum. R5 QuestionnaireResponse carries both\r\n`author` (who recorded the answers) and `source` (who supplied them); the\r\nauthor is the one who wrote the note, so it wins, and `source` only stands\r\nin when the client did not send an author. If the response carries neither,\r\nthe note comes out unauthored -- there is nothing on a QuestionnaireResponse\r\nto invent one from, and guessing at who wrote a clinical note is not a thing\r\na map should do." ] ] [ fhir:name [ fhir:v "authorFallback" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ; fhir:condition [ fhir:v "author.where(((reference.exists() and (reference.startsWith('Patient/') or reference.startsWith('Organization/'))) or (reference.empty() and (type.empty() or ('/' + type).endsWith('/Patient') or ('/' + type).endsWith('/Organization'))))).exists().not()" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "authorFromSource" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ; fhir:element [ fhir:v "source" ] ; fhir:variable [ fhir:v "src" ] ; fhir:condition [ fhir:v "(reference.exists() and (reference.startsWith('Patient/') or reference.startsWith('Organization/'))) or (reference.empty() and (type.empty() or ('/' + type).endsWith('/Patient') or ('/' + type).endsWith('/Organization')))" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "comp" ] ; fhir:element [ fhir:v "author" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "src" ] ] ) ] ) ] ) ] [ fhir:name [ fhir:v "linkQuestionnaireResponse" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "comp" ] ; fhir:element [ fhir:v "relatesTo" ] ; fhir:variable [ fhir:v "rel" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "relatesToType" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "rel" ] ; fhir:element [ fhir:v "type" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "derived-from" ] ] ) ] ) ] [ fhir:name [ fhir:v "relatesToTarget" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "rel" ] ; fhir:element [ fhir:v "resourceReference" ] ; fhir:variable [ fhir:v "ref" ] ; fhir:transform [ fhir:v "create" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "Reference" ] ] ) ] ) ; fhir:rule ( [ fhir:name [ fhir:v "relatesToRef" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ; fhir:element [ fhir:v "id" ] ; fhir:variable [ fhir:v "qid" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "ref" ] ; fhir:element [ fhir:v "reference" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "qid" ] ] ) ] ) ] ) ] ) ] ) ] [ fhir:name [ fhir:v "AddSectionText" ] ; fhir:input ( [ fhir:name [ fhir:v "it" ] ; fhir:mode [ fhir:v "source" ] ] [ fhir:name [ fhir:v "sec" ] ; fhir:mode [ fhir:v "target" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "sectionAnswer" ] ; fhir:source ( [ fhir:context [ fhir:v "it" ] ; fhir:element [ fhir:v "answer" ] ; fhir:listMode [ fhir:v "first" ] ; fhir:variable [ fhir:v "a" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "sectionText" ] ; fhir:source ( [ fhir:context [ fhir:v "a" ] ; fhir:element [ fhir:v "value" ] ; fhir:variable [ fhir:v "v" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "sec" ] ; fhir:element [ fhir:v "text" ] ; fhir:variable [ fhir:v "narrative" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "narrativeStatus" ] ; fhir:source ( [ fhir:context [ fhir:v "v" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "narrative" ] ; fhir:element [ fhir:v "status" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "generated" ] ] ) ] ) ] [ fhir:name [ fhir:v "narrativeXhtml" ] ; fhir:source ( [ fhir:context [ fhir:v "v" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "narrative" ] ; fhir:element [ fhir:v "div" ] ; fhir:variable [ fhir:v "xhtml" ] ; fhir:transform [ fhir:v "create" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "xhtml" ] ] ) ] ) ; fhir:rule ( [ fhir:name [ fhir:v "narrativeDiv" ] ; fhir:source ( [ fhir:context [ fhir:v "v" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "xhtml" ] ; fhir:element [ fhir:v "value" ] ; fhir:transform [ fhir:v "evaluate" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "a" ] ] [ fhir:value [ a fhir:string ; fhir:v "'<div xmlns=\"http://www.w3.org/1999/xhtml\"><p>' + value.toString().escape('html') + '</p></div>'" ] ] ) ] ) ] ) ] ) ] ) ] ) ] [ fhir:name [ fhir:v "SetCompositionFullUrl" ] ; fhir:input ( [ fhir:name [ fhir:v "comp" ] ; fhir:type [ fhir:v "Composition" ] ; fhir:mode [ fhir:v "source" ] ] [ fhir:name [ fhir:v "entry" ] ; fhir:mode [ fhir:v "target" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "assignFullUrl" ] ; fhir:source ( [ fhir:context [ fhir:v "comp" ] ; fhir:element [ fhir:v "id" ] ; fhir:variable [ fhir:v "id" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "entry" ] ; fhir:element [ fhir:v "fullUrl" ] ; fhir:transform [ fhir:v "append" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "https://fhir.slade360.co.ke/fhir/Composition/" ] ] [ fhir:value [ a fhir:id ; fhir:v "id" ] ] ) ] ) ] ) ] [ fhir:name [ fhir:v "SetTaskFullUrl" ] ; fhir:input ( [ fhir:name [ fhir:v "task" ] ; fhir:type [ fhir:v "Task" ] ; fhir:mode [ fhir:v "source" ] ] [ fhir:name [ fhir:v "entry" ] ; fhir:mode [ fhir:v "target" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "assignFullUrl" ] ; fhir:source ( [ fhir:context [ fhir:v "task" ] ; fhir:element [ fhir:v "id" ] ; fhir:variable [ fhir:v "id" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "entry" ] ; fhir:element [ fhir:v "fullUrl" ] ; fhir:transform [ fhir:v "append" ] ; fhir:parameter ( [ fhir:value [ a fhir:string ; fhir:v "https://fhir.slade360.co.ke/fhir/Task/" ] ] [ fhir:value [ a fhir:id ; fhir:v "id" ] ] ) ] ) ] ) ] [ fhir:name [ fhir:v "CopyResponseTags" ] ; fhir:documentation [ fhir:v "── Tenancy ──────────────────────────────────────────────────────────────────\r\nWhose this is. The platform says which tenant a response belongs to with a\r\ntag on the response, and every tag the response carries is copied onto\r\neverything this map creates, as it is. Copied rather than named here, so the\r\nmap never has to know which tenant it is running for, nor which system the\r\ntag is under: that system has moved more than once." ] ; fhir:input ( [ fhir:name [ fhir:v "qr" ] ; fhir:type [ fhir:v "QR" ] ; fhir:mode [ fhir:v "source" ] ] [ fhir:name [ fhir:v "r" ] ; fhir:mode [ fhir:v "target" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "tenantTags" ] ; fhir:source ( [ fhir:context [ fhir:v "qr" ] ; fhir:element [ fhir:v "meta" ] ; fhir:variable [ fhir:v "qm" ] ] ) ; fhir:rule ( [ fhir:name [ fhir:v "copyTag" ] ; fhir:source ( [ fhir:context [ fhir:v "qm" ] ; fhir:element [ fhir:v "tag" ] ; fhir:variable [ fhir:v "qt" ] ] ) ; fhir:target ( [ fhir:context [ fhir:v "r" ] ; fhir:element [ fhir:v "meta" ] ; fhir:variable [ fhir:v "m" ] ] [ fhir:context [ fhir:v "m" ] ; fhir:element [ fhir:v "tag" ] ; fhir:transform [ fhir:v "copy" ] ; fhir:parameter ( [ fhir:value [ a fhir:id ; fhir:v "qt" ] ] ) ] ) ] ) ] ) ] ) . #
IG © 2025+ Kathurima Kimathi. Package silfhirprofileig#0.1.0 based on FHIR 5.0.0. Generated 2026-10-06
Links: Table of Contents |
QA Report