@f1studio/form-spec 5.0.0-alpha.101
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/Designer.d.ts +89 -0
- package/FormSpec.TS/Components/HelloComponent.js +68 -0
- package/FormSpec.TS/Components/HelloComponent.js.map +1 -0
- package/FormSpec.TS/Components/HelloComponent.ts.map +1 -0
- package/FormSpec.TS/Designer.js +526 -0
- package/FormSpec.TS/Designer.js.map +1 -0
- package/FormSpec.TS/Designer.ts.map +1 -0
- package/FormSpec.TS/FormSpec.js +5400 -0
- package/FormSpec.TS/FormSpec.js.map +1 -0
- package/FormSpec.TS/FormSpec.ts.map +1 -0
- package/FormSpec.TS/FormSpecHelpers.js +382 -0
- package/FormSpec.TS/FormSpecHelpers.js.map +1 -0
- package/FormSpec.TS/FormSpecHelpers.ts.map +1 -0
- package/FormSpec.TS/Helpers.js +732 -0
- package/FormSpec.TS/Helpers.js.map +1 -0
- package/FormSpec.TS/Helpers.ts.map +1 -0
- package/FormSpec.TS/Interfaces.js +257 -0
- package/FormSpec.TS/Interfaces.js.map +1 -0
- package/FormSpec.TS/Interfaces.ts.map +1 -0
- package/FormSpec.TS/Interop/FormSpec.Api.Helpers.js +854 -0
- package/FormSpec.TS/Interop/FormSpec.Api.Helpers.js.map +1 -0
- package/FormSpec.TS/Interop/FormSpec.Api.Helpers.ts.map +1 -0
- package/FormSpec.TS/Interop/FormSpec.Api.Option.js +1961 -0
- package/FormSpec.TS/Interop/FormSpec.Api.Option.js.map +1 -0
- package/FormSpec.TS/Interop/FormSpec.Api.Option.ts.map +1 -0
- package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.js +1367 -0
- package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.js.map +1 -0
- package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.ts.map +1 -0
- package/FormSpec.TS/Logging/LogTypes.js +347 -0
- package/FormSpec.TS/Logging/LogTypes.js.map +1 -0
- package/FormSpec.TS/Logging/LogTypes.ts.map +1 -0
- package/FormSpec.TS/Migrator.js +230 -0
- package/FormSpec.TS/Migrator.js.map +1 -0
- package/FormSpec.TS/Migrator.ts.map +1 -0
- package/FormSpec.TS/PathwayDataExtractor.js +361 -0
- package/FormSpec.TS/PathwayDataExtractor.js.map +1 -0
- package/FormSpec.TS/PathwayDataExtractor.ts.map +1 -0
- package/FormSpec.TS/PathwayExecutor.js +1321 -0
- package/FormSpec.TS/PathwayExecutor.js.map +1 -0
- package/FormSpec.TS/PathwayExecutor.ts.map +1 -0
- package/FormSpec.TS/PathwayValidator.js +346 -0
- package/FormSpec.TS/PathwayValidator.js.map +1 -0
- package/FormSpec.TS/PathwayValidator.ts.map +1 -0
- package/FormSpec.TS/PluginInterface.js +171 -0
- package/FormSpec.TS/PluginInterface.js.map +1 -0
- package/FormSpec.TS/PluginInterface.ts.map +1 -0
- package/FormSpec.TS/Prelude.js +59 -0
- package/FormSpec.TS/Prelude.js.map +1 -0
- package/FormSpec.TS/Prelude.ts.map +1 -0
- package/FormSpec.TS/Renderers/FormSpecMarkdownRenderer.js +958 -0
- package/FormSpec.TS/Renderers/FormSpecMarkdownRenderer.js.map +1 -0
- package/FormSpec.TS/Renderers/FormSpecMarkdownRenderer.ts.map +1 -0
- package/FormSpec.TS/Renderers/MermaidRenderer.js +228 -0
- package/FormSpec.TS/Renderers/MermaidRenderer.js.map +1 -0
- package/FormSpec.TS/Renderers/MermaidRenderer.ts.map +1 -0
- package/FormSpec.TS/Renderers/PathwayRenderers.js +190 -0
- package/FormSpec.TS/Renderers/PathwayRenderers.js.map +1 -0
- package/FormSpec.TS/Renderers/PathwayRenderers.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Base.fs +511 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Base.fs.js +437 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Base.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Base.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Error.fs +16 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Error.fs.js +73 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Error.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Error.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Extensions.fs +50 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Extensions.fs.js +72 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Extensions.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Extensions.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Fable.Form.fableproj +28 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs +24 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs.js +56 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.3.0.0/Field.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Fable.Form.Simple.fableproj +31 -0
- package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Form.fs +178 -0
- package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Form.fs.js +464 -0
- package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Form.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.Form.Simple.5.0.1/Form.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Extensions.fs +17 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Hooks.fs +152 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Hooks.fs.js +25 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Hooks.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Hooks.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.Types.fableproj +28 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.fs +218 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.fs.js +37 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.React.Types.18.3.0/Fable.React.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.Types.fableproj +27 -0
- package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.fs +82 -0
- package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.fs.js +7 -0
- package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Fable.ReactDom.Types.18.2.0/Fable.ReactDom.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/BorderStyle.fs +59 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Colors.fs +154 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Colors.fs.js +32 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Colors.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Colors.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Feliz.fableproj +42 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Fonts.fs +240 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/GridTypes.fs +24 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Html.fs +826 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Interop.fs +83 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Interop.fs.js +292 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Interop.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Interop.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Key.fs +65 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Key.fs.js +229 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Key.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Key.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Length.fs +91 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Locale.fs +876 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Properties.fs +4080 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Properties.fs.js +133 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Properties.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Properties.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/React.fs +656 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/React.fs.js +561 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/React.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/React.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactDOM.fs +25 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactDOM.fs.js +46 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactDOM.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactDOM.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactInterop.js +63 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactInterop.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactTypes.fs +41 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactTypes.fs.js +7 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactTypes.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/ReactTypes.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/StyleTypes.fs +53 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/StyleTypes.fs.js +7 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/StyleTypes.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/StyleTypes.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Styles.fs +5740 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Svg.fs +1455 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Svg.fs.js +39 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Svg.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Svg.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TextDecorationLine.fs +13 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TextDecorationStyle.fs +33 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Transform.fs +181 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TransformOrigin.fs +17 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/TransitionProperty.fs +162 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Types.fs +13 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Types.fs.js +7 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Types.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Feliz.2.7.0/Types.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs +1768 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs.js +2337 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Decode.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs +811 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.js +465 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs +47 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs.js +18 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Extra.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Thoth.Json.fableproj +34 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs +68 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs.js +355 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs.js.map +1 -0
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Types.fs.ts.map +1 -0
- package/FormSpec.TS/fable_modules/project_cracked.json +1 -0
- package/FormSpec.d.ts +1257 -0
- package/FormSpecHelpers.d.ts +50 -0
- package/Helpers.d.ts +147 -0
- package/Interfaces.d.ts +70 -0
- package/Interop/FormSpec.Api.Helpers.d.ts +247 -0
- package/Interop/FormSpec.Api.Helpers.d.ts.map +1 -0
- package/Interop/FormSpec.Api.Option.d.ts +384 -0
- package/Interop/FormSpec.Api.Option.d.ts.map +1 -0
- package/Interop/FormSpec.Values.Api.Option.d.ts +324 -0
- package/Interop/FormSpec.Values.Api.Option.d.ts.map +1 -0
- package/Migrator.d.ts +59 -0
- package/PathwayDataExtractor.d.ts +19 -0
- package/PathwayExecutor.d.ts +210 -0
- package/PathwayValidator.d.ts +52 -0
- package/PluginInterface.d.ts +36 -0
- package/Prelude.d.ts +11 -0
- package/README.TS.md +622 -0
- package/README.md +85 -0
- package/package.json +39 -0
- package/src/Components/HelloComponent.ts +48 -0
- package/src/Components/HelloComponent.ts.map +1 -0
- package/src/Designer.ts +389 -0
- package/src/Designer.ts.map +1 -0
- package/src/FormSpec.ts +3114 -0
- package/src/FormSpec.ts.map +1 -0
- package/src/FormSpecHelpers.ts +374 -0
- package/src/FormSpecHelpers.ts.map +1 -0
- package/src/Helpers.ts +765 -0
- package/src/Helpers.ts.map +1 -0
- package/src/Interfaces.ts +166 -0
- package/src/Interfaces.ts.map +1 -0
- package/src/Interop/FormSpec.Api.Helpers.ts +872 -0
- package/src/Interop/FormSpec.Api.Helpers.ts.map +1 -0
- package/src/Interop/FormSpec.Api.Option.ts +1618 -0
- package/src/Interop/FormSpec.Api.Option.ts.map +1 -0
- package/src/Interop/FormSpec.Values.Api.Option.ts +1214 -0
- package/src/Interop/FormSpec.Values.Api.Option.ts.map +1 -0
- package/src/Logging/LogTypes.ts +212 -0
- package/src/Logging/LogTypes.ts.map +1 -0
- package/src/Migrator.ts +156 -0
- package/src/Migrator.ts.map +1 -0
- package/src/PathwayDataExtractor.ts +290 -0
- package/src/PathwayDataExtractor.ts.map +1 -0
- package/src/PathwayExecutor.ts +1102 -0
- package/src/PathwayExecutor.ts.map +1 -0
- package/src/PathwayValidator.ts +244 -0
- package/src/PathwayValidator.ts.map +1 -0
- package/src/PluginInterface.ts +79 -0
- package/src/PluginInterface.ts.map +1 -0
- package/src/Prelude.ts +21 -0
- package/src/Prelude.ts.map +1 -0
- package/src/Renderers/FormSpecMarkdownRenderer.ts +874 -0
- package/src/Renderers/FormSpecMarkdownRenderer.ts.map +1 -0
- package/src/Renderers/MermaidRenderer.ts +218 -0
- package/src/Renderers/MermaidRenderer.ts.map +1 -0
- package/src/Renderers/PathwayRenderers.ts +200 -0
- package/src/Renderers/PathwayRenderers.ts.map +1 -0
|
@@ -0,0 +1,1321 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get ClinicalPlan () {
|
|
13
|
+
return ClinicalPlan;
|
|
14
|
+
},
|
|
15
|
+
get ClinicalPlan_$reflection () {
|
|
16
|
+
return ClinicalPlan_$reflection;
|
|
17
|
+
},
|
|
18
|
+
get ExecutionContext$1 () {
|
|
19
|
+
return ExecutionContext$1;
|
|
20
|
+
},
|
|
21
|
+
get ExecutionContext$1_$reflection () {
|
|
22
|
+
return ExecutionContext$1_$reflection;
|
|
23
|
+
},
|
|
24
|
+
get ExecutionLogEntry () {
|
|
25
|
+
return ExecutionLogEntry;
|
|
26
|
+
},
|
|
27
|
+
get ExecutionLogEntry_$reflection () {
|
|
28
|
+
return ExecutionLogEntry_$reflection;
|
|
29
|
+
},
|
|
30
|
+
get FieldResolver_createResolver () {
|
|
31
|
+
return FieldResolver_createResolver;
|
|
32
|
+
},
|
|
33
|
+
get FieldResolver_extractFieldValues () {
|
|
34
|
+
return FieldResolver_extractFieldValues;
|
|
35
|
+
},
|
|
36
|
+
get FieldResolver_generateFieldKey () {
|
|
37
|
+
return FieldResolver_generateFieldKey;
|
|
38
|
+
},
|
|
39
|
+
get IncrementalExecutionResult$1 () {
|
|
40
|
+
return IncrementalExecutionResult$1;
|
|
41
|
+
},
|
|
42
|
+
get IncrementalExecutionResult$1_$reflection () {
|
|
43
|
+
return IncrementalExecutionResult$1_$reflection;
|
|
44
|
+
},
|
|
45
|
+
get MatchedTransition () {
|
|
46
|
+
return MatchedTransition;
|
|
47
|
+
},
|
|
48
|
+
get MatchedTransition_$reflection () {
|
|
49
|
+
return MatchedTransition_$reflection;
|
|
50
|
+
},
|
|
51
|
+
get PathwayExecutionResult$1 () {
|
|
52
|
+
return PathwayExecutionResult$1;
|
|
53
|
+
},
|
|
54
|
+
get PathwayExecutionResult$1_$reflection () {
|
|
55
|
+
return PathwayExecutionResult$1_$reflection;
|
|
56
|
+
},
|
|
57
|
+
get PredictedPathway () {
|
|
58
|
+
return PredictedPathway;
|
|
59
|
+
},
|
|
60
|
+
get PredictedPathway_$reflection () {
|
|
61
|
+
return PredictedPathway_$reflection;
|
|
62
|
+
},
|
|
63
|
+
get TransitionStatus () {
|
|
64
|
+
return TransitionStatus;
|
|
65
|
+
},
|
|
66
|
+
get TransitionStatus_$reflection () {
|
|
67
|
+
return TransitionStatus_$reflection;
|
|
68
|
+
},
|
|
69
|
+
get TransitionStatus_Failed () {
|
|
70
|
+
return TransitionStatus_Failed;
|
|
71
|
+
},
|
|
72
|
+
get TransitionStatus_Pending () {
|
|
73
|
+
return TransitionStatus_Pending;
|
|
74
|
+
},
|
|
75
|
+
get TransitionStatus_Satisfied () {
|
|
76
|
+
return TransitionStatus_Satisfied;
|
|
77
|
+
},
|
|
78
|
+
get VisualizationState () {
|
|
79
|
+
return VisualizationState;
|
|
80
|
+
},
|
|
81
|
+
get VisualizationState_$reflection () {
|
|
82
|
+
return VisualizationState_$reflection;
|
|
83
|
+
},
|
|
84
|
+
get calculateCompletionPercentage () {
|
|
85
|
+
return calculateCompletionPercentage;
|
|
86
|
+
},
|
|
87
|
+
get calculateProbability () {
|
|
88
|
+
return calculateProbability;
|
|
89
|
+
},
|
|
90
|
+
get categorizeTransitions () {
|
|
91
|
+
return categorizeTransitions;
|
|
92
|
+
},
|
|
93
|
+
get evaluateAllTransitions () {
|
|
94
|
+
return evaluateAllTransitions;
|
|
95
|
+
},
|
|
96
|
+
get evaluateFieldCondition () {
|
|
97
|
+
return evaluateFieldCondition;
|
|
98
|
+
},
|
|
99
|
+
get evaluateFieldConditionWithConditionValue () {
|
|
100
|
+
return evaluateFieldConditionWithConditionValue;
|
|
101
|
+
},
|
|
102
|
+
get evaluateTransitionWithPartialData () {
|
|
103
|
+
return evaluateTransitionWithPartialData;
|
|
104
|
+
},
|
|
105
|
+
get executeAction () {
|
|
106
|
+
return executeAction;
|
|
107
|
+
},
|
|
108
|
+
get executeActions () {
|
|
109
|
+
return executeActions;
|
|
110
|
+
},
|
|
111
|
+
get executeIncremental () {
|
|
112
|
+
return executeIncremental;
|
|
113
|
+
},
|
|
114
|
+
get executeSetFieldValueAction () {
|
|
115
|
+
return executeSetFieldValueAction;
|
|
116
|
+
},
|
|
117
|
+
get executeStep () {
|
|
118
|
+
return executeStep;
|
|
119
|
+
},
|
|
120
|
+
get extractActionsFromState () {
|
|
121
|
+
return extractActionsFromState;
|
|
122
|
+
},
|
|
123
|
+
get extractClinicalPlans () {
|
|
124
|
+
return extractClinicalPlans;
|
|
125
|
+
},
|
|
126
|
+
get findState () {
|
|
127
|
+
return findState;
|
|
128
|
+
},
|
|
129
|
+
get getVisualizationState () {
|
|
130
|
+
return getVisualizationState;
|
|
131
|
+
},
|
|
132
|
+
get initializeExecution () {
|
|
133
|
+
return initializeExecution;
|
|
134
|
+
},
|
|
135
|
+
get isExecutionComplete () {
|
|
136
|
+
return isExecutionComplete;
|
|
137
|
+
},
|
|
138
|
+
get isTerminalState () {
|
|
139
|
+
return isTerminalState;
|
|
140
|
+
},
|
|
141
|
+
get predictOutcomes () {
|
|
142
|
+
return predictOutcomes;
|
|
143
|
+
},
|
|
144
|
+
get resolveFieldValueSource () {
|
|
145
|
+
return resolveFieldValueSource;
|
|
146
|
+
},
|
|
147
|
+
get selectTransitionsByMode () {
|
|
148
|
+
return selectTransitionsByMode;
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
const _Types = require("@fable-org/fable-library-js/Types.js");
|
|
152
|
+
const _List = require("@fable-org/fable-library-js/List.js");
|
|
153
|
+
const _Reflection = require("@fable-org/fable-library-js/Reflection.js");
|
|
154
|
+
const _FormSpec = require("./FormSpec.js");
|
|
155
|
+
const _Util = require("@fable-org/fable-library-js/Util.js");
|
|
156
|
+
const _Set = require("@fable-org/fable-library-js/Set.js");
|
|
157
|
+
const _Array = require("@fable-org/fable-library-js/Array.js");
|
|
158
|
+
const _BitConverter = require("@fable-org/fable-library-js/BitConverter.js");
|
|
159
|
+
const _Guid = require("@fable-org/fable-library-js/Guid.js");
|
|
160
|
+
const _Map = require("@fable-org/fable-library-js/Map.js");
|
|
161
|
+
const _Option = require("@fable-org/fable-library-js/Option.js");
|
|
162
|
+
const _Seq = require("@fable-org/fable-library-js/Seq.js");
|
|
163
|
+
const _String = require("@fable-org/fable-library-js/String.js");
|
|
164
|
+
const _Encodefs = require("./fable_modules/Thoth.Json.10.4.1/Encode.fs.js");
|
|
165
|
+
const _Double = require("@fable-org/fable-library-js/Double.js");
|
|
166
|
+
const _RegExp = require("@fable-org/fable-library-js/RegExp.js");
|
|
167
|
+
const _Date = require("@fable-org/fable-library-js/Date.js");
|
|
168
|
+
function TransitionStatus_Satisfied() {
|
|
169
|
+
return new TransitionStatus(0, []);
|
|
170
|
+
}
|
|
171
|
+
function TransitionStatus_Failed() {
|
|
172
|
+
return new TransitionStatus(1, []);
|
|
173
|
+
}
|
|
174
|
+
function TransitionStatus_Pending(missingFields) {
|
|
175
|
+
return new TransitionStatus(2, [
|
|
176
|
+
missingFields
|
|
177
|
+
]);
|
|
178
|
+
}
|
|
179
|
+
class TransitionStatus extends _Types.Union {
|
|
180
|
+
cases() {
|
|
181
|
+
return [
|
|
182
|
+
"Satisfied",
|
|
183
|
+
"Failed",
|
|
184
|
+
"Pending"
|
|
185
|
+
];
|
|
186
|
+
}
|
|
187
|
+
constructor(tag, fields){
|
|
188
|
+
super(), this.tag = tag, this.fields = fields;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function TransitionStatus_$reflection() {
|
|
192
|
+
return (0, _Reflection.union_type)("F1.Studio.PathwayExecutor.TransitionStatus", [], TransitionStatus, ()=>[
|
|
193
|
+
[],
|
|
194
|
+
[],
|
|
195
|
+
[
|
|
196
|
+
[
|
|
197
|
+
"missingFields",
|
|
198
|
+
(0, _Reflection.list_type)(_Reflection.string_type)
|
|
199
|
+
]
|
|
200
|
+
]
|
|
201
|
+
]);
|
|
202
|
+
}
|
|
203
|
+
class MatchedTransition extends _Types.Record {
|
|
204
|
+
constructor(Transition, Priority, Status){
|
|
205
|
+
super();
|
|
206
|
+
this.Transition = Transition;
|
|
207
|
+
this.Priority = Priority | 0;
|
|
208
|
+
this.Status = Status;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
function MatchedTransition_$reflection() {
|
|
212
|
+
return (0, _Reflection.record_type)("F1.Studio.PathwayExecutor.MatchedTransition", [], MatchedTransition, ()=>[
|
|
213
|
+
[
|
|
214
|
+
"Transition",
|
|
215
|
+
(0, _FormSpec.ClinicalPathway_TransitionDefinition_$reflection)()
|
|
216
|
+
],
|
|
217
|
+
[
|
|
218
|
+
"Priority",
|
|
219
|
+
_Reflection.int32_type
|
|
220
|
+
],
|
|
221
|
+
[
|
|
222
|
+
"Status",
|
|
223
|
+
TransitionStatus_$reflection()
|
|
224
|
+
]
|
|
225
|
+
]);
|
|
226
|
+
}
|
|
227
|
+
class ExecutionLogEntry extends _Types.Record {
|
|
228
|
+
constructor(Timestamp, StateKey, Action, Details){
|
|
229
|
+
super();
|
|
230
|
+
this.Timestamp = Timestamp;
|
|
231
|
+
this.StateKey = StateKey;
|
|
232
|
+
this.Action = Action;
|
|
233
|
+
this.Details = Details;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
function ExecutionLogEntry_$reflection() {
|
|
237
|
+
return (0, _Reflection.record_type)("F1.Studio.PathwayExecutor.ExecutionLogEntry", [], ExecutionLogEntry, ()=>[
|
|
238
|
+
[
|
|
239
|
+
"Timestamp",
|
|
240
|
+
(0, _Reflection.class_type)("System.DateTime")
|
|
241
|
+
],
|
|
242
|
+
[
|
|
243
|
+
"StateKey",
|
|
244
|
+
(0, _FormSpec.Shared_StateKey_$reflection)()
|
|
245
|
+
],
|
|
246
|
+
[
|
|
247
|
+
"Action",
|
|
248
|
+
_Reflection.string_type
|
|
249
|
+
],
|
|
250
|
+
[
|
|
251
|
+
"Details",
|
|
252
|
+
_Reflection.string_type
|
|
253
|
+
]
|
|
254
|
+
]);
|
|
255
|
+
}
|
|
256
|
+
class ExecutionContext$1 extends _Types.Record {
|
|
257
|
+
constructor(PathwaySpec, FormSpec, CurrentStates, VisitedStates, CompletedStates, ActiveTransitions, PendingTransitions, ExecutedActions, FormData, FieldResolver, ExecutionLog){
|
|
258
|
+
super();
|
|
259
|
+
this.PathwaySpec = PathwaySpec;
|
|
260
|
+
this.FormSpec = FormSpec;
|
|
261
|
+
this.CurrentStates = CurrentStates;
|
|
262
|
+
this.VisitedStates = VisitedStates;
|
|
263
|
+
this.CompletedStates = CompletedStates;
|
|
264
|
+
this.ActiveTransitions = ActiveTransitions;
|
|
265
|
+
this.PendingTransitions = PendingTransitions;
|
|
266
|
+
this.ExecutedActions = ExecutedActions;
|
|
267
|
+
this.FormData = FormData;
|
|
268
|
+
this.FieldResolver = FieldResolver;
|
|
269
|
+
this.ExecutionLog = ExecutionLog;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function ExecutionContext$1_$reflection(gen0) {
|
|
273
|
+
return (0, _Reflection.record_type)("F1.Studio.PathwayExecutor.ExecutionContext`1", [
|
|
274
|
+
gen0
|
|
275
|
+
], ExecutionContext$1, ()=>[
|
|
276
|
+
[
|
|
277
|
+
"PathwaySpec",
|
|
278
|
+
(0, _FormSpec.ClinicalPathway_ClinicalPathwaySpec_$reflection)()
|
|
279
|
+
],
|
|
280
|
+
[
|
|
281
|
+
"FormSpec",
|
|
282
|
+
(0, _FormSpec.Spec_FormSpec$1_$reflection)(gen0)
|
|
283
|
+
],
|
|
284
|
+
[
|
|
285
|
+
"CurrentStates",
|
|
286
|
+
(0, _Reflection.class_type)("Microsoft.FSharp.Collections.FSharpSet`1", [
|
|
287
|
+
(0, _FormSpec.Shared_StateKey_$reflection)()
|
|
288
|
+
])
|
|
289
|
+
],
|
|
290
|
+
[
|
|
291
|
+
"VisitedStates",
|
|
292
|
+
(0, _Reflection.class_type)("Microsoft.FSharp.Collections.FSharpSet`1", [
|
|
293
|
+
(0, _FormSpec.Shared_StateKey_$reflection)()
|
|
294
|
+
])
|
|
295
|
+
],
|
|
296
|
+
[
|
|
297
|
+
"CompletedStates",
|
|
298
|
+
(0, _Reflection.class_type)("Microsoft.FSharp.Collections.FSharpSet`1", [
|
|
299
|
+
(0, _FormSpec.Shared_StateKey_$reflection)()
|
|
300
|
+
])
|
|
301
|
+
],
|
|
302
|
+
[
|
|
303
|
+
"ActiveTransitions",
|
|
304
|
+
(0, _Reflection.list_type)(MatchedTransition_$reflection())
|
|
305
|
+
],
|
|
306
|
+
[
|
|
307
|
+
"PendingTransitions",
|
|
308
|
+
(0, _Reflection.list_type)(MatchedTransition_$reflection())
|
|
309
|
+
],
|
|
310
|
+
[
|
|
311
|
+
"ExecutedActions",
|
|
312
|
+
(0, _Reflection.list_type)((0, _FormSpec.ClinicalPathway_ActionInfo_$reflection)())
|
|
313
|
+
],
|
|
314
|
+
[
|
|
315
|
+
"FormData",
|
|
316
|
+
(0, _FormSpec.Values_DynamicFormResultData$1_$reflection)(gen0)
|
|
317
|
+
],
|
|
318
|
+
[
|
|
319
|
+
"FieldResolver",
|
|
320
|
+
(0, _Reflection.lambda_type)(_Reflection.string_type, (0, _FormSpec.Shared_FieldKey_$reflection)())
|
|
321
|
+
],
|
|
322
|
+
[
|
|
323
|
+
"ExecutionLog",
|
|
324
|
+
(0, _Reflection.list_type)(ExecutionLogEntry_$reflection())
|
|
325
|
+
]
|
|
326
|
+
]);
|
|
327
|
+
}
|
|
328
|
+
class PredictedPathway extends _Types.Record {
|
|
329
|
+
constructor(PathwayId, Probability, RequiredFields, ExpectedActions, TargetState){
|
|
330
|
+
super();
|
|
331
|
+
this.PathwayId = PathwayId;
|
|
332
|
+
this.Probability = Probability;
|
|
333
|
+
this.RequiredFields = RequiredFields;
|
|
334
|
+
this.ExpectedActions = ExpectedActions;
|
|
335
|
+
this.TargetState = TargetState;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
function PredictedPathway_$reflection() {
|
|
339
|
+
return (0, _Reflection.record_type)("F1.Studio.PathwayExecutor.PredictedPathway", [], PredictedPathway, ()=>[
|
|
340
|
+
[
|
|
341
|
+
"PathwayId",
|
|
342
|
+
_Reflection.string_type
|
|
343
|
+
],
|
|
344
|
+
[
|
|
345
|
+
"Probability",
|
|
346
|
+
_Reflection.float64_type
|
|
347
|
+
],
|
|
348
|
+
[
|
|
349
|
+
"RequiredFields",
|
|
350
|
+
(0, _Reflection.list_type)(_Reflection.string_type)
|
|
351
|
+
],
|
|
352
|
+
[
|
|
353
|
+
"ExpectedActions",
|
|
354
|
+
(0, _Reflection.list_type)((0, _FormSpec.ClinicalPathway_ActionInfo_$reflection)())
|
|
355
|
+
],
|
|
356
|
+
[
|
|
357
|
+
"TargetState",
|
|
358
|
+
_Reflection.string_type
|
|
359
|
+
]
|
|
360
|
+
]);
|
|
361
|
+
}
|
|
362
|
+
class IncrementalExecutionResult$1 extends _Types.Record {
|
|
363
|
+
constructor(Context, NewlyActivatedStates, NewlyActiveTransitions, PredictedOutcomes, CompletionPercentage, IsComplete){
|
|
364
|
+
super();
|
|
365
|
+
this.Context = Context;
|
|
366
|
+
this.NewlyActivatedStates = NewlyActivatedStates;
|
|
367
|
+
this.NewlyActiveTransitions = NewlyActiveTransitions;
|
|
368
|
+
this.PredictedOutcomes = PredictedOutcomes;
|
|
369
|
+
this.CompletionPercentage = CompletionPercentage;
|
|
370
|
+
this.IsComplete = IsComplete;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
function IncrementalExecutionResult$1_$reflection(gen0) {
|
|
374
|
+
return (0, _Reflection.record_type)("F1.Studio.PathwayExecutor.IncrementalExecutionResult`1", [
|
|
375
|
+
gen0
|
|
376
|
+
], IncrementalExecutionResult$1, ()=>[
|
|
377
|
+
[
|
|
378
|
+
"Context",
|
|
379
|
+
ExecutionContext$1_$reflection(gen0)
|
|
380
|
+
],
|
|
381
|
+
[
|
|
382
|
+
"NewlyActivatedStates",
|
|
383
|
+
(0, _Reflection.list_type)(_Reflection.string_type)
|
|
384
|
+
],
|
|
385
|
+
[
|
|
386
|
+
"NewlyActiveTransitions",
|
|
387
|
+
(0, _Reflection.list_type)((0, _FormSpec.ClinicalPathway_TransitionDefinition_$reflection)())
|
|
388
|
+
],
|
|
389
|
+
[
|
|
390
|
+
"PredictedOutcomes",
|
|
391
|
+
(0, _Reflection.list_type)(PredictedPathway_$reflection())
|
|
392
|
+
],
|
|
393
|
+
[
|
|
394
|
+
"CompletionPercentage",
|
|
395
|
+
_Reflection.float64_type
|
|
396
|
+
],
|
|
397
|
+
[
|
|
398
|
+
"IsComplete",
|
|
399
|
+
_Reflection.bool_type
|
|
400
|
+
]
|
|
401
|
+
]);
|
|
402
|
+
}
|
|
403
|
+
class ClinicalPlan extends _Types.Record {
|
|
404
|
+
constructor(PlanId, Actions, TargetState, Priority){
|
|
405
|
+
super();
|
|
406
|
+
this.PlanId = PlanId;
|
|
407
|
+
this.Actions = Actions;
|
|
408
|
+
this.TargetState = TargetState;
|
|
409
|
+
this.Priority = Priority | 0;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
function ClinicalPlan_$reflection() {
|
|
413
|
+
return (0, _Reflection.record_type)("F1.Studio.PathwayExecutor.ClinicalPlan", [], ClinicalPlan, ()=>[
|
|
414
|
+
[
|
|
415
|
+
"PlanId",
|
|
416
|
+
_Reflection.string_type
|
|
417
|
+
],
|
|
418
|
+
[
|
|
419
|
+
"Actions",
|
|
420
|
+
(0, _Reflection.list_type)((0, _FormSpec.ClinicalPathway_ActionInfo_$reflection)())
|
|
421
|
+
],
|
|
422
|
+
[
|
|
423
|
+
"TargetState",
|
|
424
|
+
_Reflection.string_type
|
|
425
|
+
],
|
|
426
|
+
[
|
|
427
|
+
"Priority",
|
|
428
|
+
_Reflection.int32_type
|
|
429
|
+
]
|
|
430
|
+
]);
|
|
431
|
+
}
|
|
432
|
+
class VisualizationState extends _Types.Record {
|
|
433
|
+
constructor(CurrentStates, VisitedStates, ActiveTransitions, PendingTransitions, CompletedTransitions, PredictedOutcomes){
|
|
434
|
+
super();
|
|
435
|
+
this.CurrentStates = CurrentStates;
|
|
436
|
+
this.VisitedStates = VisitedStates;
|
|
437
|
+
this.ActiveTransitions = ActiveTransitions;
|
|
438
|
+
this.PendingTransitions = PendingTransitions;
|
|
439
|
+
this.CompletedTransitions = CompletedTransitions;
|
|
440
|
+
this.PredictedOutcomes = PredictedOutcomes;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
function VisualizationState_$reflection() {
|
|
444
|
+
return (0, _Reflection.record_type)("F1.Studio.PathwayExecutor.VisualizationState", [], VisualizationState, ()=>[
|
|
445
|
+
[
|
|
446
|
+
"CurrentStates",
|
|
447
|
+
(0, _Reflection.class_type)("Microsoft.FSharp.Collections.FSharpSet`1", [
|
|
448
|
+
(0, _FormSpec.Shared_StateKey_$reflection)()
|
|
449
|
+
])
|
|
450
|
+
],
|
|
451
|
+
[
|
|
452
|
+
"VisitedStates",
|
|
453
|
+
(0, _Reflection.class_type)("Microsoft.FSharp.Collections.FSharpSet`1", [
|
|
454
|
+
(0, _FormSpec.Shared_StateKey_$reflection)()
|
|
455
|
+
])
|
|
456
|
+
],
|
|
457
|
+
[
|
|
458
|
+
"ActiveTransitions",
|
|
459
|
+
(0, _Reflection.list_type)((0, _FormSpec.Shared_TransitionKey_$reflection)())
|
|
460
|
+
],
|
|
461
|
+
[
|
|
462
|
+
"PendingTransitions",
|
|
463
|
+
(0, _Reflection.list_type)((0, _FormSpec.Shared_TransitionKey_$reflection)())
|
|
464
|
+
],
|
|
465
|
+
[
|
|
466
|
+
"CompletedTransitions",
|
|
467
|
+
(0, _Reflection.list_type)(_Reflection.string_type)
|
|
468
|
+
],
|
|
469
|
+
[
|
|
470
|
+
"PredictedOutcomes",
|
|
471
|
+
(0, _Reflection.list_type)(PredictedPathway_$reflection())
|
|
472
|
+
]
|
|
473
|
+
]);
|
|
474
|
+
}
|
|
475
|
+
function FieldResolver_generateFieldKey(fieldName) {
|
|
476
|
+
const hash = (0, _Util.stringHash)(fieldName) | 0;
|
|
477
|
+
const bytes = (0, _Array.fill)(new Array(16), 0, 16, 0);
|
|
478
|
+
(0, _Array.iterateIndexed)((i, b)=>{
|
|
479
|
+
if (i < 4) {
|
|
480
|
+
(0, _Array.setItem)(bytes, i, b);
|
|
481
|
+
}
|
|
482
|
+
}, Array.from((0, _BitConverter.getBytesInt32)(hash)));
|
|
483
|
+
(0, _Array.iterateIndexed)((i_1, b_1)=>{
|
|
484
|
+
if (i_1 < 4) {
|
|
485
|
+
(0, _Array.setItem)(bytes, i_1 + 4, b_1);
|
|
486
|
+
}
|
|
487
|
+
}, Array.from((0, _BitConverter.getBytesInt32)(hash >> 1)));
|
|
488
|
+
(0, _Array.iterateIndexed)((i_2, b_2)=>{
|
|
489
|
+
if (i_2 < 4) {
|
|
490
|
+
(0, _Array.setItem)(bytes, i_2 + 8, b_2);
|
|
491
|
+
}
|
|
492
|
+
}, Array.from((0, _BitConverter.getBytesInt32)(hash >> 2)));
|
|
493
|
+
(0, _Array.iterateIndexed)((i_3, b_3)=>{
|
|
494
|
+
if (i_3 < 4) {
|
|
495
|
+
(0, _Array.setItem)(bytes, i_3 + 12, b_3);
|
|
496
|
+
}
|
|
497
|
+
}, Array.from((0, _BitConverter.getBytesInt32)(hash >> 3)));
|
|
498
|
+
return new _FormSpec.Shared_FieldKey((0, _Guid.arrayToGuid)(bytes));
|
|
499
|
+
}
|
|
500
|
+
function FieldResolver_createResolver(formSpec) {
|
|
501
|
+
const labelToFieldKey = (0, _Map.ofList)((0, _List.map)((field)=>[
|
|
502
|
+
field.Label.toLocaleLowerCase().trim(),
|
|
503
|
+
field.FieldKey
|
|
504
|
+
], (0, _List.collect)((step)=>step.Fields, formSpec.Steps)), {
|
|
505
|
+
Compare: _Util.comparePrimitives
|
|
506
|
+
});
|
|
507
|
+
return (fieldReference)=>{
|
|
508
|
+
const matchValue = (0, _Map.tryFind)(fieldReference.toLocaleLowerCase().trim(), labelToFieldKey);
|
|
509
|
+
return matchValue == null ? FieldResolver_generateFieldKey(fieldReference) : (0, _Option.value)(matchValue);
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
function FieldResolver_extractFieldValues(resolver, formData) {
|
|
513
|
+
return (0, _Map.ofSeq)((0, _Seq.collect)((tupledArg)=>(0, _Seq.map)((tupledArg_1)=>{
|
|
514
|
+
let matchValue, pluginData;
|
|
515
|
+
return [
|
|
516
|
+
tupledArg_1[0],
|
|
517
|
+
(matchValue = tupledArg_1[1].FieldValue, matchValue.tag === /* Multiple */ 1 ? (0, _String.join)(",", (0, _Set.toList)((0, _Set.map)((a)=>a.Value, matchValue.fields[0], {
|
|
518
|
+
Compare: _Util.comparePrimitives
|
|
519
|
+
}))) : matchValue.tag === /* Matrix */ 2 ? (0, _String.join)(",", (0, _List.map)((tupledArg_2)=>tupledArg_2[1], (0, _Map.toList)(matchValue.fields[0].Values))) : matchValue.tag === /* PluginData */ 3 ? (pluginData = matchValue.fields[0], (0, _Encodefs.toString)(0, (0, _Encodefs.Auto_generateBoxedEncoder_437914C6)((0, _Reflection.list_type)((0, _FormSpec.Shared_PluginDataProperty_$reflection)()), undefined, undefined, undefined)(pluginData))) : matchValue.fields[0].Value)
|
|
520
|
+
];
|
|
521
|
+
}, (0, _Map.toSeq)(tupledArg[1])), (0, _Map.toSeq)(formData.ResultSteps)), {
|
|
522
|
+
Compare: _Util.compare
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
function evaluateFieldCondition(actualValue, evaluator, expectedValue) {
|
|
526
|
+
switch(evaluator.tag){
|
|
527
|
+
case /* NotEquals */ 1:
|
|
528
|
+
return actualValue.trim().toLocaleLowerCase() !== expectedValue.trim().toLocaleLowerCase();
|
|
529
|
+
case /* GreaterThan */ 5:
|
|
530
|
+
{
|
|
531
|
+
let matchValue;
|
|
532
|
+
let outArg = 0;
|
|
533
|
+
matchValue = [
|
|
534
|
+
(0, _Double.tryParse)(actualValue, new _Types.FSharpRef(()=>outArg, (v)=>{
|
|
535
|
+
outArg = v;
|
|
536
|
+
})),
|
|
537
|
+
outArg
|
|
538
|
+
];
|
|
539
|
+
let matchValue_1;
|
|
540
|
+
let outArg_1 = 0;
|
|
541
|
+
matchValue_1 = [
|
|
542
|
+
(0, _Double.tryParse)(expectedValue, new _Types.FSharpRef(()=>outArg_1, (v_1)=>{
|
|
543
|
+
outArg_1 = v_1;
|
|
544
|
+
})),
|
|
545
|
+
outArg_1
|
|
546
|
+
];
|
|
547
|
+
let matchResult;
|
|
548
|
+
if (matchValue[0]) {
|
|
549
|
+
if (matchValue_1[0]) {
|
|
550
|
+
matchResult = 0;
|
|
551
|
+
} else {
|
|
552
|
+
matchResult = 1;
|
|
553
|
+
}
|
|
554
|
+
} else {
|
|
555
|
+
matchResult = 1;
|
|
556
|
+
}
|
|
557
|
+
switch(matchResult){
|
|
558
|
+
case 0:
|
|
559
|
+
return matchValue[1] > matchValue_1[1];
|
|
560
|
+
default:
|
|
561
|
+
return false;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
case /* GreaterOrEqual */ 6:
|
|
565
|
+
{
|
|
566
|
+
let matchValue_3;
|
|
567
|
+
let outArg_2 = 0;
|
|
568
|
+
matchValue_3 = [
|
|
569
|
+
(0, _Double.tryParse)(actualValue, new _Types.FSharpRef(()=>outArg_2, (v_2)=>{
|
|
570
|
+
outArg_2 = v_2;
|
|
571
|
+
})),
|
|
572
|
+
outArg_2
|
|
573
|
+
];
|
|
574
|
+
let matchValue_4;
|
|
575
|
+
let outArg_3 = 0;
|
|
576
|
+
matchValue_4 = [
|
|
577
|
+
(0, _Double.tryParse)(expectedValue, new _Types.FSharpRef(()=>outArg_3, (v_3)=>{
|
|
578
|
+
outArg_3 = v_3;
|
|
579
|
+
})),
|
|
580
|
+
outArg_3
|
|
581
|
+
];
|
|
582
|
+
let matchResult_1;
|
|
583
|
+
if (matchValue_3[0]) {
|
|
584
|
+
if (matchValue_4[0]) {
|
|
585
|
+
matchResult_1 = 0;
|
|
586
|
+
} else {
|
|
587
|
+
matchResult_1 = 1;
|
|
588
|
+
}
|
|
589
|
+
} else {
|
|
590
|
+
matchResult_1 = 1;
|
|
591
|
+
}
|
|
592
|
+
switch(matchResult_1){
|
|
593
|
+
case 0:
|
|
594
|
+
return matchValue_3[1] >= matchValue_4[1];
|
|
595
|
+
default:
|
|
596
|
+
return false;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
case /* LessThan */ 7:
|
|
600
|
+
{
|
|
601
|
+
let matchValue_6;
|
|
602
|
+
let outArg_4 = 0;
|
|
603
|
+
matchValue_6 = [
|
|
604
|
+
(0, _Double.tryParse)(actualValue, new _Types.FSharpRef(()=>outArg_4, (v_4)=>{
|
|
605
|
+
outArg_4 = v_4;
|
|
606
|
+
})),
|
|
607
|
+
outArg_4
|
|
608
|
+
];
|
|
609
|
+
let matchValue_7;
|
|
610
|
+
let outArg_5 = 0;
|
|
611
|
+
matchValue_7 = [
|
|
612
|
+
(0, _Double.tryParse)(expectedValue, new _Types.FSharpRef(()=>outArg_5, (v_5)=>{
|
|
613
|
+
outArg_5 = v_5;
|
|
614
|
+
})),
|
|
615
|
+
outArg_5
|
|
616
|
+
];
|
|
617
|
+
let matchResult_2;
|
|
618
|
+
if (matchValue_6[0]) {
|
|
619
|
+
if (matchValue_7[0]) {
|
|
620
|
+
matchResult_2 = 0;
|
|
621
|
+
} else {
|
|
622
|
+
matchResult_2 = 1;
|
|
623
|
+
}
|
|
624
|
+
} else {
|
|
625
|
+
matchResult_2 = 1;
|
|
626
|
+
}
|
|
627
|
+
switch(matchResult_2){
|
|
628
|
+
case 0:
|
|
629
|
+
return matchValue_6[1] < matchValue_7[1];
|
|
630
|
+
default:
|
|
631
|
+
return false;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
case /* LessOrEqual */ 8:
|
|
635
|
+
{
|
|
636
|
+
let matchValue_9;
|
|
637
|
+
let outArg_6 = 0;
|
|
638
|
+
matchValue_9 = [
|
|
639
|
+
(0, _Double.tryParse)(actualValue, new _Types.FSharpRef(()=>outArg_6, (v_6)=>{
|
|
640
|
+
outArg_6 = v_6;
|
|
641
|
+
})),
|
|
642
|
+
outArg_6
|
|
643
|
+
];
|
|
644
|
+
let matchValue_10;
|
|
645
|
+
let outArg_7 = 0;
|
|
646
|
+
matchValue_10 = [
|
|
647
|
+
(0, _Double.tryParse)(expectedValue, new _Types.FSharpRef(()=>outArg_7, (v_7)=>{
|
|
648
|
+
outArg_7 = v_7;
|
|
649
|
+
})),
|
|
650
|
+
outArg_7
|
|
651
|
+
];
|
|
652
|
+
let matchResult_3;
|
|
653
|
+
if (matchValue_9[0]) {
|
|
654
|
+
if (matchValue_10[0]) {
|
|
655
|
+
matchResult_3 = 0;
|
|
656
|
+
} else {
|
|
657
|
+
matchResult_3 = 1;
|
|
658
|
+
}
|
|
659
|
+
} else {
|
|
660
|
+
matchResult_3 = 1;
|
|
661
|
+
}
|
|
662
|
+
switch(matchResult_3){
|
|
663
|
+
case 0:
|
|
664
|
+
return matchValue_9[1] <= matchValue_10[1];
|
|
665
|
+
default:
|
|
666
|
+
return false;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
case /* Contains */ 9:
|
|
670
|
+
return actualValue.toLocaleLowerCase().indexOf(expectedValue.toLocaleLowerCase()) >= 0;
|
|
671
|
+
case /* IsPresent */ 10:
|
|
672
|
+
if (!(0, _String.isNullOrWhiteSpace)(actualValue) && actualValue.toLocaleLowerCase() !== "false") {
|
|
673
|
+
return actualValue.toLocaleLowerCase() !== "no";
|
|
674
|
+
} else {
|
|
675
|
+
return false;
|
|
676
|
+
}
|
|
677
|
+
case /* IsAbsent */ 11:
|
|
678
|
+
if ((0, _String.isNullOrWhiteSpace)(actualValue) ? true : actualValue.toLocaleLowerCase() === "false") {
|
|
679
|
+
return true;
|
|
680
|
+
} else {
|
|
681
|
+
return actualValue.toLocaleLowerCase() === "no";
|
|
682
|
+
}
|
|
683
|
+
case /* MatchesPattern */ 12:
|
|
684
|
+
return (0, _RegExp.isMatch)((0, _RegExp.create)(evaluator.fields[0]), actualValue);
|
|
685
|
+
case /* InRange */ 13:
|
|
686
|
+
{
|
|
687
|
+
const minVal = evaluator.fields[0] | 0;
|
|
688
|
+
const maxVal = evaluator.fields[1] | 0;
|
|
689
|
+
let matchValue_12;
|
|
690
|
+
let outArg_8 = 0;
|
|
691
|
+
matchValue_12 = [
|
|
692
|
+
(0, _Double.tryParse)(actualValue, new _Types.FSharpRef(()=>outArg_8, (v_8)=>{
|
|
693
|
+
outArg_8 = v_8;
|
|
694
|
+
})),
|
|
695
|
+
outArg_8
|
|
696
|
+
];
|
|
697
|
+
if (matchValue_12[0]) {
|
|
698
|
+
const actual_4 = matchValue_12[1];
|
|
699
|
+
if (actual_4 >= minVal) {
|
|
700
|
+
return actual_4 <= maxVal;
|
|
701
|
+
} else {
|
|
702
|
+
return false;
|
|
703
|
+
}
|
|
704
|
+
} else {
|
|
705
|
+
return false;
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
case /* InSet */ 2:
|
|
709
|
+
return (0, _List.exists)((v_9)=>v_9.trim().toLocaleLowerCase() === actualValue.trim().toLocaleLowerCase(), evaluator.fields[0]);
|
|
710
|
+
case /* NotInSet */ 3:
|
|
711
|
+
return !(0, _List.exists)((v_10)=>v_10.trim().toLocaleLowerCase() === actualValue.trim().toLocaleLowerCase(), evaluator.fields[0]);
|
|
712
|
+
case /* ContainsAll */ 4:
|
|
713
|
+
{
|
|
714
|
+
const values_2 = evaluator.fields[0];
|
|
715
|
+
const actualParts = (0, _Set.ofArray)((0, _Array.map)((s)=>s.trim().toLocaleLowerCase(), actualValue.split(",")), {
|
|
716
|
+
Compare: _Util.comparePrimitives
|
|
717
|
+
});
|
|
718
|
+
return (0, _Set.isSubset)((0, _Set.ofList)((0, _List.map)((s_1)=>s_1.trim().toLocaleLowerCase(), values_2), {
|
|
719
|
+
Compare: _Util.comparePrimitives
|
|
720
|
+
}), actualParts);
|
|
721
|
+
}
|
|
722
|
+
default:
|
|
723
|
+
return actualValue.trim().toLocaleLowerCase() === expectedValue.trim().toLocaleLowerCase();
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
function evaluateFieldConditionWithConditionValue(actualFieldValue, evaluator, expectedConditionValue) {
|
|
727
|
+
let pluginData, pluginData_1;
|
|
728
|
+
return evaluateFieldCondition(actualFieldValue.tag === /* Multiple */ 1 ? (0, _String.join)(",", (0, _Set.toList)((0, _Set.map)((a)=>a.Value, actualFieldValue.fields[0], {
|
|
729
|
+
Compare: _Util.comparePrimitives
|
|
730
|
+
}))) : actualFieldValue.tag === /* Matrix */ 2 ? (0, _String.join)(",", (0, _List.map)((tupledArg)=>tupledArg[1], (0, _Map.toList)(actualFieldValue.fields[0].Values))) : actualFieldValue.tag === /* PluginData */ 3 ? (pluginData = actualFieldValue.fields[0], (0, _Encodefs.toString)(0, (0, _Encodefs.Auto_generateBoxedEncoder_437914C6)((0, _Reflection.list_type)((0, _FormSpec.Shared_PluginDataProperty_$reflection)()), undefined, undefined, undefined)(pluginData))) : actualFieldValue.fields[0].Value, evaluator, expectedConditionValue.tag === /* Multiple */ 1 ? (0, _String.join)(",", (0, _Set.toList)(expectedConditionValue.fields[0])) : expectedConditionValue.tag === /* Matrix */ 2 ? (0, _String.join)(",", (0, _List.map)((tupledArg_1)=>tupledArg_1[1], (0, _Map.toList)(expectedConditionValue.fields[0]))) : expectedConditionValue.tag === /* PluginData */ 3 ? (pluginData_1 = expectedConditionValue.fields[0], (0, _Encodefs.toString)(0, (0, _Encodefs.Auto_generateBoxedEncoder_437914C6)((0, _FormSpec.Shared_PluginDataProperty_$reflection)(), undefined, undefined, undefined)(pluginData_1))) : expectedConditionValue.fields[0]);
|
|
731
|
+
}
|
|
732
|
+
function evaluateTransitionWithPartialData(resolver, formSpec, fieldValues, visitedStates, condition) {
|
|
733
|
+
let pluginData, pluginData_1;
|
|
734
|
+
switch(condition.tag){
|
|
735
|
+
case /* FieldCondition */ 0:
|
|
736
|
+
{
|
|
737
|
+
const fieldKey = condition.fields[0];
|
|
738
|
+
const evaluator = condition.fields[1];
|
|
739
|
+
const conditionValue = condition.fields[2];
|
|
740
|
+
const matchValue = (0, _Map.tryFind)(fieldKey, fieldValues);
|
|
741
|
+
if (matchValue == null) {
|
|
742
|
+
return TransitionStatus_Pending((0, _List.singleton)(fieldKey.fields[0]));
|
|
743
|
+
} else if (evaluateFieldConditionWithConditionValue((0, _FormSpec.Shared_FieldValue_Single)(new _FormSpec.Shared_FieldAnswer(fieldKey, "", (0, _Option.value)(matchValue))), evaluator, conditionValue)) {
|
|
744
|
+
return TransitionStatus_Satisfied();
|
|
745
|
+
} else {
|
|
746
|
+
return TransitionStatus_Failed();
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
case /* StateCondition */ 3:
|
|
750
|
+
{
|
|
751
|
+
const evaluator_1 = condition.fields[1];
|
|
752
|
+
const stateVisited = (0, _Set.contains)(condition.fields[0], visitedStates);
|
|
753
|
+
switch(evaluator_1.tag){
|
|
754
|
+
case /* HasValue */ 1:
|
|
755
|
+
if (stateVisited) {
|
|
756
|
+
return TransitionStatus_Satisfied();
|
|
757
|
+
} else {
|
|
758
|
+
return TransitionStatus_Failed();
|
|
759
|
+
}
|
|
760
|
+
case /* HasError */ 2:
|
|
761
|
+
return TransitionStatus_Failed();
|
|
762
|
+
case /* WasSkipped */ 3:
|
|
763
|
+
if (!stateVisited) {
|
|
764
|
+
return TransitionStatus_Satisfied();
|
|
765
|
+
} else {
|
|
766
|
+
return TransitionStatus_Failed();
|
|
767
|
+
}
|
|
768
|
+
default:
|
|
769
|
+
if (stateVisited) {
|
|
770
|
+
return TransitionStatus_Satisfied();
|
|
771
|
+
} else {
|
|
772
|
+
return TransitionStatus_Failed();
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
case /* CompositeCondition */ 4:
|
|
777
|
+
{
|
|
778
|
+
const logicalOp = condition.fields[0];
|
|
779
|
+
const conditions = condition.fields[1];
|
|
780
|
+
switch(logicalOp.tag){
|
|
781
|
+
case /* Or */ 1:
|
|
782
|
+
{
|
|
783
|
+
const results_1 = (0, _List.map)((condition_2)=>evaluateTransitionWithPartialData(resolver, formSpec, fieldValues, visitedStates, condition_2), conditions);
|
|
784
|
+
if ((0, _List.exists)((r_3)=>(0, _Util.equals)(r_3, TransitionStatus_Satisfied()), results_1)) {
|
|
785
|
+
return TransitionStatus_Satisfied();
|
|
786
|
+
} else if ((0, _List.forAll)((r_4)=>(0, _Util.equals)(r_4, TransitionStatus_Failed()), results_1)) {
|
|
787
|
+
return TransitionStatus_Failed();
|
|
788
|
+
} else {
|
|
789
|
+
return TransitionStatus_Pending((0, _List.concat)((0, _List.choose)((r_5)=>{
|
|
790
|
+
if (r_5.tag === /* Pending */ 2) {
|
|
791
|
+
return r_5.fields[0];
|
|
792
|
+
} else {
|
|
793
|
+
return undefined;
|
|
794
|
+
}
|
|
795
|
+
}, results_1)));
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
case /* Not */ 2:
|
|
799
|
+
{
|
|
800
|
+
let matchResult, cond;
|
|
801
|
+
if (!(0, _List.isEmpty)(conditions)) {
|
|
802
|
+
if ((0, _List.isEmpty)((0, _List.tail)(conditions))) {
|
|
803
|
+
matchResult = 0;
|
|
804
|
+
cond = (0, _List.head)(conditions);
|
|
805
|
+
} else {
|
|
806
|
+
matchResult = 1;
|
|
807
|
+
}
|
|
808
|
+
} else {
|
|
809
|
+
matchResult = 1;
|
|
810
|
+
}
|
|
811
|
+
switch(matchResult){
|
|
812
|
+
case 0:
|
|
813
|
+
{
|
|
814
|
+
const matchValue_1 = evaluateTransitionWithPartialData(resolver, formSpec, fieldValues, visitedStates, cond);
|
|
815
|
+
switch(matchValue_1.tag){
|
|
816
|
+
case /* Failed */ 1:
|
|
817
|
+
return TransitionStatus_Satisfied();
|
|
818
|
+
case /* Pending */ 2:
|
|
819
|
+
return TransitionStatus_Pending(matchValue_1.fields[0]);
|
|
820
|
+
default:
|
|
821
|
+
return TransitionStatus_Failed();
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
default:
|
|
825
|
+
return TransitionStatus_Failed();
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
default:
|
|
829
|
+
{
|
|
830
|
+
const results = (0, _List.map)((condition_1)=>evaluateTransitionWithPartialData(resolver, formSpec, fieldValues, visitedStates, condition_1), conditions);
|
|
831
|
+
if ((0, _List.exists)((r)=>(0, _Util.equals)(r, TransitionStatus_Failed()), results)) {
|
|
832
|
+
return TransitionStatus_Failed();
|
|
833
|
+
} else if ((0, _List.forAll)((r_1)=>(0, _Util.equals)(r_1, TransitionStatus_Satisfied()), results)) {
|
|
834
|
+
return TransitionStatus_Satisfied();
|
|
835
|
+
} else {
|
|
836
|
+
return TransitionStatus_Pending((0, _List.concat)((0, _List.choose)((r_2)=>{
|
|
837
|
+
if (r_2.tag === /* Pending */ 2) {
|
|
838
|
+
return r_2.fields[0];
|
|
839
|
+
} else {
|
|
840
|
+
return undefined;
|
|
841
|
+
}
|
|
842
|
+
}, results)));
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
case /* TestResultCondition */ 5:
|
|
848
|
+
{
|
|
849
|
+
const result = condition.fields[1];
|
|
850
|
+
return TransitionStatus_Pending((0, _List.singleton)(condition.fields[0]));
|
|
851
|
+
}
|
|
852
|
+
case /* FieldOptionCondition */ 1:
|
|
853
|
+
{
|
|
854
|
+
const optionKey = condition.fields[2];
|
|
855
|
+
const matrixItemKey = condition.fields[1];
|
|
856
|
+
const fieldKey_1 = condition.fields[0];
|
|
857
|
+
const evaluator_2 = condition.fields[3];
|
|
858
|
+
const conditionValue_1 = condition.fields[4];
|
|
859
|
+
const optionValueOpt = formSpec == null ? undefined : (0, _Option.bind)((field_1)=>{
|
|
860
|
+
const fieldType = field_1.FieldType;
|
|
861
|
+
return (0, _Option.map)((opt_1)=>opt_1.Value, (0, _List.tryFind)((opt)=>(0, _Util.equals)(opt.OptionKey, optionKey), fieldType.tag === /* SingleChoice */ 13 ? fieldType.fields[0].Options : fieldType.tag === /* Radio */ 12 ? fieldType.fields[0].Options : fieldType.tag === /* Dropdown */ 14 ? fieldType.fields[0].Options : fieldType.tag === /* MultiChoice */ 15 ? fieldType.fields[0].Options : fieldType.tag === /* CheckboxList */ 16 ? fieldType.fields[0].Options : (0, _List.empty)()));
|
|
862
|
+
}, (0, _List.tryFind)((field)=>(0, _Util.equals)(field.FieldKey, fieldKey_1), (0, _List.collect)((step)=>step.Fields, (0, _Option.value)(formSpec).Steps)));
|
|
863
|
+
const matchValue_2 = (0, _Map.tryFind)(fieldKey_1, fieldValues);
|
|
864
|
+
if (optionValueOpt == null) {
|
|
865
|
+
const guid_1 = optionKey.fields[0];
|
|
866
|
+
console.error((0, _Option.some)("[evaluateTransition] FieldOptionCondition: Could not find option in formSpec for optionKey:"), guid_1);
|
|
867
|
+
return TransitionStatus_Failed();
|
|
868
|
+
} else if (matchValue_2 == null) {
|
|
869
|
+
return TransitionStatus_Pending((0, _List.singleton)(fieldKey_1.fields[0]));
|
|
870
|
+
} else {
|
|
871
|
+
const actualValueStr_1 = (0, _Option.value)(matchValue_2);
|
|
872
|
+
const optionValue = (0, _Option.value)(optionValueOpt);
|
|
873
|
+
const actualValues = (0, _Set.ofArray)((0, _Array.map)((s)=>s.trim().toLocaleLowerCase(), actualValueStr_1.split(",")), {
|
|
874
|
+
Compare: _Util.comparePrimitives
|
|
875
|
+
});
|
|
876
|
+
const containsOption = (0, _Set.contains)(optionValue.trim().toLocaleLowerCase(), actualValues);
|
|
877
|
+
switch(evaluator_2.tag){
|
|
878
|
+
case /* Equals */ 0:
|
|
879
|
+
if (containsOption) {
|
|
880
|
+
return TransitionStatus_Satisfied();
|
|
881
|
+
} else {
|
|
882
|
+
return TransitionStatus_Failed();
|
|
883
|
+
}
|
|
884
|
+
case /* NotEquals */ 1:
|
|
885
|
+
if (!containsOption) {
|
|
886
|
+
return TransitionStatus_Satisfied();
|
|
887
|
+
} else {
|
|
888
|
+
return TransitionStatus_Failed();
|
|
889
|
+
}
|
|
890
|
+
case /* IsPresent */ 10:
|
|
891
|
+
if (containsOption) {
|
|
892
|
+
return TransitionStatus_Satisfied();
|
|
893
|
+
} else {
|
|
894
|
+
return TransitionStatus_Failed();
|
|
895
|
+
}
|
|
896
|
+
case /* IsAbsent */ 11:
|
|
897
|
+
if (!containsOption) {
|
|
898
|
+
return TransitionStatus_Satisfied();
|
|
899
|
+
} else {
|
|
900
|
+
return TransitionStatus_Failed();
|
|
901
|
+
}
|
|
902
|
+
default:
|
|
903
|
+
if (evaluateFieldCondition(actualValueStr_1, evaluator_2, conditionValue_1.tag === /* Multiple */ 1 ? (0, _String.join)(",", (0, _Set.toList)(conditionValue_1.fields[0])) : conditionValue_1.tag === /* Matrix */ 2 ? (0, _String.join)(",", (0, _List.map)((tupledArg)=>tupledArg[1], (0, _Map.toList)(conditionValue_1.fields[0]))) : conditionValue_1.tag === /* PluginData */ 3 ? (pluginData = conditionValue_1.fields[0], (0, _Encodefs.toString)(0, (0, _Encodefs.Auto_generateBoxedEncoder_437914C6)((0, _FormSpec.Shared_PluginDataProperty_$reflection)(), undefined, undefined, undefined)(pluginData))) : conditionValue_1.fields[0])) {
|
|
904
|
+
return TransitionStatus_Satisfied();
|
|
905
|
+
} else {
|
|
906
|
+
return TransitionStatus_Failed();
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
case /* PluginPropertyCondition */ 2:
|
|
912
|
+
{
|
|
913
|
+
const propertyKey = condition.fields[1];
|
|
914
|
+
const fieldKey_2 = condition.fields[0];
|
|
915
|
+
const evaluator_3 = condition.fields[2];
|
|
916
|
+
const conditionValue_2 = condition.fields[3];
|
|
917
|
+
const matchValue_4 = (0, _Map.tryFind)(fieldKey_2, fieldValues);
|
|
918
|
+
if (matchValue_4 == null) {
|
|
919
|
+
return TransitionStatus_Pending((0, _List.singleton)(fieldKey_2.fields[0]));
|
|
920
|
+
} else {
|
|
921
|
+
const actualValueStr_2 = (0, _Option.value)(matchValue_4);
|
|
922
|
+
try {
|
|
923
|
+
const actualFieldValue_1 = (0, _FormSpec.Shared_FieldValue_Single)(new _FormSpec.Shared_FieldAnswer(fieldKey_2, "", actualValueStr_2));
|
|
924
|
+
return evaluateFieldCondition(actualValueStr_2, evaluator_3, conditionValue_2.tag === /* Multiple */ 1 ? (0, _String.join)(",", (0, _Set.toList)(conditionValue_2.fields[0])) : conditionValue_2.tag === /* Matrix */ 2 ? (0, _String.join)(",", (0, _List.map)((tupledArg_1)=>tupledArg_1[1], (0, _Map.toList)(conditionValue_2.fields[0]))) : conditionValue_2.tag === /* PluginData */ 3 ? (pluginData_1 = conditionValue_2.fields[0], (0, _Encodefs.toString)(0, (0, _Encodefs.Auto_generateBoxedEncoder_437914C6)((0, _FormSpec.Shared_PluginDataProperty_$reflection)(), undefined, undefined, undefined)(pluginData_1))) : conditionValue_2.fields[0]) ? TransitionStatus_Satisfied() : TransitionStatus_Failed();
|
|
925
|
+
} catch (ex) {
|
|
926
|
+
return TransitionStatus_Failed();
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
default:
|
|
931
|
+
return TransitionStatus_Satisfied();
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
function findState(stateKey, states) {
|
|
935
|
+
return (0, _List.tryFind)((s)=>(0, _Util.equals)(s.StateKey, stateKey), states);
|
|
936
|
+
}
|
|
937
|
+
function extractActionsFromState(state) {
|
|
938
|
+
const matchValue = state.StateType;
|
|
939
|
+
switch(matchValue.tag){
|
|
940
|
+
case /* Action */ 2:
|
|
941
|
+
return (0, _List.singleton)(matchValue.fields[0]);
|
|
942
|
+
case /* CompoundAction */ 3:
|
|
943
|
+
return matchValue.fields[0];
|
|
944
|
+
case /* ConditionalAction */ 4:
|
|
945
|
+
{
|
|
946
|
+
const condition = matchValue.fields[0];
|
|
947
|
+
return (0, _List.append)((0, _List.singleton)(matchValue.fields[1]), (0, _List.ofArray)((0, _Option.toArray)(matchValue.fields[2])));
|
|
948
|
+
}
|
|
949
|
+
default:
|
|
950
|
+
return (0, _List.empty)();
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
function isTerminalState(state) {
|
|
954
|
+
if (state.StateType.tag === /* Terminal */ 5) {
|
|
955
|
+
return true;
|
|
956
|
+
} else {
|
|
957
|
+
return false;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
function evaluateAllTransitions(context) {
|
|
961
|
+
const fieldValues = FieldResolver_extractFieldValues(context.FieldResolver, context.FormData);
|
|
962
|
+
console.log((0, _Option.some)("[evaluateAllTransitions] Extracted field values:"), fieldValues);
|
|
963
|
+
console.log((0, _Option.some)("[evaluateAllTransitions] Current states in context:"), context.CurrentStates);
|
|
964
|
+
console.log((0, _Option.some)("[evaluateAllTransitions] All transitions in pathway:"), context.PathwaySpec.Transitions);
|
|
965
|
+
const transitionsFromCurrentStates = (0, _List.filter)((t)=>{
|
|
966
|
+
const isFromCurrentState = (0, _Set.contains)(t.FromState, context.CurrentStates);
|
|
967
|
+
console.log((0, _Option.some)("[evaluateAllTransitions] Transition from"), t.FromState, "to", t.ToState, "FromCurrentState=", isFromCurrentState);
|
|
968
|
+
return isFromCurrentState;
|
|
969
|
+
}, context.PathwaySpec.Transitions);
|
|
970
|
+
console.log((0, _Option.some)("[evaluateAllTransitions] Transitions from current states:"), transitionsFromCurrentStates);
|
|
971
|
+
return (0, _List.map)((transition)=>{
|
|
972
|
+
console.log((0, _Option.some)("[evaluateAllTransitions] Evaluating transition:"), transition.TransitionKey);
|
|
973
|
+
console.log((0, _Option.some)("[evaluateAllTransitions] Transition condition:"), transition.Condition);
|
|
974
|
+
const status = evaluateTransitionWithPartialData(context.FieldResolver, context.FormSpec, fieldValues, context.VisitedStates, transition.Condition);
|
|
975
|
+
console.log((0, _Option.some)("[evaluateAllTransitions] Transition status:"), status);
|
|
976
|
+
return new MatchedTransition(transition, (0, _Option.defaultArg)(transition.Priority, 999), status);
|
|
977
|
+
}, transitionsFromCurrentStates);
|
|
978
|
+
}
|
|
979
|
+
function categorizeTransitions(transitions) {
|
|
980
|
+
return [
|
|
981
|
+
(0, _List.filter)((t)=>(0, _Util.equals)(t.Status, TransitionStatus_Satisfied()), transitions),
|
|
982
|
+
(0, _List.filter)((t_1)=>{
|
|
983
|
+
if (t_1.Status.tag === /* Pending */ 2) {
|
|
984
|
+
return true;
|
|
985
|
+
} else {
|
|
986
|
+
return false;
|
|
987
|
+
}
|
|
988
|
+
}, transitions),
|
|
989
|
+
(0, _List.filter)((t_2)=>(0, _Util.equals)(t_2.Status, TransitionStatus_Failed()), transitions)
|
|
990
|
+
];
|
|
991
|
+
}
|
|
992
|
+
function selectTransitionsByMode(mode, activeTransitions) {
|
|
993
|
+
switch(mode.tag){
|
|
994
|
+
case /* MultiPathway */ 1:
|
|
995
|
+
{
|
|
996
|
+
const matchValue_1 = mode.fields[0].CombinationStrategy;
|
|
997
|
+
switch(matchValue_1.tag){
|
|
998
|
+
case /* NonConflicting */ 1:
|
|
999
|
+
return activeTransitions;
|
|
1000
|
+
case /* Complementary */ 2:
|
|
1001
|
+
return activeTransitions;
|
|
1002
|
+
default:
|
|
1003
|
+
return activeTransitions;
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
case /* TriggerBased */ 2:
|
|
1007
|
+
return activeTransitions;
|
|
1008
|
+
default:
|
|
1009
|
+
{
|
|
1010
|
+
const matchValue = mode.fields[0].SelectionStrategy;
|
|
1011
|
+
switch(matchValue.tag){
|
|
1012
|
+
case /* MostSpecific */ 1:
|
|
1013
|
+
return (0, _List.ofArray)((0, _Option.toArray)((0, _List.tryHead)((0, _List.sortBy)((m_1)=>m_1.Priority, activeTransitions, {
|
|
1014
|
+
Compare: _Util.comparePrimitives
|
|
1015
|
+
}))));
|
|
1016
|
+
case /* ClinicalSeverity */ 2:
|
|
1017
|
+
return (0, _List.ofArray)((0, _Option.toArray)((0, _List.tryHead)((0, _List.sortBy)((m_2)=>m_2.Priority, activeTransitions, {
|
|
1018
|
+
Compare: _Util.comparePrimitives
|
|
1019
|
+
}))));
|
|
1020
|
+
default:
|
|
1021
|
+
return (0, _List.ofArray)((0, _Option.toArray)((0, _List.tryHead)((0, _List.sortBy)((m)=>m.Priority, activeTransitions, {
|
|
1022
|
+
Compare: _Util.comparePrimitives
|
|
1023
|
+
}))));
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
function calculateProbability(status, totalConditions) {
|
|
1029
|
+
switch(status.tag){
|
|
1030
|
+
case /* Failed */ 1:
|
|
1031
|
+
return 0;
|
|
1032
|
+
case /* Pending */ 2:
|
|
1033
|
+
return (totalConditions - (0, _List.length)(status.fields[0])) / totalConditions;
|
|
1034
|
+
default:
|
|
1035
|
+
return 1;
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
function predictOutcomes(context) {
|
|
1039
|
+
return (0, _List.truncate)(5, (0, _List.sortByDescending)((p)=>p.Probability, (0, _List.choose)((matched)=>{
|
|
1040
|
+
const matchValue = matched.Status;
|
|
1041
|
+
switch(matchValue.tag){
|
|
1042
|
+
case /* Pending */ 2:
|
|
1043
|
+
{
|
|
1044
|
+
const fields = matchValue.fields[0];
|
|
1045
|
+
const matchValue_2 = findState(matched.Transition.ToState, context.PathwaySpec.States);
|
|
1046
|
+
if (matchValue_2 == null) {
|
|
1047
|
+
return undefined;
|
|
1048
|
+
} else {
|
|
1049
|
+
const toStateStr_1 = matched.Transition.ToState.fields[0];
|
|
1050
|
+
return new PredictedPathway(toStateStr_1, 0.5, fields, extractActionsFromState((0, _Option.value)(matchValue_2)), toStateStr_1);
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
case /* Failed */ 1:
|
|
1054
|
+
return undefined;
|
|
1055
|
+
default:
|
|
1056
|
+
{
|
|
1057
|
+
const matchValue_1 = findState(matched.Transition.ToState, context.PathwaySpec.States);
|
|
1058
|
+
if (matchValue_1 == null) {
|
|
1059
|
+
return undefined;
|
|
1060
|
+
} else {
|
|
1061
|
+
const toStateStr = matched.Transition.ToState.fields[0];
|
|
1062
|
+
return new PredictedPathway(toStateStr, 1, (0, _List.empty)(), extractActionsFromState((0, _Option.value)(matchValue_1)), toStateStr);
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
}, evaluateAllTransitions(context)), {
|
|
1067
|
+
Compare: _Util.comparePrimitives
|
|
1068
|
+
}));
|
|
1069
|
+
}
|
|
1070
|
+
function calculateCompletionPercentage(context) {
|
|
1071
|
+
const totalStates = (0, _List.length)(context.PathwaySpec.States);
|
|
1072
|
+
if (totalStates === 0) {
|
|
1073
|
+
return 0;
|
|
1074
|
+
} else {
|
|
1075
|
+
return (0, _Set.FSharpSet__get_Count)(context.VisitedStates) / totalStates * 100;
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
function isExecutionComplete(context) {
|
|
1079
|
+
if ((0, _List.exists)(isTerminalState, (0, _List.choose)((sk)=>findState(sk, context.PathwaySpec.States), (0, _Set.toList)(context.CurrentStates)))) {
|
|
1080
|
+
return true;
|
|
1081
|
+
} else if ((0, _List.isEmpty)(categorizeTransitions(context.ActiveTransitions)[0])) {
|
|
1082
|
+
return !(0, _Set.FSharpSet__get_IsEmpty)(context.CurrentStates);
|
|
1083
|
+
} else {
|
|
1084
|
+
return false;
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
function initializeExecution(formSpec, formData) {
|
|
1088
|
+
const matchValue = formSpec.ClinicalPathway;
|
|
1089
|
+
if (matchValue == null) {
|
|
1090
|
+
throw new Error("No clinical pathway found in form spec");
|
|
1091
|
+
} else {
|
|
1092
|
+
const pathway = (0, _Option.value)(matchValue);
|
|
1093
|
+
const resolver = FieldResolver_createResolver(formSpec);
|
|
1094
|
+
let initialStates;
|
|
1095
|
+
const matchValue_1 = pathway.InitialState;
|
|
1096
|
+
if (matchValue_1 == null) {
|
|
1097
|
+
const statesWithIncoming = (0, _Set.ofList)((0, _List.map)((t)=>t.ToState, pathway.Transitions), {
|
|
1098
|
+
Compare: _Util.compare
|
|
1099
|
+
});
|
|
1100
|
+
const candidates = (0, _List.map)((s_1)=>s_1.StateKey, (0, _List.filter)((s)=>!(0, _Set.contains)(s.StateKey, statesWithIncoming), pathway.States));
|
|
1101
|
+
initialStates = (0, _List.isEmpty)(candidates) ? (0, _Option.defaultArg)((0, _Option.map)((s_2)=>(0, _List.singleton)(s_2.StateKey), (0, _List.tryHead)(pathway.States)), (0, _List.empty)()) : candidates;
|
|
1102
|
+
} else {
|
|
1103
|
+
initialStates = (0, _List.singleton)((0, _Option.value)(matchValue_1));
|
|
1104
|
+
}
|
|
1105
|
+
return new ExecutionContext$1(pathway, formSpec, (0, _Set.ofList)(initialStates, {
|
|
1106
|
+
Compare: _Util.compare
|
|
1107
|
+
}), (0, _Set.ofList)(initialStates, {
|
|
1108
|
+
Compare: _Util.compare
|
|
1109
|
+
}), (0, _Set.empty)({
|
|
1110
|
+
Compare: _Util.compare
|
|
1111
|
+
}), (0, _List.empty)(), (0, _List.empty)(), (0, _List.empty)(), formData, resolver, (0, _List.map)((stateKey)=>new ExecutionLogEntry((0, _Date.now)(), stateKey, "Initialized", "Starting state"), initialStates));
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
function resolveFieldValueSource(valueSource, formSpec, formData) {
|
|
1115
|
+
switch(valueSource.tag){
|
|
1116
|
+
case /* FieldReference */ 1:
|
|
1117
|
+
return (0, _Option.defaultArg)((0, _Map.tryFind)(valueSource.fields[0], FieldResolver_extractFieldValues(FieldResolver_createResolver(formSpec), formData)), "");
|
|
1118
|
+
case /* OptionKey */ 2:
|
|
1119
|
+
{
|
|
1120
|
+
const optionKey = valueSource.fields[0];
|
|
1121
|
+
return (0, _Option.defaultArg)((0, _List.tryPick)((field)=>{
|
|
1122
|
+
const fieldType = field.FieldType;
|
|
1123
|
+
return (0, _Option.map)((opt_1)=>opt_1.Description, (0, _List.tryFind)((opt)=>(0, _Util.equals)(opt.OptionKey, optionKey), fieldType.tag === /* SingleChoice */ 13 ? fieldType.fields[0].Options : fieldType.tag === /* MultiChoice */ 15 ? fieldType.fields[0].Options : fieldType.tag === /* CheckboxList */ 16 ? fieldType.fields[0].Options : fieldType.tag === /* Dropdown */ 14 ? fieldType.fields[0].Options : fieldType.tag === /* Radio */ 12 ? fieldType.fields[0].Options : (0, _List.empty)()));
|
|
1124
|
+
}, (0, _List.collect)((step)=>step.Fields, formSpec.Steps)), "");
|
|
1125
|
+
}
|
|
1126
|
+
default:
|
|
1127
|
+
return valueSource.fields[0];
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
function executeSetFieldValueAction(action, formSpec, formData) {
|
|
1131
|
+
let matchValue, condition, fieldValues, fieldType;
|
|
1132
|
+
if (!(matchValue = action.Condition, matchValue == null ? true : (condition = (0, _Option.value)(matchValue), fieldValues = FieldResolver_extractFieldValues(FieldResolver_createResolver(formSpec), formData), evaluateTransitionWithPartialData(FieldResolver_createResolver(formSpec), formSpec, fieldValues, (0, _Set.empty)({
|
|
1133
|
+
Compare: _Util.compare
|
|
1134
|
+
}), condition).tag === /* Satisfied */ 0))) {
|
|
1135
|
+
return formData;
|
|
1136
|
+
} else {
|
|
1137
|
+
const valueToSet = resolveFieldValueSource(action.Value, formSpec, formData);
|
|
1138
|
+
const targetFieldOpt = (0, _List.tryFind)((field)=>(0, _Util.equals)(field.FieldKey, action.TargetField), (0, _List.collect)((step)=>step.Fields, formSpec.Steps));
|
|
1139
|
+
if (targetFieldOpt == null) {
|
|
1140
|
+
return formData;
|
|
1141
|
+
} else {
|
|
1142
|
+
const targetField = (0, _Option.value)(targetFieldOpt);
|
|
1143
|
+
const stepOpt = (0, _List.tryFind)((step_1)=>(0, _List.exists)((f)=>(0, _Util.equals)(f.FieldKey, action.TargetField), step_1.Fields), formSpec.Steps);
|
|
1144
|
+
if (stepOpt == null) {
|
|
1145
|
+
return formData;
|
|
1146
|
+
} else {
|
|
1147
|
+
const stepOrder = new _FormSpec.Values_StepOrder((0, _Option.value)(stepOpt).StepOrder);
|
|
1148
|
+
const fieldAnswer = new _FormSpec.Shared_FieldAnswer(action.TargetField, targetField.Label, valueToSet);
|
|
1149
|
+
return new _FormSpec.Values_DynamicFormResultData$1(formData.ResultFormSpecDetails, (0, _Map.FSharpMap__Add)(formData.ResultSteps, stepOrder, (0, _Map.FSharpMap__Add)((0, _Option.defaultArg)((0, _Map.tryFind)(stepOrder, formData.ResultSteps), (0, _Map.empty)({
|
|
1150
|
+
Compare: _Util.compare
|
|
1151
|
+
})), action.TargetField, (fieldType = targetField.FieldType, new _FormSpec.Values_FieldDetails$1(targetField.FieldOrder, action.TargetField, targetField.Label, (0, _FormSpec.Shared_FieldValue_Single)(fieldAnswer), targetField.FieldType, (0, _List.map)((opt)=>new _FormSpec.Shared_FieldOption(opt.Description, opt.Value, opt.OptionKey), fieldType.tag === /* SingleChoice */ 13 ? fieldType.fields[0].Options : fieldType.tag === /* MultiChoice */ 15 ? fieldType.fields[0].Options : fieldType.tag === /* CheckboxList */ 16 ? fieldType.fields[0].Options : fieldType.tag === /* Dropdown */ 14 ? fieldType.fields[0].Options : fieldType.tag === /* Radio */ 12 ? fieldType.fields[0].Options : (0, _List.empty)()))))));
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
function executeAction(action, formSpec, formData) {
|
|
1157
|
+
if (action.tag === /* SetFieldValue */ 10) {
|
|
1158
|
+
return executeSetFieldValueAction(action.fields[0], formSpec, formData);
|
|
1159
|
+
} else {
|
|
1160
|
+
return formData;
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
function executeActions(actions, formSpec, formData) {
|
|
1164
|
+
return (0, _List.fold)((currentData, action)=>executeAction(action, formSpec, currentData), formData, actions);
|
|
1165
|
+
}
|
|
1166
|
+
function executeStep(context_mut, maxIterations_mut) {
|
|
1167
|
+
executeStep: while(true){
|
|
1168
|
+
const context = context_mut, maxIterations = maxIterations_mut;
|
|
1169
|
+
if (maxIterations <= 0) {
|
|
1170
|
+
return context;
|
|
1171
|
+
} else {
|
|
1172
|
+
const patternInput = categorizeTransitions(evaluateAllTransitions(context));
|
|
1173
|
+
const pending = patternInput[1];
|
|
1174
|
+
const active = patternInput[0];
|
|
1175
|
+
const selectedTransitions = selectTransitionsByMode(context.PathwaySpec.ExecutionMode, active);
|
|
1176
|
+
if ((0, _List.isEmpty)(selectedTransitions)) {
|
|
1177
|
+
return new ExecutionContext$1(context.PathwaySpec, context.FormSpec, context.CurrentStates, context.VisitedStates, context.CompletedStates, active, pending, context.ExecutedActions, context.FormData, context.FieldResolver, context.ExecutionLog);
|
|
1178
|
+
} else {
|
|
1179
|
+
const newStates = (0, _Set.ofList)((0, _List.map)((t)=>t.Transition.ToState, selectedTransitions), {
|
|
1180
|
+
Compare: _Util.compare
|
|
1181
|
+
});
|
|
1182
|
+
const newActions = (0, _List.collect)(extractActionsFromState, (0, _List.choose)((sk)=>findState(sk, context.PathwaySpec.States), (0, _Set.toList)(newStates)));
|
|
1183
|
+
const updatedFormData = executeActions(newActions, context.FormSpec, context.FormData);
|
|
1184
|
+
const newLogEntries = (0, _List.map)((t_1)=>{
|
|
1185
|
+
let arg, arg_1;
|
|
1186
|
+
return new ExecutionLogEntry((0, _Date.now)(), t_1.Transition.ToState, "Transitioned", (arg = t_1.Transition.FromState.fields[0], arg_1 = t_1.Transition.TransitionKey.fields[0], (0, _String.toText)((0, _String.printf)("From %s via %s"))(arg)(arg_1)));
|
|
1187
|
+
}, selectedTransitions);
|
|
1188
|
+
const updatedContext = new ExecutionContext$1(context.PathwaySpec, context.FormSpec, newStates, (0, _Set.union)(context.VisitedStates, newStates), (0, _Set.union)(context.CompletedStates, context.CurrentStates), active, pending, (0, _List.append)(context.ExecutedActions, newActions), updatedFormData, context.FieldResolver, (0, _List.append)(context.ExecutionLog, newLogEntries));
|
|
1189
|
+
if (isExecutionComplete(updatedContext)) {
|
|
1190
|
+
return updatedContext;
|
|
1191
|
+
} else {
|
|
1192
|
+
context_mut = updatedContext;
|
|
1193
|
+
maxIterations_mut = maxIterations - 1;
|
|
1194
|
+
continue executeStep;
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
break;
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
function executeIncremental(context, formData) {
|
|
1202
|
+
let previousTransitionKeys, newKeys;
|
|
1203
|
+
const startingAtTerminal = (0, _List.exists)(isTerminalState, (0, _List.choose)((sk)=>findState(sk, context.PathwaySpec.States), (0, _Set.toList)(context.CurrentStates)));
|
|
1204
|
+
const updatedContext = new ExecutionContext$1(context.PathwaySpec, context.FormSpec, context.CurrentStates, context.VisitedStates, context.CompletedStates, context.ActiveTransitions, context.PendingTransitions, context.ExecutedActions, formData, context.FieldResolver, context.ExecutionLog);
|
|
1205
|
+
const newContext = executeStep(updatedContext, 100);
|
|
1206
|
+
return new IncrementalExecutionResult$1(newContext, (0, _List.map)((_arg)=>_arg.fields[0], (0, _Set.toList)((0, _Set.difference)(newContext.CurrentStates, updatedContext.CurrentStates))), (previousTransitionKeys = (0, _Set.ofList)((0, _List.map)((t)=>t.Transition.TransitionKey, updatedContext.ActiveTransitions), {
|
|
1207
|
+
Compare: _Util.compare
|
|
1208
|
+
}), newKeys = (0, _Set.difference)((0, _Set.ofList)((0, _List.map)((t_1)=>t_1.Transition.TransitionKey, newContext.ActiveTransitions), {
|
|
1209
|
+
Compare: _Util.compare
|
|
1210
|
+
}), previousTransitionKeys), (0, _List.map)((t_3)=>t_3.Transition, (0, _List.filter)((t_2)=>(0, _Set.contains)(t_2.Transition.TransitionKey, newKeys), newContext.ActiveTransitions))), predictOutcomes(newContext), calculateCompletionPercentage(newContext), isExecutionComplete(newContext));
|
|
1211
|
+
}
|
|
1212
|
+
function getVisualizationState(context) {
|
|
1213
|
+
const patternInput = categorizeTransitions(context.ActiveTransitions);
|
|
1214
|
+
const completedTransitions = (0, _List.map)((log_1)=>log_1.Details, (0, _List.filter)((log)=>log.Action === "Transitioned", context.ExecutionLog));
|
|
1215
|
+
return new VisualizationState(context.CurrentStates, context.VisitedStates, (0, _List.map)((t)=>t.Transition.TransitionKey, patternInput[0]), (0, _List.map)((t_1)=>t_1.Transition.TransitionKey, patternInput[1]), completedTransitions, predictOutcomes(context));
|
|
1216
|
+
}
|
|
1217
|
+
function extractClinicalPlans(context) {
|
|
1218
|
+
return (0, _List.sortBy)((plan)=>plan.Priority, (0, _List.choose)((stateKey)=>{
|
|
1219
|
+
const matchValue = findState(stateKey, context.PathwaySpec.States);
|
|
1220
|
+
let matchResult, state_1;
|
|
1221
|
+
if (matchValue != null) {
|
|
1222
|
+
if (!(0, _List.isEmpty)(extractActionsFromState((0, _Option.value)(matchValue)))) {
|
|
1223
|
+
matchResult = 0;
|
|
1224
|
+
state_1 = (0, _Option.value)(matchValue);
|
|
1225
|
+
} else {
|
|
1226
|
+
matchResult = 1;
|
|
1227
|
+
}
|
|
1228
|
+
} else {
|
|
1229
|
+
matchResult = 1;
|
|
1230
|
+
}
|
|
1231
|
+
switch(matchResult){
|
|
1232
|
+
case 0:
|
|
1233
|
+
{
|
|
1234
|
+
const stateKeyStr = stateKey.fields[0];
|
|
1235
|
+
return new ClinicalPlan(stateKeyStr, extractActionsFromState(state_1), stateKeyStr, state_1.StateOrder);
|
|
1236
|
+
}
|
|
1237
|
+
default:
|
|
1238
|
+
return undefined;
|
|
1239
|
+
}
|
|
1240
|
+
}, (0, _Set.toList)(context.CurrentStates)), {
|
|
1241
|
+
Compare: _Util.comparePrimitives
|
|
1242
|
+
});
|
|
1243
|
+
}
|
|
1244
|
+
class PathwayExecutionResult$1 extends _Types.Record {
|
|
1245
|
+
constructor(PathwayId, StartState, CurrentState, ExecutionMode, SelectedPaths, RejectedPaths, ExecutedActions, VisitedStates, TransitionsUsed, FormData, ExecutionTime, Success, Errors){
|
|
1246
|
+
super();
|
|
1247
|
+
this.PathwayId = PathwayId;
|
|
1248
|
+
this.StartState = StartState;
|
|
1249
|
+
this.CurrentState = CurrentState;
|
|
1250
|
+
this.ExecutionMode = ExecutionMode;
|
|
1251
|
+
this.SelectedPaths = SelectedPaths;
|
|
1252
|
+
this.RejectedPaths = RejectedPaths;
|
|
1253
|
+
this.ExecutedActions = ExecutedActions;
|
|
1254
|
+
this.VisitedStates = VisitedStates;
|
|
1255
|
+
this.TransitionsUsed = TransitionsUsed;
|
|
1256
|
+
this.FormData = FormData;
|
|
1257
|
+
this.ExecutionTime = ExecutionTime;
|
|
1258
|
+
this.Success = Success;
|
|
1259
|
+
this.Errors = Errors;
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
function PathwayExecutionResult$1_$reflection(gen0) {
|
|
1263
|
+
return (0, _Reflection.record_type)("F1.Studio.PathwayExecutor.PathwayExecutionResult`1", [
|
|
1264
|
+
gen0
|
|
1265
|
+
], PathwayExecutionResult$1, ()=>[
|
|
1266
|
+
[
|
|
1267
|
+
"PathwayId",
|
|
1268
|
+
_Reflection.string_type
|
|
1269
|
+
],
|
|
1270
|
+
[
|
|
1271
|
+
"StartState",
|
|
1272
|
+
_Reflection.string_type
|
|
1273
|
+
],
|
|
1274
|
+
[
|
|
1275
|
+
"CurrentState",
|
|
1276
|
+
_Reflection.string_type
|
|
1277
|
+
],
|
|
1278
|
+
[
|
|
1279
|
+
"ExecutionMode",
|
|
1280
|
+
(0, _FormSpec.ClinicalPathway_PathwayExecutionMode_$reflection)()
|
|
1281
|
+
],
|
|
1282
|
+
[
|
|
1283
|
+
"SelectedPaths",
|
|
1284
|
+
(0, _Reflection.list_type)(_Reflection.string_type)
|
|
1285
|
+
],
|
|
1286
|
+
[
|
|
1287
|
+
"RejectedPaths",
|
|
1288
|
+
(0, _Reflection.list_type)((0, _Reflection.tuple_type)(_Reflection.string_type, _Reflection.string_type))
|
|
1289
|
+
],
|
|
1290
|
+
[
|
|
1291
|
+
"ExecutedActions",
|
|
1292
|
+
(0, _Reflection.list_type)((0, _FormSpec.ClinicalPathway_ActionInfo_$reflection)())
|
|
1293
|
+
],
|
|
1294
|
+
[
|
|
1295
|
+
"VisitedStates",
|
|
1296
|
+
(0, _Reflection.list_type)(_Reflection.string_type)
|
|
1297
|
+
],
|
|
1298
|
+
[
|
|
1299
|
+
"TransitionsUsed",
|
|
1300
|
+
(0, _Reflection.list_type)(_Reflection.string_type)
|
|
1301
|
+
],
|
|
1302
|
+
[
|
|
1303
|
+
"FormData",
|
|
1304
|
+
(0, _FormSpec.Values_DynamicFormResultData$1_$reflection)(gen0)
|
|
1305
|
+
],
|
|
1306
|
+
[
|
|
1307
|
+
"ExecutionTime",
|
|
1308
|
+
(0, _Reflection.class_type)("System.DateTime")
|
|
1309
|
+
],
|
|
1310
|
+
[
|
|
1311
|
+
"Success",
|
|
1312
|
+
_Reflection.bool_type
|
|
1313
|
+
],
|
|
1314
|
+
[
|
|
1315
|
+
"Errors",
|
|
1316
|
+
(0, _Reflection.list_type)(_Reflection.string_type)
|
|
1317
|
+
]
|
|
1318
|
+
]);
|
|
1319
|
+
} //# sourceMappingURL=PathwayExecutor.ts.map
|
|
1320
|
+
|
|
1321
|
+
//# sourceMappingURL=PathwayExecutor.js.map
|