@f1studio/form-spec 5.0.0-alpha.168 → 5.0.0-alpha.169
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/BlueprintValidation.d.ts +6 -3
- package/FormSpec.FS/BlueprintValidation.d.ts.map +1 -1
- package/FormSpec.FS/BlueprintValidation.js +39 -15
- package/FormSpec.FS/BlueprintValidation.js.map +1 -1
- package/FormSpec.FS/Designer.d.ts.map +1 -1
- package/FormSpec.FS/Designer.js +1 -1
- package/FormSpec.FS/Designer.js.map +1 -1
- package/FormSpec.FS/FormSpec.d.ts +108 -58
- package/FormSpec.FS/FormSpec.d.ts.map +1 -1
- package/FormSpec.FS/FormSpec.js +319 -129
- package/FormSpec.FS/FormSpec.js.map +1 -1
- package/FormSpec.FS/FormSpecHelpers.d.ts.map +1 -1
- package/FormSpec.FS/FormSpecHelpers.js +1 -1
- package/FormSpec.FS/FormSpecHelpers.js.map +1 -1
- package/FormSpec.FS/FormSpecValues.d.ts.map +1 -1
- package/FormSpec.FS/FormSpecValues.js +5 -2
- package/FormSpec.FS/FormSpecValues.js.map +1 -1
- package/FormSpec.FS/Helpers.d.ts.map +1 -1
- package/FormSpec.FS/Helpers.js +14 -9
- package/FormSpec.FS/Helpers.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.js +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.d.ts +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.js +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.d.ts +3 -3
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.js +7 -5
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.js +11 -10
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.js +1 -9
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.d.ts +11 -4
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.js +30 -28
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.d.ts +3 -9
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js +4 -31
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js +2 -6
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImportPipeline.d.ts +45 -0
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImportPipeline.d.ts.map +1 -0
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImportPipeline.js +141 -0
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImportPipeline.js.map +1 -0
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImporterAnalysis.d.ts +326 -0
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImporterAnalysis.d.ts.map +1 -0
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImporterAnalysis.js +1743 -0
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImporterAnalysis.js.map +1 -0
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.d.ts +8 -8
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js +6 -6
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRTriggerEnrichment.d.ts +21 -15
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRTriggerEnrichment.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRTriggerEnrichment.js +83 -80
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRTriggerEnrichment.js.map +1 -1
- package/FormSpec.FS/Integrations/CorEMR/CoreMRPathwayMapper.d.ts +51 -0
- package/FormSpec.FS/Integrations/CorEMR/CoreMRPathwayMapper.d.ts.map +1 -0
- package/FormSpec.FS/Integrations/CorEMR/CoreMRPathwayMapper.js +939 -0
- package/FormSpec.FS/Integrations/CorEMR/CoreMRPathwayMapper.js.map +1 -0
- package/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.d.ts +2 -17
- package/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.js +1 -66
- package/FormSpec.FS/Integrations/CorEMR/{TemplateManifestDecoder.d.ts → FormTemplateDecoder.d.ts} +53 -45
- package/FormSpec.FS/Integrations/CorEMR/FormTemplateDecoder.d.ts.map +1 -0
- package/FormSpec.FS/Integrations/CorEMR/{TemplateManifestDecoder.js → FormTemplateDecoder.js} +544 -254
- package/FormSpec.FS/Integrations/CorEMR/FormTemplateDecoder.js.map +1 -0
- package/FormSpec.FS/Integrations/CorEMR/FormTemplateDomainDecoder.d.ts +7 -0
- package/FormSpec.FS/Integrations/CorEMR/FormTemplateDomainDecoder.d.ts.map +1 -0
- package/FormSpec.FS/Integrations/CorEMR/FormTemplateDomainDecoder.js +280 -0
- package/FormSpec.FS/Integrations/CorEMR/FormTemplateDomainDecoder.js.map +1 -0
- package/FormSpec.FS/Interop/FormSpec.Api.Helpers.d.ts +16 -4
- package/FormSpec.FS/Interop/FormSpec.Api.Helpers.d.ts.map +1 -1
- package/FormSpec.FS/Interop/FormSpec.Api.Helpers.js +63 -18
- package/FormSpec.FS/Interop/FormSpec.Api.Helpers.js.map +1 -1
- package/FormSpec.FS/Interop/FormSpec.Api.Option.d.ts +4 -4
- package/FormSpec.FS/Interop/FormSpec.Api.Option.d.ts.map +1 -1
- package/FormSpec.FS/Interop/FormSpec.Api.Option.js +2 -2
- package/FormSpec.FS/Interop/FormSpec.Api.Option.js.map +1 -1
- package/FormSpec.FS/PathwayDataExtractor.d.ts.map +1 -1
- package/FormSpec.FS/PathwayDataExtractor.js +39 -18
- package/FormSpec.FS/PathwayDataExtractor.js.map +1 -1
- package/FormSpec.FS/PathwayExecutor.d.ts +10 -10
- package/FormSpec.FS/PathwayExecutor.d.ts.map +1 -1
- package/FormSpec.FS/PathwayExecutor.js +14 -14
- package/FormSpec.FS/PathwayExecutor.js.map +1 -1
- package/FormSpec.FS/PathwayValidator.d.ts.map +1 -1
- package/FormSpec.FS/PathwayValidator.js +8 -5
- package/FormSpec.FS/PathwayValidator.js.map +1 -1
- package/FormSpec.FS/Renderers/FormSpecMarkdownRenderer.d.ts.map +1 -1
- package/FormSpec.FS/Renderers/FormSpecMarkdownRenderer.js +16 -7
- package/FormSpec.FS/Renderers/FormSpecMarkdownRenderer.js.map +1 -1
- package/FormSpec.FS/Renderers/MermaidRenderer.d.ts.map +1 -1
- package/FormSpec.FS/Renderers/MermaidRenderer.js +4 -8
- package/FormSpec.FS/Renderers/MermaidRenderer.js.map +1 -1
- package/FormSpec.FS/Renderers/PathwayRenderers.d.ts.map +1 -1
- package/FormSpec.FS/Renderers/PathwayRenderers.js +5 -4
- package/FormSpec.FS/Renderers/PathwayRenderers.js.map +1 -1
- package/FormSpec.FS/TriggerActionDto.d.ts +32 -21
- package/FormSpec.FS/TriggerActionDto.d.ts.map +1 -1
- package/FormSpec.FS/TriggerActionDto.js +247 -61
- package/FormSpec.FS/TriggerActionDto.js.map +1 -1
- package/README.md +7 -7
- package/Thoth.Json/packages/Thoth.Json/Encode.js.map +1 -1
- package/package.json +1 -1
- package/plugins/allergyfinder/src/AllergyFinderField.d.ts.map +1 -1
- package/plugins/allergyfinder/src/AllergyFinderField.js +2 -2
- package/plugins/allergyfinder/src/AllergyFinderField.js.map +1 -1
- package/plugins/bmi/src/BMIField.d.ts.map +1 -1
- package/plugins/bmi/src/BMIField.js +21 -15
- package/plugins/bmi/src/BMIField.js.map +1 -1
- package/plugins/demographics/src/DemographicsField.d.ts.map +1 -1
- package/plugins/demographics/src/DemographicsField.js +4 -4
- package/plugins/demographics/src/DemographicsField.js.map +1 -1
- package/plugins/likert/src/LikertField.d.ts.map +1 -1
- package/plugins/likert/src/LikertField.js +40 -35
- package/plugins/likert/src/LikertField.js.map +1 -1
- package/plugins/signature/src/SignatureField.d.ts.map +1 -1
- package/plugins/signature/src/SignatureField.js +4 -3
- package/plugins/signature/src/SignatureField.js.map +1 -1
- package/plugins/vitals/src/VitalsField.d.ts.map +1 -1
- package/plugins/vitals/src/VitalsField.js +4 -4
- package/plugins/vitals/src/VitalsField.js.map +1 -1
- package/src/FormSpec.FS/BlueprintValidation.ts +55 -24
- package/src/FormSpec.FS/Designer.ts +2 -2
- package/src/FormSpec.FS/FormSpec.ts +223 -100
- package/src/FormSpec.FS/FormSpecHelpers.ts +2 -2
- package/src/FormSpec.FS/FormSpecValues.ts +6 -3
- package/src/FormSpec.FS/Helpers.ts +16 -11
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.ts +2 -2
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.ts +3 -3
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.ts +10 -8
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.ts +6 -5
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.ts +1 -10
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.ts +35 -30
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts +7 -26
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts +2 -6
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImportPipeline.ts +115 -0
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImporterAnalysis.ts +1059 -0
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts +10 -10
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRTriggerEnrichment.ts +61 -88
- package/src/FormSpec.FS/Integrations/CorEMR/CoreMRPathwayMapper.ts +926 -0
- package/src/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.ts +3 -37
- package/src/FormSpec.FS/Integrations/CorEMR/FormTemplateDecoder.ts +1284 -0
- package/src/FormSpec.FS/Integrations/CorEMR/FormTemplateDomainDecoder.ts +287 -0
- package/src/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts +76 -25
- package/src/FormSpec.FS/Interop/FormSpec.Api.Option.ts +6 -6
- package/src/FormSpec.FS/PathwayDataExtractor.ts +40 -20
- package/src/FormSpec.FS/PathwayExecutor.ts +26 -26
- package/src/FormSpec.FS/PathwayValidator.ts +8 -5
- package/src/FormSpec.FS/Renderers/FormSpecMarkdownRenderer.ts +18 -8
- package/src/FormSpec.FS/Renderers/MermaidRenderer.ts +6 -10
- package/src/FormSpec.FS/Renderers/PathwayRenderers.ts +5 -5
- package/src/FormSpec.FS/TriggerActionDto.ts +247 -74
- package/src/plugins/allergyfinder/src/AllergyFinderField.ts +3 -3
- package/src/plugins/bmi/src/BMIField.ts +12 -5
- package/src/plugins/demographics/src/DemographicsField.ts +5 -5
- package/src/plugins/likert/src/LikertField.ts +16 -11
- package/src/plugins/signature/src/SignatureField.ts +4 -3
- package/src/plugins/vitals/src/VitalsField.ts +5 -5
- package/src/vye-os-contracts-fs/src/CoreMR/FormTemplate.ts +715 -0
- package/vye-os-contracts-fs/src/CoreMR/FormTemplate.d.ts +310 -0
- package/vye-os-contracts-fs/src/CoreMR/FormTemplate.d.ts.map +1 -0
- package/vye-os-contracts-fs/src/CoreMR/FormTemplate.js +1242 -0
- package/vye-os-contracts-fs/src/CoreMR/FormTemplate.js.map +1 -0
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.d.ts +0 -69
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.d.ts.map +0 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.js +0 -447
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.js.map +0 -1
- package/FormSpec.FS/Integrations/CorEMR/ItemTriggerConverter.d.ts +0 -19
- package/FormSpec.FS/Integrations/CorEMR/ItemTriggerConverter.d.ts.map +0 -1
- package/FormSpec.FS/Integrations/CorEMR/ItemTriggerConverter.js +0 -643
- package/FormSpec.FS/Integrations/CorEMR/ItemTriggerConverter.js.map +0 -1
- package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.d.ts.map +0 -1
- package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.js.map +0 -1
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.ts +0 -412
- package/src/FormSpec.FS/Integrations/CorEMR/ItemTriggerConverter.ts +0 -588
- package/src/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.ts +0 -1054
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { value as value_1, Option, defaultArg } from "@fable-org/fable-library-js/Option.js";
|
|
2
2
|
import { split, replace, join, isNullOrWhiteSpace, substring, printf, toText } from "@fable-org/fable-library-js/String.js";
|
|
3
|
-
import {
|
|
4
|
-
import { singleton, append,
|
|
3
|
+
import { ClinicalPathway_TerminalInfo, Shared_StateKey, ClinicalPathway_StateType_$union, ClinicalPathway_EvaluationInfo, ClinicalPathway_TreatmentAction, ClinicalPathway_ActionInfo_$union, ClinicalPathway_MedicationAction, ClinicalPathway_GroupRef, ClinicalPathway_GroupChangeAction, ClinicalPathway_FieldValueSource_$union, ClinicalPathway_SetFieldValueAction, ClinicalPathway_NavigateToFormAction, ClinicalPathway_PrescriptionAction, ClinicalPathway_AlertAction, ClinicalPathway_TaskAction, ClinicalPathway_DocumentationAction, ClinicalPathway_ReferralAction, ClinicalPathway_TestAction, ClinicalPathway_EducationAction, ClinicalPathway_ProcedureAction, ClinicalPathway_MedsetAction } from "./FormSpec.js";
|
|
4
|
+
import { singleton, append, FSharpList, empty, map } from "@fable-org/fable-library-js/List.js";
|
|
5
|
+
import { int32ToString } from "@fable-org/fable-library-js/Util.js";
|
|
5
6
|
import { item, map as map_1 } from "@fable-org/fable-library-js/Array.js";
|
|
6
7
|
import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
7
8
|
|
|
9
|
+
function stated(o: Option<string>): string {
|
|
10
|
+
return defaultArg<string>(o, "(none stated)");
|
|
11
|
+
}
|
|
12
|
+
|
|
8
13
|
export function extractActionText(action: ClinicalPathway_ActionInfo_$union): string {
|
|
9
14
|
switch (action.tag) {
|
|
10
15
|
case /* Treatment */ 1: {
|
|
11
|
-
const
|
|
12
|
-
return toText(printf("Treatment: %s"))(
|
|
16
|
+
const arg_1: string = stated(action.fields[0].Name);
|
|
17
|
+
return toText(printf("Treatment: %s"))(arg_1);
|
|
13
18
|
}
|
|
14
19
|
case /* Medset */ 2: {
|
|
15
20
|
const m_1: ClinicalPathway_MedsetAction = action.fields[0];
|
|
@@ -37,15 +42,16 @@ export function extractActionText(action: ClinicalPathway_ActionInfo_$union): st
|
|
|
37
42
|
}
|
|
38
43
|
case /* Task */ 8: {
|
|
39
44
|
const t_2: ClinicalPathway_TaskAction = action.fields[0];
|
|
40
|
-
|
|
45
|
+
const arg_7: string = defaultArg<string>(t_2.Description, t_2.Category);
|
|
46
|
+
return toText(printf("Task: %s"))(arg_7);
|
|
41
47
|
}
|
|
42
48
|
case /* Alert */ 9: {
|
|
43
49
|
const a: ClinicalPathway_AlertAction = action.fields[0];
|
|
44
50
|
return toText(printf("Alert: %s"))(a.Message);
|
|
45
51
|
}
|
|
46
52
|
case /* Problem */ 10: {
|
|
47
|
-
const
|
|
48
|
-
return toText(printf("Problem: %s"))(
|
|
53
|
+
const arg_9: string = stated(action.fields[0].ProblemName);
|
|
54
|
+
return toText(printf("Problem: %s"))(arg_9);
|
|
49
55
|
}
|
|
50
56
|
case /* Prescription */ 11: {
|
|
51
57
|
const p_2: ClinicalPathway_PrescriptionAction = action.fields[0];
|
|
@@ -79,6 +85,12 @@ export function extractActionText(action: ClinicalPathway_ActionInfo_$union): st
|
|
|
79
85
|
}
|
|
80
86
|
return toText(printf("Set Field: %s = %s"))(shortGuid)(valueText);
|
|
81
87
|
}
|
|
88
|
+
case /* ChangeGroups */ 14: {
|
|
89
|
+
const g_2: ClinicalPathway_GroupChangeAction = action.fields[0];
|
|
90
|
+
const verb: string = (g_2.Change.tag === /* RemoveFromGroups */ 1) ? "Remove from groups" : "Add to groups";
|
|
91
|
+
const arg_15: string = join(", ", map<ClinicalPathway_GroupRef, string>((r_1: ClinicalPathway_GroupRef): string => defaultArg<string>(r_1.Name, int32ToString(r_1.GroupId)), g_2.Groups));
|
|
92
|
+
return toText(printf("%s: %s"))(verb)(arg_15);
|
|
93
|
+
}
|
|
82
94
|
default: {
|
|
83
95
|
const m: ClinicalPathway_MedicationAction = action.fields[0];
|
|
84
96
|
return toText(printf("Rx: %s"))(m.Name);
|
|
@@ -90,8 +102,9 @@ export function extractActionDetails(action: ClinicalPathway_ActionInfo_$union):
|
|
|
90
102
|
switch (action.tag) {
|
|
91
103
|
case /* Treatment */ 1: {
|
|
92
104
|
const t: ClinicalPathway_TreatmentAction = action.fields[0];
|
|
105
|
+
const arg_4: string = stated(t.Name);
|
|
93
106
|
const arg_5: string = defaultArg(t.Signature, "");
|
|
94
|
-
return toText(printf("Treatment: %s (%s)"))(
|
|
107
|
+
return toText(printf("Treatment: %s (%s)"))(arg_4)(arg_5);
|
|
95
108
|
}
|
|
96
109
|
case /* Medset */ 2: {
|
|
97
110
|
const m_1: ClinicalPathway_MedsetAction = action.fields[0];
|
|
@@ -115,15 +128,16 @@ export function extractActionDetails(action: ClinicalPathway_ActionInfo_$union):
|
|
|
115
128
|
}
|
|
116
129
|
case /* Task */ 8: {
|
|
117
130
|
const t_2: ClinicalPathway_TaskAction = action.fields[0];
|
|
118
|
-
|
|
131
|
+
const arg_11: string = defaultArg<string>(t_2.Description, t_2.Category);
|
|
132
|
+
return toText(printf("Task: %s"))(arg_11);
|
|
119
133
|
}
|
|
120
134
|
case /* Alert */ 9: {
|
|
121
135
|
const a: ClinicalPathway_AlertAction = action.fields[0];
|
|
122
136
|
return toText(printf("Alert: %s"))(a.Message);
|
|
123
137
|
}
|
|
124
138
|
case /* Problem */ 10: {
|
|
125
|
-
const
|
|
126
|
-
return toText(printf("Problem: %s"))(
|
|
139
|
+
const arg_13: string = stated(action.fields[0].ProblemName);
|
|
140
|
+
return toText(printf("Problem: %s"))(arg_13);
|
|
127
141
|
}
|
|
128
142
|
case /* Prescription */ 11: {
|
|
129
143
|
const p_2: ClinicalPathway_PrescriptionAction = action.fields[0];
|
|
@@ -154,6 +168,12 @@ export function extractActionDetails(action: ClinicalPathway_ActionInfo_$union):
|
|
|
154
168
|
}
|
|
155
169
|
return toText(printf("Set Field %s = %s"))(guid)(valueText);
|
|
156
170
|
}
|
|
171
|
+
case /* ChangeGroups */ 14: {
|
|
172
|
+
const g_2: ClinicalPathway_GroupChangeAction = action.fields[0];
|
|
173
|
+
const verb: string = (g_2.Change.tag === /* RemoveFromGroups */ 1) ? "Remove from groups" : "Add to groups";
|
|
174
|
+
const arg_19: string = join(", ", map<ClinicalPathway_GroupRef, string>((r_1: ClinicalPathway_GroupRef): string => int32ToString(r_1.GroupId), g_2.Groups));
|
|
175
|
+
return toText(printf("%s: %s"))(verb)(arg_19);
|
|
176
|
+
}
|
|
157
177
|
default: {
|
|
158
178
|
const m: ClinicalPathway_MedicationAction = action.fields[0];
|
|
159
179
|
return toText(printf("%s %s %s %s"))(m.Name)(m.Dose)(m.Route)(m.Frequency);
|
|
@@ -189,6 +209,8 @@ export function extractActionType(action: ClinicalPathway_ActionInfo_$union): st
|
|
|
189
209
|
return "SetFieldValue";
|
|
190
210
|
case /* NavigateToForm */ 13:
|
|
191
211
|
return "NavigateToForm";
|
|
212
|
+
case /* ChangeGroups */ 14:
|
|
213
|
+
return "ChangeGroups";
|
|
192
214
|
default:
|
|
193
215
|
return "Medication";
|
|
194
216
|
}
|
|
@@ -205,23 +227,21 @@ export function extractEvaluationName(evaluation: ClinicalPathway_EvaluationInfo
|
|
|
205
227
|
|
|
206
228
|
export function stateTypeToString(stateType: ClinicalPathway_StateType_$union): string {
|
|
207
229
|
switch (stateType.tag) {
|
|
208
|
-
case /*
|
|
209
|
-
return "Evaluation";
|
|
210
|
-
case /* Action */ 2:
|
|
230
|
+
case /* Action */ 1:
|
|
211
231
|
return "Action";
|
|
212
|
-
case /* CompoundAction */
|
|
232
|
+
case /* CompoundAction */ 2:
|
|
213
233
|
return "CompoundAction";
|
|
214
|
-
case /* ConditionalAction */
|
|
234
|
+
case /* ConditionalAction */ 3:
|
|
215
235
|
return "ConditionalAction";
|
|
216
|
-
case /* Terminal */
|
|
236
|
+
case /* Terminal */ 4:
|
|
217
237
|
return "Terminal";
|
|
218
238
|
default:
|
|
219
|
-
|
|
239
|
+
return "Evaluation";
|
|
220
240
|
}
|
|
221
241
|
}
|
|
222
242
|
|
|
223
243
|
export function isTerminalState(stateType: ClinicalPathway_StateType_$union): boolean {
|
|
224
|
-
if (stateType.tag === /* Terminal */
|
|
244
|
+
if (stateType.tag === /* Terminal */ 4) {
|
|
225
245
|
return true;
|
|
226
246
|
}
|
|
227
247
|
else {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FSharpRef, Record, Union } from "@fable-org/fable-library-js/Types.js";
|
|
2
|
-
import { fold, findIndex, tryPick, sortByDescending, truncate, length, sortBy, tryHead, filter as filter_1, ofArray as ofArray_1, append, empty, head, tail, concat, exists, singleton, forAll,
|
|
2
|
+
import { fold, findIndex, tryPick, sortByDescending, truncate, length, sortBy, tryHead, filter as filter_1, ofArray as ofArray_1, append, empty, head, tail, concat, exists, singleton, forAll, map as map_1, collect, sumBy, sum, isEmpty, choose, tryFind, FSharpList } from "@fable-org/fable-library-js/List.js";
|
|
3
3
|
import { tuple_type, bool_type, float64_type, lambda_type, class_type, record_type, int32_type, union_type, list_type, string_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
4
|
-
import { ClinicalPathway_PathwayExecutionMode_$reflection, ClinicalPathway_SetFieldValueAction, ClinicalPathway_FieldValueSource_$union, ClinicalPathway_PathwayExecutionMode_$union, ClinicalPathway_SelectionStrategy_$union, ClinicalPathway_CombinationStrategy_$union, ClinicalPathway_StateType_$union, ClinicalPathway_StateDefinition, Shared_PluginPropertyKey, Shared_FieldOptionKey, ClinicalPathway_TransitionCondition_$union, ClinicalPathway_LogicalOp_$union, ClinicalPathway_StateEvaluator_$union, Shared_FieldValue_Single, Shared_ConditionValue_$union, Shared_MatrixAnswer, ClinicalPathway_FieldEvaluator_$union, Shared_PluginDataProperty, Shared_PluginDataProperty_$reflection, Spec_Score, Spec_ScoreRange, Spec_FormStep$1, Spec_FormField$1, Shared_FieldValue_$union, Shared_MatrixItemKey, Shared_FieldAnswer, Shared_FieldOption, Spec_FieldType, Shared_TransitionKey_$reflection, Shared_TransitionKey, Shared_FieldKey_$reflection,
|
|
4
|
+
import { ClinicalPathway_PathwayExecutionMode_$reflection, ClinicalPathway_ActionInfo_$union, ClinicalPathway_SetFieldValueAction, Spec_Label_shown, ClinicalPathway_FieldValueSource_$union, ClinicalPathway_PathwayExecutionMode_$union, ClinicalPathway_SelectionStrategy_$union, ClinicalPathway_CombinationStrategy_$union, ClinicalPathway_StateType_$union, ClinicalPathway_StateDefinition, Shared_PluginPropertyKey, Shared_FieldOptionKey, ClinicalPathway_TransitionCondition_$union, ClinicalPathway_LogicalOp_$union, ClinicalPathway_StateEvaluator_$union, Shared_FieldValue_Single, Shared_ConditionValue_$union, Shared_MatrixAnswer, ClinicalPathway_FieldEvaluator_$union, Shared_PluginDataProperty, Shared_PluginDataProperty_$reflection, Spec_Score, Spec_ScoreRange, Spec_FormStep$1, Spec_FormField$1, Shared_FieldValue_$union, Shared_MatrixItemKey, Shared_FieldAnswer, Shared_FieldOption, Spec_FieldType, Shared_TransitionKey_$reflection, Shared_TransitionKey, Shared_FieldKey_$reflection, ClinicalPathway_PathwayAction_$reflection, Spec_FormSpec$1_$reflection, Spec_FieldType_$reflection, ClinicalPathway_ClinicalPathwaySpec_$reflection, Shared_FieldKey, ClinicalPathway_PathwayAction, Spec_FieldType_$union, Spec_FormSpec$1, ClinicalPathway_ClinicalPathwaySpec, Shared_StateKey_$reflection, Shared_StateKey, ClinicalPathway_TransitionDefinition_$reflection, ClinicalPathway_TransitionDefinition } from "./FormSpec.js";
|
|
5
5
|
import { tryParse as tryParse_1, float64, int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
6
6
|
import { int32ToString, equals, compare, comparePrimitives, IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
|
|
7
7
|
import { difference, union, empty as empty_1, FSharpSet__get_IsEmpty, FSharpSet__get_Count, contains, isSubset, ofArray, FSharpSet__Contains, ofList as ofList_1, map as map_2, toList, FSharpSet } from "@fable-org/fable-library-js/Set.js";
|
|
@@ -95,10 +95,10 @@ export class ExecutionContext extends Record {
|
|
|
95
95
|
readonly CompletedStates: FSharpSet<Shared_StateKey>;
|
|
96
96
|
readonly ActiveTransitions: FSharpList<MatchedTransition>;
|
|
97
97
|
readonly PendingTransitions: FSharpList<MatchedTransition>;
|
|
98
|
-
readonly ExecutedActions: FSharpList<
|
|
98
|
+
readonly ExecutedActions: FSharpList<ClinicalPathway_PathwayAction>;
|
|
99
99
|
readonly FieldResolver: ((arg0: string) => Shared_FieldKey);
|
|
100
100
|
readonly ExecutionLog: FSharpList<ExecutionLogEntry>;
|
|
101
|
-
constructor(PathwaySpec: ClinicalPathway_ClinicalPathwaySpec, FormSpec: Spec_FormSpec$1<Spec_FieldType_$union>, CurrentStates: FSharpSet<Shared_StateKey>, VisitedStates: FSharpSet<Shared_StateKey>, CompletedStates: FSharpSet<Shared_StateKey>, ActiveTransitions: FSharpList<MatchedTransition>, PendingTransitions: FSharpList<MatchedTransition>, ExecutedActions: FSharpList<
|
|
101
|
+
constructor(PathwaySpec: ClinicalPathway_ClinicalPathwaySpec, FormSpec: Spec_FormSpec$1<Spec_FieldType_$union>, CurrentStates: FSharpSet<Shared_StateKey>, VisitedStates: FSharpSet<Shared_StateKey>, CompletedStates: FSharpSet<Shared_StateKey>, ActiveTransitions: FSharpList<MatchedTransition>, PendingTransitions: FSharpList<MatchedTransition>, ExecutedActions: FSharpList<ClinicalPathway_PathwayAction>, FieldResolver: ((arg0: string) => Shared_FieldKey), ExecutionLog: FSharpList<ExecutionLogEntry>) {
|
|
102
102
|
super();
|
|
103
103
|
this.PathwaySpec = PathwaySpec;
|
|
104
104
|
this.FormSpec = FormSpec;
|
|
@@ -114,16 +114,16 @@ export class ExecutionContext extends Record {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
export function ExecutionContext_$reflection(): TypeInfo {
|
|
117
|
-
return record_type("F1.Studio.PathwayExecutor.ExecutionContext", [], ExecutionContext, () => [["PathwaySpec", ClinicalPathway_ClinicalPathwaySpec_$reflection()], ["FormSpec", Spec_FormSpec$1_$reflection(Spec_FieldType_$reflection())], ["CurrentStates", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [Shared_StateKey_$reflection()])], ["VisitedStates", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [Shared_StateKey_$reflection()])], ["CompletedStates", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [Shared_StateKey_$reflection()])], ["ActiveTransitions", list_type(MatchedTransition_$reflection())], ["PendingTransitions", list_type(MatchedTransition_$reflection())], ["ExecutedActions", list_type(
|
|
117
|
+
return record_type("F1.Studio.PathwayExecutor.ExecutionContext", [], ExecutionContext, () => [["PathwaySpec", ClinicalPathway_ClinicalPathwaySpec_$reflection()], ["FormSpec", Spec_FormSpec$1_$reflection(Spec_FieldType_$reflection())], ["CurrentStates", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [Shared_StateKey_$reflection()])], ["VisitedStates", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [Shared_StateKey_$reflection()])], ["CompletedStates", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [Shared_StateKey_$reflection()])], ["ActiveTransitions", list_type(MatchedTransition_$reflection())], ["PendingTransitions", list_type(MatchedTransition_$reflection())], ["ExecutedActions", list_type(ClinicalPathway_PathwayAction_$reflection())], ["FieldResolver", lambda_type(string_type, Shared_FieldKey_$reflection())], ["ExecutionLog", list_type(ExecutionLogEntry_$reflection())]]);
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
export class PredictedPathway extends Record implements IEquatable<PredictedPathway>, IComparable<PredictedPathway> {
|
|
121
121
|
readonly PathwayId: string;
|
|
122
122
|
readonly Probability: float64;
|
|
123
123
|
readonly RequiredFields: FSharpList<string>;
|
|
124
|
-
readonly ExpectedActions: FSharpList<
|
|
124
|
+
readonly ExpectedActions: FSharpList<ClinicalPathway_PathwayAction>;
|
|
125
125
|
readonly TargetState: string;
|
|
126
|
-
constructor(PathwayId: string, Probability: float64, RequiredFields: FSharpList<string>, ExpectedActions: FSharpList<
|
|
126
|
+
constructor(PathwayId: string, Probability: float64, RequiredFields: FSharpList<string>, ExpectedActions: FSharpList<ClinicalPathway_PathwayAction>, TargetState: string) {
|
|
127
127
|
super();
|
|
128
128
|
this.PathwayId = PathwayId;
|
|
129
129
|
this.Probability = Probability;
|
|
@@ -134,7 +134,7 @@ export class PredictedPathway extends Record implements IEquatable<PredictedPath
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
export function PredictedPathway_$reflection(): TypeInfo {
|
|
137
|
-
return record_type("F1.Studio.PathwayExecutor.PredictedPathway", [], PredictedPathway, () => [["PathwayId", string_type], ["Probability", float64_type], ["RequiredFields", list_type(string_type)], ["ExpectedActions", list_type(
|
|
137
|
+
return record_type("F1.Studio.PathwayExecutor.PredictedPathway", [], PredictedPathway, () => [["PathwayId", string_type], ["Probability", float64_type], ["RequiredFields", list_type(string_type)], ["ExpectedActions", list_type(ClinicalPathway_PathwayAction_$reflection())], ["TargetState", string_type]]);
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
export class IncrementalExecutionResult extends Record {
|
|
@@ -161,10 +161,10 @@ export function IncrementalExecutionResult_$reflection(): TypeInfo {
|
|
|
161
161
|
|
|
162
162
|
export class ClinicalPlan extends Record implements IEquatable<ClinicalPlan>, IComparable<ClinicalPlan> {
|
|
163
163
|
readonly PlanId: string;
|
|
164
|
-
readonly Actions: FSharpList<
|
|
164
|
+
readonly Actions: FSharpList<ClinicalPathway_PathwayAction>;
|
|
165
165
|
readonly TargetState: string;
|
|
166
166
|
readonly Priority: int32;
|
|
167
|
-
constructor(PlanId: string, Actions: FSharpList<
|
|
167
|
+
constructor(PlanId: string, Actions: FSharpList<ClinicalPathway_PathwayAction>, TargetState: string, Priority: int32) {
|
|
168
168
|
super();
|
|
169
169
|
this.PlanId = PlanId;
|
|
170
170
|
this.Actions = Actions;
|
|
@@ -174,7 +174,7 @@ export class ClinicalPlan extends Record implements IEquatable<ClinicalPlan>, IC
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
export function ClinicalPlan_$reflection(): TypeInfo {
|
|
177
|
-
return record_type("F1.Studio.PathwayExecutor.ClinicalPlan", [], ClinicalPlan, () => [["PlanId", string_type], ["Actions", list_type(
|
|
177
|
+
return record_type("F1.Studio.PathwayExecutor.ClinicalPlan", [], ClinicalPlan, () => [["PlanId", string_type], ["Actions", list_type(ClinicalPathway_PathwayAction_$reflection())], ["TargetState", string_type], ["Priority", int32_type]]);
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
export class VisualizationState extends Record implements IEquatable<VisualizationState>, IComparable<VisualizationState> {
|
|
@@ -322,7 +322,7 @@ export function ScoreCalculator_getScoreRange(score: Option<Spec_Score>, value:
|
|
|
322
322
|
*/
|
|
323
323
|
export function FieldResolver_createResolver(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): ((arg0: string) => Shared_FieldKey) {
|
|
324
324
|
const formCode: string = defaultArg(map<string, string>(Helpers_canonicalizeFieldKey, formSpec.Code), "unknown");
|
|
325
|
-
const labelToFieldKey: FSharpMap<string, Shared_FieldKey> = ofList<string, Shared_FieldKey>(
|
|
325
|
+
const labelToFieldKey: FSharpMap<string, Shared_FieldKey> = ofList<string, Shared_FieldKey>(choose<Spec_FormField$1<Spec_FieldType_$union>, [string, Shared_FieldKey]>((field: Spec_FormField$1<Spec_FieldType_$union>): Option<[string, Shared_FieldKey]> => map<string, [string, Shared_FieldKey]>((label: string): [string, Shared_FieldKey] => ([label.toLocaleLowerCase().trim(), field.FieldKey] as [string, Shared_FieldKey]), field.Label), collect<Spec_FormStep$1<Spec_FieldType_$union>, Spec_FormField$1<Spec_FieldType_$union>>((step: Spec_FormStep$1<Spec_FieldType_$union>): FSharpList<Spec_FormField$1<Spec_FieldType_$union>> => step.Fields, formSpec.Steps)), {
|
|
326
326
|
Compare: comparePrimitives,
|
|
327
327
|
});
|
|
328
328
|
return (fieldReference: string): Shared_FieldKey => {
|
|
@@ -949,19 +949,19 @@ export function findState(stateKey: Shared_StateKey, states: FSharpList<Clinical
|
|
|
949
949
|
/**
|
|
950
950
|
* Extract actions from state
|
|
951
951
|
*/
|
|
952
|
-
export function extractActionsFromState(state: ClinicalPathway_StateDefinition): FSharpList<
|
|
952
|
+
export function extractActionsFromState(state: ClinicalPathway_StateDefinition): FSharpList<ClinicalPathway_PathwayAction> {
|
|
953
953
|
const matchValue: ClinicalPathway_StateType_$union = state.StateType;
|
|
954
954
|
switch (matchValue.tag) {
|
|
955
|
-
case /* Action */
|
|
955
|
+
case /* Action */ 1:
|
|
956
956
|
return singleton(matchValue.fields[0]);
|
|
957
|
-
case /* CompoundAction */
|
|
957
|
+
case /* CompoundAction */ 2:
|
|
958
958
|
return matchValue.fields[0];
|
|
959
|
-
case /* ConditionalAction */
|
|
959
|
+
case /* ConditionalAction */ 3: {
|
|
960
960
|
const condition: ClinicalPathway_TransitionCondition_$union = matchValue.fields[0];
|
|
961
|
-
return append(singleton(matchValue.fields[1]), ofArray_1(toArray<
|
|
961
|
+
return append(singleton(matchValue.fields[1]), ofArray_1(toArray<ClinicalPathway_PathwayAction>(matchValue.fields[2])));
|
|
962
962
|
}
|
|
963
963
|
default:
|
|
964
|
-
return empty<
|
|
964
|
+
return empty<ClinicalPathway_PathwayAction>();
|
|
965
965
|
}
|
|
966
966
|
}
|
|
967
967
|
|
|
@@ -969,7 +969,7 @@ export function extractActionsFromState(state: ClinicalPathway_StateDefinition):
|
|
|
969
969
|
* Check if a state is terminal
|
|
970
970
|
*/
|
|
971
971
|
export function isTerminalState(state: ClinicalPathway_StateDefinition): boolean {
|
|
972
|
-
if (state.StateType.tag === /* Terminal */
|
|
972
|
+
if (state.StateType.tag === /* Terminal */ 4) {
|
|
973
973
|
return true;
|
|
974
974
|
}
|
|
975
975
|
else {
|
|
@@ -1147,7 +1147,7 @@ export function initializeExecution(formSpec: Spec_FormSpec$1<Spec_FieldType_$un
|
|
|
1147
1147
|
Compare: compare,
|
|
1148
1148
|
}), empty_1<Shared_StateKey>({
|
|
1149
1149
|
Compare: compare,
|
|
1150
|
-
}), empty<MatchedTransition>(), empty<MatchedTransition>(), empty<
|
|
1150
|
+
}), empty<MatchedTransition>(), empty<MatchedTransition>(), empty<ClinicalPathway_PathwayAction>(), resolver, map_1<Shared_StateKey, ExecutionLogEntry>((stateKey: Shared_StateKey): ExecutionLogEntry => (new ExecutionLogEntry(now(), stateKey, "Initialized", "Starting state")), initialStates));
|
|
1151
1151
|
}
|
|
1152
1152
|
}
|
|
1153
1153
|
|
|
@@ -1194,7 +1194,7 @@ export function executeSetFieldValueAction(action: ClinicalPathway_SetFieldValue
|
|
|
1194
1194
|
}
|
|
1195
1195
|
else {
|
|
1196
1196
|
const step_2: Spec_FormStep$1<Spec_FieldType_$union> = value_4(stepOpt);
|
|
1197
|
-
return updateField<Spec_FieldType_$union>(formSpec, action.TargetField, Shared_FieldValue_Single(new Shared_FieldAnswer(action.TargetField, targetField.Label, valueToSet, undefined)), findIndex<Spec_FormStep$1<Spec_FieldType_$union>>((s: Spec_FormStep$1<Spec_FieldType_$union>): boolean => (s.StepOrder === step_2.StepOrder), formSpec.Steps));
|
|
1197
|
+
return updateField<Spec_FieldType_$union>(formSpec, action.TargetField, Shared_FieldValue_Single(new Shared_FieldAnswer(action.TargetField, Spec_Label_shown(targetField.Label), valueToSet, undefined)), findIndex<Spec_FormStep$1<Spec_FieldType_$union>>((s: Spec_FormStep$1<Spec_FieldType_$union>): boolean => (s.StepOrder === step_2.StepOrder), formSpec.Steps));
|
|
1198
1198
|
}
|
|
1199
1199
|
}
|
|
1200
1200
|
}
|
|
@@ -1241,8 +1241,8 @@ export function executeStep(context_mut: ExecutionContext, maxIterations_mut: in
|
|
|
1241
1241
|
const newStates: FSharpSet<Shared_StateKey> = ofList_1<Shared_StateKey>(map_1<MatchedTransition, Shared_StateKey>((t: MatchedTransition): Shared_StateKey => t.Transition.ToState, selectedTransitions), {
|
|
1242
1242
|
Compare: compare,
|
|
1243
1243
|
});
|
|
1244
|
-
const newActions: FSharpList<
|
|
1245
|
-
const updatedFormSpec: Spec_FormSpec$1<Spec_FieldType_$union> = executeActions(newActions, context.FormSpec);
|
|
1244
|
+
const newActions: FSharpList<ClinicalPathway_PathwayAction> = collect<ClinicalPathway_StateDefinition, ClinicalPathway_PathwayAction>(extractActionsFromState, choose<Shared_StateKey, ClinicalPathway_StateDefinition>((sk: Shared_StateKey): Option<ClinicalPathway_StateDefinition> => findState(sk, context.PathwaySpec.States), toList<Shared_StateKey>(newStates)));
|
|
1245
|
+
const updatedFormSpec: Spec_FormSpec$1<Spec_FieldType_$union> = executeActions(map_1<ClinicalPathway_PathwayAction, ClinicalPathway_ActionInfo_$union>((a: ClinicalPathway_PathwayAction): ClinicalPathway_ActionInfo_$union => a.Action, newActions), context.FormSpec);
|
|
1246
1246
|
const newLogEntries: FSharpList<ExecutionLogEntry> = map_1<MatchedTransition, ExecutionLogEntry>((t_1: MatchedTransition): ExecutionLogEntry => {
|
|
1247
1247
|
let arg: string, arg_1: string;
|
|
1248
1248
|
return new ExecutionLogEntry(now(), t_1.Transition.ToState, "Transitioned", (arg = t_1.Transition.FromState.fields[0], (arg_1 = t_1.Transition.TransitionKey.fields[0], toText(printf("From %s via %s"))(arg)(arg_1))));
|
|
@@ -1325,14 +1325,14 @@ export class PathwayExecutionResult$1<FieldType> extends Record implements IEqua
|
|
|
1325
1325
|
readonly ExecutionMode: ClinicalPathway_PathwayExecutionMode_$union;
|
|
1326
1326
|
readonly SelectedPaths: FSharpList<string>;
|
|
1327
1327
|
readonly RejectedPaths: FSharpList<[string, string]>;
|
|
1328
|
-
readonly ExecutedActions: FSharpList<
|
|
1328
|
+
readonly ExecutedActions: FSharpList<ClinicalPathway_PathwayAction>;
|
|
1329
1329
|
readonly VisitedStates: FSharpList<string>;
|
|
1330
1330
|
readonly TransitionsUsed: FSharpList<string>;
|
|
1331
1331
|
readonly FormSpec: Spec_FormSpec$1<FieldType>;
|
|
1332
1332
|
readonly ExecutionTime: Date;
|
|
1333
1333
|
readonly Success: boolean;
|
|
1334
1334
|
readonly Errors: FSharpList<string>;
|
|
1335
|
-
constructor(PathwayId: string, StartState: string, CurrentState: string, ExecutionMode: ClinicalPathway_PathwayExecutionMode_$union, SelectedPaths: FSharpList<string>, RejectedPaths: FSharpList<[string, string]>, ExecutedActions: FSharpList<
|
|
1335
|
+
constructor(PathwayId: string, StartState: string, CurrentState: string, ExecutionMode: ClinicalPathway_PathwayExecutionMode_$union, SelectedPaths: FSharpList<string>, RejectedPaths: FSharpList<[string, string]>, ExecutedActions: FSharpList<ClinicalPathway_PathwayAction>, VisitedStates: FSharpList<string>, TransitionsUsed: FSharpList<string>, FormSpec: Spec_FormSpec$1<FieldType>, ExecutionTime: Date, Success: boolean, Errors: FSharpList<string>) {
|
|
1336
1336
|
super();
|
|
1337
1337
|
this.PathwayId = PathwayId;
|
|
1338
1338
|
this.StartState = StartState;
|
|
@@ -1351,7 +1351,7 @@ export class PathwayExecutionResult$1<FieldType> extends Record implements IEqua
|
|
|
1351
1351
|
}
|
|
1352
1352
|
|
|
1353
1353
|
export function PathwayExecutionResult$1_$reflection(gen0: TypeInfo): TypeInfo {
|
|
1354
|
-
return record_type("F1.Studio.PathwayExecutor.PathwayExecutionResult`1", [gen0], PathwayExecutionResult$1, () => [["PathwayId", string_type], ["StartState", string_type], ["CurrentState", string_type], ["ExecutionMode", ClinicalPathway_PathwayExecutionMode_$reflection()], ["SelectedPaths", list_type(string_type)], ["RejectedPaths", list_type(tuple_type(string_type, string_type))], ["ExecutedActions", list_type(
|
|
1354
|
+
return record_type("F1.Studio.PathwayExecutor.PathwayExecutionResult`1", [gen0], PathwayExecutionResult$1, () => [["PathwayId", string_type], ["StartState", string_type], ["CurrentState", string_type], ["ExecutionMode", ClinicalPathway_PathwayExecutionMode_$reflection()], ["SelectedPaths", list_type(string_type)], ["RejectedPaths", list_type(tuple_type(string_type, string_type))], ["ExecutedActions", list_type(ClinicalPathway_PathwayAction_$reflection())], ["VisitedStates", list_type(string_type)], ["TransitionsUsed", list_type(string_type)], ["FormSpec", Spec_FormSpec$1_$reflection(gen0)], ["ExecutionTime", class_type("System.DateTime")], ["Success", bool_type], ["Errors", list_type(string_type)]]);
|
|
1355
1355
|
}
|
|
1356
1356
|
|
|
1357
1357
|
//# sourceMappingURL=PathwayExecutor.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Record } from "@fable-org/fable-library-js/Types.js";
|
|
2
2
|
import { tryFind, fold, toList, ofList, FSharpMap } from "@fable-org/fable-library-js/Map.js";
|
|
3
|
-
import { ClinicalPathway_StateDefinition, Shared_FieldValue_Single, Shared_FieldAnswer, Shared_FieldValue_Matrix, Shared_MatrixAnswer, Shared_MatrixItemKey, Shared_FieldValue_$union, Spec_FormSpec$1, Spec_FormStep$1, ClinicalPathway_ClinicalPathwaySpec, ClinicalPathway_TransitionDefinition, ClinicalPathway_TransitionCondition_$union, Spec_FormField$1, Shared_FieldOption, Spec_FieldType_$union, Shared_StateKey_$reflection, Shared_StateKey, Shared_FieldKey_$reflection, Shared_FieldKey } from "./FormSpec.js";
|
|
3
|
+
import { ClinicalPathway_StateDefinition, Shared_FieldValue_Single, Shared_FieldAnswer, Shared_FieldValue_Matrix, Shared_MatrixAnswer, Spec_Label_shown, Shared_MatrixItemKey, Shared_FieldValue_$union, Spec_FormSpec$1, Spec_FormStep$1, ClinicalPathway_ClinicalPathwaySpec, ClinicalPathway_TransitionDefinition, ClinicalPathway_TransitionCondition_$union, Spec_FormField$1, Shared_FieldOption, Spec_FieldType_$union, Shared_StateKey_$reflection, Shared_StateKey, Shared_FieldKey_$reflection, Shared_FieldKey } from "./FormSpec.js";
|
|
4
4
|
import { stringHash, safeHash, compare, equals, IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
|
|
5
5
|
import { option_type, list_type, int32_type, bool_type, record_type, class_type, string_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
6
6
|
import { ofList as ofList_1, intersect, isEmpty as isEmpty_1, empty as empty_1, FSharpSet } from "@fable-org/fable-library-js/Set.js";
|
|
@@ -165,15 +165,18 @@ export function generateTestScenarios(formSpec: Spec_FormSpec$1<Spec_FieldType_$
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
function scenarioToFormSpec(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, scenario: TestScenario): Spec_FormSpec$1<Spec_FieldType_$union> {
|
|
168
|
-
return fold<Shared_FieldKey, Shared_FieldValue_$union, Spec_FormSpec$1<Spec_FieldType_$union>>((spec: Spec_FormSpec$1<Spec_FieldType_$union>, fieldKey: Shared_FieldKey, fieldValue_1: Shared_FieldValue_$union): Spec_FormSpec$1<Spec_FieldType_$union> => defaultArg(map_1<int32, Spec_FormSpec$1<Spec_FieldType_$union>>((stepIdx: int32): Spec_FormSpec$1<Spec_FieldType_$union> => updateField<Spec_FieldType_$union>(spec, fieldKey, fieldValue_1, stepIdx), findStepIndexForField<Spec_FieldType_$union>(spec, fieldKey)), spec), formSpec, ofList<Shared_FieldKey, Shared_FieldValue_$union>(choose<Spec_FormField$1<Spec_FieldType_$union>, [Shared_FieldKey, Shared_FieldValue_$union]>((field: Spec_FormField$1<Spec_FieldType_$union>): Option<[Shared_FieldKey, Shared_FieldValue_$union]> => map_1<string, [Shared_FieldKey, Shared_FieldValue_$union]>((value: string): [Shared_FieldKey, Shared_FieldValue_$union] =>
|
|
169
|
-
|
|
170
|
-
|
|
168
|
+
return fold<Shared_FieldKey, Shared_FieldValue_$union, Spec_FormSpec$1<Spec_FieldType_$union>>((spec: Spec_FormSpec$1<Spec_FieldType_$union>, fieldKey: Shared_FieldKey, fieldValue_1: Shared_FieldValue_$union): Spec_FormSpec$1<Spec_FieldType_$union> => defaultArg(map_1<int32, Spec_FormSpec$1<Spec_FieldType_$union>>((stepIdx: int32): Spec_FormSpec$1<Spec_FieldType_$union> => updateField<Spec_FieldType_$union>(spec, fieldKey, fieldValue_1, stepIdx), findStepIndexForField<Spec_FieldType_$union>(spec, fieldKey)), spec), formSpec, ofList<Shared_FieldKey, Shared_FieldValue_$union>(choose<Spec_FormField$1<Spec_FieldType_$union>, [Shared_FieldKey, Shared_FieldValue_$union]>((field: Spec_FormField$1<Spec_FieldType_$union>): Option<[Shared_FieldKey, Shared_FieldValue_$union]> => map_1<string, [Shared_FieldKey, Shared_FieldValue_$union]>((value: string): [Shared_FieldKey, Shared_FieldValue_$union] => {
|
|
169
|
+
let matrixValues: FSharpMap<Shared_MatrixItemKey, string>;
|
|
170
|
+
return [field.FieldKey, (field.FieldType.tag === /* Matrix */ 19) ? ((matrixValues = ofList<Shared_MatrixItemKey, string>(map<Shared_MatrixItemKey, [Shared_MatrixItemKey, string]>((itemKey: Shared_MatrixItemKey): [Shared_MatrixItemKey, string] => ([itemKey, value] as [Shared_MatrixItemKey, string]), singleton(new Shared_MatrixItemKey(newGuid()))), {
|
|
171
|
+
Compare: compare,
|
|
172
|
+
}), Shared_FieldValue_Matrix(new Shared_MatrixAnswer(field.FieldKey, Spec_Label_shown(field.Label), matrixValues, undefined)))) : Shared_FieldValue_Single(new Shared_FieldAnswer(field.FieldKey, Spec_Label_shown(field.Label), value, undefined))] as [Shared_FieldKey, Shared_FieldValue_$union];
|
|
173
|
+
}, tryFind<Shared_FieldKey, string>(field.FieldKey, scenario.FieldValues)), collect<Spec_FormStep$1<Spec_FieldType_$union>, Spec_FormField$1<Spec_FieldType_$union>>((step: Spec_FormStep$1<Spec_FieldType_$union>): FSharpList<Spec_FormField$1<Spec_FieldType_$union>> => step.Fields, formSpec.Steps)), {
|
|
171
174
|
Compare: compare,
|
|
172
175
|
}));
|
|
173
176
|
}
|
|
174
177
|
|
|
175
178
|
function isTerminalState(state: ClinicalPathway_StateDefinition): boolean {
|
|
176
|
-
if (state.StateType.tag === /* Terminal */
|
|
179
|
+
if (state.StateType.tag === /* Terminal */ 4) {
|
|
177
180
|
return true;
|
|
178
181
|
}
|
|
179
182
|
else {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { printf, toText, isNullOrWhiteSpace, join, replicate } from "@fable-org/fable-library-js/String.js";
|
|
2
2
|
import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
3
3
|
import { value as value_4, Option, map, defaultArg } from "@fable-org/fable-library-js/Option.js";
|
|
4
|
-
import { Shared_FieldKey, Values_StepOrder, Spec_FormStep$1, Spec_FormSpec$1, ClinicalPathway_ClinicalPathwaySpec, Spec_MatrixInfo, Shared_MatrixItemKey, Shared_MatrixAnswer, Spec_FormField$1, Shared_FieldValue_$union, Spec_FieldType_$union, Spec_MultiChoiceInfo, Spec_SingleChoiceInfo, Shared_PluginDataProperty, Shared_FieldAnswer, Shared_FieldOption } from "../FormSpec.js";
|
|
4
|
+
import { Shared_FieldKey, Values_StepOrder, Spec_Label_shown, Spec_FormStep$1, Spec_FormSpec$1, ClinicalPathway_ClinicalPathwaySpec, Spec_MatrixInfo, Shared_MatrixItemKey, Shared_MatrixAnswer, Spec_FormField$1, Shared_FieldValue_$union, Spec_FieldType_$union, Spec_MultiChoiceInfo, Spec_SingleChoiceInfo, Shared_PluginDataProperty, Shared_FieldAnswer, Shared_FieldOption } from "../FormSpec.js";
|
|
5
5
|
import { partition, isEmpty, FSharpList, map as map_1, choose, tryFind } from "@fable-org/fable-library-js/List.js";
|
|
6
6
|
import { FSharpSet, toList } from "@fable-org/fable-library-js/Set.js";
|
|
7
7
|
import { singleton, append, delay, toList as toList_1 } from "@fable-org/fable-library-js/Seq.js";
|
|
@@ -722,7 +722,7 @@ function generatePathwayMermaid(pathway: ClinicalPathway_ClinicalPathwaySpec, fo
|
|
|
722
722
|
* Uses well-typed Spec.FieldType and Values.FieldValue throughout - NO boxing/unboxing.
|
|
723
723
|
*/
|
|
724
724
|
export function renderFormSpecToMarkdown(startHeading: int32, withPathway: boolean, formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, formValues: Option<FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>>>): string {
|
|
725
|
-
let
|
|
725
|
+
let arg_3: string, arg_6: string, arg_2: string, arg: string;
|
|
726
726
|
const lines: string[] = [];
|
|
727
727
|
const titleHeading: string = generateHeadingLevel(startHeading);
|
|
728
728
|
void (lines.push(`${titleHeading} ${formSpec.Title}`));
|
|
@@ -777,7 +777,7 @@ export function renderFormSpecToMarkdown(startHeading: int32, withPathway: boole
|
|
|
777
777
|
try {
|
|
778
778
|
while (enumerator_2["System.Collections.IEnumerator.MoveNext"]()) {
|
|
779
779
|
const step: Spec_FormStep$1<Spec_FieldType_$union> = enumerator_2["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
780
|
-
const stepLabel: string =
|
|
780
|
+
const stepLabel: string = Spec_Label_shown(step.StepLabel);
|
|
781
781
|
void (lines.push(`${stepHeading} ${stepLabel}`));
|
|
782
782
|
void (lines.push(""));
|
|
783
783
|
const patternInput: [FSharpList<Spec_FormField$1<Spec_FieldType_$union>>, FSharpList<Spec_FormField$1<Spec_FieldType_$union>>] = partition<Spec_FormField$1<Spec_FieldType_$union>>((field: Spec_FormField$1<Spec_FieldType_$union>): boolean => {
|
|
@@ -799,7 +799,7 @@ export function renderFormSpecToMarkdown(startHeading: int32, withPathway: boole
|
|
|
799
799
|
const field_3: Spec_FormField$1<Spec_FieldType_$union> = enumerator_5["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
800
800
|
const fieldTypeName: string = getFieldTypeName(field_3.FieldType);
|
|
801
801
|
const requiredText: string = field_3.IsOptional ? "" : " *(required)*";
|
|
802
|
-
void (lines.push(toText(printf("- %s%s [%s]"))(
|
|
802
|
+
void (lines.push((arg_3 = Spec_Label_shown(field_3.Label), toText(printf("- %s%s [%s]"))(arg_3)(requiredText)(fieldTypeName))));
|
|
803
803
|
}
|
|
804
804
|
}
|
|
805
805
|
finally {
|
|
@@ -813,7 +813,7 @@ export function renderFormSpecToMarkdown(startHeading: int32, withPathway: boole
|
|
|
813
813
|
const field_4: Spec_FormField$1<Spec_FieldType_$union> = enumerator_6["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
814
814
|
const fieldTypeName_1: string = getFieldTypeName(field_4.FieldType);
|
|
815
815
|
const requiredText_1: string = field_4.IsOptional ? "" : " *(required)*";
|
|
816
|
-
void (lines.push(toText(printf("- %s%s [%s]"))(
|
|
816
|
+
void (lines.push((arg_6 = Spec_Label_shown(field_4.Label), toText(printf("- %s%s [%s]"))(arg_6)(requiredText_1)(fieldTypeName_1))));
|
|
817
817
|
}
|
|
818
818
|
}
|
|
819
819
|
finally {
|
|
@@ -830,12 +830,12 @@ export function renderFormSpecToMarkdown(startHeading: int32, withPathway: boole
|
|
|
830
830
|
const field_1: Spec_FormField$1<Spec_FieldType_$union> = enumerator_3["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
831
831
|
const matchValue_2: Option<FieldDetails$1<Spec_FieldType_$union>> = FSharpMap__TryFind(stepValues, field_1.FieldKey);
|
|
832
832
|
if (matchValue_2 == null) {
|
|
833
|
-
void (lines.push(toText(printf("- **%s**: *No response provided*"))(
|
|
833
|
+
void (lines.push((arg_2 = Spec_Label_shown(field_1.Label), toText(printf("- **%s**: *No response provided*"))(arg_2))));
|
|
834
834
|
}
|
|
835
835
|
else {
|
|
836
836
|
const formattedValue: string = formatFieldValue(field_1.FieldType, value_4(matchValue_2).FieldValue, field_1);
|
|
837
837
|
if (!isNullOrWhiteSpace(formattedValue)) {
|
|
838
|
-
void (lines.push(toText(printf("- **%s**: %s"))(
|
|
838
|
+
void (lines.push((arg = Spec_Label_shown(field_1.Label), toText(printf("- **%s**: %s"))(arg)(formattedValue))));
|
|
839
839
|
}
|
|
840
840
|
}
|
|
841
841
|
}
|
|
@@ -849,7 +849,17 @@ export function renderFormSpecToMarkdown(startHeading: int32, withPathway: boole
|
|
|
849
849
|
const field_2: Spec_FormField$1<Spec_FieldType_$union> = enumerator_4["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
850
850
|
const matchValue_3: Spec_FieldType_$union = field_2.FieldType;
|
|
851
851
|
if (matchValue_3.tag === /* Matrix */ 19) {
|
|
852
|
-
const
|
|
852
|
+
const matrixInfo: Spec_MatrixInfo = matchValue_3.fields[0];
|
|
853
|
+
let matrixAnswer_1: Option<Shared_MatrixAnswer>;
|
|
854
|
+
const matchValue_4: Option<FieldDetails$1<Spec_FieldType_$union>> = FSharpMap__TryFind(stepValues, field_2.FieldKey);
|
|
855
|
+
if (matchValue_4 == null) {
|
|
856
|
+
matrixAnswer_1 = undefined;
|
|
857
|
+
}
|
|
858
|
+
else {
|
|
859
|
+
const matchValue_5: Shared_FieldValue_$union = value_4(matchValue_4).FieldValue;
|
|
860
|
+
matrixAnswer_1 = ((matchValue_5.tag === /* Single */ 0) ? undefined : ((matchValue_5.tag === /* Multiple */ 1) ? undefined : ((matchValue_5.tag === /* PluginData */ 3) ? undefined : matchValue_5.fields[0])));
|
|
861
|
+
}
|
|
862
|
+
const tableMarkdown: string = formatMatrixFieldAsTable(Spec_Label_shown(field_2.Label), matrixInfo, matrixAnswer_1);
|
|
853
863
|
if (!isNullOrWhiteSpace(tableMarkdown)) {
|
|
854
864
|
void (lines.push(""));
|
|
855
865
|
void (lines.push(tableMarkdown));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { StringBuilder_$ctor, StringBuilder__AppendLine_Z721C83C5 } from "@fable-org/fable-library-js/System.Text.js";
|
|
2
|
-
import { sanitizeMermaidText, extractActionText, extractEvaluationName,
|
|
2
|
+
import { sanitizeMermaidText, getTerminalOutcome, extractActionText, extractEvaluationName, stateTypeToString, extractStateKeyString, sanitizeMermaidId } from "../PathwayDataExtractor.js";
|
|
3
3
|
import { isNullOrEmpty, join, printf, toText } from "@fable-org/fable-library-js/String.js";
|
|
4
4
|
import { empty, exists, isEmpty, iterateIndexed, FSharpList, mapIndexed, cons, map } from "@fable-org/fable-library-js/List.js";
|
|
5
|
-
import { ClinicalPathway_PathRequirement, ClinicalPathway_ConstraintDefinition, ClinicalPathway_ClinicalPathwaySpec, ClinicalPathway_TransitionDefinition, ClinicalPathway_StateType_$union, ClinicalPathway_StateDefinition,
|
|
5
|
+
import { ClinicalPathway_PathRequirement, ClinicalPathway_ConstraintDefinition, ClinicalPathway_ClinicalPathwaySpec, ClinicalPathway_TransitionDefinition, ClinicalPathway_StateType_$union, ClinicalPathway_StateDefinition, ClinicalPathway_PathwayAction } from "../FormSpec.js";
|
|
6
6
|
import { toString } from "@fable-org/fable-library-js/Types.js";
|
|
7
7
|
import { int32, float64 } from "@fable-org/fable-library-js/Int32.js";
|
|
8
8
|
import { formatRequiredPathLabel, formatConstraintLabel, isTransitionRequired, getTransitionArrowStyle, IGraphRenderer$3 } from "./PathwayRenderers.js";
|
|
@@ -24,13 +24,11 @@ export class MermaidRenderer implements IGraphRenderer$3<void, void, string> {
|
|
|
24
24
|
StringBuilder__AppendLine_Z721C83C5(_.sb, "graph TD");
|
|
25
25
|
}
|
|
26
26
|
AddNode(state: ClinicalPathway_StateDefinition): void {
|
|
27
|
-
let matchValue: ClinicalPathway_StateType_$union,
|
|
27
|
+
let matchValue: ClinicalPathway_StateType_$union, evalName: string, actionText: string, arg_11: string, actionText_1: string, outcome: string;
|
|
28
28
|
const _: MermaidRenderer = this;
|
|
29
29
|
const nodeId: string = sanitizeMermaidId(extractStateKeyString(state.StateKey));
|
|
30
30
|
const stateTypeStr: string = stateTypeToString(state.StateType);
|
|
31
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, (matchValue = state.StateType, (matchValue.tag === /*
|
|
32
|
-
throw new Error("Match failure: F1.Studio.ClinicalPathway.StateType");
|
|
33
|
-
})()))))));
|
|
31
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, (matchValue = state.StateType, (matchValue.tag === /* Evaluation */ 0) ? ((evalName = extractEvaluationName(matchValue.fields[0]), toText(printf(" %s[/\"%s<br/>%s\"/]:::evaluation"))(nodeId)(state.StateLabel)(evalName))) : ((matchValue.tag === /* Action */ 1) ? ((actionText = extractActionText(matchValue.fields[0].Action), toText(printf(" %s[\"%s<br/>%s\"]:::action"))(nodeId)(state.StateLabel)(actionText))) : ((matchValue.tag === /* CompoundAction */ 2) ? ((arg_11 = join("<br/>", map<ClinicalPathway_PathwayAction, string>((action_1: ClinicalPathway_PathwayAction): string => extractActionText(action_1.Action), matchValue.fields[0])), toText(printf(" %s[\"%s<br/>%s\"]:::action"))(nodeId)(state.StateLabel)(arg_11))) : ((matchValue.tag === /* ConditionalAction */ 3) ? ((actionText_1 = extractActionText(matchValue.fields[1].Action), toText(printf(" %s[\"%s<br/>%s\"]:::action"))(nodeId)(state.StateLabel)(actionText_1))) : ((outcome = getTerminalOutcome(matchValue.fields[0]), toText(printf(" %s((\"%s<br/>%s\"))"))(nodeId)(state.StateLabel)(outcome))))))));
|
|
34
32
|
}
|
|
35
33
|
AddEdge(transition: ClinicalPathway_TransitionDefinition, label: string): void {
|
|
36
34
|
let sanitizedLabel: string;
|
|
@@ -92,14 +90,12 @@ export class EnhancedMermaidRenderer implements IGraphRenderer$3<void, void, str
|
|
|
92
90
|
StringBuilder__AppendLine_Z721C83C5(_.sb, "graph TD");
|
|
93
91
|
}
|
|
94
92
|
AddNode(state: ClinicalPathway_StateDefinition): void {
|
|
95
|
-
let matchValue: ClinicalPathway_StateType_$union,
|
|
93
|
+
let matchValue: ClinicalPathway_StateType_$union, evalName: string, arg_4: string, actionText: string, arg_7: string, actionTexts: FSharpList<string>, arg_10: string, arg_11: string, actionText_2: string, arg_13: string, outcome: string, arg_1: string;
|
|
96
94
|
const _: EnhancedMermaidRenderer = this;
|
|
97
95
|
_.addedStates = cons(state, _.addedStates);
|
|
98
96
|
const nodeId: string = sanitizeMermaidId(extractStateKeyString(state.StateKey));
|
|
99
97
|
const stateTypeStr: string = stateTypeToString(state.StateType);
|
|
100
|
-
StringBuilder__AppendLine_Z721C83C5(_.sb, (matchValue = state.StateType, (matchValue.tag === /*
|
|
101
|
-
throw new Error("Match failure: F1.Studio.ClinicalPathway.StateType");
|
|
102
|
-
})()))))));
|
|
98
|
+
StringBuilder__AppendLine_Z721C83C5(_.sb, (matchValue = state.StateType, (matchValue.tag === /* Evaluation */ 0) ? ((evalName = sanitizeMermaidText(extractEvaluationName(matchValue.fields[0])), (arg_4 = sanitizeMermaidText(state.StateLabel), toText(printf(" %s[/\"%s<br/>%s\"/]:::evaluation"))(nodeId)(arg_4)(evalName)))) : ((matchValue.tag === /* Action */ 1) ? ((actionText = sanitizeMermaidText(extractActionText(matchValue.fields[0].Action)), (arg_7 = sanitizeMermaidText(state.StateLabel), toText(printf(" %s[\"%s<br/>%s\"]:::action"))(nodeId)(arg_7)(actionText)))) : ((matchValue.tag === /* CompoundAction */ 2) ? ((actionTexts = mapIndexed<ClinicalPathway_PathwayAction, string>((i: int32, action_1: ClinicalPathway_PathwayAction): string => (`${i + 1}. ${sanitizeMermaidText(extractActionText(action_1.Action))}`), matchValue.fields[0]), (arg_10 = sanitizeMermaidText(state.StateLabel), (arg_11 = join("<br/>", actionTexts), toText(printf(" %s[\"%s<br/>📋 Multiple Actions:<br/>%s\"]:::compound"))(nodeId)(arg_10)(arg_11))))) : ((matchValue.tag === /* ConditionalAction */ 3) ? ((actionText_2 = sanitizeMermaidText(extractActionText(matchValue.fields[1].Action)), (arg_13 = sanitizeMermaidText(state.StateLabel), toText(printf(" %s[\"%s<br/>%s\"]:::action"))(nodeId)(arg_13)(actionText_2)))) : ((outcome = sanitizeMermaidText(getTerminalOutcome(matchValue.fields[0])), (arg_1 = sanitizeMermaidText(state.StateLabel), toText(printf(" %s((\"%s<br/>%s\"))"))(nodeId)(arg_1)(outcome)))))))));
|
|
103
99
|
}
|
|
104
100
|
AddEdge(transition: ClinicalPathway_TransitionDefinition, label: string): void {
|
|
105
101
|
let sanitizedLabel: string, fullLabel: string, matchValue_1: Option<ClinicalPathway_ClinicalPathwaySpec>, p_2: ClinicalPathway_ClinicalPathwaySpec;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClinicalPathway_PathRequirement, Shared_StateKey, ClinicalPathway_ConstraintType_$union, ClinicalPathway_ConstraintDefinition, ClinicalPathway_ClinicalPathwaySpec, ClinicalPathway_TransitionCondition_$union, ClinicalPathway_LogicalOp_$union, Shared_FieldOption, Shared_FieldOptionKey, Shared_PluginPropertyKey, Shared_MatrixItemKey, Shared_ConditionValue_$union, ClinicalPathway_FieldEvaluator_$union, Spec_FormSpec$1, Spec_FormStep$1, Spec_FieldType_$union, Spec_FormField$1, Shared_FieldKey, ClinicalPathway_StateDefinition, ClinicalPathway_TransitionDefinition } from "../FormSpec.js";
|
|
1
|
+
import { ClinicalPathway_PathRequirement, Shared_StateKey, ClinicalPathway_ConstraintType_$union, ClinicalPathway_ConstraintDefinition, ClinicalPathway_ClinicalPathwaySpec, ClinicalPathway_TransitionCondition_$union, ClinicalPathway_LogicalOp_$union, Shared_FieldOption, Shared_FieldOptionKey, Shared_PluginPropertyKey, Shared_MatrixItemKey, Shared_ConditionValue_$union, ClinicalPathway_FieldEvaluator_$union, Spec_FormSpec$1, Spec_FormStep$1, Spec_FieldType_$union, Spec_FormField$1, Spec_Label_shown, Shared_FieldKey, ClinicalPathway_StateDefinition, ClinicalPathway_TransitionDefinition } from "../FormSpec.js";
|
|
2
2
|
import { int32, float64 } from "@fable-org/fable-library-js/Int32.js";
|
|
3
3
|
import { unwrap, value as value_2, defaultArgWith, Option, map, bind, defaultArg } from "@fable-org/fable-library-js/Option.js";
|
|
4
4
|
import { contains, exists, iterate, length, empty, map as map_1, FSharpList, collect, tryFind } from "@fable-org/fable-library-js/List.js";
|
|
@@ -41,13 +41,13 @@ export function getTransitionLabel(condition: ClinicalPathway_TransitionConditio
|
|
|
41
41
|
const minScore_1: int32 = condition.fields[1] | 0;
|
|
42
42
|
const maxScore_1: int32 = condition.fields[2] | 0;
|
|
43
43
|
const fieldKey: Shared_FieldKey = condition.fields[0];
|
|
44
|
-
return `${defaultArg(bind<Spec_FormSpec$1<Spec_FieldType_$union>, string>((spec: Spec_FormSpec$1<Spec_FieldType_$union>): Option<string> => map<Spec_FormField$1<Spec_FieldType_$union>, string>((field_1: Spec_FormField$1<Spec_FieldType_$union>): string => field_1.Label, tryFind<Spec_FormField$1<Spec_FieldType_$union>>((field: Spec_FormField$1<Spec_FieldType_$union>): boolean => equals(field.FieldKey, fieldKey), collect<Spec_FormStep$1<Spec_FieldType_$union>, Spec_FormField$1<Spec_FieldType_$union>>((step: Spec_FormStep$1<Spec_FieldType_$union>): FSharpList<Spec_FormField$1<Spec_FieldType_$union>> => step.Fields, spec.Steps))), formSpec), "Field")} Score: ${minScore_1}-${maxScore_1}`;
|
|
44
|
+
return `${defaultArg(bind<Spec_FormSpec$1<Spec_FieldType_$union>, string>((spec: Spec_FormSpec$1<Spec_FieldType_$union>): Option<string> => map<Spec_FormField$1<Spec_FieldType_$union>, string>((field_1: Spec_FormField$1<Spec_FieldType_$union>): string => Spec_Label_shown(field_1.Label), tryFind<Spec_FormField$1<Spec_FieldType_$union>>((field: Spec_FormField$1<Spec_FieldType_$union>): boolean => equals(field.FieldKey, fieldKey), collect<Spec_FormStep$1<Spec_FieldType_$union>, Spec_FormField$1<Spec_FieldType_$union>>((step: Spec_FormStep$1<Spec_FieldType_$union>): FSharpList<Spec_FormField$1<Spec_FieldType_$union>> => step.Fields, spec.Steps))), formSpec), "Field")} Score: ${minScore_1}-${maxScore_1}`;
|
|
45
45
|
}
|
|
46
46
|
case /* FieldCondition */ 0: {
|
|
47
47
|
const op: ClinicalPathway_FieldEvaluator_$union = condition.fields[1];
|
|
48
48
|
const fieldPath: Shared_FieldKey = condition.fields[0];
|
|
49
49
|
const conditionValue: Shared_ConditionValue_$union = condition.fields[2];
|
|
50
|
-
const fieldName_1: string = defaultArgWith<string>(bind<Spec_FormSpec$1<Spec_FieldType_$union>, string>((spec_1: Spec_FormSpec$1<Spec_FieldType_$union>): Option<string> => map<Spec_FormField$1<Spec_FieldType_$union>, string>((field_3: Spec_FormField$1<Spec_FieldType_$union>): string => replace(field_3.Label, ":", "").trim(), tryFind<Spec_FormField$1<Spec_FieldType_$union>>((field_2: Spec_FormField$1<Spec_FieldType_$union>): boolean => equals(field_2.FieldKey, fieldPath), collect<Spec_FormStep$1<Spec_FieldType_$union>, Spec_FormField$1<Spec_FieldType_$union>>((step_1: Spec_FormStep$1<Spec_FieldType_$union>): FSharpList<Spec_FormField$1<Spec_FieldType_$union>> => step_1.Fields, spec_1.Steps))), formSpec), (): string => (`Field-${substring(fieldPath.fields[0], 0, 8)}`));
|
|
50
|
+
const fieldName_1: string = defaultArgWith<string>(bind<Spec_FormSpec$1<Spec_FieldType_$union>, string>((spec_1: Spec_FormSpec$1<Spec_FieldType_$union>): Option<string> => map<Spec_FormField$1<Spec_FieldType_$union>, string>((field_3: Spec_FormField$1<Spec_FieldType_$union>): string => replace(Spec_Label_shown(field_3.Label), ":", "").trim(), tryFind<Spec_FormField$1<Spec_FieldType_$union>>((field_2: Spec_FormField$1<Spec_FieldType_$union>): boolean => equals(field_2.FieldKey, fieldPath), collect<Spec_FormStep$1<Spec_FieldType_$union>, Spec_FormField$1<Spec_FieldType_$union>>((step_1: Spec_FormStep$1<Spec_FieldType_$union>): FSharpList<Spec_FormField$1<Spec_FieldType_$union>> => step_1.Fields, spec_1.Steps))), formSpec), (): string => (`Field-${substring(fieldPath.fields[0], 0, 8)}`));
|
|
51
51
|
const valueStr: string = (conditionValue.tag === /* Multiple */ 1) ? join(", ", toList<string>(conditionValue.fields[0])) : ((conditionValue.tag === /* Matrix */ 2) ? join(", ", map_1<[Shared_MatrixItemKey, string], string>((tupledArg: [Shared_MatrixItemKey, string]): string => tupledArg[1], toList_1<Shared_MatrixItemKey, string>(conditionValue.fields[0]))) : ((conditionValue.tag === /* PluginData */ 3) ? conditionValue.fields[0].Value : conditionValue.fields[0]));
|
|
52
52
|
switch (op.tag) {
|
|
53
53
|
case /* InRange */ 13: {
|
|
@@ -83,7 +83,7 @@ export function getTransitionLabel(condition: ClinicalPathway_TransitionConditio
|
|
|
83
83
|
const op_1: ClinicalPathway_FieldEvaluator_$union = condition.fields[2];
|
|
84
84
|
const fieldKey_1: Shared_FieldKey = condition.fields[0];
|
|
85
85
|
const conditionValue_1: Shared_ConditionValue_$union = condition.fields[3];
|
|
86
|
-
const fieldName_2: string = defaultArgWith<string>(bind<Spec_FormSpec$1<Spec_FieldType_$union>, string>((spec_2: Spec_FormSpec$1<Spec_FieldType_$union>): Option<string> => map<Spec_FormField$1<Spec_FieldType_$union>, string>((field_5: Spec_FormField$1<Spec_FieldType_$union>): string => replace(field_5.Label, ":", "").trim(), tryFind<Spec_FormField$1<Spec_FieldType_$union>>((field_4: Spec_FormField$1<Spec_FieldType_$union>): boolean => equals(field_4.FieldKey, fieldKey_1), collect<Spec_FormStep$1<Spec_FieldType_$union>, Spec_FormField$1<Spec_FieldType_$union>>((step_2: Spec_FormStep$1<Spec_FieldType_$union>): FSharpList<Spec_FormField$1<Spec_FieldType_$union>> => step_2.Fields, spec_2.Steps))), formSpec), (): string => (`Field-${substring(fieldKey_1.fields[0], 0, 8)}`));
|
|
86
|
+
const fieldName_2: string = defaultArgWith<string>(bind<Spec_FormSpec$1<Spec_FieldType_$union>, string>((spec_2: Spec_FormSpec$1<Spec_FieldType_$union>): Option<string> => map<Spec_FormField$1<Spec_FieldType_$union>, string>((field_5: Spec_FormField$1<Spec_FieldType_$union>): string => replace(Spec_Label_shown(field_5.Label), ":", "").trim(), tryFind<Spec_FormField$1<Spec_FieldType_$union>>((field_4: Spec_FormField$1<Spec_FieldType_$union>): boolean => equals(field_4.FieldKey, fieldKey_1), collect<Spec_FormStep$1<Spec_FieldType_$union>, Spec_FormField$1<Spec_FieldType_$union>>((step_2: Spec_FormStep$1<Spec_FieldType_$union>): FSharpList<Spec_FormField$1<Spec_FieldType_$union>> => step_2.Fields, spec_2.Steps))), formSpec), (): string => (`Field-${substring(fieldKey_1.fields[0], 0, 8)}`));
|
|
87
87
|
const valueStr_1: string = (conditionValue_1.tag === /* Multiple */ 1) ? join(", ", toList<string>(conditionValue_1.fields[0])) : ((conditionValue_1.tag === /* Matrix */ 2) ? join(", ", map_1<[Shared_MatrixItemKey, string], string>((tupledArg_1: [Shared_MatrixItemKey, string]): string => tupledArg_1[1], toList_1<Shared_MatrixItemKey, string>(conditionValue_1.fields[0]))) : ((conditionValue_1.tag === /* PluginData */ 3) ? conditionValue_1.fields[0].Value : conditionValue_1.fields[0]));
|
|
88
88
|
return `${fieldName_2}.${"Property"} ${(op_1.tag === /* Equals */ 0) ? "=" : ((op_1.tag === /* NotEquals */ 1) ? "≠" : ((op_1.tag === /* GreaterThan */ 5) ? ">" : ((op_1.tag === /* GreaterOrEqual */ 6) ? "≥" : ((op_1.tag === /* LessThan */ 7) ? "<" : ((op_1.tag === /* LessOrEqual */ 8) ? "≤" : "?")))))} ${valueStr_1}`;
|
|
89
89
|
}
|
|
@@ -93,7 +93,7 @@ export function getTransitionLabel(condition: ClinicalPathway_TransitionConditio
|
|
|
93
93
|
const fieldKey_2: Shared_FieldKey = condition.fields[0];
|
|
94
94
|
const fieldItemKey: Option<Shared_MatrixItemKey> = condition.fields[1];
|
|
95
95
|
const conditionValue_2: Shared_ConditionValue_$union = condition.fields[4];
|
|
96
|
-
const baseFieldLabel: string = defaultArgWith<string>(bind<Spec_FormSpec$1<Spec_FieldType_$union>, string>((spec_3: Spec_FormSpec$1<Spec_FieldType_$union>): Option<string> => map<Spec_FormField$1<Spec_FieldType_$union>, string>((field_7: Spec_FormField$1<Spec_FieldType_$union>): string => replace(field_7.Label, ":", "").trim(), tryFind<Spec_FormField$1<Spec_FieldType_$union>>((field_6: Spec_FormField$1<Spec_FieldType_$union>): boolean => equals(field_6.FieldKey, fieldKey_2), collect<Spec_FormStep$1<Spec_FieldType_$union>, Spec_FormField$1<Spec_FieldType_$union>>((step_3: Spec_FormStep$1<Spec_FieldType_$union>): FSharpList<Spec_FormField$1<Spec_FieldType_$union>> => step_3.Fields, spec_3.Steps))), formSpec), (): string => (`Field-${substring(fieldKey_2.fields[0], 0, 8)}`));
|
|
96
|
+
const baseFieldLabel: string = defaultArgWith<string>(bind<Spec_FormSpec$1<Spec_FieldType_$union>, string>((spec_3: Spec_FormSpec$1<Spec_FieldType_$union>): Option<string> => map<Spec_FormField$1<Spec_FieldType_$union>, string>((field_7: Spec_FormField$1<Spec_FieldType_$union>): string => replace(Spec_Label_shown(field_7.Label), ":", "").trim(), tryFind<Spec_FormField$1<Spec_FieldType_$union>>((field_6: Spec_FormField$1<Spec_FieldType_$union>): boolean => equals(field_6.FieldKey, fieldKey_2), collect<Spec_FormStep$1<Spec_FieldType_$union>, Spec_FormField$1<Spec_FieldType_$union>>((step_3: Spec_FormStep$1<Spec_FieldType_$union>): FSharpList<Spec_FormField$1<Spec_FieldType_$union>> => step_3.Fields, spec_3.Steps))), formSpec), (): string => (`Field-${substring(fieldKey_2.fields[0], 0, 8)}`));
|
|
97
97
|
const fieldName_3: string = (fieldItemKey == null) ? baseFieldLabel : (`${baseFieldLabel} [${substring(value_2(fieldItemKey).fields[0], 0, 8)}]`);
|
|
98
98
|
const optionLabel: string = defaultArgWith<string>(bind<Spec_FormSpec$1<Spec_FieldType_$union>, string>((spec_4: Spec_FormSpec$1<Spec_FieldType_$union>): Option<string> => bind<Spec_FormField$1<Spec_FieldType_$union>, string>((field_9: Spec_FormField$1<Spec_FieldType_$union>): Option<string> => {
|
|
99
99
|
let matchValue: Spec_FieldType_$union;
|