@f1studio/form-spec 5.0.0-alpha.140 → 5.0.0-alpha.141
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.
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.d.ts +3 -2
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.d.ts +74 -0
- package/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.d.ts.map +1 -0
- package/FormSpec.TS/FormSpec.FS/BlueprintValidation.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/BlueprintValidation.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.js +36 -30
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.js +4 -19
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js +12 -2
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.js +282 -0
- package/FormSpec.TS/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.js.map +1 -0
- package/FormSpec.TS/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.ts.map +1 -0
- package/FormSpec.TS/FormSpec.FS/Interop/Facade/FormAnswersGate.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Interop/Facade/FormAnswersGate.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Values.Api.Option.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Values.Api.Option.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Migrator.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Migrator.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/PathwayExecutor.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/PathwayExecutor.ts.map +1 -1
- package/FormSpec.TS/PluginRegistration.js +2 -0
- package/FormSpec.TS/PluginRegistration.js.map +1 -1
- package/FormSpec.TS/PluginRegistration.ts.map +1 -1
- package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Decode.js +63 -69
- package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Decode.js.map +1 -1
- package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Decode.ts.map +1 -1
- package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Encode.js +6 -10
- package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Encode.js.map +1 -1
- package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Encode.ts.map +1 -1
- package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs +57 -0
- package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs.js +119 -0
- package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/Fable.Promise.fableproj +20 -0
- package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/Promise.fs +766 -0
- package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/Promise.fs.js +165 -0
- package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/Promise.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/Promise.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs +31 -0
- package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.js +32 -0
- package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.8.0/DateParsing.fs.js.map +1 -1
- package/FormSpec.TS/fable_modules/Feliz.2.8.0/DateParsing.fs.ts.map +1 -1
- package/FormSpec.TS/fable_modules/project_cracked.json +1 -1
- package/FormSpec.TS/plugins/allergyfinder/src/AllergyFinderField.js +2431 -0
- package/FormSpec.TS/plugins/allergyfinder/src/AllergyFinderField.js.map +1 -0
- package/FormSpec.TS/plugins/allergyfinder/src/AllergyFinderField.ts.map +1 -0
- package/FormSpec.TS/plugins/allergyfinder/src/OpenFdaClient.js +107 -0
- package/FormSpec.TS/plugins/allergyfinder/src/OpenFdaClient.js.map +1 -0
- package/FormSpec.TS/plugins/allergyfinder/src/OpenFdaClient.ts.map +1 -0
- package/FormSpec.TS/plugins/vitals/src/VitalsField.js +29 -312
- package/FormSpec.TS/plugins/vitals/src/VitalsField.js.map +1 -1
- package/FormSpec.TS/plugins/vitals/src/VitalsField.ts.map +1 -1
- package/FormSpec.TS/plugins/vitals/src/VitalsLogic.js +506 -0
- package/FormSpec.TS/plugins/vitals/src/VitalsLogic.js.map +1 -0
- package/FormSpec.TS/plugins/vitals/src/VitalsLogic.ts.map +1 -0
- package/README.md +7 -7
- package/Thoth.Json/packages/Thoth.Json/Decode.d.ts +2 -2
- package/Thoth.Json/packages/Thoth.Json/Decode.d.ts.map +1 -1
- package/Thoth.Json/packages/Thoth.Json/Encode.d.ts.map +1 -1
- package/fable_modules/Fable.Promise.3.2.0/Promise.fs.d.ts +112 -0
- package/fable_modules/Fable.Promise.3.2.0/Promise.fs.d.ts.map +1 -0
- package/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.d.ts +8 -0
- package/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.d.ts.map +1 -0
- package/package.json +1 -1
- package/plugins/allergyfinder/src/AllergyFinderField.d.ts +116 -0
- package/plugins/allergyfinder/src/AllergyFinderField.d.ts.map +1 -0
- package/plugins/allergyfinder/src/OpenFdaClient.d.ts +5 -0
- package/plugins/allergyfinder/src/OpenFdaClient.d.ts.map +1 -0
- package/plugins/vitals/src/VitalsField.d.ts +4 -43
- package/plugins/vitals/src/VitalsField.d.ts.map +1 -1
- package/plugins/vitals/src/VitalsLogic.d.ts +72 -0
- package/plugins/vitals/src/VitalsLogic.d.ts.map +1 -0
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.ts +35 -32
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.ts +5 -22
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts +13 -2
- package/src/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.ts +160 -0
- package/src/PluginRegistration.ts +2 -0
- package/src/Thoth.Json/packages/Thoth.Json/Decode.ts +38 -55
- package/src/Thoth.Json/packages/Thoth.Json/Encode.ts +10 -16
- package/src/plugins/allergyfinder/src/AllergyFinderField.ts +1341 -0
- package/src/plugins/allergyfinder/src/OpenFdaClient.ts +103 -0
- package/src/plugins/vitals/src/VitalsField.ts +35 -244
- package/src/plugins/vitals/src/VitalsLogic.ts +360 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { field, fromString, list, IOptionalGetter, IRequiredGetter, IGetters, int, object, string, fail, succeed, andThen } from "../../../Thoth.Json/packages/Thoth.Json/Decode.js";
|
|
2
|
+
import { uncurry2, uncurry3 } from "@fable-org/fable-library-js/Util.js";
|
|
3
|
+
import { AllergenInsights, LabelWarnings, CountResult, OpenFdaSearchResult, AllergyCategory_Custom, AllergyCategory_Environmental, AllergyCategory_Food, AllergyCategory_$union, AllergyCategory_Drug } from "../../../FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.js";
|
|
4
|
+
import { FSharpResult$2_$union } from "@fable-org/fable-library-js/Result.js";
|
|
5
|
+
import { ErrorReason_$union } from "../../../Thoth.Json/packages/Thoth.Json/Types.js";
|
|
6
|
+
import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
7
|
+
import { empty as empty_1, FSharpList } from "@fable-org/fable-library-js/List.js";
|
|
8
|
+
import { PromiseBuilder__Delay_62FBFDE1, PromiseBuilder__Run_212F1D4B } from "../../../fable_modules/Fable.Promise.3.2.0/Promise.fs.js";
|
|
9
|
+
import { promise } from "../../../fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.js";
|
|
10
|
+
import { isNullOrWhiteSpace } from "@fable-org/fable-library-js/String.js";
|
|
11
|
+
import { some } from "@fable-org/fable-library-js/Option.js";
|
|
12
|
+
|
|
13
|
+
const allergyCategoryDecoder = (path_2: string): ((arg0: any) => FSharpResult$2_$union<AllergyCategory_$union, [string, ErrorReason_$union]>) => ((value_1: any): FSharpResult$2_$union<AllergyCategory_$union, [string, ErrorReason_$union]> => andThen<string, AllergyCategory_$union>(uncurry3((s: string): ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<AllergyCategory_$union, [string, ErrorReason_$union]>)) => {
|
|
14
|
+
switch (s) {
|
|
15
|
+
case "Drug":
|
|
16
|
+
return (arg10$0040: string): ((arg0: any) => FSharpResult$2_$union<AllergyCategory_$union, [string, ErrorReason_$union]>) => ((arg20$0040: any): FSharpResult$2_$union<AllergyCategory_$union, [string, ErrorReason_$union]> => succeed<AllergyCategory_$union>(AllergyCategory_Drug(), arg10$0040, arg20$0040));
|
|
17
|
+
case "Food":
|
|
18
|
+
return (arg10$0040_1: string): ((arg0: any) => FSharpResult$2_$union<AllergyCategory_$union, [string, ErrorReason_$union]>) => ((arg20$0040_1: any): FSharpResult$2_$union<AllergyCategory_$union, [string, ErrorReason_$union]> => succeed<AllergyCategory_$union>(AllergyCategory_Food(), arg10$0040_1, arg20$0040_1));
|
|
19
|
+
case "Environmental":
|
|
20
|
+
return (arg10$0040_2: string): ((arg0: any) => FSharpResult$2_$union<AllergyCategory_$union, [string, ErrorReason_$union]>) => ((arg20$0040_2: any): FSharpResult$2_$union<AllergyCategory_$union, [string, ErrorReason_$union]> => succeed<AllergyCategory_$union>(AllergyCategory_Environmental(), arg10$0040_2, arg20$0040_2));
|
|
21
|
+
case "Custom":
|
|
22
|
+
return (arg10$0040_3: string): ((arg0: any) => FSharpResult$2_$union<AllergyCategory_$union, [string, ErrorReason_$union]>) => ((arg20$0040_3: any): FSharpResult$2_$union<AllergyCategory_$union, [string, ErrorReason_$union]> => succeed<AllergyCategory_$union>(AllergyCategory_Custom(), arg10$0040_3, arg20$0040_3));
|
|
23
|
+
default: {
|
|
24
|
+
const msg = `Unknown AllergyCategory: ${s}`;
|
|
25
|
+
return (path_1: string): ((arg0: any) => FSharpResult$2_$union<AllergyCategory_$union, [string, ErrorReason_$union]>) => ((arg20$0040_4: any): FSharpResult$2_$union<AllergyCategory_$union, [string, ErrorReason_$union]> => fail<AllergyCategory_$union>(msg, path_1, arg20$0040_4));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}), string, path_2, value_1));
|
|
29
|
+
|
|
30
|
+
const searchResultDecoder = (path_9: string): ((arg0: any) => FSharpResult$2_$union<OpenFdaSearchResult, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<OpenFdaSearchResult, [string, ErrorReason_$union]> => object<OpenFdaSearchResult>((get$: IGetters): OpenFdaSearchResult => {
|
|
31
|
+
let objectArg: IRequiredGetter, objectArg_1: IOptionalGetter, objectArg_2: IRequiredGetter, objectArg_3: IRequiredGetter, objectArg_4: IRequiredGetter, objectArg_5: IOptionalGetter, objectArg_6: IOptionalGetter, objectArg_7: IOptionalGetter, objectArg_8: IOptionalGetter, objectArg_9: IOptionalGetter, objectArg_10: IOptionalGetter;
|
|
32
|
+
return new OpenFdaSearchResult((objectArg = get$.Required, objectArg.Field<string>("Name", string)), (objectArg_1 = get$.Optional, objectArg_1.Field<string>("GenericName", string)), (objectArg_2 = get$.Required, objectArg_2.Field<string>("SubstanceName", string)), (objectArg_3 = get$.Required, objectArg_3.Field<AllergyCategory_$union>("Category", uncurry2(allergyCategoryDecoder))), (objectArg_4 = get$.Required, objectArg_4.Field<string>("Source", string)), (objectArg_5 = get$.Optional, objectArg_5.Field<string>("NdcCode", string)), (objectArg_6 = get$.Optional, objectArg_6.Field<string>("Manufacturer", string)), (objectArg_7 = get$.Optional, objectArg_7.Field<string>("Route", string)), (objectArg_8 = get$.Optional, objectArg_8.Field<string>("DosageForm", string)), (objectArg_9 = get$.Optional, objectArg_9.Field<string>("Strength", string)), (objectArg_10 = get$.Optional, objectArg_10.Field<int32>("ReportCount", uncurry2(int))));
|
|
33
|
+
}, path_9, v));
|
|
34
|
+
|
|
35
|
+
const countResultDecoder = (path_1: string): ((arg0: any) => FSharpResult$2_$union<CountResult, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<CountResult, [string, ErrorReason_$union]> => object<CountResult>((get$: IGetters): CountResult => {
|
|
36
|
+
let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter;
|
|
37
|
+
return new CountResult((objectArg = get$.Required, objectArg.Field<string>("Term", string)), (objectArg_1 = get$.Required, objectArg_1.Field<int32>("Count", uncurry2(int))));
|
|
38
|
+
}, path_1, v));
|
|
39
|
+
|
|
40
|
+
const labelWarningsDecoder = (path_3: string): ((arg0: any) => FSharpResult$2_$union<LabelWarnings, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<LabelWarnings, [string, ErrorReason_$union]> => object<LabelWarnings>((get$: IGetters): LabelWarnings => {
|
|
41
|
+
let objectArg: IOptionalGetter, objectArg_1: IOptionalGetter, objectArg_2: IOptionalGetter;
|
|
42
|
+
return new LabelWarnings((objectArg = get$.Optional, objectArg.Field<string>("Contraindications", string)), (objectArg_1 = get$.Optional, objectArg_1.Field<string>("Warnings", string)), (objectArg_2 = get$.Optional, objectArg_2.Field<string>("AdverseReactions", string)));
|
|
43
|
+
}, path_3, v));
|
|
44
|
+
|
|
45
|
+
const insightsDecoder = (path_1: string): ((arg0: any) => FSharpResult$2_$union<AllergenInsights, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<AllergenInsights, [string, ErrorReason_$union]> => object<AllergenInsights>((get$: IGetters): AllergenInsights => {
|
|
46
|
+
let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter, objectArg_2: IOptionalGetter;
|
|
47
|
+
return new AllergenInsights((objectArg = get$.Required, objectArg.Field<FSharpList<CountResult>>("Reactions", (path: string, value: any): FSharpResult$2_$union<FSharpList<CountResult>, [string, ErrorReason_$union]> => list<CountResult>(uncurry2(countResultDecoder), path, value))), (objectArg_1 = get$.Required, objectArg_1.Field<int32>("TotalEvents", uncurry2(int))), (objectArg_2 = get$.Optional, objectArg_2.Field<LabelWarnings>("LabelWarnings", uncurry2(labelWarningsDecoder))));
|
|
48
|
+
}, path_1, v));
|
|
49
|
+
|
|
50
|
+
function encodeURIComponent$(s: string): string {
|
|
51
|
+
return encodeURIComponent(s);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function searchAllergens(apiFetch: ((arg0: string) => Promise<string>), query: string): Promise<FSharpList<OpenFdaSearchResult>> {
|
|
55
|
+
return PromiseBuilder__Run_212F1D4B<FSharpList<OpenFdaSearchResult>>(promise, PromiseBuilder__Delay_62FBFDE1<FSharpList<OpenFdaSearchResult>>(promise, (): Promise<FSharpList<OpenFdaSearchResult>> => {
|
|
56
|
+
const url = `/api/openfda/search?q=${encodeURIComponent$(query)}`;
|
|
57
|
+
return apiFetch(url).then((_arg: string): Promise<FSharpList<OpenFdaSearchResult>> => {
|
|
58
|
+
const json: string = _arg;
|
|
59
|
+
if (isNullOrWhiteSpace(json)) {
|
|
60
|
+
return Promise.resolve(empty_1<OpenFdaSearchResult>());
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
const matchValue: FSharpResult$2_$union<FSharpList<OpenFdaSearchResult>, string> = fromString<FSharpList<OpenFdaSearchResult>>((path_1: string, value_1: any): FSharpResult$2_$union<FSharpList<OpenFdaSearchResult>, [string, ErrorReason_$union]> => field<FSharpList<OpenFdaSearchResult>>("Results", (path: string, value: any): FSharpResult$2_$union<FSharpList<OpenFdaSearchResult>, [string, ErrorReason_$union]> => list<OpenFdaSearchResult>(uncurry2(searchResultDecoder), path, value), path_1, value_1), json);
|
|
64
|
+
if (matchValue.tag === /* Error */ 1) {
|
|
65
|
+
const err: string = matchValue.fields[0];
|
|
66
|
+
console.warn(some("OpenFDA: failed to decode search results:"), err);
|
|
67
|
+
return Promise.resolve(empty_1<OpenFdaSearchResult>());
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
const results: FSharpList<OpenFdaSearchResult> = matchValue.fields[0];
|
|
71
|
+
return Promise.resolve(results);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function getAllergenInsights(apiFetch: ((arg0: string) => Promise<string>), substanceName: string): Promise<AllergenInsights> {
|
|
79
|
+
const empty: AllergenInsights = new AllergenInsights(empty_1<CountResult>(), 0, undefined);
|
|
80
|
+
return PromiseBuilder__Run_212F1D4B<AllergenInsights>(promise, PromiseBuilder__Delay_62FBFDE1<AllergenInsights>(promise, (): Promise<AllergenInsights> => {
|
|
81
|
+
const url = `/api/openfda/insights?substance=${encodeURIComponent$(substanceName)}`;
|
|
82
|
+
return apiFetch(url).then((_arg: string): Promise<AllergenInsights> => {
|
|
83
|
+
const json: string = _arg;
|
|
84
|
+
if (isNullOrWhiteSpace(json)) {
|
|
85
|
+
return Promise.resolve(empty);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
const matchValue: FSharpResult$2_$union<AllergenInsights, string> = fromString<AllergenInsights>((path: string, value: any): FSharpResult$2_$union<AllergenInsights, [string, ErrorReason_$union]> => field<AllergenInsights>("Insights", uncurry2(insightsDecoder), path, value), json);
|
|
89
|
+
if (matchValue.tag === /* Error */ 1) {
|
|
90
|
+
const err: string = matchValue.fields[0];
|
|
91
|
+
console.warn(some("OpenFDA: failed to decode insights:"), err);
|
|
92
|
+
return Promise.resolve(empty);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
const insights: AllergenInsights = matchValue.fields[0];
|
|
96
|
+
return Promise.resolve(insights);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
//# sourceMappingURL=OpenFdaClient.ts.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { FSharpRef, Record } from "@fable-org/fable-library-js/Types.js";
|
|
2
|
-
import {
|
|
3
|
-
import { float64 } from "@fable-org/fable-library-js/Int32.js";
|
|
2
|
+
import { isValidPainScale, isCriticalOxygenSat, isValidOxygenSat, isCriticalRespiration, isValidRespiration, isCriticalPulse, isValidPulse, isCriticalDiastolicBP, isValidDiastolicBP, isCriticalSystolicBP, isValidSystolicBP, isNormalTemperature, isCriticalTemperature, isValidTemperature, getVitalStatus, serializeVitalsData, VitalsData, parseVitalsData, VitalsConfig_$reflection, VitalsConfig } from "./VitalsLogic.js";
|
|
4
3
|
import { equals, createObj, IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
|
|
5
|
-
import { class_type, string_type, bool_type, record_type, option_type, float64_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
6
4
|
import { mapValues, Field$3, IAttributes } from "../../../fable_modules/Fable.Form.3.0.0/Field.fs.js";
|
|
5
|
+
import { class_type, record_type, string_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
7
6
|
import { Form$3, FieldConfig$4, field as field_1 } from "../../../fable_modules/Fable.Form.3.0.0/Base.fs.js";
|
|
8
|
-
import { printf, toText,
|
|
9
|
-
import { item } from "@fable-org/fable-library-js/Array.js";
|
|
10
|
-
import { tryParse, parse } from "@fable-org/fable-library-js/Double.js";
|
|
7
|
+
import { join, printf, toText, isNullOrWhiteSpace, isNullOrEmpty } from "@fable-org/fable-library-js/String.js";
|
|
11
8
|
import { createElement } from "react";
|
|
12
9
|
import React from "react";
|
|
10
|
+
import { some, bind, value as value_140, Option, map, defaultArg } from "@fable-org/fable-library-js/Option.js";
|
|
11
|
+
import { float64 } from "@fable-org/fable-library-js/Int32.js";
|
|
13
12
|
import { reactApi } from "../../../fable_modules/Feliz.2.8.0/Interop.fs.js";
|
|
13
|
+
import { tryParse } from "@fable-org/fable-library-js/Double.js";
|
|
14
14
|
import { ReactElement } from "../../../fable_modules/Fable.React.Types.18.3.0/Fable.React.fs.js";
|
|
15
15
|
import { append as append_1, cons, empty as empty_1, tryFind, FSharpList, exists, singleton as singleton_1, ofArray } from "@fable-org/fable-library-js/List.js";
|
|
16
16
|
import { withLabelAndError } from "../../../fable_modules/Fable.Form.Simple.Bulma.5.0.1/Html.View.fs.js";
|
|
@@ -23,57 +23,11 @@ import { Helpers_combineClasses } from "../../../fable_modules/Feliz.Bulma.3.0.0
|
|
|
23
23
|
import { RenderPreviewProps$1 } from "../../../FormSpec.FS/Interfaces.js";
|
|
24
24
|
import { FieldDetails } from "../../../FormSpec.FS/Designer.js";
|
|
25
25
|
|
|
26
|
-
export class VitalsField_VitalsData extends Record implements IEquatable<VitalsField_VitalsData>, IComparable<VitalsField_VitalsData> {
|
|
27
|
-
readonly Temperature: Option<float64>;
|
|
28
|
-
readonly SystolicBP: Option<float64>;
|
|
29
|
-
readonly DiastolicBP: Option<float64>;
|
|
30
|
-
readonly Pulse: Option<float64>;
|
|
31
|
-
readonly Respiration: Option<float64>;
|
|
32
|
-
readonly OxygenSaturation: Option<float64>;
|
|
33
|
-
readonly PainScale: Option<float64>;
|
|
34
|
-
constructor(Temperature: Option<float64>, SystolicBP: Option<float64>, DiastolicBP: Option<float64>, Pulse: Option<float64>, Respiration: Option<float64>, OxygenSaturation: Option<float64>, PainScale: Option<float64>) {
|
|
35
|
-
super();
|
|
36
|
-
this.Temperature = Temperature;
|
|
37
|
-
this.SystolicBP = SystolicBP;
|
|
38
|
-
this.DiastolicBP = DiastolicBP;
|
|
39
|
-
this.Pulse = Pulse;
|
|
40
|
-
this.Respiration = Respiration;
|
|
41
|
-
this.OxygenSaturation = OxygenSaturation;
|
|
42
|
-
this.PainScale = PainScale;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function VitalsField_VitalsData_$reflection(): TypeInfo {
|
|
47
|
-
return record_type("Fable.Form.Simple.Bulma.Fields.VitalsField.VitalsField.VitalsData", [], VitalsField_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)]]);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export class VitalsField_VitalsConfig extends Record implements IEquatable<VitalsField_VitalsConfig>, IComparable<VitalsField_VitalsConfig> {
|
|
51
|
-
readonly IncludeTemperature: boolean;
|
|
52
|
-
readonly IncludeBP: boolean;
|
|
53
|
-
readonly IncludePulse: boolean;
|
|
54
|
-
readonly IncludeRespiration: boolean;
|
|
55
|
-
readonly IncludeOxygenSat: boolean;
|
|
56
|
-
readonly IncludePainScale: boolean;
|
|
57
|
-
constructor(IncludeTemperature: boolean, IncludeBP: boolean, IncludePulse: boolean, IncludeRespiration: boolean, IncludeOxygenSat: boolean, IncludePainScale: boolean) {
|
|
58
|
-
super();
|
|
59
|
-
this.IncludeTemperature = IncludeTemperature;
|
|
60
|
-
this.IncludeBP = IncludeBP;
|
|
61
|
-
this.IncludePulse = IncludePulse;
|
|
62
|
-
this.IncludeRespiration = IncludeRespiration;
|
|
63
|
-
this.IncludeOxygenSat = IncludeOxygenSat;
|
|
64
|
-
this.IncludePainScale = IncludePainScale;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export function VitalsField_VitalsConfig_$reflection(): TypeInfo {
|
|
69
|
-
return record_type("Fable.Form.Simple.Bulma.Fields.VitalsField.VitalsField.VitalsConfig", [], VitalsField_VitalsConfig, () => [["IncludeTemperature", bool_type], ["IncludeBP", bool_type], ["IncludePulse", bool_type], ["IncludeRespiration", bool_type], ["IncludeOxygenSat", bool_type], ["IncludePainScale", bool_type]]);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
26
|
export class VitalsField_Attributes extends Record implements IEquatable<VitalsField_Attributes>, IComparable<VitalsField_Attributes>, IAttributes {
|
|
73
27
|
readonly FieldId: string;
|
|
74
28
|
readonly Label: string;
|
|
75
|
-
readonly Config:
|
|
76
|
-
constructor(FieldId: string, Label: string, Config:
|
|
29
|
+
readonly Config: VitalsConfig;
|
|
30
|
+
constructor(FieldId: string, Label: string, Config: VitalsConfig) {
|
|
77
31
|
super();
|
|
78
32
|
this.FieldId = FieldId;
|
|
79
33
|
this.Label = Label;
|
|
@@ -86,180 +40,17 @@ export class VitalsField_Attributes extends Record implements IEquatable<VitalsF
|
|
|
86
40
|
}
|
|
87
41
|
|
|
88
42
|
export function VitalsField_Attributes_$reflection(): TypeInfo {
|
|
89
|
-
return record_type("Fable.Form.Simple.Bulma.Fields.VitalsField.VitalsField.Attributes", [], VitalsField_Attributes, () => [["FieldId", string_type], ["Label", string_type], ["Config",
|
|
43
|
+
return record_type("Fable.Form.Simple.Bulma.Fields.VitalsField.VitalsField.Attributes", [], VitalsField_Attributes, () => [["FieldId", string_type], ["Label", string_type], ["Config", VitalsConfig_$reflection()]]);
|
|
90
44
|
}
|
|
91
45
|
|
|
92
46
|
export function VitalsField_form<Values, Field, Output>(): ((arg0: ((arg0: Field$3<VitalsField_Attributes, string, Values>) => Field)) => ((arg0: FieldConfig$4<VitalsField_Attributes, string, Values, Output>) => Form$3<Values, Output, Field>)) {
|
|
93
47
|
return (build: ((arg0: Field$3<VitalsField_Attributes, string, Values>) => Field)): ((arg0: FieldConfig$4<VitalsField_Attributes, string, Values, Output>) => Form$3<Values, Output, Field>) => ((config: FieldConfig$4<VitalsField_Attributes, string, Values, Output>): Form$3<Values, Output, Field> => field_1<string, VitalsField_Attributes, Values, Field, Output>(isNullOrEmpty, build, config));
|
|
94
48
|
}
|
|
95
49
|
|
|
96
|
-
export function VitalsField_isValidTemperature(temp: float64): boolean {
|
|
97
|
-
if (temp >= 95) {
|
|
98
|
-
return temp <= 108;
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export function VitalsField_isValidSystolicBP(sys: float64): boolean {
|
|
106
|
-
if (sys >= 60) {
|
|
107
|
-
return sys <= 200;
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
return false;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export function VitalsField_isValidDiastolicBP(dia: float64): boolean {
|
|
115
|
-
if (dia >= 40) {
|
|
116
|
-
return dia <= 120;
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
return false;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export function VitalsField_isValidPulse(pulse: float64): boolean {
|
|
124
|
-
if (pulse >= 40) {
|
|
125
|
-
return pulse <= 180;
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export function VitalsField_isValidRespiration(resp: float64): boolean {
|
|
133
|
-
if (resp >= 8) {
|
|
134
|
-
return resp <= 35;
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
return false;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export function VitalsField_isValidOxygenSat(sat: float64): boolean {
|
|
142
|
-
if (sat >= 70) {
|
|
143
|
-
return sat <= 100;
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
return false;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export function VitalsField_isValidPainScale(pain: float64): boolean {
|
|
151
|
-
if (pain >= 0) {
|
|
152
|
-
return pain <= 10;
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
return false;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export function VitalsField_isCriticalTemperature(temp: float64): boolean {
|
|
160
|
-
if (temp < 96) {
|
|
161
|
-
return true;
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
return temp > 104;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export function VitalsField_isNormalTemperature(temp: float64): boolean {
|
|
169
|
-
if (temp >= 97) {
|
|
170
|
-
return temp <= 99;
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
return false;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
export function VitalsField_isCriticalSystolicBP(sys: float64): boolean {
|
|
178
|
-
if (sys < 90) {
|
|
179
|
-
return true;
|
|
180
|
-
}
|
|
181
|
-
else {
|
|
182
|
-
return sys > 180;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
export function VitalsField_isCriticalDiastolicBP(dia: float64): boolean {
|
|
187
|
-
if (dia < 60) {
|
|
188
|
-
return true;
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
return dia > 110;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
export function VitalsField_isCriticalPulse(pulse: float64): boolean {
|
|
196
|
-
if (pulse < 50) {
|
|
197
|
-
return true;
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
return pulse > 120;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
export function VitalsField_isCriticalRespiration(resp: float64): boolean {
|
|
205
|
-
if (resp < 12) {
|
|
206
|
-
return true;
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
return resp > 25;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
export function VitalsField_isCriticalOxygenSat(sat: float64): boolean {
|
|
214
|
-
return sat < 95;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
export function VitalsField_parseVitalsData(value: string): VitalsField_VitalsData {
|
|
218
|
-
try {
|
|
219
|
-
if (isNullOrWhiteSpace(value)) {
|
|
220
|
-
return new VitalsField_VitalsData(undefined, undefined, undefined, undefined, undefined, undefined, undefined);
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
const parts: string[] = split(value, ["|"], undefined, 0);
|
|
224
|
-
return new VitalsField_VitalsData(((parts.length > 0) && !isNullOrWhiteSpace(item(0, parts))) ? parse(item(0, parts)) : undefined, ((parts.length > 1) && !isNullOrWhiteSpace(item(1, parts))) ? parse(item(1, parts)) : undefined, ((parts.length > 2) && !isNullOrWhiteSpace(item(2, parts))) ? parse(item(2, parts)) : undefined, ((parts.length > 3) && !isNullOrWhiteSpace(item(3, parts))) ? parse(item(3, parts)) : undefined, ((parts.length > 4) && !isNullOrWhiteSpace(item(4, parts))) ? parse(item(4, parts)) : undefined, ((parts.length > 5) && !isNullOrWhiteSpace(item(5, parts))) ? parse(item(5, parts)) : undefined, ((parts.length > 6) && !isNullOrWhiteSpace(item(6, parts))) ? parse(item(6, parts)) : undefined);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
catch (matchValue: any) {
|
|
228
|
-
return new VitalsField_VitalsData(undefined, undefined, undefined, undefined, undefined, undefined, undefined);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
export function VitalsField_serializeVitalsData(vitalsData: VitalsField_VitalsData): string {
|
|
233
|
-
const optToString = (opt: Option<float64>): string => defaultArg(map<float64, string>((value: float64): string => value.toString(), opt), "");
|
|
234
|
-
return join("|", [optToString(vitalsData.Temperature), optToString(vitalsData.SystolicBP), optToString(vitalsData.DiastolicBP), optToString(vitalsData.Pulse), optToString(vitalsData.Respiration), optToString(vitalsData.OxygenSaturation), optToString(vitalsData.PainScale)]);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
export function VitalsField_getVitalStatus(value: Option<float64>, isValid: ((arg0: float64) => boolean), isCritical: ((arg0: float64) => boolean), isNormal: Option<((arg0: float64) => boolean)>): string {
|
|
238
|
-
let v_2: float64;
|
|
239
|
-
if (value == null) {
|
|
240
|
-
return "empty";
|
|
241
|
-
}
|
|
242
|
-
else if (isCritical(value_140(value))) {
|
|
243
|
-
const v_3: float64 = value_140(value);
|
|
244
|
-
return "critical";
|
|
245
|
-
}
|
|
246
|
-
else if (!isValid(value_140(value))) {
|
|
247
|
-
const v_4: float64 = value_140(value);
|
|
248
|
-
return "abnormal";
|
|
249
|
-
}
|
|
250
|
-
else if ((v_2 = value_140(value), (isNormal != null) && !value_140(isNormal)(v_2))) {
|
|
251
|
-
const v_5: float64 = value_140(value);
|
|
252
|
-
return "abnormal";
|
|
253
|
-
}
|
|
254
|
-
else {
|
|
255
|
-
return "normal";
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
50
|
export function VitalsField_VitalsFieldComponent(config: StandardRenderFieldConfig$2<string, VitalsField_Attributes>): ReactElement {
|
|
260
51
|
let elems_12: Iterable<ReactElement>;
|
|
261
|
-
const vitalsData:
|
|
262
|
-
const vitalsConfig:
|
|
52
|
+
const vitalsData: VitalsData = parseVitalsData(config.Value);
|
|
53
|
+
const vitalsConfig: VitalsConfig = config.Attributes.Config;
|
|
263
54
|
let patternInput: [string, ((arg0: string) => void)];
|
|
264
55
|
const initial: string = defaultArg(map<float64, string>((value: float64): string => value.toString(), vitalsData.Temperature), "");
|
|
265
56
|
patternInput = reactApi.useState<string, string>(initial);
|
|
@@ -308,7 +99,7 @@ export function VitalsField_VitalsFieldComponent(config: StandardRenderFieldConf
|
|
|
308
99
|
}
|
|
309
100
|
}
|
|
310
101
|
};
|
|
311
|
-
config.OnChange(
|
|
102
|
+
config.OnChange(serializeVitalsData(new VitalsData(parseOpt(temperature), parseOpt(systolicBP), parseOpt(diastolicBP), parseOpt(pulse), parseOpt(respiration), parseOpt(oxygenSat), parseOpt(painScale))));
|
|
312
103
|
}, dependencies);
|
|
313
104
|
const parseNumeric = (raw: string): Option<float64> => {
|
|
314
105
|
if (isNullOrWhiteSpace(raw)) {
|
|
@@ -334,7 +125,7 @@ export function VitalsField_VitalsFieldComponent(config: StandardRenderFieldConf
|
|
|
334
125
|
});
|
|
335
126
|
const createVitalInput = (label_1: string, value_18: string, setValue: ((arg0: string) => void), unitText: string, placeholder: string, isValid: ((arg0: float64) => boolean), isCritical: ((arg0: float64) => boolean), isNormal: Option<((arg0: float64) => boolean)>): ReactElement => {
|
|
336
127
|
let elems_1: Iterable<ReactElement>, elems: Iterable<ReactElement>;
|
|
337
|
-
const vitalStatus: string =
|
|
128
|
+
const vitalStatus: string = getVitalStatus(parseNumeric(value_18), isValid, isCritical, isNormal);
|
|
338
129
|
let inputClass: string;
|
|
339
130
|
const baseClass = "mt-1 block w-full rounded-md border bg-white px-2.5 py-1.5 text-sm text-slate-900 shadow-sm transition placeholder:text-slate-400 focus:outline-none focus:ring-2 disabled:cursor-not-allowed disabled:bg-slate-100 disabled:text-slate-500";
|
|
340
131
|
inputClass = ((config.ShowError && (config.Error != null)) ? (`${baseClass} border-red-400 focus:border-red-500 focus:ring-red-500/30`) : (`${baseClass} ${(vitalStatus === "critical") ? "border-red-300 focus:border-red-500 focus:ring-red-500/30" : ((vitalStatus === "abnormal") ? "border-amber-300 focus:border-amber-500 focus:ring-amber-500/30" : "border-slate-300 focus:border-sky-500 focus:ring-sky-500/30")}`));
|
|
@@ -357,9 +148,9 @@ export function VitalsField_VitalsFieldComponent(config: StandardRenderFieldConf
|
|
|
357
148
|
};
|
|
358
149
|
return withLabelAndError(config.Attributes.Label, config.ShowError, config.Error, createElement<any>("div", createObj(ofArray([["className", "space-y-2.5"] as [string, any], (elems_12 = toList<ReactElement>(delay<ReactElement>((): Iterable<ReactElement> => {
|
|
359
150
|
let elems_8: Iterable<ReactElement>;
|
|
360
|
-
return append<ReactElement>(singleton<ReactElement>(createElement<any>("div", createObj(ofArray([["className", "grid grid-cols-1 auto-rows-min content-start items-start gap-2 md:grid-cols-2 lg:grid-cols-3"] as [string, any], (elems_8 = toList<ReactElement>(delay<ReactElement>((): Iterable<ReactElement> => append<ReactElement>(vitalsConfig.IncludeTemperature ? singleton<ReactElement>(createVitalInput("Temperature", temperature, patternInput[1], "Normal: 97-99°F", "98.6",
|
|
151
|
+
return append<ReactElement>(singleton<ReactElement>(createElement<any>("div", createObj(ofArray([["className", "grid grid-cols-1 auto-rows-min content-start items-start gap-2 md:grid-cols-2 lg:grid-cols-3"] as [string, any], (elems_8 = toList<ReactElement>(delay<ReactElement>((): Iterable<ReactElement> => append<ReactElement>(vitalsConfig.IncludeTemperature ? singleton<ReactElement>(createVitalInput("Temperature", temperature, patternInput[1], "Normal: 97-99°F", "98.6", isValidTemperature, isCriticalTemperature, isNormalTemperature)) : empty<ReactElement>(), delay<ReactElement>((): Iterable<ReactElement> => {
|
|
361
152
|
let systolicStatus: string, diastolicStatus: string, elems_7: Iterable<ReactElement>, elems_3: Iterable<ReactElement>, elems_2: Iterable<ReactElement>, elems_6: Iterable<ReactElement>, elems_4: Iterable<ReactElement>, value_66: string, elems_5: Iterable<ReactElement>, value_85: string;
|
|
362
|
-
return append<ReactElement>(vitalsConfig.IncludeBP ? ((systolicStatus =
|
|
153
|
+
return append<ReactElement>(vitalsConfig.IncludeBP ? ((systolicStatus = getVitalStatus(parseNumeric(systolicBP), isValidSystolicBP, isCriticalSystolicBP, undefined), (diastolicStatus = getVitalStatus(parseNumeric(diastolicBP), isValidDiastolicBP, isCriticalDiastolicBP, undefined), singleton<ReactElement>(createElement<any>("div", createObj(ofArray([["className", "rounded-lg border border-slate-200 bg-white p-2.5 shadow-sm"] as [string, any], (elems_7 = [createElement<any>("div", createObj(ofArray([["className", "flex items-center justify-between gap-3"] as [string, any], (elems_3 = [createElement<any>("label", {
|
|
363
154
|
className: "text-xs font-semibold uppercase tracking-wide text-slate-700",
|
|
364
155
|
children: "Blood Pressure",
|
|
365
156
|
}), createElement<any>("div", createObj(ofArray([["className", "inline-flex gap-2"] as [string, any], (elems_2 = [statusBadge(systolicStatus), statusBadge(diastolicStatus)], ["children", reactApi.Children.toArray(Array.from(elems_2))] as [string, any])])))], ["children", reactApi.Children.toArray(Array.from(elems_3))] as [string, any])]))), createElement<any>("div", createObj(ofArray([["className", "mt-1 grid grid-cols-[1fr_auto_1fr] items-center gap-1.5"] as [string, any], (elems_6 = [createElement<any>("div", createObj(singleton_1((elems_4 = [createElement<any>("label", {
|
|
@@ -378,7 +169,7 @@ export function VitalsField_VitalsFieldComponent(config: StandardRenderFieldConf
|
|
|
378
169
|
}] as [string, any]])))], ["children", reactApi.Children.toArray(Array.from(elems_5))] as [string, any]))))], ["children", reactApi.Children.toArray(Array.from(elems_6))] as [string, any])]))), createElement<any>("p", {
|
|
379
170
|
className: "mt-1 text-[11px] text-slate-500",
|
|
380
171
|
children: "mmHg",
|
|
381
|
-
})], ["children", reactApi.Children.toArray(Array.from(elems_7))] as [string, any])]))))))) : empty<ReactElement>(), delay<ReactElement>((): Iterable<ReactElement> => append<ReactElement>(vitalsConfig.IncludePulse ? singleton<ReactElement>(createVitalInput("Pulse Rate", pulse, patternInput_3[1], "BPM", "72",
|
|
172
|
+
})], ["children", reactApi.Children.toArray(Array.from(elems_7))] as [string, any])]))))))) : empty<ReactElement>(), delay<ReactElement>((): Iterable<ReactElement> => append<ReactElement>(vitalsConfig.IncludePulse ? singleton<ReactElement>(createVitalInput("Pulse Rate", pulse, patternInput_3[1], "BPM", "72", isValidPulse, isCriticalPulse, undefined)) : empty<ReactElement>(), delay<ReactElement>((): Iterable<ReactElement> => append<ReactElement>(vitalsConfig.IncludeRespiration ? singleton<ReactElement>(createVitalInput("Respiration Rate", respiration, patternInput_4[1], "per minute", "16", isValidRespiration, isCriticalRespiration, undefined)) : empty<ReactElement>(), delay<ReactElement>((): Iterable<ReactElement> => append<ReactElement>(vitalsConfig.IncludeOxygenSat ? singleton<ReactElement>(createVitalInput("Oxygen Saturation", oxygenSat, patternInput_5[1], "%", "98", isValidOxygenSat, isCriticalOxygenSat, undefined)) : empty<ReactElement>(), delay<ReactElement>((): Iterable<ReactElement> => (vitalsConfig.IncludePainScale ? singleton<ReactElement>(createVitalInput("Pain Scale", painScale, patternInput_6[1], "0-10 scale", "0", isValidPainScale, (_arg: float64): boolean => false, undefined)) : empty<ReactElement>())))))))));
|
|
382
173
|
})))), ["children", reactApi.Children.toArray(Array.from(elems_8))] as [string, any])])))), delay<ReactElement>((): Iterable<ReactElement> => {
|
|
383
174
|
let elems_11: Iterable<ReactElement>, elems_10: Iterable<ReactElement>, elems_9: Iterable<ReactElement>;
|
|
384
175
|
return exists<string>((s_1: string): boolean => !isNullOrWhiteSpace(s_1), ofArray([temperature, systolicBP, diastolicBP, pulse, respiration, oxygenSat, painScale])) ? singleton<ReactElement>(createElement<any>("div", createObj(ofArray([["className", "rounded-lg border border-sky-200 bg-sky-50/60 p-2.5 shadow-sm"] as [string, any], (elems_11 = [createElement<any>("h6", {
|
|
@@ -451,7 +242,7 @@ export const Form_PropertyKeys_OxygenSaturation: Shared_PluginPropertyKey = new
|
|
|
451
242
|
export const Form_PropertyKeys_PainScale: Shared_PluginPropertyKey = new Shared_PluginPropertyKey("67890123-4567-89ab-cdef-0123456789ef");
|
|
452
243
|
|
|
453
244
|
export const Form_enhancedVitalsConverter: IPluginValueConverter = new IPluginValueConverter((fieldKey: Shared_FieldKey, pluginValue: any): Option<Shared_FieldValue_$union> => {
|
|
454
|
-
const vitalsData:
|
|
245
|
+
const vitalsData: VitalsData = pluginValue;
|
|
455
246
|
return Shared_FieldValue_PluginData(toList<Shared_PluginDataProperty>(delay<Shared_PluginDataProperty>((): Iterable<Shared_PluginDataProperty> => append<Shared_PluginDataProperty>((vitalsData.Temperature != null) ? singleton<Shared_PluginDataProperty>(new Shared_PluginDataProperty(Form_PropertyKeys_Temperature, "temperature", "float", value_140(vitalsData.Temperature).toString(), "Temperature", "°F", "Body temperature in Fahrenheit")) : empty<Shared_PluginDataProperty>(), delay<Shared_PluginDataProperty>((): Iterable<Shared_PluginDataProperty> => append<Shared_PluginDataProperty>((vitalsData.SystolicBP != null) ? singleton<Shared_PluginDataProperty>(new Shared_PluginDataProperty(Form_PropertyKeys_SystolicBP, "systolic_bp", "float", value_140(vitalsData.SystolicBP).toString(), "Systolic BP", "mmHg", "Systolic blood pressure")) : empty<Shared_PluginDataProperty>(), delay<Shared_PluginDataProperty>((): Iterable<Shared_PluginDataProperty> => append<Shared_PluginDataProperty>((vitalsData.DiastolicBP != null) ? singleton<Shared_PluginDataProperty>(new Shared_PluginDataProperty(Form_PropertyKeys_DiastolicBP, "diastolic_bp", "float", value_140(vitalsData.DiastolicBP).toString(), "Diastolic BP", "mmHg", "Diastolic blood pressure")) : empty<Shared_PluginDataProperty>(), delay<Shared_PluginDataProperty>((): Iterable<Shared_PluginDataProperty> => append<Shared_PluginDataProperty>((vitalsData.Pulse != null) ? singleton<Shared_PluginDataProperty>(new Shared_PluginDataProperty(Form_PropertyKeys_Pulse, "pulse", "float", value_140(vitalsData.Pulse).toString(), "Pulse Rate", "BPM", "Heart rate in beats per minute")) : empty<Shared_PluginDataProperty>(), delay<Shared_PluginDataProperty>((): Iterable<Shared_PluginDataProperty> => append<Shared_PluginDataProperty>((vitalsData.Respiration != null) ? singleton<Shared_PluginDataProperty>(new Shared_PluginDataProperty(Form_PropertyKeys_Respiration, "respiration", "float", value_140(vitalsData.Respiration).toString(), "Respiration Rate", "RPM", "Respiratory rate per minute")) : empty<Shared_PluginDataProperty>(), delay<Shared_PluginDataProperty>((): Iterable<Shared_PluginDataProperty> => append<Shared_PluginDataProperty>((vitalsData.OxygenSaturation != null) ? singleton<Shared_PluginDataProperty>(new Shared_PluginDataProperty(Form_PropertyKeys_OxygenSaturation, "oxygen_saturation", "float", value_140(vitalsData.OxygenSaturation).toString(), "O2 Saturation", "%", "Oxygen saturation percentage")) : empty<Shared_PluginDataProperty>(), delay<Shared_PluginDataProperty>((): Iterable<Shared_PluginDataProperty> => ((vitalsData.PainScale != null) ? singleton<Shared_PluginDataProperty>(new Shared_PluginDataProperty(Form_PropertyKeys_PainScale, "pain_scale", "float", value_140(vitalsData.PainScale).toString(), "Pain Level", "/10", "Pain scale from 0 to 10")) : empty<Shared_PluginDataProperty>()))))))))))))))));
|
|
456
247
|
}, (fieldValue: Shared_FieldValue_$union): Option<any> => {
|
|
457
248
|
switch (fieldValue.tag) {
|
|
@@ -470,10 +261,10 @@ export const Form_enhancedVitalsConverter: IPluginValueConverter = new IPluginVa
|
|
|
470
261
|
return undefined;
|
|
471
262
|
}
|
|
472
263
|
}, tryFind<Shared_PluginDataProperty>((p: Shared_PluginDataProperty): boolean => (p.Name === name), properties));
|
|
473
|
-
return some(new
|
|
264
|
+
return some(new VitalsData(getPropertyValue("temperature"), getPropertyValue("systolic_bp"), getPropertyValue("diastolic_bp"), getPropertyValue("pulse"), getPropertyValue("respiration"), getPropertyValue("oxygen_saturation"), getPropertyValue("pain_scale")));
|
|
474
265
|
}
|
|
475
266
|
case /* Single */ 0:
|
|
476
|
-
return some(
|
|
267
|
+
return some(parseVitalsData(fieldValue.fields[0].Value));
|
|
477
268
|
default:
|
|
478
269
|
return undefined;
|
|
479
270
|
}
|
|
@@ -482,7 +273,7 @@ export const Form_enhancedVitalsConverter: IPluginValueConverter = new IPluginVa
|
|
|
482
273
|
case /* PluginData */ 3:
|
|
483
274
|
return tryFind<Shared_PluginDataProperty>((p_2: Shared_PluginDataProperty): boolean => (p_2.Name === propertyName_1), fieldValue_1.fields[0]);
|
|
484
275
|
case /* Single */ 0: {
|
|
485
|
-
const vitalsData_1:
|
|
276
|
+
const vitalsData_1: VitalsData = parseVitalsData(fieldValue_1.fields[0].Value);
|
|
486
277
|
return (propertyName_1 === "temperature") ? map<float64, Shared_PluginDataProperty>((v_1: float64): Shared_PluginDataProperty => (new Shared_PluginDataProperty(Form_PropertyKeys_Temperature, "temperature", "float", v_1.toString(), "Temperature", "°F", "Body temperature in Fahrenheit")), vitalsData_1.Temperature) : ((propertyName_1 === "systolic_bp") ? map<float64, Shared_PluginDataProperty>((v_2: float64): Shared_PluginDataProperty => (new Shared_PluginDataProperty(Form_PropertyKeys_SystolicBP, "systolic_bp", "float", v_2.toString(), "Systolic BP", "mmHg", "Systolic blood pressure")), vitalsData_1.SystolicBP) : ((propertyName_1 === "diastolic_bp") ? map<float64, Shared_PluginDataProperty>((v_3: float64): Shared_PluginDataProperty => (new Shared_PluginDataProperty(Form_PropertyKeys_DiastolicBP, "diastolic_bp", "float", v_3.toString(), "Diastolic BP", "mmHg", "Diastolic blood pressure")), vitalsData_1.DiastolicBP) : ((propertyName_1 === "pulse") ? map<float64, Shared_PluginDataProperty>((v_4: float64): Shared_PluginDataProperty => (new Shared_PluginDataProperty(Form_PropertyKeys_Pulse, "pulse", "float", v_4.toString(), "Pulse Rate", "BPM", "Heart rate in beats per minute")), vitalsData_1.Pulse) : ((propertyName_1 === "respiration") ? map<float64, Shared_PluginDataProperty>((v_5: float64): Shared_PluginDataProperty => (new Shared_PluginDataProperty(Form_PropertyKeys_Respiration, "respiration", "float", v_5.toString(), "Respiration Rate", "RPM", "Respiratory rate per minute")), vitalsData_1.Respiration) : ((propertyName_1 === "oxygen_saturation") ? map<float64, Shared_PluginDataProperty>((v_6: float64): Shared_PluginDataProperty => (new Shared_PluginDataProperty(Form_PropertyKeys_OxygenSaturation, "oxygen_saturation", "float", v_6.toString(), "O2 Saturation", "%", "Oxygen saturation percentage")), vitalsData_1.OxygenSaturation) : ((propertyName_1 === "pain_scale") ? map<float64, Shared_PluginDataProperty>((v_7: float64): Shared_PluginDataProperty => (new Shared_PluginDataProperty(Form_PropertyKeys_PainScale, "pain_scale", "float", v_7.toString(), "Pain Level", "/10", "Pain scale from 0 to 10")), vitalsData_1.PainScale) : undefined))))));
|
|
487
278
|
}
|
|
488
279
|
default:
|
|
@@ -493,7 +284,7 @@ export const Form_enhancedVitalsConverter: IPluginValueConverter = new IPluginVa
|
|
|
493
284
|
case /* PluginData */ 3:
|
|
494
285
|
return tryFind<Shared_PluginDataProperty>((p_3: Shared_PluginDataProperty): boolean => equals(p_3.PropertyKey, propertyKey_1), fieldValue_2.fields[0]);
|
|
495
286
|
case /* Single */ 0: {
|
|
496
|
-
const vitalsData_2:
|
|
287
|
+
const vitalsData_2: VitalsData = parseVitalsData(fieldValue_2.fields[0].Value);
|
|
497
288
|
return equals(propertyKey_1, Form_PropertyKeys_Temperature) ? map<float64, Shared_PluginDataProperty>((v_8: float64): Shared_PluginDataProperty => (new Shared_PluginDataProperty(Form_PropertyKeys_Temperature, "temperature", "float", v_8.toString(), "Temperature", "°F", "Body temperature in Fahrenheit")), vitalsData_2.Temperature) : (equals(propertyKey_1, Form_PropertyKeys_SystolicBP) ? map<float64, Shared_PluginDataProperty>((v_9: float64): Shared_PluginDataProperty => (new Shared_PluginDataProperty(Form_PropertyKeys_SystolicBP, "systolic_bp", "float", v_9.toString(), "Systolic BP", "mmHg", "Systolic blood pressure")), vitalsData_2.SystolicBP) : (equals(propertyKey_1, Form_PropertyKeys_DiastolicBP) ? map<float64, Shared_PluginDataProperty>((v_10: float64): Shared_PluginDataProperty => (new Shared_PluginDataProperty(Form_PropertyKeys_DiastolicBP, "diastolic_bp", "float", v_10.toString(), "Diastolic BP", "mmHg", "Diastolic blood pressure")), vitalsData_2.DiastolicBP) : (equals(propertyKey_1, Form_PropertyKeys_Pulse) ? map<float64, Shared_PluginDataProperty>((v_11: float64): Shared_PluginDataProperty => (new Shared_PluginDataProperty(Form_PropertyKeys_Pulse, "pulse", "float", v_11.toString(), "Pulse Rate", "BPM", "Heart rate in beats per minute")), vitalsData_2.Pulse) : (equals(propertyKey_1, Form_PropertyKeys_Respiration) ? map<float64, Shared_PluginDataProperty>((v_12: float64): Shared_PluginDataProperty => (new Shared_PluginDataProperty(Form_PropertyKeys_Respiration, "respiration", "float", v_12.toString(), "Respiration Rate", "RPM", "Respiratory rate per minute")), vitalsData_2.Respiration) : (equals(propertyKey_1, Form_PropertyKeys_OxygenSaturation) ? map<float64, Shared_PluginDataProperty>((v_13: float64): Shared_PluginDataProperty => (new Shared_PluginDataProperty(Form_PropertyKeys_OxygenSaturation, "oxygen_saturation", "float", v_13.toString(), "O2 Saturation", "%", "Oxygen saturation percentage")), vitalsData_2.OxygenSaturation) : (equals(propertyKey_1, Form_PropertyKeys_PainScale) ? map<float64, Shared_PluginDataProperty>((v_14: float64): Shared_PluginDataProperty => (new Shared_PluginDataProperty(Form_PropertyKeys_PainScale, "pain_scale", "float", v_14.toString(), "Pain Level", "/10", "Pain scale from 0 to 10")), vitalsData_2.PainScale) : undefined))))));
|
|
498
289
|
}
|
|
499
290
|
default:
|
|
@@ -507,7 +298,7 @@ export const Form_enhancedVitalsConverter: IPluginValueConverter = new IPluginVa
|
|
|
507
298
|
matchValue_1 = ([tryParse(value_1, new FSharpRef<float64>((): float64 => outArg_1, (v_15: float64): void => {
|
|
508
299
|
outArg_1 = v_15;
|
|
509
300
|
})), outArg_1] as [boolean, float64]);
|
|
510
|
-
return matchValue_1[0] ? (
|
|
301
|
+
return matchValue_1[0] ? (isValidTemperature(matchValue_1[1]) ? FSharpResult$2_Ok<void, string>(undefined) : FSharpResult$2_Error<void, string>(("Temperature must be between 95-108°F, got " + matchValue_1[1].toString()) + "°F")) : FSharpResult$2_Error<void, string>("Temperature must be a valid number");
|
|
511
302
|
}
|
|
512
303
|
case "systolic_bp": {
|
|
513
304
|
let matchValue_2: [boolean, float64];
|
|
@@ -515,7 +306,7 @@ export const Form_enhancedVitalsConverter: IPluginValueConverter = new IPluginVa
|
|
|
515
306
|
matchValue_2 = ([tryParse(value_1, new FSharpRef<float64>((): float64 => outArg_2, (v_19: float64): void => {
|
|
516
307
|
outArg_2 = v_19;
|
|
517
308
|
})), outArg_2] as [boolean, float64]);
|
|
518
|
-
return matchValue_2[0] ? (
|
|
309
|
+
return matchValue_2[0] ? (isValidSystolicBP(matchValue_2[1]) ? FSharpResult$2_Ok<void, string>(undefined) : FSharpResult$2_Error<void, string>("Systolic BP must be between 60-200 mmHg, got " + matchValue_2[1].toString())) : FSharpResult$2_Error<void, string>("Systolic BP must be a valid number");
|
|
519
310
|
}
|
|
520
311
|
case "diastolic_bp": {
|
|
521
312
|
let matchValue_3: [boolean, float64];
|
|
@@ -523,7 +314,7 @@ export const Form_enhancedVitalsConverter: IPluginValueConverter = new IPluginVa
|
|
|
523
314
|
matchValue_3 = ([tryParse(value_1, new FSharpRef<float64>((): float64 => outArg_3, (v_23: float64): void => {
|
|
524
315
|
outArg_3 = v_23;
|
|
525
316
|
})), outArg_3] as [boolean, float64]);
|
|
526
|
-
return matchValue_3[0] ? (
|
|
317
|
+
return matchValue_3[0] ? (isValidDiastolicBP(matchValue_3[1]) ? FSharpResult$2_Ok<void, string>(undefined) : FSharpResult$2_Error<void, string>("Diastolic BP must be between 40-120 mmHg, got " + matchValue_3[1].toString())) : FSharpResult$2_Error<void, string>("Diastolic BP must be a valid number");
|
|
527
318
|
}
|
|
528
319
|
case "pulse": {
|
|
529
320
|
let matchValue_4: [boolean, float64];
|
|
@@ -531,7 +322,7 @@ export const Form_enhancedVitalsConverter: IPluginValueConverter = new IPluginVa
|
|
|
531
322
|
matchValue_4 = ([tryParse(value_1, new FSharpRef<float64>((): float64 => outArg_4, (v_27: float64): void => {
|
|
532
323
|
outArg_4 = v_27;
|
|
533
324
|
})), outArg_4] as [boolean, float64]);
|
|
534
|
-
return matchValue_4[0] ? (
|
|
325
|
+
return matchValue_4[0] ? (isValidPulse(matchValue_4[1]) ? FSharpResult$2_Ok<void, string>(undefined) : FSharpResult$2_Error<void, string>("Pulse must be between 40-180 BPM, got " + matchValue_4[1].toString())) : FSharpResult$2_Error<void, string>("Pulse must be a valid number");
|
|
535
326
|
}
|
|
536
327
|
case "respiration": {
|
|
537
328
|
let matchValue_5: [boolean, float64];
|
|
@@ -539,7 +330,7 @@ export const Form_enhancedVitalsConverter: IPluginValueConverter = new IPluginVa
|
|
|
539
330
|
matchValue_5 = ([tryParse(value_1, new FSharpRef<float64>((): float64 => outArg_5, (v_31: float64): void => {
|
|
540
331
|
outArg_5 = v_31;
|
|
541
332
|
})), outArg_5] as [boolean, float64]);
|
|
542
|
-
return matchValue_5[0] ? (
|
|
333
|
+
return matchValue_5[0] ? (isValidRespiration(matchValue_5[1]) ? FSharpResult$2_Ok<void, string>(undefined) : FSharpResult$2_Error<void, string>("Respiration rate must be between 8-35 RPM, got " + matchValue_5[1].toString())) : FSharpResult$2_Error<void, string>("Respiration rate must be a valid number");
|
|
543
334
|
}
|
|
544
335
|
case "oxygen_saturation": {
|
|
545
336
|
let matchValue_6: [boolean, float64];
|
|
@@ -547,7 +338,7 @@ export const Form_enhancedVitalsConverter: IPluginValueConverter = new IPluginVa
|
|
|
547
338
|
matchValue_6 = ([tryParse(value_1, new FSharpRef<float64>((): float64 => outArg_6, (v_35: float64): void => {
|
|
548
339
|
outArg_6 = v_35;
|
|
549
340
|
})), outArg_6] as [boolean, float64]);
|
|
550
|
-
return matchValue_6[0] ? (
|
|
341
|
+
return matchValue_6[0] ? (isValidOxygenSat(matchValue_6[1]) ? FSharpResult$2_Ok<void, string>(undefined) : FSharpResult$2_Error<void, string>(("Oxygen saturation must be between 70-100%, got " + matchValue_6[1].toString()) + "%")) : FSharpResult$2_Error<void, string>("Oxygen saturation must be a valid number");
|
|
551
342
|
}
|
|
552
343
|
case "pain_scale": {
|
|
553
344
|
let matchValue_7: [boolean, float64];
|
|
@@ -555,7 +346,7 @@ export const Form_enhancedVitalsConverter: IPluginValueConverter = new IPluginVa
|
|
|
555
346
|
matchValue_7 = ([tryParse(value_1, new FSharpRef<float64>((): float64 => outArg_7, (v_39: float64): void => {
|
|
556
347
|
outArg_7 = v_39;
|
|
557
348
|
})), outArg_7] as [boolean, float64]);
|
|
558
|
-
return matchValue_7[0] ? (
|
|
349
|
+
return matchValue_7[0] ? (isValidPainScale(matchValue_7[1]) ? FSharpResult$2_Ok<void, string>(undefined) : FSharpResult$2_Error<void, string>("Pain scale must be between 0-10, got " + matchValue_7[1].toString())) : FSharpResult$2_Error<void, string>("Pain scale must be a valid number");
|
|
559
350
|
}
|
|
560
351
|
default:
|
|
561
352
|
return FSharpResult$2_Error<void, string>("Unknown property: " + propertyName_2);
|
|
@@ -565,7 +356,7 @@ export const Form_enhancedVitalsConverter: IPluginValueConverter = new IPluginVa
|
|
|
565
356
|
case /* PluginData */ 3:
|
|
566
357
|
return fieldValue_3.fields[0];
|
|
567
358
|
case /* Single */ 0: {
|
|
568
|
-
const vitalsData_3:
|
|
359
|
+
const vitalsData_3: VitalsData = parseVitalsData(fieldValue_3.fields[0].Value);
|
|
569
360
|
return toList<Shared_PluginDataProperty>(delay<Shared_PluginDataProperty>((): Iterable<Shared_PluginDataProperty> => append<Shared_PluginDataProperty>((vitalsData_3.Temperature != null) ? singleton<Shared_PluginDataProperty>(new Shared_PluginDataProperty(Form_PropertyKeys_Temperature, "temperature", "float", value_140(vitalsData_3.Temperature).toString(), "Temperature", "°F", "Body temperature in Fahrenheit")) : empty<Shared_PluginDataProperty>(), delay<Shared_PluginDataProperty>((): Iterable<Shared_PluginDataProperty> => append<Shared_PluginDataProperty>((vitalsData_3.SystolicBP != null) ? singleton<Shared_PluginDataProperty>(new Shared_PluginDataProperty(Form_PropertyKeys_SystolicBP, "systolic_bp", "float", value_140(vitalsData_3.SystolicBP).toString(), "Systolic BP", "mmHg", "Systolic blood pressure")) : empty<Shared_PluginDataProperty>(), delay<Shared_PluginDataProperty>((): Iterable<Shared_PluginDataProperty> => append<Shared_PluginDataProperty>((vitalsData_3.DiastolicBP != null) ? singleton<Shared_PluginDataProperty>(new Shared_PluginDataProperty(Form_PropertyKeys_DiastolicBP, "diastolic_bp", "float", value_140(vitalsData_3.DiastolicBP).toString(), "Diastolic BP", "mmHg", "Diastolic blood pressure")) : empty<Shared_PluginDataProperty>(), delay<Shared_PluginDataProperty>((): Iterable<Shared_PluginDataProperty> => append<Shared_PluginDataProperty>((vitalsData_3.Pulse != null) ? singleton<Shared_PluginDataProperty>(new Shared_PluginDataProperty(Form_PropertyKeys_Pulse, "pulse", "float", value_140(vitalsData_3.Pulse).toString(), "Pulse Rate", "BPM", "Heart rate in beats per minute")) : empty<Shared_PluginDataProperty>(), delay<Shared_PluginDataProperty>((): Iterable<Shared_PluginDataProperty> => append<Shared_PluginDataProperty>((vitalsData_3.Respiration != null) ? singleton<Shared_PluginDataProperty>(new Shared_PluginDataProperty(Form_PropertyKeys_Respiration, "respiration", "float", value_140(vitalsData_3.Respiration).toString(), "Respiration Rate", "RPM", "Respiratory rate per minute")) : empty<Shared_PluginDataProperty>(), delay<Shared_PluginDataProperty>((): Iterable<Shared_PluginDataProperty> => append<Shared_PluginDataProperty>((vitalsData_3.OxygenSaturation != null) ? singleton<Shared_PluginDataProperty>(new Shared_PluginDataProperty(Form_PropertyKeys_OxygenSaturation, "oxygen_saturation", "float", value_140(vitalsData_3.OxygenSaturation).toString(), "O2 Saturation", "%", "Oxygen saturation percentage")) : empty<Shared_PluginDataProperty>(), delay<Shared_PluginDataProperty>((): Iterable<Shared_PluginDataProperty> => ((vitalsData_3.PainScale != null) ? singleton<Shared_PluginDataProperty>(new Shared_PluginDataProperty(Form_PropertyKeys_PainScale, "pain_scale", "float", value_140(vitalsData_3.PainScale).toString(), "Pain Level", "/10", "Pain scale from 0 to 10")) : empty<Shared_PluginDataProperty>())))))))))))))));
|
|
570
361
|
}
|
|
571
362
|
default:
|
|
@@ -615,33 +406,33 @@ export function Form_markdownRenderer(field: Spec_FormField$1<Spec_FieldType_$un
|
|
|
615
406
|
}
|
|
616
407
|
else {
|
|
617
408
|
try {
|
|
618
|
-
const vitalsData:
|
|
409
|
+
const vitalsData: VitalsData = parseVitalsData(value);
|
|
619
410
|
if (exists<Option<float64>>((option: Option<float64>): boolean => (option != null), ofArray([vitalsData.Temperature, vitalsData.SystolicBP, vitalsData.DiastolicBP, vitalsData.Pulse, vitalsData.Respiration, vitalsData.OxygenSaturation, vitalsData.PainScale]))) {
|
|
620
411
|
let rows: FSharpList<string> = ofArray([("**" + field.Label) + "** 🩺", "", "| Vital Sign | Value | Status |", "|------------|-------|--------|"]);
|
|
621
412
|
if (vitalsData.Temperature != null) {
|
|
622
413
|
const temp: float64 = value_140(vitalsData.Temperature);
|
|
623
|
-
const status: string =
|
|
414
|
+
const status: string = isCriticalTemperature(temp) ? "🚨 CRITICAL" : (!isValidTemperature(temp) ? "⚠️ ABNORMAL" : (!isNormalTemperature(temp) ? "⚠️ ABNORMAL" : "✅ Normal"));
|
|
624
415
|
rows = append_1(rows, singleton_1(((("| **Temperature** | " + toText(printf("%.1f"))(temp)) + "°F | ") + status) + " |"));
|
|
625
416
|
}
|
|
626
417
|
if ((vitalsData.SystolicBP != null) && (vitalsData.DiastolicBP != null)) {
|
|
627
418
|
const sys: float64 = value_140(vitalsData.SystolicBP);
|
|
628
419
|
const dia: float64 = value_140(vitalsData.DiastolicBP);
|
|
629
|
-
const status_1: string = (
|
|
420
|
+
const status_1: string = (isCriticalSystolicBP(sys) ? true : isCriticalDiastolicBP(dia)) ? "🚨 CRITICAL" : ((!isValidSystolicBP(sys) ? true : !isValidDiastolicBP(dia)) ? "⚠️ ABNORMAL" : "✅ Normal");
|
|
630
421
|
rows = append_1(rows, singleton_1(((((("| **Blood Pressure** | " + toText(printf("%.0f"))(sys)) + "/") + toText(printf("%.0f"))(dia)) + " mmHg | ") + status_1) + " |"));
|
|
631
422
|
}
|
|
632
423
|
if (vitalsData.Pulse != null) {
|
|
633
424
|
const pulse: float64 = value_140(vitalsData.Pulse);
|
|
634
|
-
const status_2: string =
|
|
425
|
+
const status_2: string = isCriticalPulse(pulse) ? "🚨 CRITICAL" : (!isValidPulse(pulse) ? "⚠️ ABNORMAL" : "✅ Normal");
|
|
635
426
|
rows = append_1(rows, singleton_1(((("| **Pulse Rate** | " + toText(printf("%.0f"))(pulse)) + " BPM | ") + status_2) + " |"));
|
|
636
427
|
}
|
|
637
428
|
if (vitalsData.Respiration != null) {
|
|
638
429
|
const resp: float64 = value_140(vitalsData.Respiration);
|
|
639
|
-
const status_3: string =
|
|
430
|
+
const status_3: string = isCriticalRespiration(resp) ? "🚨 CRITICAL" : (!isValidRespiration(resp) ? "⚠️ ABNORMAL" : "✅ Normal");
|
|
640
431
|
rows = append_1(rows, singleton_1(((("| **Respiration** | " + toText(printf("%.0f"))(resp)) + " RPM | ") + status_3) + " |"));
|
|
641
432
|
}
|
|
642
433
|
if (vitalsData.OxygenSaturation != null) {
|
|
643
434
|
const sat: float64 = value_140(vitalsData.OxygenSaturation);
|
|
644
|
-
const status_4: string =
|
|
435
|
+
const status_4: string = isCriticalOxygenSat(sat) ? "🚨 CRITICAL" : (!isValidOxygenSat(sat) ? "⚠️ ABNORMAL" : "✅ Normal");
|
|
645
436
|
rows = append_1(rows, singleton_1(((("| **O2 Saturation** | " + toText(printf("%.0f"))(sat)) + "% | ") + status_4) + " |"));
|
|
646
437
|
}
|
|
647
438
|
if (vitalsData.PainScale != null) {
|