@openmrs/ngx-formentry 3.0.1-pre.62 → 3.0.1-pre.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1326,6 +1326,253 @@ class FutureDateRestrictionValidator {
1326
1326
  }
1327
1327
  }
1328
1328
 
1329
+ // South East Asia Non Laboratory CVD Risk Array of Arrays
1330
+ // Vertically we have the BMI value eg for the first array [26(bmi < 20), 28(bmi 20 - 24), 30(bmi 25 - 29), 32(bmi 30 - 35), 34(bmi >= 35)]
1331
+ const southEastAsiaCvdRiskTables = [
1332
+ // Men
1333
+ [
1334
+ // Non smoker
1335
+ [
1336
+ // Age 70 - 74
1337
+ [
1338
+ [26, 28, 30, 32, 34],
1339
+ [21, 23, 25, 26, 28],
1340
+ [17, 19, 20, 21, 23],
1341
+ [14, 15, 16, 17, 18],
1342
+ [11, 12, 13, 14, 15], // sbp < 120
1343
+ ],
1344
+ // Age 65 - 69
1345
+ [
1346
+ [20, 22, 24, 26, 28],
1347
+ [16, 17, 19, 21, 22],
1348
+ [12, 14, 15, 16, 18],
1349
+ [10, 11, 12, 13, 14],
1350
+ [8, 8, 9, 10, 11], // < 120
1351
+ ],
1352
+ // Age 60 - 64
1353
+ [
1354
+ [15, 17, 19, 21, 23],
1355
+ [12, 13, 14, 16, 18],
1356
+ [9, 10, 11, 12, 14],
1357
+ [7, 8, 8, 9, 10],
1358
+ [5, 6, 6, 7, 8], // sbp < 120
1359
+ ],
1360
+ // Age 55 - 59
1361
+ [
1362
+ [12, 13, 15, 16, 18],
1363
+ [9, 10, 11, 12, 14],
1364
+ [7, 7, 8, 9, 10],
1365
+ [5, 5, 6, 7, 8],
1366
+ [4, 4, 4, 5, 6], // sbp < 120
1367
+ ],
1368
+ // Age 50 - 54
1369
+ [
1370
+ [9, 10, 11, 13, 15],
1371
+ [7, 7, 8, 9, 11],
1372
+ [5, 5, 6, 7, 8],
1373
+ [3, 4, 4, 5, 6],
1374
+ [2, 3, 3, 4, 4], // sbp < 120
1375
+ ],
1376
+ // Age 45 - 49
1377
+ [
1378
+ [7, 8, 9, 10, 12],
1379
+ [5, 6, 6, 7, 8],
1380
+ [3, 4, 4, 5, 6],
1381
+ [2, 3, 3, 4, 4],
1382
+ [2, 2, 2, 2, 3], // < 120
1383
+ ],
1384
+ // Age 40 - 44
1385
+ [
1386
+ [5, 6, 7, 8, 10],
1387
+ [4, 4, 5, 6, 7],
1388
+ [2, 3, 3, 4, 4],
1389
+ [2, 2, 2, 3, 3],
1390
+ [1, 1, 2, 2, 2],
1391
+ ],
1392
+ ],
1393
+ // Smoker
1394
+ [
1395
+ // Age 70 - 74
1396
+ [
1397
+ [34, 36, 39, 41, 44],
1398
+ [28, 30, 32, 34, 36],
1399
+ [23, 24, 26, 28, 30],
1400
+ [18, 20, 21, 23, 24],
1401
+ [15, 16, 17, 18, 20], // < 120
1402
+ ],
1403
+ // Age 65 - 69
1404
+ [
1405
+ [28, 30, 33, 36, 39],
1406
+ [22, 24, 26, 29, 31],
1407
+ [18, 19, 21, 23, 25],
1408
+ [14, 15, 16, 18, 20],
1409
+ [11, 12, 13, 14, 16], // < 120
1410
+ ],
1411
+ // Age 60 - 64
1412
+ [
1413
+ [23, 25, 28, 31, 34],
1414
+ [18, 18, 20, 22, 24],
1415
+ [14, 15, 17, 19, 21],
1416
+ [10, 12, 13, 14, 16],
1417
+ [8, 9, 10, 11, 12], // < 120
1418
+ ],
1419
+ // Age 55 - 59
1420
+ [
1421
+ [19, 21, 24, 27, 30],
1422
+ [14, 16, 18, 20, 23],
1423
+ [11, 12, 13, 15, 17],
1424
+ [8, 9, 10, 11, 13],
1425
+ [6, 7, 7, 8, 10],
1426
+ ],
1427
+ // Age 50 - 54
1428
+ [
1429
+ [15, 18, 20, 23, 27],
1430
+ [11, 13, 15, 17, 20],
1431
+ [8, 9, 11, 12, 14],
1432
+ [6, 7, 8, 9, 11],
1433
+ [4, 5, 6, 7, 8],
1434
+ ],
1435
+ // Age 45 - 49
1436
+ [
1437
+ [13, 15, 17, 20, 23],
1438
+ [9, 10, 12, 14, 17],
1439
+ [6, 7, 9, 10, 12],
1440
+ [4, 5, 6, 7, 8],
1441
+ [3, 4, 4, 5, 6],
1442
+ ],
1443
+ // Age 40 - 44
1444
+ [
1445
+ [10, 12, 14, 17, 20],
1446
+ [7, 8, 10, 12, 14],
1447
+ [5, 6, 7, 8, 10],
1448
+ [3, 4, 5, 6, 7],
1449
+ [2, 3, 3, 4, 5],
1450
+ ],
1451
+ ],
1452
+ ],
1453
+ // Women
1454
+ [
1455
+ // Non smoker
1456
+ [
1457
+ // Age 70 -74
1458
+ [
1459
+ [21, 22, 22, 23, 24],
1460
+ [17, 18, 19, 19, 20],
1461
+ [15, 15, 16, 16, 17],
1462
+ [12, 12, 13, 13, 14],
1463
+ [10, 10, 11, 11, 11], // < 120
1464
+ ],
1465
+ // Age 65 - 69
1466
+ [
1467
+ [16, 17, 18, 18, 19],
1468
+ [13, 14, 14, 15, 15],
1469
+ [11, 11, 11, 12, 12],
1470
+ [9, 9, 9, 10, 10],
1471
+ [7, 7, 7, 8, 8],
1472
+ ],
1473
+ // Age 60 - 64
1474
+ [
1475
+ [13, 13, 14, 14, 15],
1476
+ [10, 10, 11, 11, 12],
1477
+ [8, 8, 8, 9, 9],
1478
+ [6, 6, 7, 7, 7],
1479
+ [5, 5, 5, 5, 6],
1480
+ ],
1481
+ // Age 55 - 59
1482
+ [
1483
+ [10, 10, 11, 11, 12],
1484
+ [8, 8, 8, 9, 9],
1485
+ [6, 6, 6, 7, 7],
1486
+ [4, 5, 5, 5, 5],
1487
+ [3, 3, 4, 4, 4],
1488
+ ],
1489
+ // Age 50 - 54
1490
+ [
1491
+ [8, 8, 8, 9, 9],
1492
+ [6, 6, 6, 7, 7],
1493
+ [4, 4, 5, 5, 5],
1494
+ [3, 3, 3, 4, 4],
1495
+ [2, 2, 3, 3, 3],
1496
+ ],
1497
+ // Age 45 - 49
1498
+ [
1499
+ [6, 6, 7, 7, 7],
1500
+ [4, 5, 5, 5, 5],
1501
+ [3, 3, 3, 4, 4],
1502
+ [2, 2, 2, 3, 3],
1503
+ [2, 2, 2, 2, 2],
1504
+ ],
1505
+ // Age 40 - 44
1506
+ [
1507
+ [5, 5, 5, 5, 6],
1508
+ [3, 3, 4, 4, 4],
1509
+ [2, 2, 3, 3, 3],
1510
+ [2, 2, 2, 2, 2],
1511
+ [1, 1, 1, 1, 1],
1512
+ ],
1513
+ ],
1514
+ // Smoker
1515
+ [
1516
+ // Age 70 - 74
1517
+ [
1518
+ [30, 31, 32, 33, 34],
1519
+ [25, 26, 27, 28, 29],
1520
+ [21, 22, 22, 23, 24],
1521
+ [17, 18, 19, 19, 20],
1522
+ [14, 15, 15, 16, 17],
1523
+ ],
1524
+ // Age 65 - 69
1525
+ [
1526
+ [25, 26, 27, 29, 30],
1527
+ [21, 22, 22, 23, 24],
1528
+ [17, 18, 18, 19, 20],
1529
+ [14, 14, 15, 15, 16],
1530
+ [11, 11, 12, 12, 13],
1531
+ ],
1532
+ // Age 60 - 64
1533
+ [
1534
+ [21, 22, 23, 25, 26],
1535
+ [17, 18, 19, 20, 21],
1536
+ [13, 14, 15, 16, 16],
1537
+ [11, 11, 12, 12, 13],
1538
+ [8, 9, 9, 10, 10],
1539
+ ],
1540
+ // Age 55 - 59
1541
+ [
1542
+ [18, 19, 20, 21, 22],
1543
+ [14, 15, 15, 16, 17],
1544
+ [11, 11, 12, 13, 13],
1545
+ [8, 9, 9, 10, 10],
1546
+ [6, 7, 7, 7, 8],
1547
+ ],
1548
+ // Age 50 - 54
1549
+ [
1550
+ [15, 16, 17, 18, 19],
1551
+ [11, 12, 13, 14, 14],
1552
+ [9, 9, 10, 10, 11],
1553
+ [6, 7, 7, 8, 8],
1554
+ [5, 5, 5, 6, 6],
1555
+ ],
1556
+ // Age 45 - 49
1557
+ [
1558
+ [13, 14, 14, 15, 16],
1559
+ [9, 10, 11, 11, 12],
1560
+ [7, 7, 8, 8, 9],
1561
+ [5, 5, 6, 6, 6],
1562
+ [4, 4, 4, 4, 5],
1563
+ ],
1564
+ // Age 40 - 44
1565
+ [
1566
+ [11, 11, 12, 13, 14],
1567
+ [8, 8, 9, 9, 10],
1568
+ [5, 6, 6, 7, 7],
1569
+ [4, 4, 4, 5, 5],
1570
+ [3, 3, 3, 3, 4],
1571
+ ],
1572
+ ],
1573
+ ],
1574
+ ];
1575
+
1329
1576
  class JsExpressionHelper {
1330
1577
  calcBMI(height, weight) {
1331
1578
  let r;
@@ -1477,6 +1724,19 @@ class JsExpressionHelper {
1477
1724
  }
1478
1725
  return height && weight && refSectionObject ? formattedSDValue : null;
1479
1726
  }
1727
+ calcSouthEastAsiaNonLabCVDRisk(sex, smoker, age, sbp, bmi) {
1728
+ // Bin functions
1729
+ const getAgeBin = (age) => Math.floor((Math.min(Math.max(40, age), 74) - 40) / 5);
1730
+ const getSbpBin = (sbp) => Math.max(0, Math.floor((Math.min(sbp, 180) - 120) / 20) + 1);
1731
+ const getBmiBin = (bmi) => Math.max(0, Math.floor((Math.min(bmi, 35) - 20) / 5) + 1);
1732
+ // Variables
1733
+ const sexIdx = sex === 'M' ? 0 : 1;
1734
+ const smokerIdx = smoker ? 1 : 0;
1735
+ const ageIdx = 6 - getAgeBin(age);
1736
+ const bmiIdx = getBmiBin(bmi);
1737
+ const sbpIdx = 4 - getSbpBin(sbp);
1738
+ return southEastAsiaCvdRiskTables[sexIdx][smokerIdx][ageIdx][sbpIdx][bmiIdx];
1739
+ }
1480
1740
  isEmpty(val) {
1481
1741
  if (val === undefined ||
1482
1742
  val === null ||
@@ -1552,6 +1812,7 @@ class JsExpressionHelper {
1552
1812
  calcBMIForAgeZscore: helper.calcBMIForAgeZscore,
1553
1813
  calcWeightForHeightZscore: helper.calcWeightForHeightZscore,
1554
1814
  calcHeightForAgeZscore: helper.calcHeightForAgeZscore,
1815
+ calcSouthEastAsiaNonLabCVDRisk: helper.calcSouthEastAsiaNonLabCVDRisk,
1555
1816
  isEmpty: helper.isEmpty,
1556
1817
  arrayContains: helper.arrayContains,
1557
1818
  extractRepeatingGroupValues: helper.extractRepeatingGroupValues