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: subscapularSkinfoldForAge

Official URL: https://fhir.dk.swisstph-mis.ch/matchbox/fhir/Library/subscapularSkinfoldForAge Version: 0.1.0
Active as of 2023-10-04 Computable Name: subscapularSkinfoldForAge

Related Artifacts

depends-onanthrobase
depends-onhttp://fhir.org/guides/who/anc-cds/Library/FHIRHelpers

Parameters

zscoreindecimal
Ageindecimal
sexindecimal
generatesubscapularSkinfoldFromAgeoutdecimal
generateZScoresubscapularSkinfoldForAgeoutdecimal
ZscoresubscapularSkinfoldForAgetables_soutdecimal
ZscoresubscapularSkinfoldForAgetables_moutdecimal
ZscoresubscapularSkinfoldForAgetables_loutdecimal

Data Requirements

Type: Patient (Patient)

Contents

text/cql


library subscapularSkinfoldForAge version '1.0.4'
using FHIR version '4.0.1'
include anthrobase version '1.0.4' called base
include FHIRHelpers version '4.0.1' called FHIRHelpers

// Antrho library for subscapularSkinfoldForAge  Z-Score from the ssanthro files
codesystem "administrative-gender": 'http://hl7.org/fhir/administrative-gender'
//code "Female" : 'female' from "administrative-gender"  display 'Female'


define subscapularSkinfoldForAgeFemale:
{
	{y:91.0,l:-0.2019,s:0.18428,m:7.7874},
	{y:98.0,l:-0.2159,s:0.18428,m:7.7259},
	{y:105.0,l:-0.229,s:0.18429,m:7.6679},
	{y:112.0,l:-0.2414,s:0.18429,m:7.6129},
	{y:119.0,l:-0.2532,s:0.1843,m:7.5605},
	{y:126.0,l:-0.2644,s:0.1843,m:7.5103},
	{y:133.0,l:-0.2751,s:0.18429,m:7.462},
	{y:140.0,l:-0.2853,s:0.18429,m:7.4155},
	{y:147.0,l:-0.2951,s:0.18429,m:7.3707},
	{y:154.0,l:-0.3044,s:0.18428,m:7.3273},
	{y:161.0,l:-0.3135,s:0.18427,m:7.2853},
	{y:168.0,l:-0.3222,s:0.18427,m:7.2446},
	{y:175.0,l:-0.3306,s:0.18426,m:7.2052},
	{y:182.0,l:-0.3387,s:0.18426,m:7.167},
	{y:197.0,l:-0.3553,s:0.18424,m:7.0892},
	{y:227.0,l:-0.3854,s:0.18418,m:6.9493},
	{y:257.0,l:-0.4123,s:0.18406,m:6.8285},
	{y:287.0,l:-0.4366,s:0.18393,m:6.7244},
	{y:317.0,l:-0.4589,s:0.18384,m:6.6344},
	{y:347.0,l:-0.4795,s:0.18381,m:6.5563},
	{y:377.0,l:-0.4985,s:0.18386,m:6.4883},
	{y:407.0,l:-0.5164,s:0.184,m:6.4292},
	{y:437.0,l:-0.5331,s:0.18425,m:6.3775},
	{y:467.0,l:-0.5489,s:0.18459,m:6.3324},
	{y:497.0,l:-0.5639,s:0.18503,m:6.2929},
	{y:527.0,l:-0.5781,s:0.18556,m:6.2585},
	{y:557.0,l:-0.5916,s:0.18617,m:6.2287},
	{y:587.0,l:-0.6045,s:0.18687,m:6.2031},
	{y:617.0,l:-0.6169,s:0.18763,m:6.1811},
	{y:647.0,l:-0.6288,s:0.18845,m:6.1623},
	{y:677.0,l:-0.6402,s:0.18934,m:6.1462},
	{y:707.0,l:-0.6512,s:0.19027,m:6.1325},
	{y:737.0,l:-0.6618,s:0.19126,m:6.1209},
	{y:767.0,l:-0.672,s:0.19228,m:6.111},
	{y:797.0,l:-0.6819,s:0.19335,m:6.1027},
	{y:827.0,l:-0.6915,s:0.19445,m:6.0956},
	{y:857.0,l:-0.7008,s:0.19558,m:6.0896},
	{y:887.0,l:-0.7099,s:0.19674,m:6.0844},
	{y:917.0,l:-0.7186,s:0.19792,m:6.08},
	{y:947.0,l:-0.7272,s:0.19912,m:6.0762},
	{y:977.0,l:-0.7355,s:0.20033,m:6.073},
	{y:1007.0,l:-0.7436,s:0.20155,m:6.0703},
	{y:1037.0,l:-0.7514,s:0.20279,m:6.0681},
	{y:1067.0,l:-0.7591,s:0.20402,m:6.0664},
	{y:1097.0,l:-0.7667,s:0.20526,m:6.0651},
	{y:1127.0,l:-0.774,s:0.20651,m:6.0642},
	{y:1157.0,l:-0.7812,s:0.20775,m:6.0637},
	{y:1187.0,l:-0.7882,s:0.20899,m:6.0633},
	{y:1217.0,l:-0.7951,s:0.21022,m:6.0632},
	{y:1247.0,l:-0.8018,s:0.21145,m:6.0632},
	{y:1277.0,l:-0.8084,s:0.21267,m:6.0634},
	{y:1307.0,l:-0.8149,s:0.21389,m:6.0637},
	{y:1337.0,l:-0.8212,s:0.21509,m:6.0641},
	{y:1367.0,l:-0.8274,s:0.21628,m:6.0646},
	{y:1397.0,l:-0.8335,s:0.21746,m:6.0653},
	{y:1427.0,l:-0.8395,s:0.21862,m:6.066},
	{y:1457.0,l:-0.8454,s:0.21978,m:6.0668},
	{y:1487.0,l:-0.8512,s:0.22092,m:6.0678},
	{y:1517.0,l:-0.8569,s:0.22204,m:6.0688},
	{y:1547.0,l:-0.8624,s:0.22316,m:6.07},
	{y:1577.0,l:-0.8679,s:0.22426,m:6.0714},
	{y:1607.0,l:-0.8734,s:0.22534,m:6.0728},
	{y:1637.0,l:-0.8787,s:0.22641,m:6.0744},
	{y:1667.0,l:-0.8839,s:0.22746,m:6.0761},
	{y:1697.0,l:-0.8891,s:0.2285,m:6.0779},
	{y:1727.0,l:-0.8942,s:0.22953,m:6.0798},
	{y:1757.0,l:-0.8992,s:0.23053,m:6.0818},
	{y:1787.0,l:-0.9041,s:0.23153,m:6.0838},
	{y:1817.0,l:-0.909,s:0.23251,m:6.0859},
	{y:1847.0,l:-0.9138,s:0.23347,m:6.088}
}

