extract calculator growth data
This commit is contained in:
parent
56edfb8b8d
commit
40926c8f5f
4 changed files with 3543 additions and 34 deletions
3428
public/data/calculators/growth-lms.json
Normal file
3428
public/data/calculators/growth-lms.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -2,6 +2,7 @@ import { parseAgeMonths, formatParsedAge } from './calculators/age.js';
|
|||
import { calculateAapBilirubinAssessment, classifyBhutaniRisk, loadAapBilirubinThresholds, loadBhutaniZones } from './calculators/bilirubin.js';
|
||||
import { calculateBMIAssessment, loadBmiLmsData } from './calculators/bmi.js';
|
||||
import { loadEquipmentData, renderEquipmentResult } from './calculators/equipment.js';
|
||||
import { loadGrowthLmsData } from './calculators/growth.js';
|
||||
import { initImageLightbox } from './calculators/lightbox.js';
|
||||
import { loadResusMedsData, renderResusMeds } from './calculators/resus.js';
|
||||
import { loadVitalsData, renderVitalsResult } from './calculators/vitals.js';
|
||||
|
|
@ -1080,41 +1081,26 @@ initImageLightbox();
|
|||
|
||||
var currentGrowthType = 'wfa';
|
||||
|
||||
// WHO Weight-for-Age 0-60mo (monthly, from WHO Anthro daily LMS)
|
||||
var wfaLMS = {male:{0:{L:0.3487,M:3.3464,S:0.14602},1:{L:0.2303,M:4.4525,S:0.13413},2:{L:0.1969,M:5.5714,S:0.12382},3:{L:0.174,M:6.369,S:0.11732},4:{L:0.1551,M:7.0069,S:0.11313},5:{L:0.1396,M:7.5077,S:0.11081},6:{L:0.1256,M:7.9389,S:0.10957},7:{L:0.1134,M:8.2963,S:0.10902},8:{L:0.1019,M:8.62,S:0.10882},9:{L:0.0917,M:8.9019,S:0.10881},10:{L:0.0821,M:9.1618,S:0.1089},11:{L:0.0729,M:9.4136,S:0.10906},12:{L:0.0645,M:9.646,S:0.10925},13:{L:0.0563,M:9.8772,S:0.10949},14:{L:0.0487,M:10.0944,S:0.10976},15:{L:0.0412,M:10.3139,S:0.11008},16:{L:0.0343,M:10.5228,S:0.11041},17:{L:0.0276,M:10.7289,S:0.11078},18:{L:0.021,M:10.9393,S:0.1112},19:{L:0.0149,M:11.1409,S:0.11163},20:{L:0.0087,M:11.3478,S:0.11212},21:{L:0.0029,M:11.5474,S:0.11261},22:{L:-0.0029,M:11.7528,S:0.11315},23:{L:-0.0083,M:11.951,S:0.11369},24:{L:-0.0136,M:12.1482,S:0.11425},25:{L:-0.0189,M:12.3506,S:0.11485},26:{L:-0.0239,M:12.5442,S:0.11544},27:{L:-0.0289,M:12.7413,S:0.11604},28:{L:-0.0337,M:12.9288,S:0.11663},29:{L:-0.0385,M:13.1188,S:0.11723},30:{L:-0.0431,M:13.2993,S:0.11781},31:{L:-0.0477,M:13.4824,S:0.1184},32:{L:-0.052,M:13.6567,S:0.11896},33:{L:-0.0563,M:13.8285,S:0.11952},34:{L:-0.0607,M:14.0038,S:0.12008},35:{L:-0.0648,M:14.1719,S:0.12062},36:{L:-0.0689,M:14.3443,S:0.12116},37:{L:-0.0729,M:14.5102,S:0.12168},38:{L:-0.0769,M:14.6811,S:0.12221},39:{L:-0.0808,M:14.8462,S:0.12271},40:{L:-0.0846,M:15.0167,S:0.12323},41:{L:-0.0883,M:15.1816,S:0.12373},42:{L:-0.092,M:15.3465,S:0.12424},43:{L:-0.0957,M:15.5168,S:0.12478},44:{L:-0.0992,M:15.6815,S:0.12531},45:{L:-0.1028,M:15.8514,S:0.12587},46:{L:-0.1063,M:16.0156,S:0.12642},47:{L:-0.1098,M:16.1851,S:0.12701},48:{L:-0.1131,M:16.3489,S:0.12759},49:{L:-0.1164,M:16.5126,S:0.12818},50:{L:-0.1198,M:16.6818,S:0.12881},51:{L:-0.123,M:16.8454,S:0.12942},52:{L:-0.1263,M:17.0145,S:0.13006},53:{L:-0.1294,M:17.1782,S:0.13068},54:{L:-0.1326,M:17.3473,S:0.13133},55:{L:-0.1356,M:17.5107,S:0.13196},56:{L:-0.1387,M:17.674,S:0.1326},57:{L:-0.1417,M:17.8425,S:0.13325},58:{L:-0.1447,M:18.0053,S:0.13389},59:{L:-0.1477,M:18.1732,S:0.13454},60:{L:-0.1506,M:18.3352,S:0.13517}},female:{0:{L:0.3809,M:3.2322,S:0.14171},1:{L:0.1727,M:4.1716,S:0.13738},2:{L:0.0959,M:5.1315,S:0.12998},3:{L:0.0407,M:5.8393,S:0.12622},4:{L:-0.0053,M:6.428,S:0.12401},5:{L:-0.0428,M:6.8959,S:0.12274},6:{L:-0.0759,M:7.3016,S:0.12204},7:{L:-0.1039,M:7.6416,S:0.12178},8:{L:-0.1292,M:7.9534,S:0.12181},9:{L:-0.1507,M:8.2259,S:0.12199},10:{L:-0.1698,M:8.4769,S:0.12222},11:{L:-0.1873,M:8.7207,S:0.12247},12:{L:-0.2022,M:8.9462,S:0.12267},13:{L:-0.216,M:9.1722,S:0.12283},14:{L:-0.2277,M:9.3861,S:0.12294},15:{L:-0.2385,M:9.6038,S:0.12299},16:{L:-0.2478,M:9.8124,S:0.12303},17:{L:-0.2561,M:10.0196,S:0.12305},18:{L:-0.2637,M:10.2324,S:0.12309},19:{L:-0.2702,M:10.4372,S:0.12315},20:{L:-0.2763,M:10.6481,S:0.12324},21:{L:-0.2814,M:10.8521,S:0.12335},22:{L:-0.2862,M:11.0633,S:0.12351},23:{L:-0.2903,M:11.2684,S:0.12369},24:{L:-0.294,M:11.4741,S:0.12389},25:{L:-0.2975,M:11.6868,S:0.12414},26:{L:-0.3005,M:11.8922,S:0.12441},27:{L:-0.3033,M:12.1028,S:0.12472},28:{L:-0.3057,M:12.3042,S:0.12506},29:{L:-0.308,M:12.5093,S:0.12545},30:{L:-0.3101,M:12.7047,S:0.12587},31:{L:-0.312,M:12.9033,S:0.12634},32:{L:-0.3138,M:13.093,S:0.12683},33:{L:-0.3155,M:13.2809,S:0.12736},34:{L:-0.3171,M:13.4739,S:0.12794},35:{L:-0.3186,M:13.6599,S:0.12854},36:{L:-0.3201,M:13.8518,S:0.1292},37:{L:-0.3216,M:14.0373,S:0.12987},38:{L:-0.323,M:14.2288,S:0.1306},39:{L:-0.3243,M:14.4136,S:0.13134},40:{L:-0.3257,M:14.6041,S:0.13214},41:{L:-0.327,M:14.7877,S:0.13294},42:{L:-0.3283,M:14.9704,S:0.13375},43:{L:-0.3296,M:15.1584,S:0.13461},44:{L:-0.3309,M:15.3395,S:0.13544},45:{L:-0.3322,M:15.5259,S:0.13631},46:{L:-0.3335,M:15.7056,S:0.13715},47:{L:-0.3348,M:15.8908,S:0.13801},48:{L:-0.3361,M:16.0697,S:0.13884},49:{L:-0.3374,M:16.2485,S:0.13967},50:{L:-0.3387,M:16.433,S:0.14051},51:{L:-0.34,M:16.6114,S:0.14132},52:{L:-0.3414,M:16.7957,S:0.14214},53:{L:-0.3427,M:16.9737,S:0.14292},54:{L:-0.344,M:17.1573,S:0.14372},55:{L:-0.3453,M:17.3344,S:0.14448},56:{L:-0.3466,M:17.5107,S:0.14524},57:{L:-0.3479,M:17.692,S:0.146},58:{L:-0.3492,M:17.8664,S:0.14674},59:{L:-0.3505,M:18.0456,S:0.14749},60:{L:-0.3518,M:18.2179,S:0.14821}}};
|
||||
// WHO/CDC/Fenton growth LMS values load from /data/calculators/growth-lms.json.
|
||||
var wfaLMS = null;
|
||||
var cdcWfaLMS = null;
|
||||
var lfaLMS = null;
|
||||
var cdcLfaLMS = null;
|
||||
var hcfaLMS = null;
|
||||
var wflLMS = null;
|
||||
var fentonLMS = null;
|
||||
|
||||
// CDC Weight-for-Age 24-240mo (every 6 months)
|
||||
var cdcWfaLMS = {male:{24:{L:-0.216501,M:12.7415,S:0.108166},30:{L:-0.397568,M:13.5609,S:0.109378},36:{L:-0.62132,M:14.4026,S:0.111875},42:{L:-0.804515,M:15.3194,S:0.115493},48:{L:-0.915242,M:16.3168,S:0.119955},54:{L:-0.969633,M:17.3791,S:0.124879},60:{L:-1.000454,M:18.4859,S:0.129879},66:{L:-1.035044,M:19.6214,S:0.134676},72:{L:-1.087471,M:20.7777,S:0.139143},78:{L:-1.158132,M:21.9564,S:0.14331},84:{L:-1.236497,M:23.1674,S:0.147337},90:{L:-1.306268,M:24.4265,S:0.151472},96:{L:-1.351813,M:25.7526,S:0.155974},102:{L:-1.363458,M:27.1649,S:0.161026},108:{L:-1.339405,M:28.6813,S:0.166659},114:{L:-1.284375,M:30.3177,S:0.172729},120:{L:-1.206688,M:32.088,S:0.178929},126:{L:-1.115543,M:34.0036,S:0.184847},132:{L:-1.019277,M:36.0726,S:0.19003},138:{L:-0.92467,M:38.2978,S:0.194053},144:{L:-0.836962,M:40.6744,S:0.196592},150:{L:-0.760274,M:43.1883,S:0.197464},156:{L:-0.698166,M:45.8134,S:0.196662},162:{L:-0.654143,M:48.5111,S:0.194344},168:{L:-0.631877,M:51.231,S:0.190808},174:{L:-0.634919,M:53.9126,S:0.186442},180:{L:-0.665609,M:56.491,S:0.181666},186:{L:-0.723218,M:58.9029,S:0.176887},192:{L:-0.801993,M:61.0954,S:0.172459},198:{L:-0.890436,M:63.0323,S:0.168655},204:{L:-0.973245,M:64.6996,S:0.16564},210:{L:-1.035402,M:66.1075,S:0.163439},216:{L:-1.066224,M:67.2899,S:0.161923},222:{L:-1.061342,M:68.3,S:0.16087},228:{L:-1.023292,M:69.1947,S:0.160138},234:{L:-0.964377,M:69.9987,S:0.160007},240:{L:-0.916488,M:70.5976,S:0.161477}},female:{24:{L:-0.752207,M:12.1346,S:0.10774},30:{L:-0.914719,M:13.0436,S:0.113023},36:{L:-1.024471,M:13.9411,S:0.119492},42:{L:-1.107022,M:14.8812,S:0.125973},48:{L:-1.17703,M:15.8782,S:0.131802},54:{L:-1.238331,M:16.9283,S:0.136811},60:{L:-1.287692,M:18.0231,S:0.141191},66:{L:-1.318993,M:19.1583,S:0.145317},72:{L:-1.326764,M:20.3364,S:0.14959},78:{L:-1.308487,M:21.5675,S:0.154326},84:{L:-1.265549,M:22.868,S:0.159693},90:{L:-1.202884,M:24.2579,S:0.165689},96:{L:-1.127684,M:25.757,S:0.172147},102:{L:-1.047847,M:27.382,S:0.178774},108:{L:-0.970686,M:29.1429,S:0.185201},114:{L:-0.902198,M:31.0403,S:0.191041},120:{L:-0.846873,M:33.0639,S:0.195947},126:{L:-0.807873,M:35.1918,S:0.199648},132:{L:-0.787374,M:37.3909,S:0.201971},138:{L:-0.786904,M:39.6191,S:0.202848},144:{L:-0.8076,M:41.828,S:0.202299},150:{L:-0.850307,M:43.9661,S:0.200419},156:{L:-0.915514,M:45.9837,S:0.197363},162:{L:-1.003051,M:47.8366,S:0.19333},168:{L:-1.111606,M:49.4908,S:0.18856},174:{L:-1.238005,M:50.9254,S:0.183328},180:{L:-1.376478,M:52.1357,S:0.177947},186:{L:-1.518156,M:53.1333,S:0.172761},192:{L:-1.651248,M:53.9454,S:0.168125},198:{L:-1.762241,M:54.6122,S:0.164368},204:{L:-1.838092,M:55.1822,S:0.161753},210:{L:-1.868977,M:55.7062,S:0.160423},216:{L:-1.850946,M:56.2297,S:0.16037},222:{L:-1.787979,M:56.7803,S:0.161399},228:{L:-1.693267,M:57.3518,S:0.163138},234:{L:-1.589533,M:57.8833,S:0.165088},240:{L:-1.513362,M:58.219,S:0.166645}}};
|
||||
|
||||
// WHO Length/Height-for-Age 0-60mo (monthly)
|
||||
var lfaLMS = {male:{0:{L:1.0,M:49.8842,S:0.03795},1:{L:1.0,M:54.6645,S:0.03559},2:{L:1.0,M:58.4384,S:0.03423},3:{L:1.0,M:61.4013,S:0.03329},4:{L:1.0,M:63.9041,S:0.03257},5:{L:1.0,M:65.8912,S:0.03204},6:{L:1.0,M:67.6435,S:0.03165},7:{L:1.0,M:69.1615,S:0.03139},8:{L:1.0,M:70.6224,S:0.03124},9:{L:1.0,M:71.9714,S:0.03117},10:{L:1.0,M:73.2653,S:0.03118},11:{L:1.0,M:74.5464,S:0.03125},12:{L:1.0,M:75.7391,S:0.03137},13:{L:1.0,M:76.9304,S:0.03154},14:{L:1.0,M:78.0451,S:0.03174},15:{L:1.0,M:79.1613,S:0.03197},16:{L:1.0,M:80.2113,S:0.03222},17:{L:1.0,M:81.234,S:0.03249},18:{L:1.0,M:82.2628,S:0.03279},19:{L:1.0,M:83.2318,S:0.0331},20:{L:1.0,M:84.2074,S:0.03342},21:{L:1.0,M:85.1291,S:0.03375},22:{L:1.0,M:86.0589,S:0.0341},23:{L:1.0,M:86.9392,S:0.03445},24:{L:1.0,M:87.8018,S:0.03479},25:{L:1.0,M:87.9737,S:0.03542},26:{L:1.0,M:88.7964,S:0.03576},27:{L:1.0,M:89.6247,S:0.0361},28:{L:1.0,M:90.4056,S:0.03642},29:{L:1.0,M:91.1906,S:0.03674},30:{L:1.0,M:91.9297,S:0.03704},31:{L:1.0,M:92.6735,S:0.03733},32:{L:1.0,M:93.3753,S:0.03761},33:{L:1.0,M:94.0612,S:0.03787},34:{L:1.0,M:94.7559,S:0.03812},35:{L:1.0,M:95.4168,S:0.03836},36:{L:1.0,M:96.0889,S:0.03858},37:{L:1.0,M:96.7298,S:0.03879},38:{L:1.0,M:97.3827,S:0.039},39:{L:1.0,M:98.006,S:0.03919},40:{L:1.0,M:98.6412,S:0.03937},41:{L:1.0,M:99.2471,S:0.03954},42:{L:1.0,M:99.8441,S:0.0397},43:{L:1.0,M:100.4522,S:0.03986},44:{L:1.0,M:101.0326,S:0.04002},45:{L:1.0,M:101.6246,S:0.04017},46:{L:1.0,M:102.191,S:0.04031},47:{L:1.0,M:102.7706,S:0.04045},48:{L:1.0,M:103.3273,S:0.04059},49:{L:1.0,M:103.8806,S:0.04073},50:{L:1.0,M:104.4496,S:0.04086},51:{L:1.0,M:104.9984,S:0.041},52:{L:1.0,M:105.5641,S:0.04113},53:{L:1.0,M:106.1104,S:0.04126},54:{L:1.0,M:106.6736,S:0.04139},55:{L:1.0,M:107.2176,S:0.04152},56:{L:1.0,M:107.7607,S:0.04165},57:{L:1.0,M:108.3209,S:0.04177},58:{L:1.0,M:108.8621,S:0.0419},59:{L:1.0,M:109.4203,S:0.04202},60:{L:1.0,M:109.9593,S:0.04214}},female:{0:{L:1.0,M:49.1477,S:0.0379},1:{L:1.0,M:53.6326,S:0.03641},2:{L:1.0,M:57.0796,S:0.03568},3:{L:1.0,M:59.7773,S:0.0352},4:{L:1.0,M:62.1071,S:0.03486},5:{L:1.0,M:64.019,S:0.03463},6:{L:1.0,M:65.751,S:0.03448},7:{L:1.0,M:67.2842,S:0.03441},8:{L:1.0,M:68.7732,S:0.0344},9:{L:1.0,M:70.1463,S:0.03444},10:{L:1.0,M:71.4656,S:0.03452},11:{L:1.0,M:72.7788,S:0.03464},12:{L:1.0,M:74.0049,S:0.03479},13:{L:1.0,M:75.2297,S:0.03496},14:{L:1.0,M:76.377,S:0.03514},15:{L:1.0,M:77.5258,S:0.03534},16:{L:1.0,M:78.6055,S:0.03555},17:{L:1.0,M:79.6559,S:0.03576},18:{L:1.0,M:80.7121,S:0.03598},19:{L:1.0,M:81.708,S:0.0362},20:{L:1.0,M:82.7116,S:0.03643},21:{L:1.0,M:83.6595,S:0.03665},22:{L:1.0,M:84.6154,S:0.03689},23:{L:1.0,M:85.5184,S:0.03711},24:{L:1.0,M:86.4008,S:0.03733},25:{L:1.0,M:86.5922,S:0.03786},26:{L:1.0,M:87.4358,S:0.03808},27:{L:1.0,M:88.2881,S:0.0383},28:{L:1.0,M:89.0938,S:0.03851},29:{L:1.0,M:89.9072,S:0.03872},30:{L:1.0,M:90.6765,S:0.03893},31:{L:1.0,M:91.4539,S:0.03913},32:{L:1.0,M:92.1906,S:0.03933},33:{L:1.0,M:92.9135,S:0.03952},34:{L:1.0,M:93.6473,S:0.03971},35:{L:1.0,M:94.346,S:0.03989},36:{L:1.0,M:95.0572,S:0.04007},37:{L:1.0,M:95.7356,S:0.04024},38:{L:1.0,M:96.427,S:0.04041},39:{L:1.0,M:97.0871,S:0.04057},40:{L:1.0,M:97.7601,S:0.04074},41:{L:1.0,M:98.4028,S:0.04089},42:{L:1.0,M:99.0369,S:0.04105},43:{L:1.0,M:99.6834,S:0.0412},44:{L:1.0,M:100.3007,S:0.04135},45:{L:1.0,M:100.9301,S:0.0415},46:{L:1.0,M:101.5312,S:0.04164},47:{L:1.0,M:102.1446,S:0.04179},48:{L:1.0,M:102.7312,S:0.04193},49:{L:1.0,M:103.3113,S:0.04206},50:{L:1.0,M:103.9045,S:0.0422},51:{L:1.0,M:104.4727,S:0.04233},52:{L:1.0,M:105.0541,S:0.04247},53:{L:1.0,M:105.6114,S:0.04259},54:{L:1.0,M:106.1817,S:0.04272},55:{L:1.0,M:106.7284,S:0.04285},56:{L:1.0,M:107.2698,S:0.04297},57:{L:1.0,M:107.8238,S:0.0431},58:{L:1.0,M:108.3547,S:0.04322},59:{L:1.0,M:108.8981,S:0.04335},60:{L:1.0,M:109.4189,S:0.04346}}};
|
||||
|
||||
// CDC Stature-for-Age 24-240mo (every 6 months)
|
||||
var cdcLfaLMS = {male:{24:{L:1.007208,M:86.8616,S:0.040396},30:{L:0.174489,M:91.3324,S:0.040965},36:{L:-0.390918,M:95.2736,S:0.040534},42:{L:0.32653,M:99.0025,S:0.040848},48:{L:0.827637,M:102.5105,S:0.041344},54:{L:1.133652,M:105.8813,S:0.041956},60:{L:1.266367,M:109.1751,S:0.042593},66:{L:1.255402,M:112.4296,S:0.043181},72:{L:1.137443,M:115.6609,S:0.043673},78:{L:0.954853,M:118.8668,S:0.044069},84:{L:0.753244,M:122.0305,S:0.044403},90:{L:0.575908,M:125.1259,S:0.044736},96:{L:0.455268,M:128.1237,S:0.045127},102:{L:0.404778,M:130.9983,S:0.045618},108:{L:0.415687,M:133.7345,S:0.046217},114:{L:0.461031,M:136.3343,S:0.046897},120:{L:0.505564,M:138.8234,S:0.04761},126:{L:0.518588,M:141.2582,S:0.048304},132:{L:0.487939,M:143.7304,S:0.048938},138:{L:0.434576,M:146.3665,S:0.049489},144:{L:0.420919,M:149.3088,S:0.049948},150:{L:0.531952,M:152.6624,S:0.050273},156:{L:0.81624,M:156.4099,S:0.050333},162:{L:1.232769,M:160.3493,S:0.049927},168:{L:1.670433,M:164.1418,S:0.048945},174:{L:2.016782,M:167.4641,S:0.047507},180:{L:2.20518,M:170.1393,S:0.04589},186:{L:2.225326,M:172.1563,S:0.044363},192:{L:2.113023,M:173.6101,S:0.043086},198:{L:1.927321,M:174.631,S:0.042107},204:{L:1.724738,M:175.341,S:0.041408},210:{L:1.543253,M:175.836,S:0.040938},216:{L:1.399999,M:176.185,S:0.040644},222:{L:1.297149,M:176.4352,S:0.040474},228:{L:1.229163,M:176.6179,S:0.040391},234:{L:1.18802,M:176.7538,S:0.040364},240:{L:1.167279,M:176.8492,S:0.04037}},female:{24:{L:1.051273,M:85.3973,S:0.04086},30:{L:0.814544,M:90.3334,S:0.041754},36:{L:0.541981,M:94.2134,S:0.042018},42:{L:0.377878,M:97.6485,S:0.042622},48:{L:0.225706,M:101.0339,S:0.04326},54:{L:0.075699,M:104.4635,S:0.043817},60:{L:-0.05773,M:107.9566,S:0.044277},66:{L:-0.159198,M:111.4876,S:0.044653},72:{L:-0.219069,M:115.0055,S:0.044964},78:{L:-0.234772,M:118.4496,S:0.045226},84:{L:-0.210211,M:121.7617,S:0.045461},90:{L:-0.154357,M:124.8956,S:0.045694},96:{L:-0.079283,M:127.8263,S:0.045968},102:{L:0.002744,M:130.5574,S:0.04634},108:{L:0.084148,M:133.1304,S:0.046884},114:{L:0.169805,M:135.6342,S:0.04767},120:{L:0.284749,M:138.2112,S:0.048705},126:{L:0.46918,M:141.0397,S:0.049812},132:{L:0.74429,M:144.2609,S:0.050524},138:{L:1.062475,M:147.8424,S:0.050208},144:{L:1.303045,M:151.4866,S:0.048599},150:{L:1.358163,M:154.7555,S:0.046198},156:{L:1.242968,M:157.3437,S:0.043859},162:{L:1.076971,M:159.2075,S:0.042114},168:{L:0.956572,M:160.4777,S:0.041022},174:{L:0.902452,M:161.3268,S:0.040409},180:{L:0.89557,M:161.898,S:0.040084},186:{L:0.913398,M:162.2908,S:0.039913},192:{L:0.941146,M:162.569,S:0.039821},198:{L:0.971038,M:162.7719,S:0.039767},204:{L:0.999506,M:162.9238,S:0.039732},210:{L:1.025143,M:163.0402,S:0.039707},216:{L:1.047571,M:163.1308,S:0.039687},222:{L:1.066873,M:163.2022,S:0.039671},228:{L:1.083315,M:163.259,S:0.039657},234:{L:1.097229,M:163.3045,S:0.039646},240:{L:1.108046,M:163.3383,S:0.039636}}};
|
||||
|
||||
// WHO Head Circumference 0-60mo (monthly)
|
||||
var hcfaLMS = {male:{0:{L:1.0,M:34.4618,S:0.03686},1:{L:1.0,M:37.2435,S:0.03135},2:{L:1.0,M:39.1349,S:0.02997},3:{L:1.0,M:40.5008,S:0.02918},4:{L:1.0,M:41.6401,S:0.02868},5:{L:1.0,M:42.5524,S:0.02837},6:{L:1.0,M:43.3393,S:0.02817},7:{L:1.0,M:43.9791,S:0.02804},8:{L:1.0,M:44.5384,S:0.02796},9:{L:1.0,M:45.0007,S:0.02792},10:{L:1.0,M:45.4004,S:0.0279},11:{L:1.0,M:45.7593,S:0.02789},12:{L:1.0,M:46.0637,S:0.02789},13:{L:1.0,M:46.3421,S:0.02789},14:{L:1.0,M:46.5834,S:0.02791},15:{L:1.0,M:46.809,S:0.02792},16:{L:1.0,M:47.0088,S:0.02795},17:{L:1.0,M:47.1936,S:0.02797},18:{L:1.0,M:47.3718,S:0.028},19:{L:1.0,M:47.5341,S:0.02803},20:{L:1.0,M:47.6931,S:0.02806},21:{L:1.0,M:47.8399,S:0.0281},22:{L:1.0,M:47.985,S:0.02814},23:{L:1.0,M:48.1198,S:0.02817},24:{L:1.0,M:48.2494,S:0.02821},25:{L:1.0,M:48.378,S:0.02825},26:{L:1.0,M:48.4974,S:0.0283},27:{L:1.0,M:48.6158,S:0.02834},28:{L:1.0,M:48.7255,S:0.02838},29:{L:1.0,M:48.8341,S:0.02843},30:{L:1.0,M:48.9347,S:0.02847},31:{L:1.0,M:49.0341,S:0.02851},32:{L:1.0,M:49.126,S:0.02855},33:{L:1.0,M:49.214,S:0.02859},34:{L:1.0,M:49.3011,S:0.02863},35:{L:1.0,M:49.3818,S:0.02867},36:{L:1.0,M:49.4619,S:0.02871},37:{L:1.0,M:49.5362,S:0.02875},38:{L:1.0,M:49.6101,S:0.02878},39:{L:1.0,M:49.679,S:0.02882},40:{L:1.0,M:49.7476,S:0.02886},41:{L:1.0,M:49.8117,S:0.02889},42:{L:1.0,M:49.8737,S:0.02893},43:{L:1.0,M:49.9357,S:0.02896},44:{L:1.0,M:49.9938,S:0.02899},45:{L:1.0,M:50.0518,S:0.02903},46:{L:1.0,M:50.1062,S:0.02906},47:{L:1.0,M:50.1606,S:0.02909},48:{L:1.0,M:50.2115,S:0.02912},49:{L:1.0,M:50.261,S:0.02915},50:{L:1.0,M:50.3107,S:0.02918},51:{L:1.0,M:50.3573,S:0.02921},52:{L:1.0,M:50.4043,S:0.02924},53:{L:1.0,M:50.4485,S:0.02927},54:{L:1.0,M:50.4931,S:0.0293},55:{L:1.0,M:50.5353,S:0.02932},56:{L:1.0,M:50.5766,S:0.02935},57:{L:1.0,M:50.6184,S:0.02938},58:{L:1.0,M:50.6582,S:0.0294},59:{L:1.0,M:50.6986,S:0.02943},60:{L:1.0,M:50.7372,S:0.02945}},female:{0:{L:1.0,M:33.8787,S:0.03496},1:{L:1.0,M:36.5163,S:0.03211},2:{L:1.0,M:38.258,S:0.03168},3:{L:1.0,M:39.521,S:0.0314},4:{L:1.0,M:40.5895,S:0.03119},5:{L:1.0,M:41.454,S:0.03102},6:{L:1.0,M:42.2079,S:0.03087},7:{L:1.0,M:42.8278,S:0.03075},8:{L:1.0,M:43.3753,S:0.03063},9:{L:1.0,M:43.8309,S:0.03053},10:{L:1.0,M:44.2273,S:0.03044},11:{L:1.0,M:44.5865,S:0.03035},12:{L:1.0,M:44.894,S:0.03027},13:{L:1.0,M:45.1779,S:0.03019},14:{L:1.0,M:45.4255,S:0.03012},15:{L:1.0,M:45.6582,S:0.03005},16:{L:1.0,M:45.865,S:0.02999},17:{L:1.0,M:46.0571,S:0.02993},18:{L:1.0,M:46.2431,S:0.02987},19:{L:1.0,M:46.4135,S:0.02982},20:{L:1.0,M:46.5814,S:0.02977},21:{L:1.0,M:46.7375,S:0.02972},22:{L:1.0,M:46.8931,S:0.02967},23:{L:1.0,M:47.0388,S:0.02962},24:{L:1.0,M:47.1799,S:0.02958},25:{L:1.0,M:47.3207,S:0.02953},26:{L:1.0,M:47.452,S:0.02949},27:{L:1.0,M:47.5825,S:0.02945},28:{L:1.0,M:47.7035,S:0.02941},29:{L:1.0,M:47.8231,S:0.02937},30:{L:1.0,M:47.9336,S:0.02933},31:{L:1.0,M:48.0425,S:0.02929},32:{L:1.0,M:48.1432,S:0.02926},33:{L:1.0,M:48.2395,S:0.02922},34:{L:1.0,M:48.3347,S:0.02919},35:{L:1.0,M:48.423,S:0.02916},36:{L:1.0,M:48.5106,S:0.02912},37:{L:1.0,M:48.5921,S:0.02909},38:{L:1.0,M:48.6732,S:0.02906},39:{L:1.0,M:48.7487,S:0.02903},40:{L:1.0,M:48.824,S:0.029},41:{L:1.0,M:48.8942,S:0.02897},42:{L:1.0,M:48.9621,S:0.02894},43:{L:1.0,M:49.0298,S:0.02891},44:{L:1.0,M:49.0932,S:0.02888},45:{L:1.0,M:49.1566,S:0.02886},46:{L:1.0,M:49.2162,S:0.02883},47:{L:1.0,M:49.2759,S:0.0288},48:{L:1.0,M:49.3321,S:0.02878},49:{L:1.0,M:49.3869,S:0.02875},50:{L:1.0,M:49.4421,S:0.02873},51:{L:1.0,M:49.4942,S:0.0287},52:{L:1.0,M:49.5468,S:0.02868},53:{L:1.0,M:49.5966,S:0.02866},54:{L:1.0,M:49.647,S:0.02863},55:{L:1.0,M:49.6946,S:0.02861},56:{L:1.0,M:49.7413,S:0.02859},57:{L:1.0,M:49.7886,S:0.02856},58:{L:1.0,M:49.8335,S:0.02854},59:{L:1.0,M:49.8791,S:0.02852},60:{L:1.0,M:49.9225,S:0.0285}}};
|
||||
|
||||
// WHO Weight-for-Length 45-110cm (every 1cm)
|
||||
var wflLMS = {male:{45:{L:-0.3521,M:2.441,S:0.09182},46:{L:-0.3521,M:2.6077,S:0.09124},47:{L:-0.3521,M:2.7755,S:0.09065},48:{L:-0.3521,M:2.948,S:0.09007},49:{L:-0.3521,M:3.1308,S:0.08948},50:{L:-0.3521,M:3.3278,S:0.0889},51:{L:-0.3521,M:3.5376,S:0.08831},52:{L:-0.3521,M:3.762,S:0.08771},53:{L:-0.3521,M:4.006,S:0.08711},54:{L:-0.3521,M:4.2693,S:0.08651},55:{L:-0.3521,M:4.5467,S:0.08592},56:{L:-0.3521,M:4.8338,S:0.08535},57:{L:-0.3521,M:5.1259,S:0.08481},58:{L:-0.3521,M:5.418,S:0.0843},59:{L:-0.3521,M:5.7074,S:0.08383},60:{L:-0.3521,M:5.9907,S:0.08342},61:{L:-0.3521,M:6.2632,S:0.08308},62:{L:-0.3521,M:6.5251,S:0.08279},63:{L:-0.3521,M:6.7786,S:0.08255},64:{L:-0.3521,M:7.0255,S:0.08236},65:{L:-0.3521,M:7.2666,S:0.08223},66:{L:-0.3521,M:7.5034,S:0.08215},67:{L:-0.3521,M:7.737,S:0.08212},68:{L:-0.3521,M:7.9674,S:0.08214},69:{L:-0.3521,M:8.1955,S:0.08219},70:{L:-0.3521,M:8.4227,S:0.08229},71:{L:-0.3521,M:8.648,S:0.08241},72:{L:-0.3521,M:8.8697,S:0.08254},73:{L:-0.3521,M:9.0865,S:0.08269},74:{L:-0.3521,M:9.2974,S:0.08283},75:{L:-0.3521,M:9.5032,S:0.08295},76:{L:-0.3521,M:9.7033,S:0.08307},77:{L:-0.3521,M:9.8963,S:0.08314},78:{L:-0.3521,M:10.0827,S:0.08318},79:{L:-0.3521,M:10.2649,S:0.08316},80:{L:-0.3521,M:10.4475,S:0.08308},81:{L:-0.3521,M:10.6352,S:0.08293},82:{L:-0.3521,M:10.8321,S:0.08273},83:{L:-0.3521,M:11.0415,S:0.08246},84:{L:-0.3521,M:11.2651,S:0.08215},85:{L:-0.3521,M:11.5007,S:0.08181},86:{L:-0.3521,M:11.7444,S:0.08145},87:{L:-0.3521,M:11.9916,S:0.08111},88:{L:-0.3521,M:12.2382,S:0.08082},89:{L:-0.3521,M:12.4815,S:0.08058},90:{L:-0.3521,M:12.7209,S:0.08041},91:{L:-0.3521,M:12.9569,S:0.0803},92:{L:-0.3521,M:13.191,S:0.08025},93:{L:-0.3521,M:13.4239,S:0.08026},94:{L:-0.3521,M:13.6572,S:0.08034},95:{L:-0.3521,M:13.8928,S:0.08047},96:{L:-0.3521,M:14.1325,S:0.08067},97:{L:-0.3521,M:14.3782,S:0.08092},98:{L:-0.3521,M:14.6316,S:0.08122},99:{L:-0.3521,M:14.8934,S:0.08157},100:{L:-0.3521,M:15.1637,S:0.08198},101:{L:-0.3521,M:15.4419,S:0.08243},102:{L:-0.3521,M:15.7276,S:0.08292},103:{L:-0.3521,M:16.0206,S:0.08343},104:{L:-0.3521,M:16.3204,S:0.08397},105:{L:-0.3521,M:16.6268,S:0.08453},106:{L:-0.3521,M:16.9401,S:0.0851},107:{L:-0.3521,M:17.2607,S:0.08568},108:{L:-0.3521,M:17.5885,S:0.08629},109:{L:-0.3521,M:17.9242,S:0.08691},110:{L:-0.3521,M:18.2689,S:0.08755}},female:{45:{L:-0.3833,M:2.4607,S:0.09029},46:{L:-0.3833,M:2.6306,S:0.09037},47:{L:-0.3833,M:2.8007,S:0.09044},48:{L:-0.3833,M:2.9741,S:0.09052},49:{L:-0.3833,M:3.156,S:0.0906},50:{L:-0.3833,M:3.3518,S:0.09068},51:{L:-0.3833,M:3.5636,S:0.09076},52:{L:-0.3833,M:3.7911,S:0.09085},53:{L:-0.3833,M:4.0332,S:0.09093},54:{L:-0.3833,M:4.2875,S:0.09102},55:{L:-0.3833,M:4.5498,S:0.0911},56:{L:-0.3833,M:4.8162,S:0.09118},57:{L:-0.3833,M:5.0837,S:0.09125},58:{L:-0.3833,M:5.3507,S:0.0913},59:{L:-0.3833,M:5.6151,S:0.09134},60:{L:-0.3833,M:5.8742,S:0.09136},61:{L:-0.3833,M:6.127,S:0.09137},62:{L:-0.3833,M:6.3738,S:0.09135},63:{L:-0.3833,M:6.6144,S:0.09131},64:{L:-0.3833,M:6.8501,S:0.09126},65:{L:-0.3833,M:7.0812,S:0.09119},66:{L:-0.3833,M:7.3076,S:0.0911},67:{L:-0.3833,M:7.5288,S:0.09101},68:{L:-0.3833,M:7.7448,S:0.0909},69:{L:-0.3833,M:7.9559,S:0.09079},70:{L:-0.3833,M:8.163,S:0.09068},71:{L:-0.3833,M:8.3666,S:0.09056},72:{L:-0.3833,M:8.5679,S:0.09043},73:{L:-0.3833,M:8.7661,S:0.09031},74:{L:-0.3833,M:8.9601,S:0.09018},75:{L:-0.3833,M:9.149,S:0.09005},76:{L:-0.3833,M:9.3337,S:0.08992},77:{L:-0.3833,M:9.5166,S:0.08979},78:{L:-0.3833,M:9.7015,S:0.08965},79:{L:-0.3833,M:9.8915,S:0.08952},80:{L:-0.3833,M:10.0891,S:0.0894},81:{L:-0.3833,M:10.2965,S:0.08928},82:{L:-0.3833,M:10.514,S:0.08918},83:{L:-0.3833,M:10.741,S:0.0891},84:{L:-0.3833,M:10.9767,S:0.08903},85:{L:-0.3833,M:11.2198,S:0.08898},86:{L:-0.3833,M:11.4684,S:0.08895},87:{L:-0.3833,M:11.7201,S:0.08895},88:{L:-0.3833,M:11.972,S:0.08896},89:{L:-0.3833,M:12.2229,S:0.089},90:{L:-0.3833,M:12.4723,S:0.08906},91:{L:-0.3833,M:12.7205,S:0.08913},92:{L:-0.3833,M:12.9681,S:0.08923},93:{L:-0.3833,M:13.2158,S:0.08934},94:{L:-0.3833,M:13.4643,S:0.08948},95:{L:-0.3833,M:13.7146,S:0.08963},96:{L:-0.3833,M:13.9676,S:0.08981},97:{L:-0.3833,M:14.2239,S:0.09},98:{L:-0.3833,M:14.4848,S:0.09021},99:{L:-0.3833,M:14.7519,S:0.09044},100:{L:-0.3833,M:15.0267,S:0.09069},101:{L:-0.3833,M:15.3108,S:0.09096},102:{L:-0.3833,M:15.6046,S:0.09125},103:{L:-0.3833,M:15.9087,S:0.09155},104:{L:-0.3833,M:16.2229,S:0.09186},105:{L:-0.3833,M:16.547,S:0.09219},106:{L:-0.3833,M:16.8814,S:0.09254},107:{L:-0.3833,M:17.2269,S:0.09289},108:{L:-0.3833,M:17.5839,S:0.09326},109:{L:-0.3833,M:17.9526,S:0.09363},110:{L:-0.3833,M:18.3324,S:0.09401}}};
|
||||
|
||||
// Fenton Preterm Growth LMS (GA 22-50 weeks) — Weight in grams
|
||||
var fentonLMS = {
|
||||
male: {
|
||||
22:{L:0.21,M:496,S:0.17},24:{L:0.21,M:660,S:0.17},26:{L:0.21,M:870,S:0.16},
|
||||
28:{L:0.20,M:1124,S:0.15},30:{L:0.18,M:1430,S:0.14},32:{L:0.15,M:1795,S:0.14},
|
||||
34:{L:0.12,M:2230,S:0.13},36:{L:0.08,M:2710,S:0.13},38:{L:0.04,M:3195,S:0.12},
|
||||
40:{L:0.01,M:3530,S:0.12},42:{L:-0.02,M:3820,S:0.12},44:{L:-0.04,M:4200,S:0.12},
|
||||
46:{L:-0.06,M:4680,S:0.12},48:{L:-0.07,M:5200,S:0.12},50:{L:-0.08,M:5760,S:0.12}
|
||||
},
|
||||
female: {
|
||||
22:{L:0.23,M:474,S:0.17},24:{L:0.22,M:610,S:0.17},26:{L:0.22,M:810,S:0.16},
|
||||
28:{L:0.21,M:1040,S:0.15},30:{L:0.19,M:1330,S:0.14},32:{L:0.16,M:1680,S:0.14},
|
||||
34:{L:0.12,M:2090,S:0.13},36:{L:0.08,M:2540,S:0.13},38:{L:0.04,M:3000,S:0.12},
|
||||
40:{L:0.01,M:3340,S:0.12},42:{L:-0.02,M:3630,S:0.12},44:{L:-0.04,M:4010,S:0.12},
|
||||
46:{L:-0.06,M:4470,S:0.12},48:{L:-0.07,M:4970,S:0.12},50:{L:-0.08,M:5510,S:0.12}
|
||||
}
|
||||
};
|
||||
loadGrowthLmsData()
|
||||
.then(function(data) {
|
||||
wfaLMS = data.wfaLMS;
|
||||
cdcWfaLMS = data.cdcWfaLMS;
|
||||
lfaLMS = data.lfaLMS;
|
||||
cdcLfaLMS = data.cdcLfaLMS;
|
||||
hcfaLMS = data.hcfaLMS;
|
||||
wflLMS = data.wflLMS;
|
||||
fentonLMS = data.fentonLMS;
|
||||
})
|
||||
.catch(function(err) { console.warn('[calculators] Growth LMS data unavailable:', err && err.message); });
|
||||
|
||||
// Growth sub-pill navigation
|
||||
document.querySelectorAll('[data-growth]').forEach(function(pill) {
|
||||
|
|
@ -1184,6 +1170,9 @@ initImageLightbox();
|
|||
document.getElementById('btn-calc-growth').addEventListener('click', function() {
|
||||
var sex = document.getElementById('growth-sex').value;
|
||||
if (!sex) { showToast('Select sex', 'error'); return; }
|
||||
if (!wfaLMS || !cdcWfaLMS || !lfaLMS || !cdcLfaLMS || !hcfaLMS || !wflLMS || !fentonLMS) {
|
||||
showToast('Growth chart data is still loading.', 'info'); return;
|
||||
}
|
||||
|
||||
var resultDiv = document.getElementById('growth-result');
|
||||
|
||||
|
|
|
|||
48
public/js/calculators/growth.js
Normal file
48
public/js/calculators/growth.js
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
var growthCache = null;
|
||||
|
||||
export function loadGrowthLmsData() {
|
||||
if (growthCache) return Promise.resolve(growthCache);
|
||||
return fetch('/data/calculators/growth-lms.json', { credentials: 'same-origin' })
|
||||
.then(function(response) {
|
||||
if (!response.ok) throw new Error('Failed to load growth LMS data');
|
||||
return response.json();
|
||||
})
|
||||
.then(function(data) {
|
||||
growthCache = data.lms || {};
|
||||
return growthCache;
|
||||
});
|
||||
}
|
||||
|
||||
export function interpolateLMS(lmsTable, val) {
|
||||
var keys = Object.keys(lmsTable).map(Number).sort(function(a,b){return a-b;});
|
||||
if (val <= keys[0]) return lmsTable[keys[0]];
|
||||
if (val >= keys[keys.length-1]) return lmsTable[keys[keys.length-1]];
|
||||
for (var i = 0; i < keys.length - 1; i++) {
|
||||
if (val >= keys[i] && val <= keys[i+1]) {
|
||||
var t = (val - keys[i]) / (keys[i+1] - keys[i]);
|
||||
var a = lmsTable[keys[i]], b = lmsTable[keys[i+1]];
|
||||
return { L: a.L + t*(b.L-a.L), M: a.M + t*(b.M-a.M), S: a.S + t*(b.S-a.S) };
|
||||
}
|
||||
}
|
||||
return lmsTable[keys[0]];
|
||||
}
|
||||
|
||||
export function normalCDF(z) {
|
||||
var a1=0.254829592, a2=-0.284496736, a3=1.421413741, a4=-1.453152027, a5=1.061405429, p=0.3275911;
|
||||
var sign = z < 0 ? -1 : 1;
|
||||
z = Math.abs(z) / Math.sqrt(2);
|
||||
var t = 1 / (1 + p * z);
|
||||
var y = 1 - (((((a5*t+a4)*t)+a3)*t+a2)*t+a1)*t*Math.exp(-z*z);
|
||||
return 0.5 * (1 + sign * y);
|
||||
}
|
||||
|
||||
export function calcZFromLMS(value, L, M, S) {
|
||||
if (Math.abs(L) < 0.001) return Math.log(value / M) / S;
|
||||
return (Math.pow(value / M, L) - 1) / (L * S);
|
||||
}
|
||||
|
||||
export function calculateLmsPercentile(lmsTable, x, value) {
|
||||
var lms = interpolateLMS(lmsTable, x);
|
||||
var z = calcZFromLMS(value, lms.L, lms.M, lms.S);
|
||||
return { lms: lms, z: z, percentile: normalCDF(z) * 100 };
|
||||
}
|
||||
|
|
@ -305,3 +305,47 @@ test('BMI calculator preserves legacy outputs across sex/age/body-size combinati
|
|||
assert.equal(Number(actual.classification.bmi95.toFixed(1)), expected.bmi95, expected.name + ' bmi95');
|
||||
});
|
||||
});
|
||||
|
||||
test('growth-lms.json exposes complete WHO/CDC/Fenton datasets', () => {
|
||||
const raw = fs.readFileSync(path.join(__dirname, '..', 'public', 'data', 'calculators', 'growth-lms.json'), 'utf8');
|
||||
const data = JSON.parse(raw);
|
||||
assert.equal(data.version, '1.0');
|
||||
assert.deepEqual(Object.keys(data.lms), ['wfaLMS', 'cdcWfaLMS', 'lfaLMS', 'cdcLfaLMS', 'hcfaLMS', 'wflLMS', 'fentonLMS']);
|
||||
Object.entries(data.lms).forEach(([tableName, bySex]) => {
|
||||
['male', 'female'].forEach((sex) => {
|
||||
const rows = bySex[sex];
|
||||
assert.ok(rows, `${tableName}.${sex}`);
|
||||
const keys = Object.keys(rows).map(Number).sort((a, b) => a - b);
|
||||
assert.ok(keys.length > 0, `${tableName}.${sex}.rows`);
|
||||
keys.forEach((key) => {
|
||||
assert.equal(typeof rows[key].L, 'number', `${tableName}.${sex}.${key}.L`);
|
||||
assert.equal(typeof rows[key].M, 'number', `${tableName}.${sex}.${key}.M`);
|
||||
assert.equal(typeof rows[key].S, 'number', `${tableName}.${sex}.${key}.S`);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('growth calculator preserves legacy outputs across chart combinations', async () => {
|
||||
const growth = await import('../public/js/calculators/growth.js');
|
||||
const raw = fs.readFileSync(path.join(__dirname, '..', 'public', 'data', 'calculators', 'growth-lms.json'), 'utf8');
|
||||
const data = JSON.parse(raw).lms;
|
||||
const cases = [
|
||||
{ name: 'who wfa male 6mo 8kg', table: data.wfaLMS.male, x: 6, value: 8, z: 0.07, percentile: 52.79, lms: { L: 0.1256, M: 7.9389, S: 0.10957 } },
|
||||
{ name: 'cdc wfa female 72mo 20kg', table: data.cdcWfaLMS.female, x: 72, value: 20, z: -0.11, percentile: 45.51, lms: { L: -1.326764, M: 20.3364, S: 0.14959 } },
|
||||
{ name: 'who lfa male 12mo 75cm', table: data.lfaLMS.male, x: 12, value: 75, z: -0.31, percentile: 37.79, lms: { L: 1, M: 75.7391, S: 0.03137 } },
|
||||
{ name: 'cdc lfa female 120mo 140cm', table: data.cdcLfaLMS.female, x: 120, value: 140, z: 0.26, percentile: 60.43, lms: { L: 0.284749, M: 138.2112, S: 0.048705 } },
|
||||
{ name: 'who hcfa male 12mo 46cm', table: data.hcfaLMS.male, x: 12, value: 46, z: -0.05, percentile: 48.02, lms: { L: 1, M: 46.0637, S: 0.02789 } },
|
||||
{ name: 'who wfl female 70cm 8kg', table: data.wflLMS.female, x: 70, value: 8, z: -0.22, percentile: 41.17, lms: { L: -0.3833, M: 8.163, S: 0.09068 } },
|
||||
{ name: 'fenton male 30w 1.5kg', table: data.fentonLMS.male, x: 30, value: 1500, z: 0.34, percentile: 63.41, lms: { L: 0.18, M: 1430, S: 0.14 } }
|
||||
];
|
||||
|
||||
cases.forEach((expected) => {
|
||||
const actual = growth.calculateLmsPercentile(expected.table, expected.x, expected.value);
|
||||
assert.equal(Number(actual.z.toFixed(2)), expected.z, expected.name + ' z');
|
||||
assert.equal(Number(actual.percentile.toFixed(2)), expected.percentile, expected.name + ' percentile');
|
||||
assert.equal(Number(actual.lms.L.toFixed(6)), expected.lms.L, expected.name + ' L');
|
||||
assert.equal(Number(actual.lms.M.toFixed(4)), expected.lms.M, expected.name + ' M');
|
||||
assert.equal(Number(actual.lms.S.toFixed(6)), expected.lms.S, expected.name + ' S');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue