@f1studio/form-spec 5.0.0-alpha.140 → 5.0.0-alpha.142

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.
Files changed (105) hide show
  1. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.d.ts +3 -2
  2. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.d.ts.map +1 -1
  3. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.d.ts.map +1 -1
  4. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.d.ts.map +1 -1
  5. package/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.d.ts +74 -0
  6. package/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.d.ts.map +1 -0
  7. package/FormSpec.TS/FormSpec.FS/BlueprintValidation.js.map +1 -1
  8. package/FormSpec.TS/FormSpec.FS/BlueprintValidation.ts.map +1 -1
  9. package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.js.map +1 -1
  10. package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.ts.map +1 -1
  11. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.js +36 -30
  12. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.js.map +1 -1
  13. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.ts.map +1 -1
  14. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.js +4 -19
  15. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.js.map +1 -1
  16. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.ts.map +1 -1
  17. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js.map +1 -1
  18. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts.map +1 -1
  19. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js +12 -2
  20. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js.map +1 -1
  21. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts.map +1 -1
  22. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js.map +1 -1
  23. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts.map +1 -1
  24. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.js.map +1 -1
  25. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.ts.map +1 -1
  26. package/FormSpec.TS/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.js +282 -0
  27. package/FormSpec.TS/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.js.map +1 -0
  28. package/FormSpec.TS/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.ts.map +1 -0
  29. package/FormSpec.TS/FormSpec.FS/Interop/Facade/FormAnswersGate.js.map +1 -1
  30. package/FormSpec.TS/FormSpec.FS/Interop/Facade/FormAnswersGate.ts.map +1 -1
  31. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js.map +1 -1
  32. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts.map +1 -1
  33. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.js.map +1 -1
  34. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.ts.map +1 -1
  35. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Values.Api.Option.js.map +1 -1
  36. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Values.Api.Option.ts.map +1 -1
  37. package/FormSpec.TS/FormSpec.FS/Migrator.js.map +1 -1
  38. package/FormSpec.TS/FormSpec.FS/Migrator.ts.map +1 -1
  39. package/FormSpec.TS/FormSpec.FS/PathwayExecutor.js.map +1 -1
  40. package/FormSpec.TS/FormSpec.FS/PathwayExecutor.ts.map +1 -1
  41. package/FormSpec.TS/PluginRegistration.js +2 -0
  42. package/FormSpec.TS/PluginRegistration.js.map +1 -1
  43. package/FormSpec.TS/PluginRegistration.ts.map +1 -1
  44. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Decode.js +63 -69
  45. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Decode.js.map +1 -1
  46. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Decode.ts.map +1 -1
  47. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Encode.js +6 -10
  48. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Encode.js.map +1 -1
  49. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Encode.ts.map +1 -1
  50. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs +57 -0
  51. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs.js +119 -0
  52. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs.js.map +1 -0
  53. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs.ts.map +1 -0
  54. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/Fable.Promise.fableproj +20 -0
  55. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/Promise.fs +766 -0
  56. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/Promise.fs.js +165 -0
  57. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/Promise.fs.js.map +1 -0
  58. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/Promise.fs.ts.map +1 -0
  59. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs +31 -0
  60. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.js +32 -0
  61. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.js.map +1 -0
  62. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.ts.map +1 -0
  63. package/FormSpec.TS/fable_modules/Feliz.2.8.0/DateParsing.fs.js.map +1 -1
  64. package/FormSpec.TS/fable_modules/Feliz.2.8.0/DateParsing.fs.ts.map +1 -1
  65. package/FormSpec.TS/fable_modules/project_cracked.json +1 -1
  66. package/FormSpec.TS/plugins/allergyfinder/src/AllergyFinderField.js +2431 -0
  67. package/FormSpec.TS/plugins/allergyfinder/src/AllergyFinderField.js.map +1 -0
  68. package/FormSpec.TS/plugins/allergyfinder/src/AllergyFinderField.ts.map +1 -0
  69. package/FormSpec.TS/plugins/allergyfinder/src/OpenFdaClient.js +107 -0
  70. package/FormSpec.TS/plugins/allergyfinder/src/OpenFdaClient.js.map +1 -0
  71. package/FormSpec.TS/plugins/allergyfinder/src/OpenFdaClient.ts.map +1 -0
  72. package/FormSpec.TS/plugins/vitals/src/VitalsField.js +85 -364
  73. package/FormSpec.TS/plugins/vitals/src/VitalsField.js.map +1 -1
  74. package/FormSpec.TS/plugins/vitals/src/VitalsField.ts.map +1 -1
  75. package/FormSpec.TS/plugins/vitals/src/VitalsLogic.js +548 -0
  76. package/FormSpec.TS/plugins/vitals/src/VitalsLogic.js.map +1 -0
  77. package/FormSpec.TS/plugins/vitals/src/VitalsLogic.ts.map +1 -0
  78. package/README.md +7 -7
  79. package/Thoth.Json/packages/Thoth.Json/Decode.d.ts +2 -2
  80. package/Thoth.Json/packages/Thoth.Json/Decode.d.ts.map +1 -1
  81. package/Thoth.Json/packages/Thoth.Json/Encode.d.ts.map +1 -1
  82. package/fable_modules/Fable.Promise.3.2.0/Promise.fs.d.ts +112 -0
  83. package/fable_modules/Fable.Promise.3.2.0/Promise.fs.d.ts.map +1 -0
  84. package/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.d.ts +8 -0
  85. package/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.d.ts.map +1 -0
  86. package/package.json +5 -1
  87. package/plugins/allergyfinder/src/AllergyFinderField.d.ts +116 -0
  88. package/plugins/allergyfinder/src/AllergyFinderField.d.ts.map +1 -0
  89. package/plugins/allergyfinder/src/OpenFdaClient.d.ts +5 -0
  90. package/plugins/allergyfinder/src/OpenFdaClient.d.ts.map +1 -0
  91. package/plugins/vitals/src/VitalsField.d.ts +4 -43
  92. package/plugins/vitals/src/VitalsField.d.ts.map +1 -1
  93. package/plugins/vitals/src/VitalsLogic.d.ts +78 -0
  94. package/plugins/vitals/src/VitalsLogic.d.ts.map +1 -0
  95. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.ts +35 -32
  96. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.ts +5 -22
  97. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts +13 -2
  98. package/src/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.ts +160 -0
  99. package/src/PluginRegistration.ts +2 -0
  100. package/src/Thoth.Json/packages/Thoth.Json/Decode.ts +38 -55
  101. package/src/Thoth.Json/packages/Thoth.Json/Encode.ts +10 -16
  102. package/src/plugins/allergyfinder/src/AllergyFinderField.ts +1341 -0
  103. package/src/plugins/allergyfinder/src/OpenFdaClient.ts +103 -0
  104. package/src/plugins/vitals/src/VitalsField.ts +78 -298
  105. package/src/plugins/vitals/src/VitalsLogic.ts +399 -0
