FHIR IG analytics| Package | silfhirprofileig |
| Resource Type | StructureMap |
| Id | StructureMap-ExtractBradenScale.json |
| FHIR Version | R5 |
| Source | https://build.fhir.org/ig/savannahghi/sil_fhir_profile_ig/StructureMap-ExtractBradenScale.html |
| URL | https://fhir.slade360.co.ke/fhir/StructureMap/ExtractBradenScale |
| Version | 0.1.0 |
| Status | active |
| Date | 2026-09-11T12:18:36+00:00 |
| Name | ExtractBradenScale |
| Title | Braden Scale Skin Assessment Extraction |
| Description | The LOINC Braden scale panel out as one Observation carrying the total, with the six sub-scores as components, plus a RiskAssessment for the band the total falls in. The total prefers what the form submitted and otherwise sums the answers itself, and it only extracts when all six sub-scores have been answered: a Braden computed from four of six items is not a Braden score, and banding one would put a number a nurse can act on next to a risk tier that is wrong. |
No resources found
No resources found
Note: links and images are rebased to the (stated) source
Generated Narrative: StructureMap ExtractBradenScale
/// url = 'https://fhir.slade360.co.ke/fhir/StructureMap/ExtractBradenScale' /// name = 'ExtractBradenScale' /// title = 'Braden Scale Skin Assessment Extraction' /// status = 'active' /// description = 'The LOINC Braden scale panel out as one Observation carrying the total, with the six sub-scores as components, plus a RiskAssessment for the band the total falls in. The total prefers what the form submitted and otherwise sums the answers itself, and it only extracts when all six sub-scores have been answered: a Braden computed from four of six items is not a Braden score, and banding one would put a number a nurse can act on next to a risk tier that is wrong.' 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/RiskAssessment" alias RiskAssessment as target group ExtractBradenScale(source qr : QR, target bundle : Bundle) { qr -> bundle.type = 'transaction' "setBundleType"; // LOINC publishes this panel flat -- the six sub-scores, the total and the risk // level are all top-level items, keyed by their own LOINC code -- so there is no // group to hang the Observation off and the response itself is the anchor. qr where (item.where(linkId in ('38222-6' | '38229-1' | '38223-4' | '38224-2' | '38225-9' | '38226-7')).answer.value.ofType(Coding).exists()) -> bundle.entry as entry, entry.resource = create('Observation') as obs then { qr -> obs, entry then BuildObsBase(qr, obs, entry) "base"; qr -> obs then SetSurveyCategory(qr, obs) "category"; qr -> obs.code as code then { qr -> code.coding as coding then { qr -> coding.system = 'http://loinc.org' "codeSystem"; qr -> coding.code = '38227-5' "codeCode"; qr -> coding.display = 'Braden scale total score' "codeDisplay"; } "codeCoding"; } "code"; // The submitted total wins; otherwise sum the answers. // The weight cannot be read off the code the way the SGHI-coded instruments // allow, because these are LOINC answer codes and LA9605-2 says nothing about // being worth 3. It is read off a lookup instead. That lookup is safe to write // globally rather than per sub-score: the twenty-one answer codes across the // six items collapse to nineteen distinct ones, and the two that repeat -- // LA9604-5 "Very limited" and LA9605-2 "Slightly limited", shared by sensory // perception and mobility -- carry the same weight in both. Both paths are the // arithmetic Bergstrom published, so they cannot disagree. // truncate(), not toInteger(): the form types the total `decimal`, and this // engine's toInteger() returns empty for anything with a fractional part. // Observation.value has no decimal choice, so it has to land as an integer. // Guarded on all six sub-scores being present. qr where (item.where(linkId in ('38222-6' | '38229-1' | '38223-4' | '38224-2' | '38225-9' | '38226-7')).answer.value.ofType(Coding).count() = 6) then { qr -> obs.value = evaluate(qr, iif(item.where(linkId = '38227-5').answer.value.exists(), item.where(linkId = '38227-5').answer.value.truncate(), item.where(linkId in ('38222-6' | '38229-1' | '38223-4' | '38224-2' | '38225-9' | '38226-7')).answer.value.ofType(Coding).code.select(iif($this in ('LA9603-7' | 'LA9607-8' | 'LA6742-6' | 'LA9614-4' | 'LA9615-1' | 'LA9617-7'), 1, iif($this in ('LA9604-5' | 'LA9608-6' | 'LA9611-0' | 'LA9616-9' | 'LA9618-5'), 2, iif($this in ('LA9605-2' | 'LA9609-4' | 'LA9612-8' | 'LA8913-1' | 'LA9619-3'), 3, iif($this in ('LA9606-0' | 'LA9610-2' | 'LA9613-6' | 'LA120-8' | 'LA9206-9'), 4, 0))))).aggregate($this + $total, 0))) "totalValue"; } "totalRule"; qr.item as it where ((linkId = '38222-6') and answer.value.exists()) -> obs.component as comp then { it -> comp.code as code then { it -> code.coding as coding then { it -> coding.system = 'http://loinc.org' "codeSystem"; it -> coding.code = '38222-6' "codeCode"; it -> coding.display = 'Sensory perception Braden scale' "codeDisplay"; } "codeCoding"; } "sensoryCode"; it -> comp then SetComponentCodedValue(it, comp) "sensoryValue"; } "sensoryRule"; qr.item as it where ((linkId = '38229-1') and answer.value.exists()) -> obs.component as comp then { it -> comp.code as code then { it -> code.coding as coding then { it -> coding.system = 'http://loinc.org' "codeSystem"; it -> coding.code = '38229-1' "codeCode"; it -> coding.display = 'Moisture exposure Braden scale' "codeDisplay"; } "codeCoding"; } "moistureCode"; it -> comp then SetComponentCodedValue(it, comp) "moistureValue"; } "moistureRule"; qr.item as it where ((linkId = '38223-4') and answer.value.exists()) -> obs.component as comp then { it -> comp.code as code then { it -> code.coding as coding then { it -> coding.system = 'http://loinc.org' "codeSystem"; it -> coding.code = '38223-4' "codeCode"; it -> coding.display = 'Physical activity Braden scale' "codeDisplay"; } "codeCoding"; } "activityCode"; it -> comp then SetComponentCodedValue(it, comp) "activityValue"; } "activityRule"; qr.item as it where ((linkId = '38224-2') and answer.value.exists()) -> obs.component as comp then { it -> comp.code as code then { it -> code.coding as coding then { it -> coding.system = 'http://loinc.org' "codeSystem"; it -> coding.code = '38224-2' "codeCode"; it -> coding.display = 'Physical mobility Braden scale' "codeDisplay"; } "codeCoding"; } "mobilityCode"; it -> comp then SetComponentCodedValue(it, comp) "mobilityValue"; } "mobilityRule"; qr.item as it where ((linkId = '38225-9') and answer.value.exists()) -> obs.component as comp then { it -> comp.code as code then { it -> code.coding as coding then { it -> coding.system = 'http://loinc.org' "codeSystem"; it -> coding.code = '38225-9' "codeCode"; it -> coding.display = 'Nutrition intake pattern Braden scale' "codeDisplay"; } "codeCoding"; } "nutritionCode"; it -> comp then SetComponentCodedValue(it, comp) "nutritionValue"; } "nutritionRule"; qr.item as it where ((linkId = '38226-7') and answer.value.exists()) -> obs.component as comp then { it -> comp.code as code then { it -> code.coding as coding then { it -> coding.system = 'http://loinc.org' "codeSystem"; it -> coding.code = '38226-7' "codeCode"; it -> coding.display = 'Friction and shear Braden scale' "codeDisplay"; } "codeCoding"; } "frictionCode"; it -> comp then SetComponentCodedValue(it, comp) "frictionValue"; } "frictionValueRule"; qr -> obs, bundle then AddBradenRiskAssessment(obs, qr, bundle) "band"; } "bradenRule"; } // ───────────────────────────────────────────────────────────────────────────── // The band // Bergstrom's published tiers: 19 and over no risk, 15-18 mild, 13-14 moderate, // 10-12 high, 9 and under very high. Lower is worse. // qualitativeRisk carries two codings and a text. HL7's risk-probability is what // a consumer escalates on, and it has five concepts against Braden's five tiers // but not the same five, so "very high" and "high" both land on #high. LOINC's // own answer list for 81636-3 -- the list printed on the form the nurse filled // in -- has the tier exactly, so it rides alongside and the two never drift. The // text spells the published wording out for anything that only prints. // The band is derived from the total rather than copied from the form's own // risk-level item. That item is a free pick list with nothing calculating it, so // deriving is the only way the number and the tier are guaranteed to agree. // ───────────────────────────────────────────────────────────────────────────── group AddBradenRiskAssessment(source obs : Observation, source qr : QR, target bundle : Bundle) { obs where (value.ofType(integer) <= 9) -> bundle.entry as entry, entry.resource = create('RiskAssessment') as ra then { qr -> ra, entry then BuildRiskBase(qr, obs, ra, entry) "riskBase"; qr -> ra then SetBradenRiskCode(qr, ra) "riskCode"; qr -> ra.prediction as pred then { qr -> pred.qualitativeRisk as risk then { qr -> risk.coding as coding then { qr -> coding.system = 'http://terminology.hl7.org/CodeSystem/risk-probability' "riskSystem"; qr -> coding.code = 'high' "riskCode"; qr -> coding.display = 'High likelihood' "riskDisplay"; } "hl7Coding"; qr -> risk.coding as loinc then { qr -> loinc.system = 'http://loinc.org' "loincSystem"; qr -> loinc.code = 'LA14637-5' "loincCode"; qr -> loinc.display = 'Very high' "loincDisplay"; } "loincCoding"; qr -> risk.text = 'Very high risk' "riskText"; } "qualitativeRisk"; } "prediction"; } "bradenVeryHigh"; obs where ((value.ofType(integer) >= 10) and (value.ofType(integer) <= 12)) -> bundle.entry as entry, entry.resource = create('RiskAssessment') as ra then { qr -> ra, entry then BuildRiskBase(qr, obs, ra, entry) "riskBase"; qr -> ra then SetBradenRiskCode(qr, ra) "riskCode"; qr -> ra.prediction as pred then { qr -> pred.qualitativeRisk as risk then { qr -> risk.coding as coding then { qr -> coding.system = 'http://terminology.hl7.org/CodeSystem/risk-probability' "riskSystem"; qr -> coding.code = 'high' "riskCode"; qr -> coding.display = 'High likelihood' "riskDisplay"; } "hl7Coding"; qr -> risk.coding as loinc then { qr -> loinc.system = 'http://loinc.org' "loincSystem"; qr -> loinc.code = 'LA9193-9' "loincCode"; qr -> loinc.display = 'High' "loincDisplay"; } "loincCoding"; qr -> risk.text = 'High risk' "riskText"; } "qualitativeRisk"; } "prediction"; } "bradenHigh"; obs where ((value.ofType(integer) >= 13) and (value.ofType(integer) <= 14)) -> bundle.entry as entry, entry.resource = create('RiskAssessment') as ra then { qr -> ra, entry then BuildRiskBase(qr, obs, ra, entry) "riskBase"; qr -> ra then SetBradenRiskCode(qr, ra) "riskCode"; qr -> ra.prediction as pred then { qr -> pred.qualitativeRisk as risk then { qr -> risk.coding as coding then { qr -> coding.system = 'http://terminology.hl7.org/CodeSystem/risk-probability' "riskSystem"; qr -> coding.code = 'moderate' "riskCode"; qr -> coding.display = 'Moderate likelihood' "riskDisplay"; } "hl7Coding"; qr -> risk.coding as loinc then { qr -> loinc.system = 'http://loinc.org' "loincSystem"; qr -> loinc.code = 'LA6751-7' "loincCode"; qr -> loinc.display = 'Moderate' "loincDisplay"; } "loincCoding"; qr -> risk.text = 'Moderate risk' "riskText"; } "qualitativeRisk"; } "prediction"; } "bradenModerate"; obs where ((value.ofType(integer) >= 15) and (value.ofType(integer) <= 18)) -> bundle.entry as entry, entry.resource = create('RiskAssessment') as ra then { qr -> ra, entry then BuildRiskBase(qr, obs, ra, entry) "riskBase"; qr -> ra then SetBradenRiskCode(qr, ra) "riskCode"; qr -> ra.prediction as pred then { qr -> pred.qualitativeRisk as risk then { qr -> risk.coding as coding then { qr -> coding.system = 'http://terminology.hl7.org/CodeSystem/risk-probability' "riskSystem"; qr -> coding.code = 'low' "riskCode"; qr -> coding.display = 'Low likelihood' "riskDisplay"; } "hl7Coding"; qr -> risk.coding as loinc then { qr -> loinc.system = 'http://loinc.org' "loincSystem"; qr -> loinc.code = 'LA6752-5' "loincCode"; qr -> loinc.display = 'Mild' "loincDisplay"; } "loincCoding"; qr -> risk.text = 'Mild risk' "riskText"; } "qualitativeRisk"; } "prediction"; } "bradenMild"; obs where (value.ofType(integer) >= 19) -> bundle.entry as entry, entry.resource = create('RiskAssessment') as ra then { qr -> ra, entry then BuildRiskBase(qr, obs, ra, entry) "riskBase"; qr -> ra then SetBradenRiskCode(qr, ra) "riskCode"; qr -> ra.prediction as pred then { qr -> pred.qualitativeRisk as risk then { qr -> risk.coding as coding then { qr -> coding.system = 'http://terminology.hl7.org/CodeSystem/risk-probability' "riskSystem"; qr -> coding.code = 'negligible' "riskCode"; qr -> coding.display = 'Negligible likelihood' "riskDisplay"; } "hl7Coding"; qr -> risk.coding as loinc then { qr -> loinc.system = 'http://loinc.org' "loincSystem"; qr -> loinc.code = 'LA19983-8' "loincCode"; qr -> loinc.display = 'No risk' "loincDisplay"; } "loincCoding"; qr -> risk.text = 'No risk identified' "riskText"; } "qualitativeRisk"; } "prediction"; } "bradenNoRisk"; } group SetBradenRiskCode(source qr : QR, target ra : RiskAssessment) { qr -> ra.code as code then { qr -> code.coding as coding then { qr -> coding.system = 'http://loinc.org' "codeSystem"; qr -> coding.code = '81636-3' "codeCode"; qr -> coding.display = 'Pressure injury risk level Braden scale' "codeDisplay"; } "codeCoding"; } "code"; } // ───────────────────────────────────────────────────────────────────────────── // 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"; // A stored response's id already reads "QuestionnaireResponse/<id>", so it is a // relative reference as it stands. The hasValue() guard is what stops an // unsaved response -- one posted straight to $extract rather than saved first -- // from writing "QuestionnaireResponse/null" into the record. qr.id as qid where ($this.hasValue()) -> obs.derivedFrom = create('Reference') as ref, ref.reference = qid "linkQuestionnaireResponse"; } // The RiskAssessment stands on two things: the response that was filled in and // the Observation that holds the number. Both go in basis, which is what the // SGHI RiskAssessment profile binds to a QuestionnaireResponse. group BuildRiskBase(source qr : QR, source obs : Observation, target ra : RiskAssessment, target entry) { qr -> ra.id = uuid() then SetRiskAssessmentFullUrl(ra, entry) "idAndFullUrl"; qr -> entry.request as request then { qr -> request.method = 'POST' "requestMethod"; qr -> request.url = 'RiskAssessment' "requestUrl"; } "entryRequest"; qr -> ra.status = 'final' "status"; qr.subject as s -> ra.subject = s; qr.encounter as e -> ra.encounter = e; qr.authored as t -> ra.occurrence = t "occurrence"; qr.author as a -> ra.performer = a "performerFromAuthor"; qr where (author.exists().not()) then { qr.source as src -> ra.performer = src "performerFromSource"; } "performerFallback"; qr.id as qid where ($this.hasValue()) -> ra.basis = create('Reference') as qref, qref.reference = qid "basisResponse"; obs.id as oid -> ra.basis = create('Reference') as oref then { oid -> oref.reference = append('Observation/', oid) "basisObservationRef"; } "basisObservation"; } group SetComponentCodedValue(source it, target comp) { it.answer first as a then { a.value as cv -> comp.value = create('CodeableConcept') as cc then { cv -> cc.coding = cv "valueCoding"; cv.display as d -> cc.text = d "valueText"; } "codedValue"; } "componentAnswer"; } 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 SetObservationFullUrl(source obs : Observation, target entry) { obs.id as id -> entry.fullUrl = append('https://fhir.slade360.co.ke/fhir/Observation/', id) "assignFullUrl"; } group SetRiskAssessmentFullUrl(source ra : RiskAssessment, target entry) { ra.id as id -> entry.fullUrl = append('https://fhir.slade360.co.ke/fhir/RiskAssessment/', id) "assignFullUrl"; }
{
"resourceType": "StructureMap",
"id": "ExtractBradenScale",
"text": {
"status": "generated",
"div": "<!-- snip (see above) -->"
},
"url": "https://fhir.slade360.co.ke/fhir/StructureMap/ExtractBradenScale",
"version": "0.1.0",
"name": "ExtractBradenScale",
"title": "Braden Scale Skin 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 LOINC Braden scale panel out as one Observation carrying the total, with the six sub-scores as components, plus a RiskAssessment for the band the total falls in. The total prefers what the form submitted and otherwise sums the answers itself, and it only extracts when all six sub-scores have been answered: a Braden computed from four of six items is not a Braden score, and banding one would put a number a nurse can act on next to a risk tier that is wrong.",
"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/RiskAssessment",
"mode": "target",
"alias": "RiskAssessment"
}
],
"group": [
{
"name": "ExtractBradenScale",
"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": "bradenRule",
"source": [
{
"context": "qr",
"condition": "item.where(linkId in ('38222-6' | '38229-1' | '38223-4' | '38224-2' | '38225-9' | '38226-7')).answer.value.ofType(Coding).exists()"
}
],
"target": [
{
"context": "bundle",
"element": "entry",
"variable": "entry"
},
{
"context": "entry",
"element": "resource",
"variable": "obs",
"transform": "create",
"parameter": [
{
"valueString": "Observation"
}
]
}
],
"rule": [
{
"name": "base",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "obs"
},
{
"context": "entry"
}
],
"dependent": [
{
"name": "BuildObsBase",
"parameter": [
{
"valueId": "qr"
},
{
"valueId": "obs"
},
{
"valueId": "entry"
}
]
}
]
},
{
"name": "category",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "obs"
}
],
"dependent": [
{
"name": "SetSurveyCategory",
"parameter": [
{
"valueId": "qr"
},
{
"valueId": "obs"
}
]
}
]
},
{
"name": "code",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "obs",
"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": "38227-5"
}
]
}
]
},
{
"name": "codeDisplay",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "Braden scale total score"
}
]
}
]
}
]
}
]
},
{
"name": "totalRule",
"source": [
{
"context": "qr",
"condition": "item.where(linkId in ('38222-6' | '38229-1' | '38223-4' | '38224-2' | '38225-9' | '38226-7')).answer.value.ofType(Coding).count() = 6"
}
],
"rule": [
{
"name": "totalValue",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "obs",
"element": "value",
"transform": "evaluate",
"parameter": [
{
"valueId": "qr"
},
{
"valueString": "iif(item.where(linkId = '38227-5').answer.value.exists(), item.where(linkId = '38227-5').answer.value.truncate(), item.where(linkId in ('38222-6' | '38229-1' | '38223-4' | '38224-2' | '38225-9' | '38226-7')).answer.value.ofType(Coding).code.select(iif($this in ('LA9603-7' | 'LA9607-8' | 'LA6742-6' | 'LA9614-4' | 'LA9615-1' | 'LA9617-7'), 1, iif($this in ('LA9604-5' | 'LA9608-6' | 'LA9611-0' | 'LA9616-9' | 'LA9618-5'), 2, iif($this in ('LA9605-2' | 'LA9609-4' | 'LA9612-8' | 'LA8913-1' | 'LA9619-3'), 3, iif($this in ('LA9606-0' | 'LA9610-2' | 'LA9613-6' | 'LA120-8' | 'LA9206-9'), 4, 0))))).aggregate($this + $total, 0))"
}
]
}
]
}
],
"documentation": "The submitted total wins; otherwise sum the answers.\r\nThe weight cannot be read off the code the way the SGHI-coded instruments\r\nallow, because these are LOINC answer codes and LA9605-2 says nothing about\r\nbeing worth 3. It is read off a lookup instead. That lookup is safe to write\r\nglobally rather than per sub-score: the twenty-one answer codes across the\r\nsix items collapse to nineteen distinct ones, and the two that repeat --\r\nLA9604-5 \"Very limited\" and LA9605-2 \"Slightly limited\", shared by sensory\r\nperception and mobility -- carry the same weight in both. Both paths are the\r\narithmetic Bergstrom published, so they cannot disagree.\r\ntruncate(), not toInteger(): the form types the total `decimal`, and this\r\nengine's toInteger() returns empty for anything with a fractional part.\r\nObservation.value has no decimal choice, so it has to land as an integer.\r\nGuarded on all six sub-scores being present."
},
{
"name": "sensoryRule",
"source": [
{
"context": "qr",
"element": "item",
"variable": "it",
"condition": "(linkId = '38222-6') and answer.value.exists()"
}
],
"target": [
{
"context": "obs",
"element": "component",
"variable": "comp"
}
],
"rule": [
{
"name": "sensoryCode",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "comp",
"element": "code",
"variable": "code"
}
],
"rule": [
{
"name": "codeCoding",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "code",
"element": "coding",
"variable": "coding"
}
],
"rule": [
{
"name": "codeSystem",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "coding",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "http://loinc.org"
}
]
}
]
},
{
"name": "codeCode",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "coding",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "38222-6"
}
]
}
]
},
{
"name": "codeDisplay",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "coding",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "Sensory perception Braden scale"
}
]
}
]
}
]
}
]
},
{
"name": "sensoryValue",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "comp"
}
],
"dependent": [
{
"name": "SetComponentCodedValue",
"parameter": [
{
"valueId": "it"
},
{
"valueId": "comp"
}
]
}
]
}
]
},
{
"name": "moistureRule",
"source": [
{
"context": "qr",
"element": "item",
"variable": "it",
"condition": "(linkId = '38229-1') and answer.value.exists()"
}
],
"target": [
{
"context": "obs",
"element": "component",
"variable": "comp"
}
],
"rule": [
{
"name": "moistureCode",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "comp",
"element": "code",
"variable": "code"
}
],
"rule": [
{
"name": "codeCoding",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "code",
"element": "coding",
"variable": "coding"
}
],
"rule": [
{
"name": "codeSystem",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "coding",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "http://loinc.org"
}
]
}
]
},
{
"name": "codeCode",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "coding",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "38229-1"
}
]
}
]
},
{
"name": "codeDisplay",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "coding",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "Moisture exposure Braden scale"
}
]
}
]
}
]
}
]
},
{
"name": "moistureValue",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "comp"
}
],
"dependent": [
{
"name": "SetComponentCodedValue",
"parameter": [
{
"valueId": "it"
},
{
"valueId": "comp"
}
]
}
]
}
]
},
{
"name": "activityRule",
"source": [
{
"context": "qr",
"element": "item",
"variable": "it",
"condition": "(linkId = '38223-4') and answer.value.exists()"
}
],
"target": [
{
"context": "obs",
"element": "component",
"variable": "comp"
}
],
"rule": [
{
"name": "activityCode",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "comp",
"element": "code",
"variable": "code"
}
],
"rule": [
{
"name": "codeCoding",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "code",
"element": "coding",
"variable": "coding"
}
],
"rule": [
{
"name": "codeSystem",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "coding",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "http://loinc.org"
}
]
}
]
},
{
"name": "codeCode",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "coding",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "38223-4"
}
]
}
]
},
{
"name": "codeDisplay",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "coding",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "Physical activity Braden scale"
}
]
}
]
}
]
}
]
},
{
"name": "activityValue",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "comp"
}
],
"dependent": [
{
"name": "SetComponentCodedValue",
"parameter": [
{
"valueId": "it"
},
{
"valueId": "comp"
}
]
}
]
}
]
},
{
"name": "mobilityRule",
"source": [
{
"context": "qr",
"element": "item",
"variable": "it",
"condition": "(linkId = '38224-2') and answer.value.exists()"
}
],
"target": [
{
"context": "obs",
"element": "component",
"variable": "comp"
}
],
"rule": [
{
"name": "mobilityCode",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "comp",
"element": "code",
"variable": "code"
}
],
"rule": [
{
"name": "codeCoding",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "code",
"element": "coding",
"variable": "coding"
}
],
"rule": [
{
"name": "codeSystem",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "coding",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "http://loinc.org"
}
]
}
]
},
{
"name": "codeCode",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "coding",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "38224-2"
}
]
}
]
},
{
"name": "codeDisplay",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "coding",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "Physical mobility Braden scale"
}
]
}
]
}
]
}
]
},
{
"name": "mobilityValue",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "comp"
}
],
"dependent": [
{
"name": "SetComponentCodedValue",
"parameter": [
{
"valueId": "it"
},
{
"valueId": "comp"
}
]
}
]
}
]
},
{
"name": "nutritionRule",
"source": [
{
"context": "qr",
"element": "item",
"variable": "it",
"condition": "(linkId = '38225-9') and answer.value.exists()"
}
],
"target": [
{
"context": "obs",
"element": "component",
"variable": "comp"
}
],
"rule": [
{
"name": "nutritionCode",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "comp",
"element": "code",
"variable": "code"
}
],
"rule": [
{
"name": "codeCoding",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "code",
"element": "coding",
"variable": "coding"
}
],
"rule": [
{
"name": "codeSystem",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "coding",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "http://loinc.org"
}
]
}
]
},
{
"name": "codeCode",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "coding",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "38225-9"
}
]
}
]
},
{
"name": "codeDisplay",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "coding",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "Nutrition intake pattern Braden scale"
}
]
}
]
}
]
}
]
},
{
"name": "nutritionValue",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "comp"
}
],
"dependent": [
{
"name": "SetComponentCodedValue",
"parameter": [
{
"valueId": "it"
},
{
"valueId": "comp"
}
]
}
]
}
]
},
{
"name": "frictionValueRule",
"source": [
{
"context": "qr",
"element": "item",
"variable": "it",
"condition": "(linkId = '38226-7') and answer.value.exists()"
}
],
"target": [
{
"context": "obs",
"element": "component",
"variable": "comp"
}
],
"rule": [
{
"name": "frictionCode",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "comp",
"element": "code",
"variable": "code"
}
],
"rule": [
{
"name": "codeCoding",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "code",
"element": "coding",
"variable": "coding"
}
],
"rule": [
{
"name": "codeSystem",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "coding",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "http://loinc.org"
}
]
}
]
},
{
"name": "codeCode",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "coding",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "38226-7"
}
]
}
]
},
{
"name": "codeDisplay",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "coding",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "Friction and shear Braden scale"
}
]
}
]
}
]
}
]
},
{
"name": "frictionValue",
"source": [
{
"context": "it"
}
],
"target": [
{
"context": "comp"
}
],
"dependent": [
{
"name": "SetComponentCodedValue",
"parameter": [
{
"valueId": "it"
},
{
"valueId": "comp"
}
]
}
]
}
]
},
{
"name": "band",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "obs"
},
{
"context": "bundle"
}
],
"dependent": [
{
"name": "AddBradenRiskAssessment",
"parameter": [
{
"valueId": "obs"
},
{
"valueId": "qr"
},
{
"valueId": "bundle"
}
]
}
]
}
],
"documentation": "LOINC publishes this panel flat -- the six sub-scores, the total and the risk\r\nlevel are all top-level items, keyed by their own LOINC code -- so there is no\r\ngroup to hang the Observation off and the response itself is the anchor."
}
]
},
{
"name": "AddBradenRiskAssessment",
"documentation": "─────────────────────────────────────────────────────────────────────────────\r\nThe band\r\nBergstrom's published tiers: 19 and over no risk, 15-18 mild, 13-14 moderate,\r\n10-12 high, 9 and under very high. Lower is worse.\r\nqualitativeRisk carries two codings and a text. HL7's risk-probability is what\r\na consumer escalates on, and it has five concepts against Braden's five tiers\r\nbut not the same five, so \"very high\" and \"high\" both land on #high. LOINC's\r\nown answer list for 81636-3 -- the list printed on the form the nurse filled\r\nin -- has the tier exactly, so it rides alongside and the two never drift. The\r\ntext spells the published wording out for anything that only prints.\r\nThe band is derived from the total rather than copied from the form's own\r\nrisk-level item. That item is a free pick list with nothing calculating it, so\r\nderiving is the only way the number and the tier are guaranteed to agree.\r\n─────────────────────────────────────────────────────────────────────────────",
"input": [
{
"name": "obs",
"type": "Observation",
"mode": "source"
},
{
"name": "qr",
"type": "QR",
"mode": "source"
},
{
"name": "bundle",
"type": "Bundle",
"mode": "target"
}
],
"rule": [
{
"name": "bradenVeryHigh",
"source": [
{
"context": "obs",
"condition": "value.ofType(integer) <= 9"
}
],
"target": [
{
"context": "bundle",
"element": "entry",
"variable": "entry"
},
{
"context": "entry",
"element": "resource",
"variable": "ra",
"transform": "create",
"parameter": [
{
"valueString": "RiskAssessment"
}
]
}
],
"rule": [
{
"name": "riskBase",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "ra"
},
{
"context": "entry"
}
],
"dependent": [
{
"name": "BuildRiskBase",
"parameter": [
{
"valueId": "qr"
},
{
"valueId": "obs"
},
{
"valueId": "ra"
},
{
"valueId": "entry"
}
]
}
]
},
{
"name": "riskCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "ra"
}
],
"dependent": [
{
"name": "SetBradenRiskCode",
"parameter": [
{
"valueId": "qr"
},
{
"valueId": "ra"
}
]
}
]
},
{
"name": "prediction",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "ra",
"element": "prediction",
"variable": "pred"
}
],
"rule": [
{
"name": "qualitativeRisk",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "pred",
"element": "qualitativeRisk",
"variable": "risk"
}
],
"rule": [
{
"name": "hl7Coding",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "risk",
"element": "coding",
"variable": "coding"
}
],
"rule": [
{
"name": "riskSystem",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "http://terminology.hl7.org/CodeSystem/risk-probability"
}
]
}
]
},
{
"name": "riskCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "high"
}
]
}
]
},
{
"name": "riskDisplay",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "High likelihood"
}
]
}
]
}
]
},
{
"name": "loincCoding",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "risk",
"element": "coding",
"variable": "loinc"
}
],
"rule": [
{
"name": "loincSystem",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "loinc",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "http://loinc.org"
}
]
}
]
},
{
"name": "loincCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "loinc",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "LA14637-5"
}
]
}
]
},
{
"name": "loincDisplay",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "loinc",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "Very high"
}
]
}
]
}
]
},
{
"name": "riskText",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "risk",
"element": "text",
"transform": "copy",
"parameter": [
{
"valueString": "Very high risk"
}
]
}
]
}
]
}
]
}
]
},
{
"name": "bradenHigh",
"source": [
{
"context": "obs",
"condition": "(value.ofType(integer) >= 10) and (value.ofType(integer) <= 12)"
}
],
"target": [
{
"context": "bundle",
"element": "entry",
"variable": "entry"
},
{
"context": "entry",
"element": "resource",
"variable": "ra",
"transform": "create",
"parameter": [
{
"valueString": "RiskAssessment"
}
]
}
],
"rule": [
{
"name": "riskBase",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "ra"
},
{
"context": "entry"
}
],
"dependent": [
{
"name": "BuildRiskBase",
"parameter": [
{
"valueId": "qr"
},
{
"valueId": "obs"
},
{
"valueId": "ra"
},
{
"valueId": "entry"
}
]
}
]
},
{
"name": "riskCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "ra"
}
],
"dependent": [
{
"name": "SetBradenRiskCode",
"parameter": [
{
"valueId": "qr"
},
{
"valueId": "ra"
}
]
}
]
},
{
"name": "prediction",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "ra",
"element": "prediction",
"variable": "pred"
}
],
"rule": [
{
"name": "qualitativeRisk",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "pred",
"element": "qualitativeRisk",
"variable": "risk"
}
],
"rule": [
{
"name": "hl7Coding",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "risk",
"element": "coding",
"variable": "coding"
}
],
"rule": [
{
"name": "riskSystem",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "http://terminology.hl7.org/CodeSystem/risk-probability"
}
]
}
]
},
{
"name": "riskCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "high"
}
]
}
]
},
{
"name": "riskDisplay",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "High likelihood"
}
]
}
]
}
]
},
{
"name": "loincCoding",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "risk",
"element": "coding",
"variable": "loinc"
}
],
"rule": [
{
"name": "loincSystem",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "loinc",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "http://loinc.org"
}
]
}
]
},
{
"name": "loincCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "loinc",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "LA9193-9"
}
]
}
]
},
{
"name": "loincDisplay",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "loinc",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "High"
}
]
}
]
}
]
},
{
"name": "riskText",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "risk",
"element": "text",
"transform": "copy",
"parameter": [
{
"valueString": "High risk"
}
]
}
]
}
]
}
]
}
]
},
{
"name": "bradenModerate",
"source": [
{
"context": "obs",
"condition": "(value.ofType(integer) >= 13) and (value.ofType(integer) <= 14)"
}
],
"target": [
{
"context": "bundle",
"element": "entry",
"variable": "entry"
},
{
"context": "entry",
"element": "resource",
"variable": "ra",
"transform": "create",
"parameter": [
{
"valueString": "RiskAssessment"
}
]
}
],
"rule": [
{
"name": "riskBase",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "ra"
},
{
"context": "entry"
}
],
"dependent": [
{
"name": "BuildRiskBase",
"parameter": [
{
"valueId": "qr"
},
{
"valueId": "obs"
},
{
"valueId": "ra"
},
{
"valueId": "entry"
}
]
}
]
},
{
"name": "riskCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "ra"
}
],
"dependent": [
{
"name": "SetBradenRiskCode",
"parameter": [
{
"valueId": "qr"
},
{
"valueId": "ra"
}
]
}
]
},
{
"name": "prediction",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "ra",
"element": "prediction",
"variable": "pred"
}
],
"rule": [
{
"name": "qualitativeRisk",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "pred",
"element": "qualitativeRisk",
"variable": "risk"
}
],
"rule": [
{
"name": "hl7Coding",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "risk",
"element": "coding",
"variable": "coding"
}
],
"rule": [
{
"name": "riskSystem",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "http://terminology.hl7.org/CodeSystem/risk-probability"
}
]
}
]
},
{
"name": "riskCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "moderate"
}
]
}
]
},
{
"name": "riskDisplay",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "Moderate likelihood"
}
]
}
]
}
]
},
{
"name": "loincCoding",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "risk",
"element": "coding",
"variable": "loinc"
}
],
"rule": [
{
"name": "loincSystem",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "loinc",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "http://loinc.org"
}
]
}
]
},
{
"name": "loincCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "loinc",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "LA6751-7"
}
]
}
]
},
{
"name": "loincDisplay",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "loinc",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "Moderate"
}
]
}
]
}
]
},
{
"name": "riskText",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "risk",
"element": "text",
"transform": "copy",
"parameter": [
{
"valueString": "Moderate risk"
}
]
}
]
}
]
}
]
}
]
},
{
"name": "bradenMild",
"source": [
{
"context": "obs",
"condition": "(value.ofType(integer) >= 15) and (value.ofType(integer) <= 18)"
}
],
"target": [
{
"context": "bundle",
"element": "entry",
"variable": "entry"
},
{
"context": "entry",
"element": "resource",
"variable": "ra",
"transform": "create",
"parameter": [
{
"valueString": "RiskAssessment"
}
]
}
],
"rule": [
{
"name": "riskBase",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "ra"
},
{
"context": "entry"
}
],
"dependent": [
{
"name": "BuildRiskBase",
"parameter": [
{
"valueId": "qr"
},
{
"valueId": "obs"
},
{
"valueId": "ra"
},
{
"valueId": "entry"
}
]
}
]
},
{
"name": "riskCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "ra"
}
],
"dependent": [
{
"name": "SetBradenRiskCode",
"parameter": [
{
"valueId": "qr"
},
{
"valueId": "ra"
}
]
}
]
},
{
"name": "prediction",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "ra",
"element": "prediction",
"variable": "pred"
}
],
"rule": [
{
"name": "qualitativeRisk",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "pred",
"element": "qualitativeRisk",
"variable": "risk"
}
],
"rule": [
{
"name": "hl7Coding",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "risk",
"element": "coding",
"variable": "coding"
}
],
"rule": [
{
"name": "riskSystem",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "http://terminology.hl7.org/CodeSystem/risk-probability"
}
]
}
]
},
{
"name": "riskCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "low"
}
]
}
]
},
{
"name": "riskDisplay",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "Low likelihood"
}
]
}
]
}
]
},
{
"name": "loincCoding",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "risk",
"element": "coding",
"variable": "loinc"
}
],
"rule": [
{
"name": "loincSystem",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "loinc",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "http://loinc.org"
}
]
}
]
},
{
"name": "loincCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "loinc",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "LA6752-5"
}
]
}
]
},
{
"name": "loincDisplay",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "loinc",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "Mild"
}
]
}
]
}
]
},
{
"name": "riskText",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "risk",
"element": "text",
"transform": "copy",
"parameter": [
{
"valueString": "Mild risk"
}
]
}
]
}
]
}
]
}
]
},
{
"name": "bradenNoRisk",
"source": [
{
"context": "obs",
"condition": "value.ofType(integer) >= 19"
}
],
"target": [
{
"context": "bundle",
"element": "entry",
"variable": "entry"
},
{
"context": "entry",
"element": "resource",
"variable": "ra",
"transform": "create",
"parameter": [
{
"valueString": "RiskAssessment"
}
]
}
],
"rule": [
{
"name": "riskBase",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "ra"
},
{
"context": "entry"
}
],
"dependent": [
{
"name": "BuildRiskBase",
"parameter": [
{
"valueId": "qr"
},
{
"valueId": "obs"
},
{
"valueId": "ra"
},
{
"valueId": "entry"
}
]
}
]
},
{
"name": "riskCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "ra"
}
],
"dependent": [
{
"name": "SetBradenRiskCode",
"parameter": [
{
"valueId": "qr"
},
{
"valueId": "ra"
}
]
}
]
},
{
"name": "prediction",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "ra",
"element": "prediction",
"variable": "pred"
}
],
"rule": [
{
"name": "qualitativeRisk",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "pred",
"element": "qualitativeRisk",
"variable": "risk"
}
],
"rule": [
{
"name": "hl7Coding",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "risk",
"element": "coding",
"variable": "coding"
}
],
"rule": [
{
"name": "riskSystem",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "http://terminology.hl7.org/CodeSystem/risk-probability"
}
]
}
]
},
{
"name": "riskCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "negligible"
}
]
}
]
},
{
"name": "riskDisplay",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "Negligible likelihood"
}
]
}
]
}
]
},
{
"name": "loincCoding",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "risk",
"element": "coding",
"variable": "loinc"
}
],
"rule": [
{
"name": "loincSystem",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "loinc",
"element": "system",
"transform": "copy",
"parameter": [
{
"valueString": "http://loinc.org"
}
]
}
]
},
{
"name": "loincCode",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "loinc",
"element": "code",
"transform": "copy",
"parameter": [
{
"valueString": "LA19983-8"
}
]
}
]
},
{
"name": "loincDisplay",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "loinc",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "No risk"
}
]
}
]
}
]
},
{
"name": "riskText",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "risk",
"element": "text",
"transform": "copy",
"parameter": [
{
"valueString": "No risk identified"
}
]
}
]
}
]
}
]
}
]
}
]
},
{
"name": "SetBradenRiskCode",
"input": [
{
"name": "qr",
"type": "QR",
"mode": "source"
},
{
"name": "ra",
"type": "RiskAssessment",
"mode": "target"
}
],
"rule": [
{
"name": "code",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "ra",
"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": "81636-3"
}
]
}
]
},
{
"name": "codeDisplay",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "coding",
"element": "display",
"transform": "copy",
"parameter": [
{
"valueString": "Pressure injury risk level Braden scale"
}
]
}
]
}
]
}
]
}
]
},
{
"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",
"element": "id",
"variable": "qid",
"condition": "$this.hasValue()"
}
],
"target": [
{
"context": "obs",
"element": "derivedFrom",
"variable": "ref",
"transform": "create",
"parameter": [
{
"valueString": "Reference"
}
]
},
{
"context": "ref",
"element": "reference",
"transform": "copy",
"parameter": [
{
"valueId": "qid"
}
]
}
],
"documentation": "A stored response's id already reads \"QuestionnaireResponse/<id>\", so it is a\r\nrelative reference as it stands. The hasValue() guard is what stops an\r\nunsaved response -- one posted straight to $extract rather than saved first --\r\nfrom writing \"QuestionnaireResponse/null\" into the record."
}
]
},
{
"name": "BuildRiskBase",
"documentation": "The RiskAssessment stands on two things: the response that was filled in and\r\nthe Observation that holds the number. Both go in basis, which is what the\r\nSGHI RiskAssessment profile binds to a QuestionnaireResponse.",
"input": [
{
"name": "qr",
"type": "QR",
"mode": "source"
},
{
"name": "obs",
"type": "Observation",
"mode": "source"
},
{
"name": "ra",
"type": "RiskAssessment",
"mode": "target"
},
{
"name": "entry",
"mode": "target"
}
],
"rule": [
{
"name": "idAndFullUrl",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "ra",
"element": "id",
"transform": "uuid"
}
],
"dependent": [
{
"name": "SetRiskAssessmentFullUrl",
"parameter": [
{
"valueId": "ra"
},
{
"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": "RiskAssessment"
}
]
}
]
}
]
},
{
"name": "status",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "ra",
"element": "status",
"transform": "copy",
"parameter": [
{
"valueString": "final"
}
]
}
]
},
{
"name": "subject",
"source": [
{
"context": "qr",
"element": "subject",
"variable": "s"
}
],
"target": [
{
"context": "ra",
"element": "subject",
"transform": "copy",
"parameter": [
{
"valueId": "s"
}
]
}
]
},
{
"name": "encounter",
"source": [
{
"context": "qr",
"element": "encounter",
"variable": "e"
}
],
"target": [
{
"context": "ra",
"element": "encounter",
"transform": "copy",
"parameter": [
{
"valueId": "e"
}
]
}
]
},
{
"name": "occurrence",
"source": [
{
"context": "qr",
"element": "authored",
"variable": "t"
}
],
"target": [
{
"context": "ra",
"element": "occurrence",
"transform": "copy",
"parameter": [
{
"valueId": "t"
}
]
}
]
},
{
"name": "performerFromAuthor",
"source": [
{
"context": "qr",
"element": "author",
"variable": "a"
}
],
"target": [
{
"context": "ra",
"element": "performer",
"transform": "copy",
"parameter": [
{
"valueId": "a"
}
]
}
]
},
{
"name": "performerFallback",
"source": [
{
"context": "qr",
"condition": "author.exists().not()"
}
],
"rule": [
{
"name": "performerFromSource",
"source": [
{
"context": "qr",
"element": "source",
"variable": "src"
}
],
"target": [
{
"context": "ra",
"element": "performer",
"transform": "copy",
"parameter": [
{
"valueId": "src"
}
]
}
]
}
]
},
{
"name": "basisResponse",
"source": [
{
"context": "qr",
"element": "id",
"variable": "qid",
"condition": "$this.hasValue()"
}
],
"target": [
{
"context": "ra",
"element": "basis",
"variable": "qref",
"transform": "create",
"parameter": [
{
"valueString": "Reference"
}
]
},
{
"context": "qref",
"element": "reference",
"transform": "copy",
"parameter": [
{
"valueId": "qid"
}
]
}
]
},
{
"name": "basisObservation",
"source": [
{
"context": "obs",
"element": "id",
"variable": "oid"
}
],
"target": [
{
"context": "ra",
"element": "basis",
"variable": "oref",
"transform": "create",
"parameter": [
{
"valueString": "Reference"
}
]
}
],
"rule": [
{
"name": "basisObservationRef",
"source": [
{
"context": "oid"
}
],
"target": [
{
"context": "oref",
"element": "reference",
"transform": "append",
"parameter": [
{
"valueString": "Observation/"
},
{
"valueId": "oid"
}
]
}
]
}
]
}
]
},
{
"name": "SetComponentCodedValue",
"input": [
{
"name": "it",
"mode": "source"
},
{
"name": "comp",
"mode": "target"
}
],
"rule": [
{
"name": "componentAnswer",
"source": [
{
"context": "it",
"element": "answer",
"listMode": "first",
"variable": "a"
}
],
"rule": [
{
"name": "codedValue",
"source": [
{
"context": "a",
"element": "value",
"variable": "cv"
}
],
"target": [
{
"context": "comp",
"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": "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": "SetRiskAssessmentFullUrl",
"input": [
{
"name": "ra",
"type": "RiskAssessment",
"mode": "source"
},
{
"name": "entry",
"mode": "target"
}
],
"rule": [
{
"name": "assignFullUrl",
"source": [
{
"context": "ra",
"element": "id",
"variable": "id"
}
],
"target": [
{
"context": "entry",
"element": "fullUrl",
"transform": "append",
"parameter": [
{
"valueString": "https://fhir.slade360.co.ke/fhir/RiskAssessment/"
},
{
"valueId": "id"
}
]
}
]
}
]
}
]
}