@f1studio/form-spec 5.0.0-alpha.101 → 5.0.0-alpha.103
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/Components/HelloComponent.d.ts +20 -0
- package/Components/HelloComponent.d.ts.map +1 -0
- package/Designer.d.ts.map +1 -0
- package/FormSpec.TS/Designer.js +2 -2
- package/FormSpec.TS/Designer.js.map +1 -1
- package/FormSpec.TS/Designer.ts.map +1 -1
- package/FormSpec.TS/FormSpec.js +210 -143
- package/FormSpec.TS/FormSpec.js.map +1 -1
- package/FormSpec.TS/FormSpec.ts.map +1 -1
- package/FormSpec.TS/FormSpecHelpers.js +62 -40
- package/FormSpec.TS/FormSpecHelpers.js.map +1 -1
- package/FormSpec.TS/FormSpecHelpers.ts.map +1 -1
- package/FormSpec.TS/FormSpecValues.js +207 -0
- package/FormSpec.TS/FormSpecValues.js.map +1 -0
- package/FormSpec.TS/FormSpecValues.ts.map +1 -0
- package/FormSpec.TS/Helpers.js +26 -25
- package/FormSpec.TS/Helpers.js.map +1 -1
- package/FormSpec.TS/Helpers.ts.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Api.Helpers.js +85 -125
- package/FormSpec.TS/Interop/FormSpec.Api.Helpers.js.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Api.Helpers.ts.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Api.Option.js +37 -7
- package/FormSpec.TS/Interop/FormSpec.Api.Option.js.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Api.Option.ts.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.js +103 -80
- package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.js.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.ts.map +1 -1
- package/FormSpec.TS/PathwayExecutor.js +371 -125
- package/FormSpec.TS/PathwayExecutor.js.map +1 -1
- package/FormSpec.TS/PathwayExecutor.ts.map +1 -1
- package/FormSpec.TS/PathwayValidator.js +14 -26
- package/FormSpec.TS/PathwayValidator.js.map +1 -1
- package/FormSpec.TS/PathwayValidator.ts.map +1 -1
- package/FormSpec.TS/Renderers/FormSpecMarkdownRenderer.ts.map +1 -1
- package/FormSpec.TS/Renderers/PathwayRenderers.js +35 -26
- package/FormSpec.TS/Renderers/PathwayRenderers.js.map +1 -1
- package/FormSpec.TS/Renderers/PathwayRenderers.ts.map +1 -1
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Base.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Error.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Extensions.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Fable.Form.fableproj +0 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Fable.Form.Simple.fableproj +0 -0
- package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Form.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Extensions.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Hooks.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Types.fableproj +0 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.fs +0 -0
- package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.Types.fableproj +0 -0
- package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/BorderStyle.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Colors.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Feliz.fableproj +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Fonts.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/GridTypes.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Html.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Interop.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Key.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Length.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Locale.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Properties.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/React.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactDOM.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactInterop.js +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactInterop.js.map +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactTypes.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/StyleTypes.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Styles.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Svg.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TextDecorationLine.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TextDecorationStyle.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Transform.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TransformOrigin.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TransitionProperty.fs +0 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Types.fs +0 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs +0 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs +0 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.js.map +1 -1
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.ts.map +1 -1
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs +0 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Thoth.Json.fableproj +0 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs +0 -0
- package/FormSpec.TS/fable_modules/project_cracked.json +1 -1
- package/FormSpec.d.ts +56 -43
- package/FormSpec.d.ts.map +1 -0
- package/FormSpecHelpers.d.ts +18 -12
- package/FormSpecHelpers.d.ts.map +1 -0
- package/FormSpecValues.d.ts +62 -0
- package/FormSpecValues.d.ts.map +1 -0
- package/Helpers.d.ts +11 -10
- package/Helpers.d.ts.map +1 -0
- package/Interfaces.d.ts.map +1 -0
- package/Interop/FormSpec.Api.Helpers.d.ts +25 -28
- package/Interop/FormSpec.Api.Helpers.d.ts.map +1 -1
- package/Interop/FormSpec.Api.Option.d.ts +10 -6
- package/Interop/FormSpec.Api.Option.d.ts.map +1 -1
- package/Interop/FormSpec.Values.Api.Option.d.ts +35 -22
- package/Interop/FormSpec.Values.Api.Option.d.ts.map +1 -1
- package/Logging/LogTypes.d.ts +112 -0
- package/Logging/LogTypes.d.ts.map +1 -0
- package/Migrator.d.ts.map +1 -0
- package/PathwayDataExtractor.d.ts.map +1 -0
- package/PathwayExecutor.d.ts +63 -33
- package/PathwayExecutor.d.ts.map +1 -0
- package/PathwayValidator.d.ts.map +1 -0
- package/PluginInterface.d.ts.map +1 -0
- package/Prelude.d.ts.map +1 -0
- package/README.TS.md +621 -621
- package/README.md +98 -85
- package/Renderers/FormSpecMarkdownRenderer.d.ts +11 -0
- package/Renderers/FormSpecMarkdownRenderer.d.ts.map +1 -0
- package/Renderers/MermaidRenderer.d.ts +48 -0
- package/Renderers/MermaidRenderer.d.ts.map +1 -0
- package/Renderers/PathwayRenderers.d.ts +59 -0
- package/Renderers/PathwayRenderers.d.ts.map +1 -0
- package/fable_modules/Thoth.Json.10.4.1/Decode.fs.d.ts +126 -0
- package/fable_modules/Thoth.Json.10.4.1/Decode.fs.d.ts.map +1 -0
- package/fable_modules/Thoth.Json.10.4.1/Encode.fs.d.ts +163 -0
- package/fable_modules/Thoth.Json.10.4.1/Encode.fs.d.ts.map +1 -0
- package/fable_modules/Thoth.Json.10.4.1/Types.fs.d.ts +66 -0
- package/fable_modules/Thoth.Json.10.4.1/Types.fs.d.ts.map +1 -0
- package/package.json +53 -39
- package/src/Components/HelloComponent.ts +48 -48
- package/src/Designer.ts +389 -389
- package/src/FormSpec.ts +3154 -3114
- package/src/FormSpecHelpers.ts +397 -374
- package/src/FormSpecValues.ts +158 -0
- package/src/Helpers.ts +766 -765
- package/src/Interfaces.ts +166 -166
- package/src/Interop/FormSpec.Api.Helpers.ts +835 -872
- package/src/Interop/FormSpec.Api.Option.ts +1637 -1618
- package/src/Interop/FormSpec.Values.Api.Option.ts +1241 -1214
- package/src/Logging/LogTypes.ts +212 -212
- package/src/Migrator.ts +156 -156
- package/src/PathwayDataExtractor.ts +290 -290
- package/src/PathwayExecutor.ts +1379 -1102
- package/src/PathwayValidator.ts +238 -244
- package/src/PluginInterface.ts +79 -79
- package/src/Prelude.ts +21 -21
- package/src/Renderers/FormSpecMarkdownRenderer.ts +875 -874
- package/src/Renderers/MermaidRenderer.ts +218 -218
- package/src/Renderers/PathwayRenderers.ts +208 -200
- package/src/Components/HelloComponent.ts.map +0 -1
- package/src/Designer.ts.map +0 -1
- package/src/FormSpec.ts.map +0 -1
- package/src/FormSpecHelpers.ts.map +0 -1
- package/src/Helpers.ts.map +0 -1
- package/src/Interfaces.ts.map +0 -1
- package/src/Interop/FormSpec.Api.Helpers.ts.map +0 -1
- package/src/Interop/FormSpec.Api.Option.ts.map +0 -1
- package/src/Interop/FormSpec.Values.Api.Option.ts.map +0 -1
- package/src/Logging/LogTypes.ts.map +0 -1
- package/src/Migrator.ts.map +0 -1
- package/src/PathwayDataExtractor.ts.map +0 -1
- package/src/PathwayExecutor.ts.map +0 -1
- package/src/PathwayValidator.ts.map +0 -1
- package/src/PluginInterface.ts.map +0 -1
- package/src/Prelude.ts.map +0 -1
- package/src/Renderers/FormSpecMarkdownRenderer.ts.map +0 -1
- package/src/Renderers/MermaidRenderer.ts.map +0 -1
- package/src/Renderers/PathwayRenderers.ts.map +0 -1
|
@@ -1,290 +1,290 @@
|
|
|
1
|
-
import { ClinicalPathway_TerminalInfo, Shared_StateKey, ClinicalPathway_StateType_$union, ClinicalPathway_EvaluationInfo, ClinicalPathway_DecisionInfo, ClinicalPathway_ActionInfo_$union, ClinicalPathway_MedicationAction, ClinicalPathway_FieldValueSource_$union, ClinicalPathway_SetFieldValueAction, ClinicalPathway_NavigateToFormAction, ClinicalPathway_PrescriptionAction, ClinicalPathway_ProblemAction, ClinicalPathway_AlertAction, ClinicalPathway_TaskAction, ClinicalPathway_DocumentationAction, ClinicalPathway_ReferralAction, ClinicalPathway_TestAction, ClinicalPathway_EducationAction, ClinicalPathway_ProcedureAction } from "./FormSpec.js";
|
|
2
|
-
import { split, replace, join, isNullOrWhiteSpace, substring, printf, toText } from "@fable-org/fable-library-js/String.js";
|
|
3
|
-
import { singleton, append, map, empty, FSharpList, filter } from "@fable-org/fable-library-js/List.js";
|
|
4
|
-
import { Option, value } from "@fable-org/fable-library-js/Option.js";
|
|
5
|
-
import { item, map as map_1 } from "@fable-org/fable-library-js/Array.js";
|
|
6
|
-
import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
7
|
-
|
|
8
|
-
export function extractActionText(action: ClinicalPathway_ActionInfo_$union): string {
|
|
9
|
-
switch (action.tag) {
|
|
10
|
-
case /* Procedure */ 4: {
|
|
11
|
-
const p: ClinicalPathway_ProcedureAction = action.fields[0];
|
|
12
|
-
return toText(printf("Procedure: %s"))(p.Name);
|
|
13
|
-
}
|
|
14
|
-
case /* Education */ 3: {
|
|
15
|
-
const e: ClinicalPathway_EducationAction = action.fields[0];
|
|
16
|
-
return "Education";
|
|
17
|
-
}
|
|
18
|
-
case /* Test */ 1: {
|
|
19
|
-
const t: ClinicalPathway_TestAction = action.fields[0];
|
|
20
|
-
return toText(printf("Test: %s"))(t.TestName);
|
|
21
|
-
}
|
|
22
|
-
case /* Referral */ 2: {
|
|
23
|
-
const r: ClinicalPathway_ReferralAction = action.fields[0];
|
|
24
|
-
return toText(printf("Refer to %s"))(r.Target);
|
|
25
|
-
}
|
|
26
|
-
case /* Documentation */ 5: {
|
|
27
|
-
const d: ClinicalPathway_DocumentationAction = action.fields[0];
|
|
28
|
-
return toText(printf("Document: %s"))(d.FormName);
|
|
29
|
-
}
|
|
30
|
-
case /* Task */ 6: {
|
|
31
|
-
const t_1: ClinicalPathway_TaskAction = action.fields[0];
|
|
32
|
-
return toText(printf("Task: %s"))(t_1.Description);
|
|
33
|
-
}
|
|
34
|
-
case /* Alert */ 7: {
|
|
35
|
-
const a: ClinicalPathway_AlertAction = action.fields[0];
|
|
36
|
-
return toText(printf("Alert: %s"))(a.Message);
|
|
37
|
-
}
|
|
38
|
-
case /* Problem */ 8: {
|
|
39
|
-
const p_1: ClinicalPathway_ProblemAction = action.fields[0];
|
|
40
|
-
return toText(printf("Problem: %s"))(p_1.ProblemName);
|
|
41
|
-
}
|
|
42
|
-
case /* Prescription */ 9: {
|
|
43
|
-
const p_2: ClinicalPathway_PrescriptionAction = action.fields[0];
|
|
44
|
-
return toText(printf("Prescription: %s"))(p_2.Medication);
|
|
45
|
-
}
|
|
46
|
-
case /* NavigateToForm */ 11: {
|
|
47
|
-
const n: ClinicalPathway_NavigateToFormAction = action.fields[0];
|
|
48
|
-
return toText(printf("Navigate to: %s"))(n.FormId);
|
|
49
|
-
}
|
|
50
|
-
case /* SetFieldValue */ 10: {
|
|
51
|
-
const s: ClinicalPathway_SetFieldValueAction = action.fields[0];
|
|
52
|
-
const fieldGuid: string = s.TargetField.fields[0];
|
|
53
|
-
const shortGuid: string = (fieldGuid.length > 8) ? (substring(fieldGuid, 0, 8) + "...") : fieldGuid;
|
|
54
|
-
let valueText: string;
|
|
55
|
-
const matchValue: ClinicalPathway_FieldValueSource_$union = s.Value;
|
|
56
|
-
switch (matchValue.tag) {
|
|
57
|
-
case /* FieldReference */ 1: {
|
|
58
|
-
const g: string = matchValue.fields[0].fields[0];
|
|
59
|
-
valueText = "from field";
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
case /* OptionKey */ 2: {
|
|
63
|
-
const g_1: string = matchValue.fields[0].fields[0];
|
|
64
|
-
valueText = "option";
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
default: {
|
|
68
|
-
const v: string = matchValue.fields[0];
|
|
69
|
-
valueText = (isNullOrWhiteSpace(v) ? "(empty)" : v);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return toText(printf("Set Field: %s = %s"))(shortGuid)(valueText);
|
|
73
|
-
}
|
|
74
|
-
default: {
|
|
75
|
-
const m: ClinicalPathway_MedicationAction = action.fields[0];
|
|
76
|
-
return toText(printf("Rx: %s"))(m.Name);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export function extractActionDetails(action: ClinicalPathway_ActionInfo_$union): string {
|
|
82
|
-
switch (action.tag) {
|
|
83
|
-
case /* Procedure */ 4:
|
|
84
|
-
return action.fields[0].Name;
|
|
85
|
-
case /* Education */ 3:
|
|
86
|
-
return join("; ", action.fields[0].Topics);
|
|
87
|
-
case /* Test */ 1: {
|
|
88
|
-
const t: ClinicalPathway_TestAction = action.fields[0];
|
|
89
|
-
return toText(printf("Test: %s"))(t.TestName);
|
|
90
|
-
}
|
|
91
|
-
case /* Referral */ 2: {
|
|
92
|
-
const r: ClinicalPathway_ReferralAction = action.fields[0];
|
|
93
|
-
return toText(printf("Refer to %s (%s)"))(r.Target)(r.Reason);
|
|
94
|
-
}
|
|
95
|
-
case /* Documentation */ 5: {
|
|
96
|
-
const d: ClinicalPathway_DocumentationAction = action.fields[0];
|
|
97
|
-
return toText(printf("Document: %s"))(d.FormName);
|
|
98
|
-
}
|
|
99
|
-
case /* Task */ 6: {
|
|
100
|
-
const t_1: ClinicalPathway_TaskAction = action.fields[0];
|
|
101
|
-
return toText(printf("Task: %s"))(t_1.Description);
|
|
102
|
-
}
|
|
103
|
-
case /* Alert */ 7: {
|
|
104
|
-
const a: ClinicalPathway_AlertAction = action.fields[0];
|
|
105
|
-
return toText(printf("Alert: %s"))(a.Message);
|
|
106
|
-
}
|
|
107
|
-
case /* Problem */ 8: {
|
|
108
|
-
const p_1: ClinicalPathway_ProblemAction = action.fields[0];
|
|
109
|
-
return toText(printf("Problem: %s"))(p_1.ProblemName);
|
|
110
|
-
}
|
|
111
|
-
case /* Prescription */ 9: {
|
|
112
|
-
const p_2: ClinicalPathway_PrescriptionAction = action.fields[0];
|
|
113
|
-
return toText(printf("Prescription: %s"))(p_2.Medication);
|
|
114
|
-
}
|
|
115
|
-
case /* NavigateToForm */ 11: {
|
|
116
|
-
const n: ClinicalPathway_NavigateToFormAction = action.fields[0];
|
|
117
|
-
return toText(printf("Navigate to: %s"))(n.FormId);
|
|
118
|
-
}
|
|
119
|
-
case /* SetFieldValue */ 10: {
|
|
120
|
-
const s: ClinicalPathway_SetFieldValueAction = action.fields[0];
|
|
121
|
-
const guid: string = s.TargetField.fields[0];
|
|
122
|
-
let valueText: string;
|
|
123
|
-
const matchValue: ClinicalPathway_FieldValueSource_$union = s.Value;
|
|
124
|
-
switch (matchValue.tag) {
|
|
125
|
-
case /* FieldReference */ 1: {
|
|
126
|
-
valueText = (`from ${matchValue.fields[0].fields[0]}`);
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
129
|
-
case /* OptionKey */ 2: {
|
|
130
|
-
valueText = (`option ${matchValue.fields[0].fields[0]}`);
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
133
|
-
default: {
|
|
134
|
-
const v: string = matchValue.fields[0];
|
|
135
|
-
valueText = (isNullOrWhiteSpace(v) ? "(empty)" : v);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return toText(printf("Set Field %s = %s"))(guid)(valueText);
|
|
139
|
-
}
|
|
140
|
-
default: {
|
|
141
|
-
const m: ClinicalPathway_MedicationAction = action.fields[0];
|
|
142
|
-
return toText(printf("%s %s %s %s"))(m.Name)(m.Dose)(m.Route)(m.Frequency);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
export function extractActionType(action: ClinicalPathway_ActionInfo_$union): string {
|
|
148
|
-
switch (action.tag) {
|
|
149
|
-
case /* Procedure */ 4:
|
|
150
|
-
return "Procedure";
|
|
151
|
-
case /* Education */ 3:
|
|
152
|
-
return "Education";
|
|
153
|
-
case /* Test */ 1:
|
|
154
|
-
return "Test";
|
|
155
|
-
case /* Referral */ 2:
|
|
156
|
-
return "Referral";
|
|
157
|
-
case /* Documentation */ 5:
|
|
158
|
-
return "Documentation";
|
|
159
|
-
case /* Task */ 6:
|
|
160
|
-
return "Task";
|
|
161
|
-
case /* Alert */ 7:
|
|
162
|
-
return "Alert";
|
|
163
|
-
case /* Problem */ 8:
|
|
164
|
-
return "Problem";
|
|
165
|
-
case /* Prescription */ 9:
|
|
166
|
-
return "Prescription";
|
|
167
|
-
case /* SetFieldValue */ 10:
|
|
168
|
-
return "SetFieldValue";
|
|
169
|
-
case /* NavigateToForm */ 11:
|
|
170
|
-
return "NavigateToForm";
|
|
171
|
-
default:
|
|
172
|
-
return "Medication";
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export function extractDecisionDetails(decision: ClinicalPathway_DecisionInfo): [string, FSharpList<string>] {
|
|
177
|
-
return [decision.Question, filter<string>((opt: string): boolean => {
|
|
178
|
-
if ((opt !== "Yes") && (opt !== "No")) {
|
|
179
|
-
return opt !== "None of the above";
|
|
180
|
-
}
|
|
181
|
-
else {
|
|
182
|
-
return false;
|
|
183
|
-
}
|
|
184
|
-
}, decision.Options)] as [string, FSharpList<string>];
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
export function extractEvaluationDetails(evaluation: ClinicalPathway_EvaluationInfo): [string, FSharpList<string>] {
|
|
188
|
-
let matchValue: Option<FSharpList<string>>;
|
|
189
|
-
return [evaluation.EvaluationName, (matchValue = evaluation.CriticalFindings, (matchValue == null) ? empty<string>() : value(matchValue))] as [string, FSharpList<string>];
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
export function extractEvaluationName(evaluation: ClinicalPathway_EvaluationInfo): string {
|
|
193
|
-
return evaluation.EvaluationName;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
export function stateTypeToString(stateType: ClinicalPathway_StateType_$union): string {
|
|
197
|
-
switch (stateType.tag) {
|
|
198
|
-
case /* Decision */ 1:
|
|
199
|
-
return "Decision";
|
|
200
|
-
case /* Action */ 2:
|
|
201
|
-
return "Action";
|
|
202
|
-
case /* CompoundAction */ 3:
|
|
203
|
-
return "CompoundAction";
|
|
204
|
-
case /* ConditionalAction */ 4:
|
|
205
|
-
return "ConditionalAction";
|
|
206
|
-
case /* Terminal */ 5:
|
|
207
|
-
return "Terminal";
|
|
208
|
-
default:
|
|
209
|
-
return "Evaluation";
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
export function isTerminalState(stateType: ClinicalPathway_StateType_$union): boolean {
|
|
214
|
-
if (stateType.tag === /* Terminal */ 5) {
|
|
215
|
-
return true;
|
|
216
|
-
}
|
|
217
|
-
else {
|
|
218
|
-
return false;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
export function extractCompoundActionTexts(actions: FSharpList<ClinicalPathway_ActionInfo_$union>): FSharpList<string> {
|
|
223
|
-
return map<ClinicalPathway_ActionInfo_$union, string>(extractActionText, actions);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
export function extractCompoundActionDetails(actions: FSharpList<ClinicalPathway_ActionInfo_$union>): FSharpList<string> {
|
|
227
|
-
return map<ClinicalPathway_ActionInfo_$union, string>(extractActionDetails, actions);
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
export function sanitizeMermaidId(id: string): string {
|
|
231
|
-
return replace(replace(replace(id, "-", "_"), " ", "_"), ".", "_");
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
export function sanitizeMermaidText(text: string): string {
|
|
235
|
-
return replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(text, "\"", "\'"), "(", "-"), ")", "-"), "{", "-"), "}", "-"), "<", "-"), ">", "-"), "|", "/"), "`", "\'"), "\n", " "), "\r", " "), " ", " ");
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
export function wrapTextForReactFlow(text: string, maxWidth: int32): string {
|
|
239
|
-
if (text.length <= maxWidth) {
|
|
240
|
-
return text;
|
|
241
|
-
}
|
|
242
|
-
else {
|
|
243
|
-
const words: string[] = map_1<string, string>((word: string): string => {
|
|
244
|
-
if (text.indexOf(`${word} =`) >= 0) {
|
|
245
|
-
return `${word} =`;
|
|
246
|
-
}
|
|
247
|
-
else if (text.indexOf(`${word},`) >= 0) {
|
|
248
|
-
return `${word},`;
|
|
249
|
-
}
|
|
250
|
-
else if (text.indexOf(`${word};`) >= 0) {
|
|
251
|
-
return `${word};`;
|
|
252
|
-
}
|
|
253
|
-
else if (text.indexOf(`${word}:`) >= 0) {
|
|
254
|
-
return `${word}:`;
|
|
255
|
-
}
|
|
256
|
-
else {
|
|
257
|
-
return word;
|
|
258
|
-
}
|
|
259
|
-
}, split(text, [" ", ",", ";", "=", ":"], undefined, 1));
|
|
260
|
-
let lines: FSharpList<string> = empty<string>();
|
|
261
|
-
let currentLine = "";
|
|
262
|
-
for (let idx = 0; idx <= (words.length - 1); idx++) {
|
|
263
|
-
const word_1: string = item(idx, words);
|
|
264
|
-
if (currentLine === "") {
|
|
265
|
-
currentLine = word_1;
|
|
266
|
-
}
|
|
267
|
-
else if (((currentLine + " ") + word_1).length <= maxWidth) {
|
|
268
|
-
currentLine = ((currentLine + " ") + word_1);
|
|
269
|
-
}
|
|
270
|
-
else {
|
|
271
|
-
lines = append(lines, singleton(currentLine));
|
|
272
|
-
currentLine = word_1;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
if (currentLine !== "") {
|
|
276
|
-
lines = append(lines, singleton(currentLine));
|
|
277
|
-
}
|
|
278
|
-
return join("\n", lines);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
export function extractStateKeyString(stateKey: Shared_StateKey): string {
|
|
283
|
-
return stateKey.fields[0];
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
export function getTerminalOutcome(terminal: ClinicalPathway_TerminalInfo): string {
|
|
287
|
-
return terminal.Outcome;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
//# sourceMappingURL=PathwayDataExtractor.ts.map
|
|
1
|
+
import { ClinicalPathway_TerminalInfo, Shared_StateKey, ClinicalPathway_StateType_$union, ClinicalPathway_EvaluationInfo, ClinicalPathway_DecisionInfo, ClinicalPathway_ActionInfo_$union, ClinicalPathway_MedicationAction, ClinicalPathway_FieldValueSource_$union, ClinicalPathway_SetFieldValueAction, ClinicalPathway_NavigateToFormAction, ClinicalPathway_PrescriptionAction, ClinicalPathway_ProblemAction, ClinicalPathway_AlertAction, ClinicalPathway_TaskAction, ClinicalPathway_DocumentationAction, ClinicalPathway_ReferralAction, ClinicalPathway_TestAction, ClinicalPathway_EducationAction, ClinicalPathway_ProcedureAction } from "./FormSpec.js";
|
|
2
|
+
import { split, replace, join, isNullOrWhiteSpace, substring, printf, toText } from "@fable-org/fable-library-js/String.js";
|
|
3
|
+
import { singleton, append, map, empty, FSharpList, filter } from "@fable-org/fable-library-js/List.js";
|
|
4
|
+
import { Option, value } from "@fable-org/fable-library-js/Option.js";
|
|
5
|
+
import { item, map as map_1 } from "@fable-org/fable-library-js/Array.js";
|
|
6
|
+
import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
7
|
+
|
|
8
|
+
export function extractActionText(action: ClinicalPathway_ActionInfo_$union): string {
|
|
9
|
+
switch (action.tag) {
|
|
10
|
+
case /* Procedure */ 4: {
|
|
11
|
+
const p: ClinicalPathway_ProcedureAction = action.fields[0];
|
|
12
|
+
return toText(printf("Procedure: %s"))(p.Name);
|
|
13
|
+
}
|
|
14
|
+
case /* Education */ 3: {
|
|
15
|
+
const e: ClinicalPathway_EducationAction = action.fields[0];
|
|
16
|
+
return "Education";
|
|
17
|
+
}
|
|
18
|
+
case /* Test */ 1: {
|
|
19
|
+
const t: ClinicalPathway_TestAction = action.fields[0];
|
|
20
|
+
return toText(printf("Test: %s"))(t.TestName);
|
|
21
|
+
}
|
|
22
|
+
case /* Referral */ 2: {
|
|
23
|
+
const r: ClinicalPathway_ReferralAction = action.fields[0];
|
|
24
|
+
return toText(printf("Refer to %s"))(r.Target);
|
|
25
|
+
}
|
|
26
|
+
case /* Documentation */ 5: {
|
|
27
|
+
const d: ClinicalPathway_DocumentationAction = action.fields[0];
|
|
28
|
+
return toText(printf("Document: %s"))(d.FormName);
|
|
29
|
+
}
|
|
30
|
+
case /* Task */ 6: {
|
|
31
|
+
const t_1: ClinicalPathway_TaskAction = action.fields[0];
|
|
32
|
+
return toText(printf("Task: %s"))(t_1.Description);
|
|
33
|
+
}
|
|
34
|
+
case /* Alert */ 7: {
|
|
35
|
+
const a: ClinicalPathway_AlertAction = action.fields[0];
|
|
36
|
+
return toText(printf("Alert: %s"))(a.Message);
|
|
37
|
+
}
|
|
38
|
+
case /* Problem */ 8: {
|
|
39
|
+
const p_1: ClinicalPathway_ProblemAction = action.fields[0];
|
|
40
|
+
return toText(printf("Problem: %s"))(p_1.ProblemName);
|
|
41
|
+
}
|
|
42
|
+
case /* Prescription */ 9: {
|
|
43
|
+
const p_2: ClinicalPathway_PrescriptionAction = action.fields[0];
|
|
44
|
+
return toText(printf("Prescription: %s"))(p_2.Medication);
|
|
45
|
+
}
|
|
46
|
+
case /* NavigateToForm */ 11: {
|
|
47
|
+
const n: ClinicalPathway_NavigateToFormAction = action.fields[0];
|
|
48
|
+
return toText(printf("Navigate to: %s"))(n.FormId);
|
|
49
|
+
}
|
|
50
|
+
case /* SetFieldValue */ 10: {
|
|
51
|
+
const s: ClinicalPathway_SetFieldValueAction = action.fields[0];
|
|
52
|
+
const fieldGuid: string = s.TargetField.fields[0];
|
|
53
|
+
const shortGuid: string = (fieldGuid.length > 8) ? (substring(fieldGuid, 0, 8) + "...") : fieldGuid;
|
|
54
|
+
let valueText: string;
|
|
55
|
+
const matchValue: ClinicalPathway_FieldValueSource_$union = s.Value;
|
|
56
|
+
switch (matchValue.tag) {
|
|
57
|
+
case /* FieldReference */ 1: {
|
|
58
|
+
const g: string = matchValue.fields[0].fields[0];
|
|
59
|
+
valueText = "from field";
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
case /* OptionKey */ 2: {
|
|
63
|
+
const g_1: string = matchValue.fields[0].fields[0];
|
|
64
|
+
valueText = "option";
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
default: {
|
|
68
|
+
const v: string = matchValue.fields[0];
|
|
69
|
+
valueText = (isNullOrWhiteSpace(v) ? "(empty)" : v);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return toText(printf("Set Field: %s = %s"))(shortGuid)(valueText);
|
|
73
|
+
}
|
|
74
|
+
default: {
|
|
75
|
+
const m: ClinicalPathway_MedicationAction = action.fields[0];
|
|
76
|
+
return toText(printf("Rx: %s"))(m.Name);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function extractActionDetails(action: ClinicalPathway_ActionInfo_$union): string {
|
|
82
|
+
switch (action.tag) {
|
|
83
|
+
case /* Procedure */ 4:
|
|
84
|
+
return action.fields[0].Name;
|
|
85
|
+
case /* Education */ 3:
|
|
86
|
+
return join("; ", action.fields[0].Topics);
|
|
87
|
+
case /* Test */ 1: {
|
|
88
|
+
const t: ClinicalPathway_TestAction = action.fields[0];
|
|
89
|
+
return toText(printf("Test: %s"))(t.TestName);
|
|
90
|
+
}
|
|
91
|
+
case /* Referral */ 2: {
|
|
92
|
+
const r: ClinicalPathway_ReferralAction = action.fields[0];
|
|
93
|
+
return toText(printf("Refer to %s (%s)"))(r.Target)(r.Reason);
|
|
94
|
+
}
|
|
95
|
+
case /* Documentation */ 5: {
|
|
96
|
+
const d: ClinicalPathway_DocumentationAction = action.fields[0];
|
|
97
|
+
return toText(printf("Document: %s"))(d.FormName);
|
|
98
|
+
}
|
|
99
|
+
case /* Task */ 6: {
|
|
100
|
+
const t_1: ClinicalPathway_TaskAction = action.fields[0];
|
|
101
|
+
return toText(printf("Task: %s"))(t_1.Description);
|
|
102
|
+
}
|
|
103
|
+
case /* Alert */ 7: {
|
|
104
|
+
const a: ClinicalPathway_AlertAction = action.fields[0];
|
|
105
|
+
return toText(printf("Alert: %s"))(a.Message);
|
|
106
|
+
}
|
|
107
|
+
case /* Problem */ 8: {
|
|
108
|
+
const p_1: ClinicalPathway_ProblemAction = action.fields[0];
|
|
109
|
+
return toText(printf("Problem: %s"))(p_1.ProblemName);
|
|
110
|
+
}
|
|
111
|
+
case /* Prescription */ 9: {
|
|
112
|
+
const p_2: ClinicalPathway_PrescriptionAction = action.fields[0];
|
|
113
|
+
return toText(printf("Prescription: %s"))(p_2.Medication);
|
|
114
|
+
}
|
|
115
|
+
case /* NavigateToForm */ 11: {
|
|
116
|
+
const n: ClinicalPathway_NavigateToFormAction = action.fields[0];
|
|
117
|
+
return toText(printf("Navigate to: %s"))(n.FormId);
|
|
118
|
+
}
|
|
119
|
+
case /* SetFieldValue */ 10: {
|
|
120
|
+
const s: ClinicalPathway_SetFieldValueAction = action.fields[0];
|
|
121
|
+
const guid: string = s.TargetField.fields[0];
|
|
122
|
+
let valueText: string;
|
|
123
|
+
const matchValue: ClinicalPathway_FieldValueSource_$union = s.Value;
|
|
124
|
+
switch (matchValue.tag) {
|
|
125
|
+
case /* FieldReference */ 1: {
|
|
126
|
+
valueText = (`from ${matchValue.fields[0].fields[0]}`);
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
case /* OptionKey */ 2: {
|
|
130
|
+
valueText = (`option ${matchValue.fields[0].fields[0]}`);
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
default: {
|
|
134
|
+
const v: string = matchValue.fields[0];
|
|
135
|
+
valueText = (isNullOrWhiteSpace(v) ? "(empty)" : v);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return toText(printf("Set Field %s = %s"))(guid)(valueText);
|
|
139
|
+
}
|
|
140
|
+
default: {
|
|
141
|
+
const m: ClinicalPathway_MedicationAction = action.fields[0];
|
|
142
|
+
return toText(printf("%s %s %s %s"))(m.Name)(m.Dose)(m.Route)(m.Frequency);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export function extractActionType(action: ClinicalPathway_ActionInfo_$union): string {
|
|
148
|
+
switch (action.tag) {
|
|
149
|
+
case /* Procedure */ 4:
|
|
150
|
+
return "Procedure";
|
|
151
|
+
case /* Education */ 3:
|
|
152
|
+
return "Education";
|
|
153
|
+
case /* Test */ 1:
|
|
154
|
+
return "Test";
|
|
155
|
+
case /* Referral */ 2:
|
|
156
|
+
return "Referral";
|
|
157
|
+
case /* Documentation */ 5:
|
|
158
|
+
return "Documentation";
|
|
159
|
+
case /* Task */ 6:
|
|
160
|
+
return "Task";
|
|
161
|
+
case /* Alert */ 7:
|
|
162
|
+
return "Alert";
|
|
163
|
+
case /* Problem */ 8:
|
|
164
|
+
return "Problem";
|
|
165
|
+
case /* Prescription */ 9:
|
|
166
|
+
return "Prescription";
|
|
167
|
+
case /* SetFieldValue */ 10:
|
|
168
|
+
return "SetFieldValue";
|
|
169
|
+
case /* NavigateToForm */ 11:
|
|
170
|
+
return "NavigateToForm";
|
|
171
|
+
default:
|
|
172
|
+
return "Medication";
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export function extractDecisionDetails(decision: ClinicalPathway_DecisionInfo): [string, FSharpList<string>] {
|
|
177
|
+
return [decision.Question, filter<string>((opt: string): boolean => {
|
|
178
|
+
if ((opt !== "Yes") && (opt !== "No")) {
|
|
179
|
+
return opt !== "None of the above";
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
}, decision.Options)] as [string, FSharpList<string>];
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export function extractEvaluationDetails(evaluation: ClinicalPathway_EvaluationInfo): [string, FSharpList<string>] {
|
|
188
|
+
let matchValue: Option<FSharpList<string>>;
|
|
189
|
+
return [evaluation.EvaluationName, (matchValue = evaluation.CriticalFindings, (matchValue == null) ? empty<string>() : value(matchValue))] as [string, FSharpList<string>];
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export function extractEvaluationName(evaluation: ClinicalPathway_EvaluationInfo): string {
|
|
193
|
+
return evaluation.EvaluationName;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export function stateTypeToString(stateType: ClinicalPathway_StateType_$union): string {
|
|
197
|
+
switch (stateType.tag) {
|
|
198
|
+
case /* Decision */ 1:
|
|
199
|
+
return "Decision";
|
|
200
|
+
case /* Action */ 2:
|
|
201
|
+
return "Action";
|
|
202
|
+
case /* CompoundAction */ 3:
|
|
203
|
+
return "CompoundAction";
|
|
204
|
+
case /* ConditionalAction */ 4:
|
|
205
|
+
return "ConditionalAction";
|
|
206
|
+
case /* Terminal */ 5:
|
|
207
|
+
return "Terminal";
|
|
208
|
+
default:
|
|
209
|
+
return "Evaluation";
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export function isTerminalState(stateType: ClinicalPathway_StateType_$union): boolean {
|
|
214
|
+
if (stateType.tag === /* Terminal */ 5) {
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export function extractCompoundActionTexts(actions: FSharpList<ClinicalPathway_ActionInfo_$union>): FSharpList<string> {
|
|
223
|
+
return map<ClinicalPathway_ActionInfo_$union, string>(extractActionText, actions);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export function extractCompoundActionDetails(actions: FSharpList<ClinicalPathway_ActionInfo_$union>): FSharpList<string> {
|
|
227
|
+
return map<ClinicalPathway_ActionInfo_$union, string>(extractActionDetails, actions);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export function sanitizeMermaidId(id: string): string {
|
|
231
|
+
return replace(replace(replace(id, "-", "_"), " ", "_"), ".", "_");
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export function sanitizeMermaidText(text: string): string {
|
|
235
|
+
return replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(text, "\"", "\'"), "(", "-"), ")", "-"), "{", "-"), "}", "-"), "<", "-"), ">", "-"), "|", "/"), "`", "\'"), "\n", " "), "\r", " "), " ", " ");
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export function wrapTextForReactFlow(text: string, maxWidth: int32): string {
|
|
239
|
+
if (text.length <= maxWidth) {
|
|
240
|
+
return text;
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
const words: string[] = map_1<string, string>((word: string): string => {
|
|
244
|
+
if (text.indexOf(`${word} =`) >= 0) {
|
|
245
|
+
return `${word} =`;
|
|
246
|
+
}
|
|
247
|
+
else if (text.indexOf(`${word},`) >= 0) {
|
|
248
|
+
return `${word},`;
|
|
249
|
+
}
|
|
250
|
+
else if (text.indexOf(`${word};`) >= 0) {
|
|
251
|
+
return `${word};`;
|
|
252
|
+
}
|
|
253
|
+
else if (text.indexOf(`${word}:`) >= 0) {
|
|
254
|
+
return `${word}:`;
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
return word;
|
|
258
|
+
}
|
|
259
|
+
}, split(text, [" ", ",", ";", "=", ":"], undefined, 1));
|
|
260
|
+
let lines: FSharpList<string> = empty<string>();
|
|
261
|
+
let currentLine = "";
|
|
262
|
+
for (let idx = 0; idx <= (words.length - 1); idx++) {
|
|
263
|
+
const word_1: string = item(idx, words);
|
|
264
|
+
if (currentLine === "") {
|
|
265
|
+
currentLine = word_1;
|
|
266
|
+
}
|
|
267
|
+
else if (((currentLine + " ") + word_1).length <= maxWidth) {
|
|
268
|
+
currentLine = ((currentLine + " ") + word_1);
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
lines = append(lines, singleton(currentLine));
|
|
272
|
+
currentLine = word_1;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
if (currentLine !== "") {
|
|
276
|
+
lines = append(lines, singleton(currentLine));
|
|
277
|
+
}
|
|
278
|
+
return join("\n", lines);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export function extractStateKeyString(stateKey: Shared_StateKey): string {
|
|
283
|
+
return stateKey.fields[0];
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export function getTerminalOutcome(terminal: ClinicalPathway_TerminalInfo): string {
|
|
287
|
+
return terminal.Outcome;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
//# sourceMappingURL=PathwayDataExtractor.ts.map
|