-
Notifications
You must be signed in to change notification settings - Fork 0
/
certification-v1.2.smcl
206 lines (203 loc) · 7.5 KB
/
certification-v1.2.smcl
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
{smcl}
{com}{sf}{ul off}{txt}{.-}
name: {res}certlog
{txt}log: {res}[REDACTED]/prism-score/certlog.smcl
{txt}log type: {res}smcl
{txt}opened on: {res}28 Feb 2023, 08:28:01
{txt}
{com}.
. cscript prismscore adofile prismscore
{txt}{hline 63}BEGIN prismscore
-> which prismscore, usesysdir
[REDACTED]/Stata/ado/personal/prismscore.ado
{res}*! | Version: 1.2 | Last Updated: Feb 28, 2023
{txt}
{com}. qui cd "./tests/data"
{txt}
{com}. qui use "prism_3_dataset_5.dta"
{txt}
{com}. datasignature confirm using "prism_3_dataset_5.dtasig", strict
{res}{txt}{p 2 3 2}
(data unchanged since 21nov2022 18:59{txt})
{p_end}
{com}.
. preserve
{txt}
{com}.
. * TEST REGULAR COMMAND
. qui prismscore neuro_c nonneuro_c totalscore_c, ///
> age(age) sbp(sbp) hr(hr) temp(temp_high) templow(temp_low) gcs(gcs) ///
> pupils(pupils) ph(phlow) phhigh(phhigh) bicarb(bicarblow) ///
> bicarbhigh(bicarbhigh) pco2(pco2) pao2(pao2) glucose(glucose) ///
> potassium(potassium) creatinine(creatinine) bun(bun) wbc(wbc) ///
> plt(plt) pt(pt) ptt(ptt)
{txt}
{com}.
. assert neuro_c == neuro
{txt}
{com}. assert nonneuro_c == nonneuro
{txt}
{com}. assert totalscore_c == totalscore
{txt}
{com}.
. qui drop neuro_c nonneuro_c totalscore_c
{txt}
{com}.
. * TEST NAME COLLISION
. rename temp_high temp
{res}{txt}
{com}. rename temp_low templow
{res}{txt}
{com}. rename phlow ph
{res}{txt}
{com}. rename bicarblow bicarb
{res}{txt}
{com}.
. qui prismscore neuro_c nonneuro_c totalscore_c, ///
> age(age) sbp(sbp) hr(hr) temp(temp) templow(templow) gcs(gcs) ///
> pupils(pupils) ph(ph) phhigh(phhigh) bicarb(bicarb) ///
> bicarbhigh(bicarbhigh) pco2(pco2) pao2(pao2) glucose(glucose) ///
> potassium(potassium) creatinine(creatinine) bun(bun) wbc(wbc) ///
> plt(plt) pt(pt) ptt(ptt)
{txt}
{com}.
. assert neuro_c == neuro
{txt}
{com}. assert nonneuro_c == nonneuro
{txt}
{com}. assert totalscore_c == totalscore
{txt}
{com}.
. qui drop neuro_c nonneuro_c totalscore_c
{txt}
{com}.
. restore
{txt}
{com}.
. * TEST UNIT OPTIONS AND AGE CALCULATIONS
. qui prismscore neuro_c nonneuro_c totalscore_c, ///
> doa(doa) dob(dob) sbp(sbp) hr(hr) temp(temp_high) templow(temp_low) ///
> gcs(gcs) pupils(pupils) ph(phlow) phhigh(phhigh) bicarb(bicarblow) ///
> bicarbhigh(bicarbhigh) pco2(pco2) pao2(pao2) glucose(glucose_si) ///
> potassium(potassium) creatinine(creatinine_si) bun(bun_si) ///
> wbc(wbc_k) plt(plt_k) pt(pt) ptt(ptt) pltunit(1000) wbcunit(1000) si
{txt}
{com}.
. assert neuro_c == neuro
{txt}
{com}. assert nonneuro_c == nonneuro
{txt}
{com}. assert totalscore_c == totalscore
{txt}
{com}.
. qui drop neuro_c nonneuro_c totalscore_c
{txt}
{com}.
. clear
{txt}
{com}.
. * MOVE TO PRISM IV DATA
. qui use "P4_Validated Data.dta"
{txt}
{com}. datasignature confirm using "P4_Validated Data.dtasig", strict
{res}{txt}{p 2 3 2}
(data unchanged since 22nov2022 11:38{txt})
{p_end}
{com}.
. * TEST REGULAR COMMAND
. qui prismscore neuro_c nonneuro_c totalscore_c score, ///
> age(age) sbp(sbp) hr(hr) temp(temp_high) templow(temp_low) gcs(gcs) ///
> pupils(pupils) ph(phlow) phhigh(phhigh) bicarb(bicarblow) ///
> bicarbhigh(bicarbhigh) pco2(pco2) pao2(pao2) glucose(glucose) ///
> potassium(potassium) creatinine(creatinine) bun(bun) wbc(wbc) ///
> plt(plt) pt(pt) ptt(ptt) ///
> prismiv source(source) risk(risk) cancer(cancer) cpr(cpr)
{txt}
{com}.
. assert abs(float(prism4) - float(score)) < 2 * 1E-2
{txt}
{com}. assert neuro_c == neuro
{txt}
{com}. assert nonneuro_c == nonneuro
{txt}
{com}. assert totalscore_c == totalscore
{txt}
{com}.
. qui drop score neuro_c nonneuro_c totalscore_c
{txt}
{com}.
. * TEST UNIT OPTIONS AND AGE CALCULATIONS
. qui prismscore neuro_c nonneuro_c totalscore_c score, ///
> dob(dob) doa(doa) sbp(sbp) hr(hr) temp(temp_high) templow(temp_low) ///
> gcs(gcs) pupils(pupils) ph(phlow) phhigh(phhigh) bicarb(bicarblow) ///
> bicarbhigh(bicarbhigh) pco2(pco2) pao2(pao2) glucose(glucose_si) ///
> potassium(potassium) creatinine(creatinine_si) bun(bun_si) ///
> wbc(wbc_k) plt(plt_k) pt(pt) ptt(ptt) pltunit(1000) wbcunit(1000) si ///
> prismiv source(source) risk(risk) cancer(cancer) cpr(cpr)
{txt}
{com}.
. assert abs(float(prism4) - float(score)) < 2 * 1E-2
{txt}
{com}. assert neuro_c == neuro
{txt}
{com}. assert nonneuro_c == nonneuro
{txt}
{com}. assert totalscore_c == totalscore
{txt}
{com}.
. qui drop score neuro_c nonneuro_c totalscore_c
{txt}
{com}.
. noi di as result "The following section will intentionally trigger errors and verify the appropriate error code. This test is passed succesfully if the last line displays: Certification completed succesfully."
{res}The following section will intentionally trigger errors and verify the appropriate error code. This test is passed succesfully if the last line displays: Certification completed succesfully.
{txt}
{com}.
. qui {c -(}
{err}You must specify either 1 or 4 newvariable names if you are trying to calculate the PRISM IV score. See help prismscore for more details.
You must specify either 1 or 4 newvariable names if you are trying to calculate the PRISM IV score. See help prismscore for more details.
You must specify 3 newvarvarnames for PRISM III score calculations. See help prismscore for more details.
You must specify 3 newvarvarnames for PRISM III score calculations. See help prismscore for more details.
You have specified too many newvarnamesor have forgotten to include prismiv
not specified. See help prismscore for more details.
too few variables specified
not specified. See help prismscore for more details.
too few variables specified
not specified. See help prismscore for more details.
too few variables specified
not specified. See help prismscore for more details.
too few variables specified
Platelet Unit incorrectly specified.
WBC Unit incorrectly specified.
Both age, DoB and DoA are specified.
Specify either age or DoB and DoA
too many variables specified
Neither age, DoB or DoA are specified.
Specify either age or DoB and DoA
too few variables specified
You must specify both DoB and DoA
too few variables specified
You must specify both DoB and DoA
too few variables specified
Age is not in the correct format. See help prismscore for more details.
You must specify either PT or PTT. See help prismscore for more details.
too few variables specified
Pupils are not in the correct format. See help prismscore for more details.
source is not in the correct format. See help prismscore for more details.
cpr is not binary. See help prismscore for more details.
0/1 variable required
cancer is not binary. See help prismscore for more details.
0/1 variable required
risk is not binary. See help prismscore for more details.
0/1 variable required
{txt}
{com}. noi di as result "Certification completed succesfully. `c(current_date)' `c(current_time)'"
{res}Certification completed succesfully. 28 Feb 2023 08:28:14
{txt}
{com}. log close certlog
{txt}name: {res}certlog
{txt}log: {res}[REDACTED]/git/statistical-commands/stata-commands/prism-score/certlog.smcl
{txt}log type: {res}smcl
{txt}closed on: {res}28 Feb 2023, 08:28:14
{txt}{.-}
{smcl}
{txt}{sf}{ul off}