@@ -0,0 +1,399 @@
1
+ import { FSharpRef, Record } from "@fable-org/fable-library-js/Types.js";
2
+ import { bind, value as value_2, map, defaultArg, Option } from "@fable-org/fable-library-js/Option.js";
3
+ import { float64 } from "@fable-org/fable-library-js/Int32.js";
4
+ import { IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
5
+ import { lambda_type, array_type, string_type, bool_type, record_type, option_type, float64_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
6
+ import { join, split, isNullOrWhiteSpace } from "@fable-org/fable-library-js/String.js";
7
+ import { tryParse } from "@fable-org/fable-library-js/Double.js";
8
+ import { zip, map as map_1, tryFind, item } from "@fable-org/fable-library-js/Array.js";
9
+ import { Shared_PluginDataProperty } from "../../../FormSpec.FS/FormSpec.js";
10
+ import { FSharpList, tryFind as tryFind_1 } from "@fable-org/fable-library-js/List.js";
11
+
12
+ export class VitalsData extends Record implements IEquatable<VitalsData>, IComparable<VitalsData> {
13
+ readonly Temperature: Option<float64>;
14
+ readonly SystolicBP: Option<float64>;
15
+ readonly DiastolicBP: Option<float64>;
16
+ readonly Pulse: Option<float64>;
17
+ readonly Respiration: Option<float64>;
18
+ readonly OxygenSaturation: Option<float64>;
19
+ readonly PainScale: Option<float64>;
20
+ constructor(Temperature: Option<float64>, SystolicBP: Option<float64>, DiastolicBP: Option<float64>, Pulse: Option<float64>, Respiration: Option<float64>, OxygenSaturation: Option<float64>, PainScale: Option<float64>) {
21
+ super();
22
+ this.Temperature = Temperature;
23
+ this.SystolicBP = SystolicBP;
24
+ this.DiastolicBP = DiastolicBP;
25
+ this.Pulse = Pulse;
26
+ this.Respiration = Respiration;
27
+ this.OxygenSaturation = OxygenSaturation;
28
+ this.PainScale = PainScale;
29
+ }
30
+ }
31
+
32
+ export function VitalsData_$reflection(): TypeInfo {
33
+ return record_type("Fable.Form.Simple.Bulma.Fields.VitalsField.VitalsLogic.VitalsData", [], VitalsData, () => [["Temperature", option_type(float64_type)], ["SystolicBP", option_type(float64_type)], ["DiastolicBP", option_type(float64_type)], ["Pulse", option_type(float64_type)], ["Respiration", option_type(float64_type)], ["OxygenSaturation", option_type(float64_type)], ["PainScale", option_type(float64_type)]]);
34
+ }
35
+
36
+ export class VitalsConfig extends Record implements IEquatable<VitalsConfig>, IComparable<VitalsConfig> {
37
+ readonly IncludeTemperature: boolean;
38
+ readonly IncludeBP: boolean;
39
+ readonly IncludePulse: boolean;
40
+ readonly IncludeRespiration: boolean;
41
+ readonly IncludeOxygenSat: boolean;
42
+ readonly IncludePainScale: boolean;
43
+ constructor(IncludeTemperature: boolean, IncludeBP: boolean, IncludePulse: boolean, IncludeRespiration: boolean, IncludeOxygenSat: boolean, IncludePainScale: boolean) {
44
+ super();
45
+ this.IncludeTemperature = IncludeTemperature;
46
+ this.IncludeBP = IncludeBP;
47
+ this.IncludePulse = IncludePulse;
48
+ this.IncludeRespiration = IncludeRespiration;
49
+ this.IncludeOxygenSat = IncludeOxygenSat;
50
+ this.IncludePainScale = IncludePainScale;
51
+ }
52
+ }
53
+
54
+ export function VitalsConfig_$reflection(): TypeInfo {
55
+ return record_type("Fable.Form.Simple.Bulma.Fields.VitalsField.VitalsLogic.VitalsConfig", [], VitalsConfig, () => [["IncludeTemperature", bool_type], ["IncludeBP", bool_type], ["IncludePulse", bool_type], ["IncludeRespiration", bool_type], ["IncludeOxygenSat", bool_type], ["IncludePainScale", bool_type]]);
56
+ }
57
+
58
+ export function isValidTemperature(temp: float64): boolean {
59
+ if (temp >= 95) {
60
+ return temp <= 108;
61
+ }
62
+ else {
63
+ return false;
64
+ }
65
+ }
66
+
67
+ export function isValidSystolicBP(sys: float64): boolean {
68
+ if (sys >= 60) {
69
+ return sys <= 200;
70
+ }
71
+ else {
72
+ return false;
73
+ }
74
+ }
75
+
76
+ export function isValidDiastolicBP(dia: float64): boolean {
77
+ if (dia >= 40) {
78
+ return dia <= 120;
79
+ }
80
+ else {
81
+ return false;
82
+ }
83
+ }
84
+
85
+ export function isValidPulse(pulse: float64): boolean {
86
+ if (pulse >= 40) {
87
+ return pulse <= 180;
88
+ }
89
+ else {
90
+ return false;
91
+ }
92
+ }
93
+
94
+ export function isValidRespiration(resp: float64): boolean {
95
+ if (resp >= 8) {
96
+ return resp <= 35;
97
+ }
98
+ else {
99
+ return false;
100
+ }
101
+ }
102
+
103
+ export function isValidOxygenSat(sat: float64): boolean {
104
+ if (sat >= 70) {
105
+ return sat <= 100;
106
+ }
107
+ else {
108
+ return false;
109
+ }
110
+ }
111
+
112
+ export function isValidPainScale(pain: float64): boolean {
113
+ if (pain >= 0) {
114
+ return pain <= 10;
115
+ }
116
+ else {
117
+ return false;
118
+ }
119
+ }
120
+
121
+ export function isCriticalTemperature(temp: float64): boolean {
122
+ if (temp < 96) {
123
+ return true;
124
+ }
125
+ else {
126
+ return temp > 104;
127
+ }
128
+ }
129
+
130
+ export function isCriticalSystolicBP(sys: float64): boolean {
131
+ if (sys < 90) {
132
+ return true;
133
+ }
134
+ else {
135
+ return sys > 180;
136
+ }
137
+ }
138
+
139
+ export function isCriticalDiastolicBP(dia: float64): boolean {
140
+ if (dia < 60) {
141
+ return true;
142
+ }
143
+ else {
144
+ return dia > 110;
145
+ }
146
+ }
147
+
148
+ export function isCriticalPulse(pulse: float64): boolean {
149
+ if (pulse < 50) {
150
+ return true;
151
+ }
152
+ else {
153
+ return pulse > 120;
154
+ }
155
+ }
156
+
157
+ export function isCriticalRespiration(resp: float64): boolean {
158
+ if (resp < 12) {
159
+ return true;
160
+ }
161
+ else {
162
+ return resp > 25;
163
+ }
164
+ }
165
+
166
+ export function isCriticalOxygenSat(sat: float64): boolean {
167
+ return sat < 95;
168
+ }
169
+
170
+ export function isNormalTemperature(temp: float64): boolean {
171
+ if (temp >= 97) {
172
+ return temp <= 99;
173
+ }
174
+ else {
175
+ return false;
176
+ }
177
+ }
178
+
179
+ export function parseVitalsData(value: string): VitalsData {
180
+ try {
181
+ if (isNullOrWhiteSpace(value)) {
182
+ return new VitalsData(undefined, undefined, undefined, undefined, undefined, undefined, undefined);
183
+ }
184
+ else {
185
+ const parts: string[] = split(value, ["|"], undefined, 0);
186
+ const tryParseFloat = (s: string): Option<float64> => {
187
+ if (isNullOrWhiteSpace(s)) {
188
+ return undefined;
189
+ }
190
+ else {
191
+ let matchValue: [boolean, float64];
192
+ let outArg = 0;
193
+ matchValue = ([tryParse(s, new FSharpRef<float64>((): float64 => outArg, (v: float64): void => {
194
+ outArg = v;
195
+ })), outArg] as [boolean, float64]);
196
+ if (matchValue[0]) {
197
+ return matchValue[1];
198
+ }
199
+ else {
200
+ return undefined;
201
+ }
202
+ }
203
+ };
204
+ return new VitalsData((parts.length > 0) ? tryParseFloat(item(0, parts)) : undefined, (parts.length > 1) ? tryParseFloat(item(1, parts)) : undefined, (parts.length > 2) ? tryParseFloat(item(2, parts)) : undefined, (parts.length > 3) ? tryParseFloat(item(3, parts)) : undefined, (parts.length > 4) ? tryParseFloat(item(4, parts)) : undefined, (parts.length > 5) ? tryParseFloat(item(5, parts)) : undefined, (parts.length > 6) ? tryParseFloat(item(6, parts)) : undefined);
205
+ }
206
+ }
207
+ catch (matchValue_1: any) {
208
+ return new VitalsData(undefined, undefined, undefined, undefined, undefined, undefined, undefined);
209
+ }
210
+ }
211
+
212
+ export function serializeVitalsData(vitalsData: VitalsData): string {
213
+ const optToString = (opt: Option<float64>): string => defaultArg(map<float64, string>((value: float64): string => value.toString(), opt), "");
214
+ return join("|", [optToString(vitalsData.Temperature), optToString(vitalsData.SystolicBP), optToString(vitalsData.DiastolicBP), optToString(vitalsData.Pulse), optToString(vitalsData.Respiration), optToString(vitalsData.OxygenSaturation), optToString(vitalsData.PainScale)]);
215
+ }
216
+
217
+ export function getVitalStatus(value: Option<float64>, isValid: ((arg0: float64) => boolean), isCritical: ((arg0: float64) => boolean), isNormal: Option<((arg0: float64) => boolean)>): string {
218
+ let v_2: float64;
219
+ if (value == null) {
220
+ return "empty";
221
+ }
222
+ else if (isCritical(value_2(value))) {
223
+ const v_3: float64 = value_2(value);
224
+ return "critical";
225
+ }
226
+ else if (!isValid(value_2(value))) {
227
+ const v_4: float64 = value_2(value);
228
+ return "abnormal";
229
+ }
230
+ else if ((v_2 = value_2(value), (isNormal != null) && !value_2(isNormal)(v_2))) {
231
+ const v_5: float64 = value_2(value);
232
+ return "abnormal";
233
+ }
234
+ else {
235
+ return "normal";
236
+ }
237
+ }
238
+
239
+ export class VitalPropertyValidation extends Record implements IEquatable<VitalPropertyValidation>, IComparable<VitalPropertyValidation> {
240
+ readonly PropertyName: string;
241
+ readonly DisplayName: string;
242
+ readonly Unit: string;
243
+ readonly Value: string;
244
+ readonly IsValid: boolean;
245
+ readonly ClinicalStatus: string;
246
+ readonly Message: string;
247
+ constructor(PropertyName: string, DisplayName: string, Unit: string, Value: string, IsValid: boolean, ClinicalStatus: string, Message: string) {
248
+ super();
249
+ this.PropertyName = PropertyName;
250
+ this.DisplayName = DisplayName;
251
+ this.Unit = Unit;
252
+ this.Value = Value;
253
+ this.IsValid = IsValid;
254
+ this.ClinicalStatus = ClinicalStatus;
255
+ this.Message = Message;
256
+ }
257
+ }
258
+
259
+ export function VitalPropertyValidation_$reflection(): TypeInfo {
260
+ return record_type("Fable.Form.Simple.Bulma.Fields.VitalsField.VitalsLogic.VitalPropertyValidation", [], VitalPropertyValidation, () => [["PropertyName", string_type], ["DisplayName", string_type], ["Unit", string_type], ["Value", string_type], ["IsValid", bool_type], ["ClinicalStatus", string_type], ["Message", string_type]]);
261
+ }
262
+
263
+ export class VitalsValidationResult extends Record implements IEquatable<VitalsValidationResult>, IComparable<VitalsValidationResult> {
264
+ readonly IsValid: boolean;
265
+ readonly HasCriticalValues: boolean;
266
+ readonly Properties: VitalPropertyValidation[];
267
+ constructor(IsValid: boolean, HasCriticalValues: boolean, Properties: VitalPropertyValidation[]) {
268
+ super();
269
+ this.IsValid = IsValid;
270
+ this.HasCriticalValues = HasCriticalValues;
271
+ this.Properties = Properties;
272
+ }
273
+ }
274
+
275
+ export function VitalsValidationResult_$reflection(): TypeInfo {
276
+ return record_type("Fable.Form.Simple.Bulma.Fields.VitalsField.VitalsLogic.VitalsValidationResult", [], VitalsValidationResult, () => [["IsValid", bool_type], ["HasCriticalValues", bool_type], ["Properties", array_type(VitalPropertyValidation_$reflection())]]);
277
+ }
278
+
279
+ class VitalPropertyDef extends Record {
280
+ readonly Name: string;
281
+ readonly DisplayName: string;
282
+ readonly Unit: string;
283
+ readonly IsValid: ((arg0: float64) => boolean);
284
+ readonly IsCritical: ((arg0: float64) => boolean);
285
+ readonly IsNormal: Option<((arg0: float64) => boolean)>;
286
+ readonly ValidRangeDescription: string;
287
+ constructor(Name: string, DisplayName: string, Unit: string, IsValid: ((arg0: float64) => boolean), IsCritical: ((arg0: float64) => boolean), IsNormal: Option<((arg0: float64) => boolean)>, ValidRangeDescription: string) {
288
+ super();
289
+ this.Name = Name;
290
+ this.DisplayName = DisplayName;
291
+ this.Unit = Unit;
292
+ this.IsValid = IsValid;
293
+ this.IsCritical = IsCritical;
294
+ this.IsNormal = IsNormal;
295
+ this.ValidRangeDescription = ValidRangeDescription;
296
+ }
297
+ }
298
+
299
+ function VitalPropertyDef_$reflection(): TypeInfo {
300
+ return record_type("Fable.Form.Simple.Bulma.Fields.VitalsField.VitalsLogic.VitalPropertyDef", [], VitalPropertyDef, () => [["Name", string_type], ["DisplayName", string_type], ["Unit", string_type], ["IsValid", lambda_type(float64_type, bool_type)], ["IsCritical", lambda_type(float64_type, bool_type)], ["IsNormal", option_type(lambda_type(float64_type, bool_type))], ["ValidRangeDescription", string_type]]);
301
+ }
302
+
303
+ const vitalPropertyDefs: VitalPropertyDef[] = [new VitalPropertyDef("temperature", "Temperature", "°F", isValidTemperature, isCriticalTemperature, isNormalTemperature, "95–108°F"), new VitalPropertyDef("systolic_bp", "Systolic BP", "mmHg", isValidSystolicBP, isCriticalSystolicBP, undefined, "60–200 mmHg"), new VitalPropertyDef("diastolic_bp", "Diastolic BP", "mmHg", isValidDiastolicBP, isCriticalDiastolicBP, undefined, "40–120 mmHg"), new VitalPropertyDef("pulse", "Pulse", "BPM", isValidPulse, isCriticalPulse, undefined, "40–180 BPM"), new VitalPropertyDef("respiration", "Respiration", "RPM", isValidRespiration, isCriticalRespiration, undefined, "8–35 RPM"), new VitalPropertyDef("oxygen_saturation", "O₂ Sat", "%", isValidOxygenSat, isCriticalOxygenSat, undefined, "70–100%"), new VitalPropertyDef("pain_scale", "Pain", "/10", isValidPainScale, (_arg: float64): boolean => false, undefined, "0–10")];
304
+
305
+ /**
306
+ * Validate a single vital property by name and raw string value.
307
+ */
308
+ export function validateVitalsProperty(propertyName: string, rawValue: string): VitalPropertyValidation {
309
+ const defOpt: Option<VitalPropertyDef> = tryFind<VitalPropertyDef>((d: VitalPropertyDef): boolean => (d.Name === propertyName), vitalPropertyDefs);
310
+ if (defOpt != null) {
311
+ const def: VitalPropertyDef = value_2(defOpt);
312
+ if (isNullOrWhiteSpace(rawValue)) {
313
+ return new VitalPropertyValidation(def.Name, def.DisplayName, def.Unit, "", true, "empty", "");
314
+ }
315
+ else {
316
+ let matchValue: [boolean, float64];
317
+ let outArg = 0;
318
+ matchValue = ([tryParse(rawValue, new FSharpRef<float64>((): float64 => outArg, (v: float64): void => {
319
+ outArg = v;
320
+ })), outArg] as [boolean, float64]);
321
+ if (matchValue[0]) {
322
+ const v_1: float64 = matchValue[1];
323
+ if (!def.IsValid(v_1)) {
324
+ return new VitalPropertyValidation(def.Name, def.DisplayName, def.Unit, rawValue, false, "invalid", ((((def.DisplayName + " must be ") + def.ValidRangeDescription) + ", got ") + rawValue) + def.Unit);
325
+ }
326
+ else if (def.IsCritical(v_1)) {
327
+ return new VitalPropertyValidation(def.Name, def.DisplayName, def.Unit, rawValue, true, "critical", (((def.DisplayName + " ") + rawValue) + def.Unit) + " — CRITICAL");
328
+ }
329
+ else {
330
+ const status: string = getVitalStatus(v_1, def.IsValid, def.IsCritical, def.IsNormal);
331
+ return new VitalPropertyValidation(def.Name, def.DisplayName, def.Unit, rawValue, true, status, (status === "abnormal") ? ((((def.DisplayName + " ") + rawValue) + def.Unit) + " — above normal") : "");
332
+ }
333
+ }
334
+ else {
335
+ return new VitalPropertyValidation(def.Name, def.DisplayName, def.Unit, rawValue, false, "invalid", def.DisplayName + " must be a valid number");
336
+ }
337
+ }
338
+ }
339
+ else {
340
+ return new VitalPropertyValidation(propertyName, propertyName, "", rawValue, false, "invalid", "Unknown vital sign property: " + propertyName);
341
+ }
342
+ }
343
+
344
+ function validateTypedValue(def: VitalPropertyDef, value: Option<float64>): VitalPropertyValidation {
345
+ if (value != null) {
346
+ const v: float64 = value_2(value);
347
+ const rawValue: string = v.toString();
348
+ if (!def.IsValid(v)) {
349
+ return new VitalPropertyValidation(def.Name, def.DisplayName, def.Unit, rawValue, false, "invalid", ((((def.DisplayName + " must be ") + def.ValidRangeDescription) + ", got ") + rawValue) + def.Unit);
350
+ }
351
+ else if (def.IsCritical(v)) {
352
+ return new VitalPropertyValidation(def.Name, def.DisplayName, def.Unit, rawValue, true, "critical", (((def.DisplayName + " ") + rawValue) + def.Unit) + " — CRITICAL");
353
+ }
354
+ else {
355
+ const status: string = getVitalStatus(v, def.IsValid, def.IsCritical, def.IsNormal);
356
+ return new VitalPropertyValidation(def.Name, def.DisplayName, def.Unit, rawValue, true, status, (status === "abnormal") ? ((((def.DisplayName + " ") + rawValue) + def.Unit) + " — above normal") : "");
357
+ }
358
+ }
359
+ else {
360
+ return new VitalPropertyValidation(def.Name, def.DisplayName, def.Unit, "", true, "empty", "");
361
+ }
362
+ }
363
+
364
+ /**
365
+ * Core validator — operates on the typed domain object. Single source of medical truth.
366
+ * Studio calls this via parseVitalsData → validateVitalsData.
367
+ * HealixAI calls this via PluginDataProperty list → converter → validateVitalsData.
368
+ */
369
+ export function validateVitalsData(data: VitalsData): VitalsValidationResult {
370
+ const results: VitalPropertyValidation[] = map_1<[VitalPropertyDef, Option<float64>], VitalPropertyValidation>((tupledArg: [VitalPropertyDef, Option<float64>]): VitalPropertyValidation => validateTypedValue(tupledArg[0], tupledArg[1]), zip<VitalPropertyDef, Option<float64>>(vitalPropertyDefs, [data.Temperature, data.SystolicBP, data.DiastolicBP, data.Pulse, data.Respiration, data.OxygenSaturation, data.PainScale]));
371
+ return new VitalsValidationResult(results.every((r: VitalPropertyValidation): boolean => r.IsValid), results.some((r_1: VitalPropertyValidation): boolean => (r_1.ClinicalStatus === "critical")), results);
372
+ }
373
+
374
+ /**
375
+ * Validate plugin data from the wire format. Parses to VitalsData, then delegates to validateVitalsData.
376
+ */
377
+ export function validateVitalsPluginData(properties: FSharpList<Shared_PluginDataProperty>): VitalsValidationResult {
378
+ const getPropertyValue = (name: string): Option<float64> => bind<Shared_PluginDataProperty, float64>((p_1: Shared_PluginDataProperty): Option<float64> => {
379
+ if (isNullOrWhiteSpace(p_1.Value)) {
380
+ return undefined;
381
+ }
382
+ else {
383
+ let matchValue: [boolean, float64];
384
+ let outArg = 0;
385
+ matchValue = ([tryParse(p_1.Value, new FSharpRef<float64>((): float64 => outArg, (v: float64): void => {
386
+ outArg = v;
387
+ })), outArg] as [boolean, float64]);
388
+ if (matchValue[0]) {
389
+ return matchValue[1];
390
+ }
391
+ else {
392
+ return undefined;
393
+ }
394
+ }
395
+ }, tryFind_1<Shared_PluginDataProperty>((p: Shared_PluginDataProperty): boolean => (p.Name === name), properties));
396
+ return validateVitalsData(new VitalsData(getPropertyValue("temperature"), getPropertyValue("systolic_bp"), getPropertyValue("diastolic_bp"), getPropertyValue("pulse"), getPropertyValue("respiration"), getPropertyValue("oxygen_saturation"), getPropertyValue("pain_scale")));
397
+ }
398
+
399
+ //# sourceMappingURL=VitalsLogic.ts.map