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

Library: Z.Functions

Official URL: https://fhir.dk.swisstph-mis.ch/matchbox/fhir//Library/zfunctions Version: 0.1.0
Active as of 2023-10-04 Computable Name: zfunctions
Other Identifiers: id: Zfunctions (use: OFFICIAL)

Related Artifacts

depends-onhttp://fhir.org/guides/who/anc-cds/Library/FHIRHelpers
depends-onhttps://fhir.dk.swisstph-mis.ch/matchbox/fhir/Library/weightforage
depends-onanthrobase
depends-onhttps://fhir.dk.swisstph-mis.ch/matchbox/fhir/Library/weightforlength
depends-onhttps://fhir.dk.swisstph-mis.ch/matchbox/fhir/Library/weightforheight

Parameters

dobindate
dobindate
sexinstring
heightindecimal
lengthindecimal
weightindecimal
zscoreindecimal
WAZoutdecimal
WLZoutdecimal
WHZoutdecimal
WAoutdecimal
WLoutdecimal
WHoutdecimal

Contents

text/cql

/*
@author: Patrick Delcroix
@description: This library is part of the project EmCare
*/
library zfunctions version '1.0.313+build.456'
using FHIR version '4.0.1'
include FHIRHelpers version '4.0.1' called FHIRHelpers 
include WeightForAge version '1.0.4' called wfa
include WeightForLength version '1.0.4' called wfl
include WeightForHeight version '1.0.4' called wfh

parameter "sex" String
parameter "dob" Date
parameter "ageindays" Date
parameter "height" Decimal
parameter "length" Decimal
parameter "weight" Decimal
parameter "zscore" Decimal

context Patient

define "AgeInDays":
    case
        when Patient is not null then AgeInDays()
        when  "dob" is not null then (difference in days between "dob" and Today())
        else "ageindays"
    end

define "Sex":
    case
        when Patient is not null then Patient.gender.value
        else "sex"
    end

define "WAZ":
    wfa.generateZScoreWeightForAge("Sex", "AgeInDays" , "weight")

define "WA":
    wfa.generateWeightFromAge("Sex", "AgeInDays" , "zscore") 

define "WLZ":
    wfl.generateZScoreWeightForLength("Sex", "length" , "weight")

define "WL":
    wfl.generateWeightFromLength("Sex", "length" , "zscore")

define "WHZ":
    wfh.generateZScoreWeightForHeight("Sex", "height" , "weight")

define "WH":
    wfh.generateWeightFromHeight("Sex", "height" , "zscore")