WHO Clinical Care in Crisis Implementation Guide for Children
0.1.0 - ci-build
WHO Clinical Care in Crisis Implementation Guide for Children - Local Development build (v0.1.0). See the Directory of published versions
Active as of 2023-10-04 |
@prefix fhir: <http://hl7.org/fhir/> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . # - resource ------------------------------------------------------------------- a fhir:Library ; fhir:nodeRole fhir:treeRoot ; fhir:id [ fhir:v "chebase"] ; # fhir:text [ fhir:status [ fhir:v "generated" ] ; fhir:div "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h2>Related Artifacts</h2><table class=\"grid\"><tr><td>depends-on</td><td><code>http://fhir.org/guides/who/anc-cds/Library/FHIRHelpers</code></td></tr></table><h2>Parameters</h2><table class=\"grid\"><tr><td>encounterid</td><td>in</td><td/><td/><td>string</td></tr></table><h2>Data Requirements</h2><table class=\"grid\"><tr><td colspan=\"2\"><b>Type</b>: <a href=\"http://hl7.org/fhir/R4/patient.html\">Patient</a> (<a href=\"http://hl7.org/fhir/R4/patient.html\">Patient</a>)</td></tr></table><table class=\"grid\"><tr><td colspan=\"2\"><b>Type</b>: <a href=\"http://hl7.org/fhir/R4/encounter.html\">Encounter</a> (<a href=\"http://hl7.org/fhir/R4/encounter.html\">Encounter</a>)</td></tr></table><h2>Contents</h2><p><code>text/cql</code></p><pre><code class=\"language-sql\">/*nter"\n@author: Patrick Delcroix\n@description: This library is part of the project CHE Project, its allows standardisation for the observation processing\n*/\n\nlibrary chebase version '1.0.313+build.456'\n\nusing FHIR version '4.0.1'\n\ninclude FHIRHelpers version '4.0.1'\n\nparameter "encounterid" String\n//parameter "Encounter" Encounter$\ncodesystem "RoleCodeSystem" : 'https://fhir.dk.swisstph-mis.ch/matchbox/fhir/CodeSystem/emcare-custom-codes'\ncode "Mother": 'MTH' from "RoleCodeSystem"\n\ncontext Patient\n\n//define encounterid:\n// "Encounter".id\n\n\n\n\ndefine "Yes":\n true\n\ndefine "No":\n false \n\n\ndefine function IsInEncounter(ref FHIR.Reference):\n case\n when encounterid = ref.id then true\n when encounterid = Last(Split(ref.reference, '/')) then true\n // when ref.identifier is not null and id = ref.identifier.id then true\n else false\nend\n\ndefine getEncounters:\n [Encounter] E \n where E.id = "encounterid"\n return E\n\ndefine getEncounter:\n singleton from getEncounters\n\ndefine function CHEExtensions(element Patient, id String):\n element.extension E\n where E.url = ('https://fhir.dk.swisstph-mis.ch/matchbox/fhir/StructureDefinition/' + id)\n return E\n\ndefine function CHEExtension(element Patient, id String):\n singleton from CHEExtensions(element, id)\n\ndefine function CHEExtensions(element Encounter, id String):\n element.extension E\n where E.url = ('https://fhir.dk.swisstph-mis.ch/matchbox/fhir/StructureDefinition/' + id)\n return E\n\n\ndefine function postcordinationExtension(element Condition, postcordination List<String>):\n element.extension E\n where E.url = ('https://fhir.dk.swisstph-mis.ch/matchbox/fhir/StructureDefinition/postcordination')\n and E.value in postcordination\n\n\ndefine function CHEExtension(element Encounter, id String):\n singleton from CHEExtensions(element, id)\n\ndefine getPrimaryCareGiverReference:\n CHEExtension(Patient, 'primarycaregiver').value\n\ndefine getPrimaryCareGiver:\n [RelatedPerson] RP where RP.id = Last(Split(getPrimaryCareGiverReference.reference, '/'))\n return RP\n\ndefine isMotherPrimaryCareGiver:\n getPrimaryCareGiver is not null and Exists(getPrimaryCareGiver.relationship r where r ~ "Mother")\n\ndefine "Biological Mother Vital Status":\n CHEExtension(Patient, 'motherVitalStatus').value\n \ndefine "Biological Father Vital Status":\n CHEExtension(Patient, 'fatherVitalStatus').value\n// person accompanying the child is a participant with a null type\ndefine getRelatedPersonReferenceAccompanyingTheChild:\n Coalesce(First(getEncounter.participant P where not exists(P.type) ).individual, getPrimaryCareGiverReference)\n\ndefine getRelatedPersonsAccompanyingTheChild:\n [RelatedPerson] RP where RP.id = Last(Split(getRelatedPersonReferenceAccompanyingTheChild.reference, '/'))\n return RP\n\n\ndefine getRelatedPersonAccompanyingTheChild:\n singleton from getRelatedPersonsAccompanyingTheChild\n\n\ndefine "Person accompanying child today's Relationship to Client":\n//WORKARROUND getRelatedPersonAccompanyingTheChild.relationship\n CHEExtension(getEncounter, 'motherpresent').value\n\n\n\n\n\ndefine function getValue(O Observation):\n case \n when O is null then null\n when O.value is CodeableConcept then Coalesce(First(O.value.coding C where C.system = 'https://fhir.dk.swisstph-mis.ch/matchbox/fhir/CodeSystem/che-custom-codes'), First(O.value.coding))\n else O.value\n end\n\n\ndefine function assesObservation(O Observation):\n case \n when O is null then null\n when O.status in {'cancelled'} then false\n when O.value is null then true\n else O.value\n end\n/* \ndefine function GetObservationDuringEncounter(idlist List<System.Code>):\n if GetObservationDuringEncounterDone(idlist ) is null then \n GetObservationDuringEncounterDone(idlist )\n else\n GetObservationDuringEncounterNotFound(idlist )\n*/\n\ndefine function GetObservationDuringEncounter(id System.Code):\n First([Observation: id ] O\n where IsInEncounter(O.encounter) \n and O.status in { 'final', 'amended', 'corrected','cancelled'} \n sort by issued.value desc) \n\n /*\n this is commented for performance improvement, even if it hides a valid observation if there is an more recent unvalid one\n Coalesce(GetObservationDuringEncounterDone(id ), GetObservationDuringEncounterNotFound(id ))\n */\n/*\ndefine function GetObservationDuringEncounterDone(idlist List<System.Code>):\n Last([Observation: idlist ] O\n where IsInEncounter(O.encounter) \n and O.status in { 'final', 'amended', 'corrected'})\n*/\ndefine function GetObservationDuringEncounterDone(id System.Code):\n First([Observation: id ] O\n where IsInEncounter(O.encounter) \n and O.status in { 'final', 'amended', 'corrected'} \n sort by issued.value desc) \n\n\ndefine function HasObservationCodeDuringEncounterDone(id System.Code, valueCode System.Code):\n \n Exists([Observation: id ] O\n where IsInEncounter(O.encounter) \n and O.status in { 'final', 'amended', 'corrected'}\n and O.value is FHIR.CodeableConcept\n and O.value ~ valueCode)\n\n//Exists([Observation] O where O.status in { 'final', 'amended', 'corrected'} and O.value is FHIR.CodeableConcept and Exists( O.value.coding C where C is FHIR.Coding and C.code = FHIR.code {value: 'CHE.B20S2.DE04'}) )"\n\n/*\ndefine function GetObservationDuringEncounterNotFound(idlist List<System.Code>):\n Last([Observation: idlist] O\n where IsInEncounter(O.encounter) \n and O.status in {'cancelled'})\n */\ndefine function GetObservationDuringEncounterNotFound(id System.Code):\n First([Observation: id] O\n where IsInEncounter(O.encounter) \n and O.status in {'cancelled'}\n sort by issued.value desc)\n/*\n\ndefine function GetNumberObservationDuringEncounter(idlist List<System.Code>):\n Count(\n [Observation: idlist] O\n where IsInEncounter( O.encounter) \n and O.status in { 'final', 'amended', 'corrected'})\n*/\ndefine function GetNumberObservationDuringEncounter(id System.Code):\n Count(\n [Observation: id] O\n where IsInEncounter( O.encounter) \n and O.status in { 'final', 'amended', 'corrected'})\n\n// ************************ GetObsValue ************************/\n/*\ndefine function GetObsValue(idlist List<System.Code>):\n getValue(GetObservationDuringEncounter(idlist))\n\ndefine function GetObsValue(id System.Code):\n getValue(GetObservationDuringEncounter({id}))\n*/\n\ndefine function GetObsValue(id System.Code):\n getValue(GetObservationDuringEncounter(id))\n\ndefine function GetObsValue(id System.String, codesystem System.String):\n getValue(GetObservationDuringEncounter(coding(id, codesystem)))\n\ndefine function GetObsValue(id System.String):\n getValue(GetObservationDuringEncounter(coding(id, 'https://fhir.dk.swisstph-mis.ch/matchbox/fhir/CodeSystem/che-custom-codes')))\n\ndefine function HasObsValueCode(id System.String, value System.Code):\n HasObservationCodeDuringEncounterDone(coding(id, 'https://fhir.dk.swisstph-mis.ch/matchbox/fhir/CodeSystem/che-custom-codes') , value )\n \ndefine function HasObsValueCode(id System.String, value System.String):\n HasObservationCodeDuringEncounterDone(coding(id, 'https://fhir.dk.swisstph-mis.ch/matchbox/fhir/CodeSystem/che-custom-codes') , coding(value, 'https://fhir.dk.swisstph-mis.ch/matchbox/fhir/CodeSystem/che-custom-codes') )\n\ndefine function HasObsValueCode(id System.Code, value System.String):\n HasObservationCodeDuringEncounterDone(id , coding(value, 'https://fhir.dk.swisstph-mis.ch/matchbox/fhir/CodeSystem/che-custom-codes') )\n\n// ************************ HasObs ************************/\n/*\ndefine function HasObs(idlist List<System.Code>):\n assesObservation(GetObservationDuringEncounter(idlist))\n\ndefine function HasObs(id System.Code):\n assesObservation(GetObservationDuringEncounter({id}))\n*/\ndefine function HasObs(id System.Code):\n assesObservation(GetObservationDuringEncounter(id))\n\ndefine function HasObs(id System.String, codesystem System.String):\n assesObservation(GetObservationDuringEncounter(coding(id, codesystem)))\n\ndefine function HasObs(id System.String):\n assesObservation(GetObservationDuringEncounter(coding(id)))\n\ndefine function HasObs(id FHIR.code, codesystem System.String):\n assesObservation(GetObservationDuringEncounter(coding(id, codesystem)))\n/*\ndefine function GetHistoricObservation(idlist List<System.Code>, nbdays Integer):\n if GetHistoricObservationNotfound(idlist , codesystem , nbdays ) is null then \n GetHistoricObservationNotfound(idlist , codesystem , nbdays )\n else\n GetHistoricObservationNotfound(idlist , codesystem , nbdays )\n*/\n\ndefine function GetHistoricObservation(id System.Code, nbdays Integer):\n First([Observation: id ] O\n where O.status in { 'final', 'amended', 'corrected','cancelled'} \n and (difference in days between O.issued and Today()) < nbdays \n sort by issued.value desc )\n\n //Coalesce(GetHistoricObservationDone(id , nbdays ), GetHistoricObservationNotfound(id , nbdays ))\n/*\ndefine function GetHistoricObservationDone(idlist List<System.Code>, nbdays Integer):\n Last([Observation: idlist ] O\n where O.status in { 'final', 'amended', 'corrected'}\n and (difference in days between O.issued and Today()) < nbdays)\n*/\ndefine function GetHistoricObservationDone(id System.Code, nbdays Integer):\n First([Observation: id ] O\n where O.status in { 'final', 'amended', 'corrected'}\n and (difference in days between O.issued and Today()) < nbdays \n sort by issued.value desc )\n\n/*\ndefine function GetHistoricObservationNotfound(idlist List<System.Code>, nbdays Integer):\n Last([Observation: idlist] O\n where O.status in {'cancelled'}\n*/\ndefine function GetHistoricObservationNotfound(id System.Code, nbdays Integer):\n First([Observation: id] O\n where O.status in {'cancelled'}\n and (difference in days between O.issued and Today()) < nbdays \n sort by issued.value desc)\n// ************************ HasObsHistory ************************/\n\n/*\ndefine function HasObsHistory(idlist List<System.Code>, nbdays Integer):\n assesObservation(GetHistoricObservation(idlist, nbdays))\n\n\n define function HasObsHistory(id System.Code, cnbdays Integer):\n assesObservation(GetHistoricObservation({id}, nbdays))\n*/\ndefine function HasObsHistory(id System.Code, nbdays Integer):\n assesObservation(GetHistoricObservation(id, nbdays))\n\ndefine function HasObsHistory(id System.String, codesystem System.String, nbdays Integer):\n assesObservation(GetHistoricObservation(coding(id, codesystem), nbdays))\n\n\ndefine function HasObsHistory(id System.String, nbdays Integer):\n assesObservation(GetHistoricObservation(coding(id), nbdays))\n\ndefine function c(s System.String):\n FHIR.code { value: s }\n\n\ndefine function coding(s System.String, url System.String):\n System.Code {\n code: s ,\n system: url \n }\n\ndefine function coding(s FHIR.code, url System.String):\n System.Code {\n code: s.value ,\n system: url \n }\n\ndefine function coding(s System.String):\n System.Code {\n code: s ,\n system: 'https://fhir.dk.swisstph-mis.ch/matchbox/fhir/CodeSystem/che-custom-codes'\n }\n\n\ndefine function ToUrl(s System.String):\n url {value:s}\n\ndefine function ToIntC(b System.Boolean):\n case\n when b is null then 0\n when b = true then 1\n else 0\n end\n\n\n// ************************ GetCond ************************/\n\ndefine function GetConditions(id System.Code):\n [Condition: id] O\n where IsInEncounter( O.encounter) \n and exists(O.verificationStatus.coding C where C.code in {'unconfirmed', 'provisional', 'differential', 'confirmed'} \n and C.system = 'http://terminology.hl7.org/CodeSystem/condition-ver-status')\n sort by recordedDate desc\n\n\n\n\ndefine function GetStemCode(id System.String):\n coding(Split( id, '&')[0])\n\ndefine function GetPostcoordinationCode(id System.String):\n Tail(Split(id, '&'))\n\ndefine function GetCondition(id System.Code):\n First(GetConditions(id))\n\n\n \ndefine function GetCondition(id System.Code, postcordination List<System.String>):\n First(\n [Condition: id] C\n where IsInEncounter( C.encounter) \n and exists(C.verificationStatus.coding cc where cc.code in {'unconfirmed', 'provisional', 'differential', 'confirmed'} \n and cc.system = 'http://terminology.hl7.org/CodeSystem/condition-ver-status')\n and postcordination is null or Count(postcordinationExtension(C,postcordination)) >= Count(postcordination)\n sort by recordedDate desc\n )\n\n\ndefine function assesCondition(O Condition):\n if O is null then \n false\n else\n true\n\ndefine function GetCond(id System.Code):\n (GetCondition(id))\n\ndefine function GetCond(id System.String, codesystem System.String):\n (GetCondition(coding(id, codesystem)))\n\ndefine function GetCond(id System.String):\n (GetCondition(GetStemCode(id),GetPostcoordinationCode(id)))\n\n// ************************ HasCond ************************/\n/*\ndefine function HasCond(idlist List<System.Code>):\n assesCondition(GetCondition(idlist))\n\n\n3518GetCondition(id))\n*/\ndefine function HasCond(id System.String, codesystem System.String):\n assesCondition(GetCondition(coding(id, codesystem)))\n\ndefine function HasCond(id System.String):\n assesCondition(GetCondition(coding(id)))\n\ndefine function HasCond(id System.Code):\n assesCondition(GetCondition(id))\n\n// ************************ PatientHasHistoryOfCondition ************************/\n/*\ndefine function GetHistoricCondition(idlist List<System.Code>, nbdays Integer):\n Last([Condition: idlist] O\n where (difference in days between O.recordedDate and Today()) < nbdays\n and exists(O.verificationStatus.coding C where C.code in {'unconfirmed', 'provisional', 'differential', 'confirmed'} \n and C.system = 'http://terminology.hl7.org/CodeSystem/condition-ver-status'))\n*/\n\ndefine function GetHistoricCondition(id System.Code, nbdays Integer):\n First([Condition: id] O\n where (difference in days between O.recordedDate and Today()) < nbdays\n and exists(O.verificationStatus.coding C where C.code in {'unconfirmed', 'provisional', 'differential', 'confirmed'} \n and C.system = 'http://terminology.hl7.org/CodeSystem/condition-ver-status') \n sort by recordedDate desc)\n\n\n\n\n/*\ndefine function HasCondHistory(idlist List<System.Code>, nbdays Integer):\n assesCondition(GetHistoricCondition(idlist, nbdays))\n\n\ndefine function HasCondHistory(id System.Code, nbdays Integer):\n assesCondition(GetHistoricCondition({id}, nbdays))\n*/\ndefine function HasCondHistory(id System.Code, nbdays Integer):\n assesCondition(GetHistoricCondition(id, nbdays))\n\ndefine function HasCondHistory(id System.String, codesystem System.String, nbdays Integer):\n assesCondition(GetHistoricCondition(coding(id,codesystem),nbdays))\n\n\ndefine function HasCondHistory(id System.String, nbdays Integer):\n assesCondition(GetHistoricCondition(coding(id), nbdays))\n\n\n\n//define function PatientHasConditionDuringEncounter(id String, codesystem url, duration Integer)):\n\n//define function PatientHasConditionFromValueSetDuringEncounter(id String, codesystem url, duration Integer)):\n\n//define function PatientHasHsistoryCondition(id String,codesystem url , duration Integer):\n//define function PatientHasHsistoryConditionFromValueSet(id String,codesystem url , duration Integer):\n\n\n// PatientHasSymptom("symptom name"): symptom in the encounter\n\n\n// PatientLastMeasureOf("measure name"): measure in the encounter\n\n// PatientLastHistoricMeasureOf("measure name", duration): measure in the patient history during duration\n\n// PatientHasDiagnostic("Diagnostic name" ): Diagnostic in the encounter\n\n// PatientHasHistoryOfDiagnostic("Diagnostic name", duration ): Diagnostic in the patient history during duration\n\n// PatientHasProposedorConfirmedDianostic("Diagnostic name" ): Diagnostic in the encounter\n\n// PatientHasHistoryOfProposedorConfirmedDianostic("Diagnostic name", duration ): Diagnostic in the patient history during duration\n\n// PatientZScoreWfA(wieght, age)\n\n// PatientWeightFromWfA(age, Muac)\n</code></pre></div>" ] ; # fhir:url [ fhir:v "https://fhir.dk.swisstph-mis.ch/matchbox/fhir//Library/chebase"^^xsd:anyURI] ; # fhir:version [ fhir:v "0.1.0"] ; # fhir:name [ fhir:v "chebase"] ; # fhir:title [ fhir:v "CHEBase"] ; # fhir:status [ fhir:v "active"] ; # fhir:type [ ( fhir:coding [ fhir:system [ fhir:v "http://hl7.org/fhir/ValueSet/library-type"^^xsd:anyURI ] ; fhir:code [ fhir:v "logic-library" ] ] ) ] ; # fhir:date [ fhir:v "2023-10-04T12:32:21+00:00"^^xsd:dateTime] ; # fhir:publisher [ fhir:v "WHO"] ; # fhir:contact ( [ fhir:name [ fhir:v "WHO" ] ; ( fhir:telecom [ fhir:system [ fhir:v "url" ] ; fhir:value [ fhir:v "http://who.int" ] ] ) ] ) ; # fhir:relatedArtifact ( [ fhir:type [ fhir:v "depends-on" ] ; fhir:resource [ fhir:v "http://fhir.org/guides/who/anc-cds/Library/FHIRHelpers"^^xsd:anyURI ; fhir:link <http://fhir.org/guides/who/anc-cds/Library/FHIRHelpers> ] ] ) ; # fhir:parameter ( [ fhir:name [ fhir:v "encounterid" ] ; fhir:use [ fhir:v "in" ] ; fhir:type [ fhir:v "string" ] ] ) ; # fhir:dataRequirement ( [ fhir:type [ fhir:v "Patient" ] ; ( fhir:profile [ fhir:v "http://hl7.org/fhir/StructureDefinition/Patient"^^xsd:anyURI ; fhir:link <http://hl7.org/fhir/StructureDefinition/Patient> ] ) ] [ fhir:type [ fhir:v "Encounter" ] ; ( fhir:profile [ fhir:v "http://hl7.org/fhir/StructureDefinition/Encounter"^^xsd:anyURI ; fhir:link <http://hl7.org/fhir/StructureDefinition/Encounter> ] ) ] ) ; # fhir:content ( [ fhir:id [ fhir:v "ig-loader-chebase.cql" ] ; fhir:contentType [ fhir:v "text/cql" ] ; fhir:data [ fhir:v "LypudGVyIgpAYXV0aG9yOiBQYXRyaWNrIERlbGNyb2l4CkBkZXNjcmlwdGlvbjogVGhpcyBsaWJyYXJ5IGlzIHBhcnQgb2YgdGhlIHByb2plY3QgQ0hFIFByb2plY3QsIGl0cyBhbGxvd3Mgc3RhbmRhcmRpc2F0aW9uIGZvciB0aGUgb2JzZXJ2YXRpb24gcHJvY2Vzc2luZwoqLwoKbGlicmFyeSBjaGViYXNlIHZlcnNpb24gJzEuMC4zMTMrYnVpbGQuNDU2JwoKdXNpbmcgRkhJUiB2ZXJzaW9uICc0LjAuMScKCmluY2x1ZGUgRkhJUkhlbHBlcnMgdmVyc2lvbiAnNC4wLjEnCgpwYXJhbWV0ZXIgImVuY291bnRlcmlkIiBTdHJpbmcKLy9wYXJhbWV0ZXIgIkVuY291bnRlciIgRW5jb3VudGVyJApjb2Rlc3lzdGVtICJSb2xlQ29kZVN5c3RlbSIgOiAnaHR0cHM6Ly9maG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bWUiLCBkdXJhdGlvbik6IG1lYXN1cmUgaW4gdGhlIHBhdGllbnQgaGlzdG9yeSBkdXJpbmcgZHVyYXRpb24KCi8vIFBhdGllbnRIYXNEaWFnbm9zdGljKCJEaWFnbm9zdGljIG5hbWUiICk6IERpYWdub3N0aWMgaW4gdGhlIGVuY291bnRlcgoKLy8gUGF0aWVudEhhc0hpc3RvcnlPZkRpYWdub3N0aWMoIkRpYWdub3N0aWMgbmFtZSIsIGR1cmF0aW9uICk6IERpYWdub3N0aWMgaW4gdGhlIHBhdGllbnQgaGlzdG9yeSBkdXJpbmcgZHVyYXRpb24KCi8vIFBhdGllbnRIYXNQcm9wb3NlZG9yQ29uZmlybWVkRGlhbm9zdGljKCJEaWFnbm9zdGljIG5hbWUiICk6IERpYWdub3N0aWMgaW4gdGhlIGVuY291bnRlcgoKLy8gUGF0aWVudEhhc0hpc3RvcnlPZlByb3Bvc2Vkb3JDb25maXJtZWREaWFub3N0aWMoIkRpYWdub3N0aWMgbmFtZSIsIGR1cmF0aW9uICk6IERpYWdub3N0aWMgaW4gdGhlIHBhdGllbnQgaGlzdG9yeSBkdXJpbmcgZHVyYXRpb24KCi8vIFBhdGllbnRaU2NvcmVXZkEod2llZ2h0LCBhZ2UpCgovLyBQYXRpZW50V2VpZ2h0RnJvbVdmQShhZ2UsIE11YWMpCg=="^^xsd:base64Binary ] ] ) . #
IG © 2023+ WHO. Package smart-ig-che-cds#0.1.0 based on FHIR 4.0.1. Generated 2023-10-04
Links: Table of Contents |
QA Report
| Version History | License