-
Notifications
You must be signed in to change notification settings - Fork 1
/
calculate-prediction.test.js
147 lines (141 loc) · 3.46 KB
/
calculate-prediction.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (C) 2021-2024 Stichting Open Electronics Lab
// vim: set sts=4 shiftwidth=4 expandtab :
"use strict";
const cp = require('./calculate-prediction')
test('calculate_prediction', () => {
let GDS_score = 1;
let grip_kg = 21.5;
let walking_speed_m_per_s = 0.6;
let BMI = 21.5;
let systolic_bp_mmHg = 140;
let number_of_limitations = 1;
let nrFall1 = 1; //3 falls
let nrFall2 = 1;
let smoking = 1;
let has_antiepileptica = 0;
let has_ca_blocker = 0;
let has_incont_med = 1;
let edu2 = 1;
let edu3 = 0;
let fear1 = 0;
let fear2 = 1;
let prediction = cp.calculate_prediction(
GDS_score,
grip_kg,
walking_speed_m_per_s,
BMI,
systolic_bp_mmHg,
number_of_limitations,
nrFall1,
nrFall2,
smoking,
has_antiepileptica,
has_ca_blocker,
has_incont_med,
edu2,
edu3,
fear1,
fear2);
expect(prediction).toBe(70);
})
test('calculate_prediction_db good data', () => {
let GDS_score = 1;
let grip_kg = 21.5;
let walking_speed_m_per_s = 0.6;
let BMI = 21.5;
let systolic_bp_mmHg = 140;
let number_of_limitations = 1;
let nr_falls_12m = 3;
let smoking = 1;
let has_antiepileptica = 0;
let has_ca_blocker = 0;
let has_incont_med = 1;
let education_hml = 3;
let fear1 = 0;
let fear2 = 1;
let prediction = cp.calculate_prediction_db(
GDS_score,
grip_kg,
walking_speed_m_per_s,
BMI,
systolic_bp_mmHg,
number_of_limitations,
nr_falls_12m,
smoking,
has_antiepileptica,
has_ca_blocker,
has_incont_med,
education_hml,
fear1,
fear2);
expect(prediction).toBe(73);
nr_falls_12m = 0;
education_hml = 1;
prediction = cp.calculate_prediction_db(
GDS_score,
grip_kg,
walking_speed_m_per_s,
BMI,
systolic_bp_mmHg,
number_of_limitations,
nr_falls_12m,
smoking,
has_antiepileptica,
has_ca_blocker,
has_incont_med,
education_hml,
fear1,
fear2);
expect(prediction).toBe(42);
nr_falls_12m = 1;
education_hml = 2;
prediction = cp.calculate_prediction_db(
GDS_score,
grip_kg,
walking_speed_m_per_s,
BMI,
systolic_bp_mmHg,
number_of_limitations,
nr_falls_12m,
smoking,
has_antiepileptica,
has_ca_blocker,
has_incont_med,
education_hml,
fear1,
fear2);
expect(prediction).toBe(56);
})
test('calculate_prediction_db bad data', () => {
let GDS_score = 1;
let grip_kg = null;
let walking_speed_m_per_s = 0.6;
let BMI = 21.5;
let systolic_bp_mmHg = 140;
let number_of_limitations = 1;
let nr_falls_12m = 3;
let smoking = 1;
let has_antiepileptica = 0;
let has_ca_blocker = 0;
let has_incont_med = 1;
let education_hml = 3;
let fear1 = 0;
let fear2 = 1;
let prediction = cp.calculate_prediction_db(
GDS_score,
grip_kg,
walking_speed_m_per_s,
BMI,
systolic_bp_mmHg,
number_of_limitations,
nr_falls_12m,
smoking,
has_antiepileptica,
has_ca_blocker,
has_incont_med,
education_hml,
fear1,
fear2);
expect(prediction).toBe(null);
})