define subscapularSkinfoldForAgeMale:
{
	{y:91.0,l:-0.303,s:0.17019,m:7.692},
	{y:98.0,l:-0.3089,s:0.17038,m:7.6458},
	{y:105.0,l:-0.3146,s:0.17055,m:7.6006},
	{y:112.0,l:-0.3202,s:0.17073,m:7.5566},
	{y:119.0,l:-0.3257,s:0.1709,m:7.5135},
	{y:126.0,l:-0.3311,s:0.17107,m:7.4713},
	{y:133.0,l:-0.3363,s:0.17123,m:7.43},
	{y:140.0,l:-0.3415,s:0.17139,m:7.3894},
	{y:147.0,l:-0.3466,s:0.17155,m:7.3497},
	{y:154.0,l:-0.3516,s:0.17171,m:7.3107},
	{y:161.0,l:-0.3565,s:0.17186,m:7.2724},
	{y:168.0,l:-0.3613,s:0.17201,m:7.2349},
	{y:175.0,l:-0.3661,s:0.17216,m:7.1981},
	{y:182.0,l:-0.3708,s:0.17231,m:7.162},
	{y:197.0,l:-0.3806,s:0.17261,m:7.087},
	{y:227.0,l:-0.3996,s:0.1732,m:6.9469},
	{y:257.0,l:-0.4177,s:0.17377,m:6.8195},
	{y:287.0,l:-0.4351,s:0.17431,m:6.7042},
	{y:317.0,l:-0.4519,s:0.17483,m:6.6006},
	{y:347.0,l:-0.4681,s:0.17534,m:6.5077},
	{y:377.0,l:-0.4839,s:0.17583,m:6.4249},
	{y:407.0,l:-0.4992,s:0.17631,m:6.3512},
	{y:437.0,l:-0.5141,s:0.17677,m:6.2856},
	{y:467.0,l:-0.5286,s:0.17723,m:6.2273},
	{y:497.0,l:-0.5429,s:0.17767,m:6.1755},
	{y:527.0,l:-0.5568,s:0.1781,m:6.1294},
	{y:557.0,l:-0.5704,s:0.17853,m:6.0882},
	{y:587.0,l:-0.5839,s:0.17895,m:6.0515},
	{y:617.0,l:-0.597,s:0.17936,m:6.0189},
	{y:647.0,l:-0.61,s:0.17976,m:5.9901},
	{y:677.0,l:-0.6227,s:0.18016,m:5.9646},
	{y:707.0,l:-0.6352,s:0.18055,m:5.942},
	{y:737.0,l:-0.6476,s:0.18093,m:5.9216},
	{y:767.0,l:-0.6598,s:0.18131,m:5.9031},
	{y:797.0,l:-0.6718,s:0.18169,m:5.8861},
	{y:827.0,l:-0.6836,s:0.18206,m:5.8702},
	{y:857.0,l:-0.6953,s:0.18242,m:5.8553},
	{y:887.0,l:-0.7069,s:0.18278,m:5.841},
	{y:917.0,l:-0.7183,s:0.18314,m:5.8272},
	{y:947.0,l:-0.7296,s:0.18349,m:5.8135},
	{y:977.0,l:-0.7408,s:0.18384,m:5.7997},
	{y:1007.0,l:-0.7519,s:0.18419,m:5.7858},
	{y:1037.0,l:-0.7628,s:0.18453,m:5.7717},
	{y:1067.0,l:-0.7736,s:0.18486,m:5.7572},
	{y:1097.0,l:-0.7844,s:0.1852,m:5.7424},
	{y:1127.0,l:-0.795,s:0.18553,m:5.7274},
	{y:1157.0,l:-0.8055,s:0.18586,m:5.7123},
	{y:1187.0,l:-0.8159,s:0.18618,m:5.6971},
	{y:1217.0,l:-0.8263,s:0.18651,m:5.6818},
	{y:1247.0,l:-0.8365,s:0.18683,m:5.6663},
	{y:1277.0,l:-0.8467,s:0.18714,m:5.6507},
	{y:1307.0,l:-0.8567,s:0.18746,m:5.6348},
	{y:1337.0,l:-0.8667,s:0.18777,m:5.6186},
	{y:1367.0,l:-0.8767,s:0.18808,m:5.6021},
	{y:1397.0,l:-0.8865,s:0.18838,m:5.5852},
	{y:1427.0,l:-0.8963,s:0.18869,m:5.568},
	{y:1457.0,l:-0.906,s:0.18899,m:5.5505},
	{y:1487.0,l:-0.9156,s:0.18929,m:5.5329},
	{y:1517.0,l:-0.9252,s:0.18959,m:5.5153},
	{y:1547.0,l:-0.9347,s:0.18989,m:5.4978},
	{y:1577.0,l:-0.9441,s:0.19018,m:5.4807},
	{y:1607.0,l:-0.9535,s:0.19047,m:5.4639},
	{y:1637.0,l:-0.9628,s:0.19076,m:5.4478},
	{y:1667.0,l:-0.972,s:0.19105,m:5.4323},
	{y:1697.0,l:-0.9812,s:0.19134,m:5.4176},
	{y:1727.0,l:-0.9903,s:0.19162,m:5.4036},
	{y:1757.0,l:-0.9994,s:0.19191,m:5.3904},
	{y:1787.0,l:-1.0085,s:0.19219,m:5.378},
	{y:1817.0,l:-1.0174,s:0.19247,m:5.3662},
	{y:1847.0,l:-1.0263,s:0.19275,m:5.3552}
}




define function ZscoresubscapularSkinfoldForAgetables(sex String, age Decimal):
	if sex = 'female' then  
        First(subscapularSkinfoldForAgeFemale c where c.y = base.AgeToMini(age) )
	else 
        First(subscapularSkinfoldForAgeMale c where  c.y = base.AgeToMini(age))
            
define function generateZScoresubscapularSkinfoldForAge(sex System.String, age System.Decimal, weight  System.Decimal)  : 
	 generateZScoresubscapularSkinfoldForAgedet(ZscoresubscapularSkinfoldForAgetables(sex,age), weight )

define function generateZScoresubscapularSkinfoldForAgedet(row Tuple {y System.Decimal,l System.Decimal,s System.Decimal,m System.Decimal}, weight  System.Decimal):
    if row is not null then 
        base.computeZScore(
            weight,
            row.m , 
            row.l ,
            row.s 
        )
    else null


define function generatesubscapularSkinfoldFromAge(sex System.String, age System.Decimal, zscore  System.Decimal) : 
	 generatesubscapularSkinfoldFromAgedet(ZscoresubscapularSkinfoldForAgetables(sex,age),zscore  )

define function generatesubscapularSkinfoldFromAgedet(row Tuple {y System.Decimal,l System.Decimal,s System.Decimal,m System.Decimal},zscore  System.Decimal) : 
    if row is not null then 
        base.computeReverseZScore(
            zscore,
            row.m , 
            row.l ,
            row.s 
        )
    else null