@f1studio/form-spec 5.0.0-alpha.152 → 5.0.0-alpha.155
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/BitmaskHelpers.d.ts.map +1 -1
- package/FormSpec.FS/FormSpec.d.ts +6 -3
- package/FormSpec.FS/FormSpec.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.d.ts +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.d.ts +3 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/CorEMR/ItemTriggerConverter.d.ts.map +1 -1
- package/FormSpec.FS/TriggerActionDto.d.ts +44 -0
- package/FormSpec.FS/TriggerActionDto.d.ts.map +1 -0
- package/FormSpec.TS/FormSpec.FS/BitmaskHelpers.js +1 -1
- package/FormSpec.TS/FormSpec.FS/BitmaskHelpers.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/FormSpec.js +18 -3
- package/FormSpec.TS/FormSpec.FS/FormSpec.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.js +20 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.js +44 -6
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js +4 -8
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.js +8 -2
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/ItemTriggerConverter.js +53 -7
- package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/ItemTriggerConverter.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js +1 -1
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/TriggerActionDto.js +176 -0
- package/FormSpec.TS/FormSpec.FS/TriggerActionDto.js.map +1 -0
- package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Encode.js.map +1 -1
- package/FormSpec.TS/plugins/allergyfinder/src/AllergyLogic.js +0 -63
- package/FormSpec.TS/plugins/allergyfinder/src/AllergyLogic.js.map +1 -1
- package/README.md +7 -7
- package/package.json +1 -1
- package/plugins/allergyfinder/src/AllergyLogic.d.ts +0 -6
- package/plugins/allergyfinder/src/AllergyLogic.d.ts.map +1 -1
- package/src/FormSpec.FS/BitmaskHelpers.ts +3 -3
- package/src/FormSpec.FS/FormSpec.ts +12 -6
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.ts +27 -11
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.ts +34 -8
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts +6 -12
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.ts +6 -3
- package/src/FormSpec.FS/Integrations/CorEMR/ItemTriggerConverter.ts +40 -8
- package/src/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts +1 -1
- package/src/FormSpec.FS/TriggerActionDto.ts +135 -0
- package/src/plugins/allergyfinder/src/AllergyLogic.ts +4 -22
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# FormSpec – Build & Publish
|
|
2
2
|
|
|
3
|
-
**Version: `5.0.0-alpha.
|
|
3
|
+
**Version: `5.0.0-alpha.155`**
|
|
4
4
|
|
|
5
5
|
TypeScript package generated from F# via Fable. Runtime uses external `@fable-org/fable-library-js`.
|
|
6
6
|
|
|
@@ -63,17 +63,17 @@ Notes:
|
|
|
63
63
|
### From Verdaccio (local testing)
|
|
64
64
|
|
|
65
65
|
```bash
|
|
66
|
-
npm install @f1studio/form-spec@5.0.0-alpha.
|
|
67
|
-
pnpm add @f1studio/form-spec@5.0.0-alpha.
|
|
68
|
-
bun add @f1studio/form-spec@5.0.0-alpha.
|
|
66
|
+
npm install @f1studio/form-spec@5.0.0-alpha.155 --registry http://localhost:4873
|
|
67
|
+
pnpm add @f1studio/form-spec@5.0.0-alpha.155 --registry http://localhost:4873
|
|
68
|
+
bun add @f1studio/form-spec@5.0.0-alpha.155 --registry http://localhost:4873
|
|
69
69
|
```
|
|
70
70
|
|
|
71
71
|
### From npm (public registry)
|
|
72
72
|
|
|
73
73
|
```bash
|
|
74
|
-
npm install @f1studio/form-spec@5.0.0-alpha.
|
|
75
|
-
pnpm add @f1studio/form-spec@5.0.0-alpha.
|
|
76
|
-
bun add @f1studio/form-spec@5.0.0-alpha.
|
|
74
|
+
npm install @f1studio/form-spec@5.0.0-alpha.155
|
|
75
|
+
pnpm add @f1studio/form-spec@5.0.0-alpha.155
|
|
76
|
+
bun add @f1studio/form-spec@5.0.0-alpha.155
|
|
77
77
|
```
|
|
78
78
|
|
|
79
79
|
Entry points:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@f1studio/form-spec",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.155",
|
|
4
4
|
"description": "F1 Core - Form specification and types",
|
|
5
5
|
"main": "./FormSpec.FS/Interop/FormSpec.Api.Option.js",
|
|
6
6
|
"types": "./FormSpec.FS/Interop/FormSpec.Api.Option.d.ts",
|
|
@@ -49,12 +49,6 @@ export declare function validateAllergyData(entries: AllergyEntryData[], reporte
|
|
|
49
49
|
export declare const PropertyKeys_AllergyCount: Shared_PluginPropertyKey;
|
|
50
50
|
export declare const PropertyKeys_HasSevereAllergy: Shared_PluginPropertyKey;
|
|
51
51
|
export declare const PropertyKeys_AllergiesJson: Shared_PluginPropertyKey;
|
|
52
|
-
/**
|
|
53
|
-
* Serialize allergy entries to the canonical TS wire format.
|
|
54
|
-
* Returns the output of Convert.fieldValueToTs(FieldValue.PluginData [...]).
|
|
55
|
-
* TypeScript passes this directly to onValueChange — zero ad-hoc construction.
|
|
56
|
-
*/
|
|
57
|
-
export declare function serializeAllergiesToCanonical(entries: AllergyEntryData[]): any;
|
|
58
52
|
/**
|
|
59
53
|
* Validate plugin data from the wire format.
|
|
60
54
|
* Takes array (not list) of PluginDataProperty for TS interop.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AllergyLogic.d.ts","sourceRoot":"","sources":["../../../../FormSpec.TS/plugins/allergyfinder/src/AllergyLogic.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"AllergyLogic.d.ts","sourceRoot":"","sources":["../../../../FormSpec.TS/plugins/allergyfinder/src/AllergyLogic.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { equals, int64, op_LeftShift, op_BitwiseOr, toInt64 } from "@fable-org/fable-library-js/BigInt.js";
|
|
1
|
+
import { map, mapIndexed, forAll, length, FSharpList, fold } from "@fable-org/fable-library-js/List.js";
|
|
2
|
+
import { toInt32, equals, int64, op_LeftShift, op_BitwiseOr, toInt64 } from "@fable-org/fable-library-js/BigInt.js";
|
|
3
3
|
import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
4
4
|
import { toList } from "@fable-org/fable-library-js/Seq.js";
|
|
5
5
|
import { rangeDouble } from "@fable-org/fable-library-js/Range.js";
|
|
@@ -46,7 +46,7 @@ export function normalizeChoiceScores(sortedScores: FSharpList<int64>): [FSharpL
|
|
|
46
46
|
return [toList<int32>(rangeDouble(0, 1, length(sortedScores) - 1)), true] as [FSharpList<int32>, boolean];
|
|
47
47
|
}
|
|
48
48
|
else {
|
|
49
|
-
return [
|
|
49
|
+
return [map<int64, int32>((value: int64): int32 => ~~toInt32(value), sortedScores), false] as [FSharpList<int32>, boolean];
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -1893,14 +1893,16 @@ export function ClinicalPathway_RecurrencePattern_$reflection(): TypeInfo {
|
|
|
1893
1893
|
}
|
|
1894
1894
|
|
|
1895
1895
|
export class ClinicalPathway_TaskAction extends Record implements IEquatable<ClinicalPathway_TaskAction>, IComparable<ClinicalPathway_TaskAction> {
|
|
1896
|
+
readonly CategoryId: Option<int32>;
|
|
1896
1897
|
readonly Category: string;
|
|
1897
1898
|
readonly Description: string;
|
|
1898
1899
|
readonly Priority: ClinicalPathway_TaskPriority_$union;
|
|
1899
1900
|
readonly DueDate: ClinicalPathway_DueDate_$union;
|
|
1900
1901
|
readonly Assignee: string;
|
|
1901
1902
|
readonly Recurrence: Option<ClinicalPathway_RecurrencePattern>;
|
|
1902
|
-
constructor(Category: string, Description: string, Priority: ClinicalPathway_TaskPriority_$union, DueDate: ClinicalPathway_DueDate_$union, Assignee: string, Recurrence: Option<ClinicalPathway_RecurrencePattern>) {
|
|
1903
|
+
constructor(CategoryId: Option<int32>, Category: string, Description: string, Priority: ClinicalPathway_TaskPriority_$union, DueDate: ClinicalPathway_DueDate_$union, Assignee: string, Recurrence: Option<ClinicalPathway_RecurrencePattern>) {
|
|
1903
1904
|
super();
|
|
1905
|
+
this.CategoryId = CategoryId;
|
|
1904
1906
|
this.Category = Category;
|
|
1905
1907
|
this.Description = Description;
|
|
1906
1908
|
this.Priority = Priority;
|
|
@@ -1911,7 +1913,7 @@ export class ClinicalPathway_TaskAction extends Record implements IEquatable<Cli
|
|
|
1911
1913
|
}
|
|
1912
1914
|
|
|
1913
1915
|
export function ClinicalPathway_TaskAction_$reflection(): TypeInfo {
|
|
1914
|
-
return record_type("F1.Studio.ClinicalPathway.TaskAction", [], ClinicalPathway_TaskAction, () => [["Category", string_type], ["Description", string_type], ["Priority", ClinicalPathway_TaskPriority_$reflection()], ["DueDate", ClinicalPathway_DueDate_$reflection()], ["Assignee", string_type], ["Recurrence", option_type(ClinicalPathway_RecurrencePattern_$reflection())]]);
|
|
1916
|
+
return record_type("F1.Studio.ClinicalPathway.TaskAction", [], ClinicalPathway_TaskAction, () => [["CategoryId", option_type(int32_type)], ["Category", string_type], ["Description", string_type], ["Priority", ClinicalPathway_TaskPriority_$reflection()], ["DueDate", ClinicalPathway_DueDate_$reflection()], ["Assignee", string_type], ["Recurrence", option_type(ClinicalPathway_RecurrencePattern_$reflection())]]);
|
|
1915
1917
|
}
|
|
1916
1918
|
|
|
1917
1919
|
export type ClinicalPathway_AlertSeverity_$union =
|
|
@@ -1957,12 +1959,14 @@ export function ClinicalPathway_AlertSeverity_$reflection(): TypeInfo {
|
|
|
1957
1959
|
}
|
|
1958
1960
|
|
|
1959
1961
|
export class ClinicalPathway_AlertAction extends Record implements IEquatable<ClinicalPathway_AlertAction>, IComparable<ClinicalPathway_AlertAction> {
|
|
1962
|
+
readonly CategoryId: Option<int32>;
|
|
1960
1963
|
readonly Category: string;
|
|
1961
1964
|
readonly Message: string;
|
|
1962
1965
|
readonly Severity: ClinicalPathway_AlertSeverity_$union;
|
|
1963
1966
|
readonly ExpiresAfter: Option<number>;
|
|
1964
|
-
constructor(Category: string, Message: string, Severity: ClinicalPathway_AlertSeverity_$union, ExpiresAfter: Option<number>) {
|
|
1967
|
+
constructor(CategoryId: Option<int32>, Category: string, Message: string, Severity: ClinicalPathway_AlertSeverity_$union, ExpiresAfter: Option<number>) {
|
|
1965
1968
|
super();
|
|
1969
|
+
this.CategoryId = CategoryId;
|
|
1966
1970
|
this.Category = Category;
|
|
1967
1971
|
this.Message = Message;
|
|
1968
1972
|
this.Severity = Severity;
|
|
@@ -1971,7 +1975,7 @@ export class ClinicalPathway_AlertAction extends Record implements IEquatable<Cl
|
|
|
1971
1975
|
}
|
|
1972
1976
|
|
|
1973
1977
|
export function ClinicalPathway_AlertAction_$reflection(): TypeInfo {
|
|
1974
|
-
return record_type("F1.Studio.ClinicalPathway.AlertAction", [], ClinicalPathway_AlertAction, () => [["Category", string_type], ["Message", string_type], ["Severity", ClinicalPathway_AlertSeverity_$reflection()], ["ExpiresAfter", option_type(class_type("System.TimeSpan"))]]);
|
|
1978
|
+
return record_type("F1.Studio.ClinicalPathway.AlertAction", [], ClinicalPathway_AlertAction, () => [["CategoryId", option_type(int32_type)], ["Category", string_type], ["Message", string_type], ["Severity", ClinicalPathway_AlertSeverity_$reflection()], ["ExpiresAfter", option_type(class_type("System.TimeSpan"))]]);
|
|
1975
1979
|
}
|
|
1976
1980
|
|
|
1977
1981
|
export type ClinicalPathway_ProblemStatus_$union =
|
|
@@ -2017,13 +2021,15 @@ export function ClinicalPathway_ProblemStatus_$reflection(): TypeInfo {
|
|
|
2017
2021
|
}
|
|
2018
2022
|
|
|
2019
2023
|
export class ClinicalPathway_ProblemAction extends Record implements IEquatable<ClinicalPathway_ProblemAction>, IComparable<ClinicalPathway_ProblemAction> {
|
|
2024
|
+
readonly CategoryId: Option<int32>;
|
|
2020
2025
|
readonly ProblemName: string;
|
|
2021
2026
|
readonly IcdCode: Option<string>;
|
|
2022
2027
|
readonly Onset: Option<Date>;
|
|
2023
2028
|
readonly Status: ClinicalPathway_ProblemStatus_$union;
|
|
2024
2029
|
readonly Notes: Option<string>;
|
|
2025
|
-
constructor(ProblemName: string, IcdCode: Option<string>, Onset: Option<Date>, Status: ClinicalPathway_ProblemStatus_$union, Notes: Option<string>) {
|
|
2030
|
+
constructor(CategoryId: Option<int32>, ProblemName: string, IcdCode: Option<string>, Onset: Option<Date>, Status: ClinicalPathway_ProblemStatus_$union, Notes: Option<string>) {
|
|
2026
2031
|
super();
|
|
2032
|
+
this.CategoryId = CategoryId;
|
|
2027
2033
|
this.ProblemName = ProblemName;
|
|
2028
2034
|
this.IcdCode = IcdCode;
|
|
2029
2035
|
this.Onset = Onset;
|
|
@@ -2033,7 +2039,7 @@ export class ClinicalPathway_ProblemAction extends Record implements IEquatable<
|
|
|
2033
2039
|
}
|
|
2034
2040
|
|
|
2035
2041
|
export function ClinicalPathway_ProblemAction_$reflection(): TypeInfo {
|
|
2036
|
-
return record_type("F1.Studio.ClinicalPathway.ProblemAction", [], ClinicalPathway_ProblemAction, () => [["ProblemName", string_type], ["IcdCode", option_type(string_type)], ["Onset", option_type(class_type("System.DateTimeOffset"))], ["Status", ClinicalPathway_ProblemStatus_$reflection()], ["Notes", option_type(string_type)]]);
|
|
2042
|
+
return record_type("F1.Studio.ClinicalPathway.ProblemAction", [], ClinicalPathway_ProblemAction, () => [["CategoryId", option_type(int32_type)], ["ProblemName", string_type], ["IcdCode", option_type(string_type)], ["Onset", option_type(class_type("System.DateTimeOffset"))], ["Status", ClinicalPathway_ProblemStatus_$reflection()], ["Notes", option_type(string_type)]]);
|
|
2037
2043
|
}
|
|
2038
2044
|
|
|
2039
2045
|
export class ClinicalPathway_PrescriptionAction extends Record implements IEquatable<ClinicalPathway_PrescriptionAction>, IComparable<ClinicalPathway_PrescriptionAction> {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { Record } from "@fable-org/fable-library-js/Types.js";
|
|
1
|
+
import { FSharpRef, Record } from "@fable-org/fable-library-js/Types.js";
|
|
2
2
|
import { int32ToString, comparePrimitives, IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
|
|
3
3
|
import { record_type, string_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
4
4
|
import { FSharpSet__Contains, contains, FSharpSet, ofSeq } from "@fable-org/fable-library-js/Set.js";
|
|
5
|
-
import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
6
|
-
import { bind, orElse, map as map_1, orElseWith, defaultArg, Option, value as
|
|
5
|
+
import { tryParse, int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
6
|
+
import { bind, orElse, map as map_1, orElseWith, defaultArg, Option, value as value_5 } from "@fable-org/fable-library-js/Option.js";
|
|
7
7
|
import { Spec_FormClassification_$union, Spec_FormClassification_General, Spec_FormClassification_Screening, Spec_FormClassification_Intake, Spec_FormClassification_ClinicalInstrument, Spec_ClinicalInstrumentInfo, Spec_InstrumentConfidence_Inferred, Spec_InstrumentConfidence_Exact } from "../../../FormSpec.js";
|
|
8
8
|
import { isNullOrEmpty } from "@fable-org/fable-library-js/String.js";
|
|
9
9
|
import { int64, toInt32 } from "@fable-org/fable-library-js/BigInt.js";
|
|
10
|
-
import { CoreMRFormDetail, CoreMRTag, CoreMRTrigger, CoreMRChoice, CoreMRItem, CoreMRFormMetadata } from "../../CorEMR/CoreMRTypes.js";
|
|
11
|
-
import { empty, item as
|
|
10
|
+
import { CoreMRFormDetail, CoreMRTag, CoreMRTrigger, CoreMRTriggerEvent, CoreMRTriggerCondition, CoreMRChoice, CoreMRItem, CoreMRFormMetadata } from "../../CorEMR/CoreMRTypes.js";
|
|
11
|
+
import { empty, choose, item as item_3, length, mapIndexed, sortBy, collect, FSharpList, isEmpty, map } from "@fable-org/fable-library-js/List.js";
|
|
12
12
|
import { FSharpMap, filter, keys, isEmpty as isEmpty_1, tryFind } from "@fable-org/fable-library-js/Map.js";
|
|
13
13
|
import { ElementTypeInfo, getElementTypeInfo } from "./CorEMRElementTypeMap.js";
|
|
14
|
-
import { TemplateForm, TemplateChoice, TemplateItem } from "../../CorEMR/TemplateManifestDecoder.js";
|
|
14
|
+
import { TemplateForm, ItemTrigger, TriggerAction, TriggerCondition, TemplateChoice, TemplateItem } from "../../CorEMR/TemplateManifestDecoder.js";
|
|
15
15
|
import { normalizeChoiceScores } from "../../../BitmaskHelpers.js";
|
|
16
16
|
|
|
17
17
|
export class BridgeElementTypeInfo extends Record implements IEquatable<BridgeElementTypeInfo>, IComparable<BridgeElementTypeInfo> {
|
|
@@ -46,11 +46,11 @@ function hasTextHasDateFromBridge(textField: string): [boolean, boolean] {
|
|
|
46
46
|
export function mapFormClassification(formCategory: Option<string>, instrumentType: Option<string>, instrumentConfidence: Option<string>, instrumentMaxScore: Option<int32>): Spec_FormClassification_$union {
|
|
47
47
|
let matchResult: int32, instType: string;
|
|
48
48
|
if (formCategory != null) {
|
|
49
|
-
switch (
|
|
49
|
+
switch (value_5(formCategory)) {
|
|
50
50
|
case "clinical_instrument": {
|
|
51
51
|
if (instrumentType != null) {
|
|
52
52
|
matchResult = 0;
|
|
53
|
-
instType =
|
|
53
|
+
instType = value_5(instrumentType);
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
56
|
matchResult = 3;
|
|
@@ -74,7 +74,7 @@ export function mapFormClassification(formCategory: Option<string>, instrumentTy
|
|
|
74
74
|
}
|
|
75
75
|
switch (matchResult) {
|
|
76
76
|
case 0:
|
|
77
|
-
return Spec_FormClassification_ClinicalInstrument(new Spec_ClinicalInstrumentInfo(instType!, (instrumentConfidence != null) ? ((
|
|
77
|
+
return Spec_FormClassification_ClinicalInstrument(new Spec_ClinicalInstrumentInfo(instType!, (instrumentConfidence != null) ? ((value_5(instrumentConfidence) === "exact") ? Spec_InstrumentConfidence_Exact() : Spec_InstrumentConfidence_Inferred()) : Spec_InstrumentConfidence_Inferred(), instrumentMaxScore));
|
|
78
78
|
case 1:
|
|
79
79
|
return Spec_FormClassification_Intake();
|
|
80
80
|
case 2:
|
|
@@ -115,13 +115,29 @@ export function mapNewTemplateToCoreMRDetail(elementTypes: FSharpMap<int32, Brid
|
|
|
115
115
|
const bitPositions: Option<FSharpList<int32>> = (FSharpSet__Contains(multiSelectTypes, item_1.Type) && patternInput_1[1]) ? patternInput_1[0] : undefined;
|
|
116
116
|
return mapIndexed<TemplateChoice, CoreMRChoice>((index: int32, choice: TemplateChoice): CoreMRChoice => (new CoreMRChoice(choice.ChoiceId, item_1.ItemId, choice.Sequence, choice.Text, choice.Score, orElse(choice.BitPosition, bind<FSharpList<int32>, int32>((positions: FSharpList<int32>): Option<int32> => {
|
|
117
117
|
if (index < length(positions)) {
|
|
118
|
-
return
|
|
118
|
+
return item_3(index, positions);
|
|
119
119
|
}
|
|
120
120
|
else {
|
|
121
121
|
return undefined;
|
|
122
122
|
}
|
|
123
123
|
}, bitPositions)), choice.Code, map_1<int32, string>(int32ToString, choice.Highlight))), sortedChoices);
|
|
124
|
-
}, template.Items),
|
|
124
|
+
}, template.Items), collect<TemplateItem, CoreMRTrigger>((item_2: TemplateItem): FSharpList<CoreMRTrigger> => mapIndexed<ItemTrigger, CoreMRTrigger>((triggerOrder: int32, trigger: ItemTrigger): CoreMRTrigger => {
|
|
125
|
+
const conditions: FSharpList<CoreMRTriggerCondition> = map<TriggerCondition, CoreMRTriggerCondition>((cond: TriggerCondition): CoreMRTriggerCondition => (new CoreMRTriggerCondition(cond.ConditionId, trigger.TriggerId, undefined, cond.Source, cond.Operator, !isEmpty(cond.RawChoiceIds) ? cond.RawChoiceIds : choose<string, int32>((value_3: string): Option<int32> => {
|
|
126
|
+
let matchValue: [boolean, int32];
|
|
127
|
+
let outArg = 0;
|
|
128
|
+
matchValue = ([tryParse(value_3, 511, false, 32, new FSharpRef<int32>((): int32 => outArg, (v: int32): void => {
|
|
129
|
+
outArg = (v | 0);
|
|
130
|
+
})), outArg] as [boolean, int32]);
|
|
131
|
+
if (matchValue[0]) {
|
|
132
|
+
return matchValue[1];
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
}, cond.Values))), trigger.Conditions);
|
|
138
|
+
const events: FSharpList<CoreMRTriggerEvent> = map<TriggerAction, CoreMRTriggerEvent>((action: TriggerAction): CoreMRTriggerEvent => (new CoreMRTriggerEvent(action.ActionId, trigger.TriggerId, action.ActionType, action.Params)), trigger.Actions);
|
|
139
|
+
return new CoreMRTrigger(trigger.TriggerId, item_2.ItemId, trigger.EventName, triggerOrder + 1, defaultArg(trigger.ExclusiveTag, ""), trigger.Enabled, conditions, events);
|
|
140
|
+
}, item_2.Triggers), template.Items), empty<CoreMRTag>(), undefined);
|
|
125
141
|
}
|
|
126
142
|
|
|
127
143
|
//# sourceMappingURL=CorEMRTemplateMapper.ts.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Helpers_generateDeterministicGuidRaw } from "../../../Helpers.js";
|
|
2
2
|
import { ClinicalPathway_PathwayExecutionMode_MultiPathway, ClinicalPathway_MultiPathwayConfig, ClinicalPathway_ConflictResolution_CombineActions, ClinicalPathway_CombinationStrategy_AllMatching, ClinicalPathway_PathwayExecutionMode_$union, ClinicalPathway_ClinicalPathwaySpec, ClinicalPathway_PathRequirement, ClinicalPathway_ConstraintDefinition, ClinicalPathway_PathwayExecutionMode_TriggerBased, ClinicalPathway_TriggerBasedConfig, ClinicalPathway_TransitionDefinition, ClinicalPathway_StateType_Terminal, ClinicalPathway_TerminalInfo, ClinicalPathway_StateType_CompoundAction, ClinicalPathway_StateType_Action, ClinicalPathway_StateDefinition, ClinicalPathway_StateType_Evaluation, ClinicalPathway_EvaluationInfo, Shared_TransitionKey, Shared_StateKey, ClinicalPathway_TransitionCondition_Always, ClinicalPathway_TransitionCondition_CompositeCondition, ClinicalPathway_LogicalOp_And, ClinicalPathway_TransitionCondition_$union, ClinicalPathway_TransitionCondition_FieldCondition, Shared_ConditionValue_Single, Shared_ConditionValue_Multiple, Shared_FieldKey, ClinicalPathway_ActionInfo_$union, ClinicalPathway_ActionInfo_Prescription, ClinicalPathway_PrescriptionAction, ClinicalPathway_ActionInfo_Medication, ClinicalPathway_MedicationAction, ClinicalPathway_ActionInfo_Problem, ClinicalPathway_ProblemAction, ClinicalPathway_ProblemStatus_Active, ClinicalPathway_ActionInfo_Task, ClinicalPathway_TaskAction, ClinicalPathway_ActionInfo_Alert, ClinicalPathway_AlertAction, ClinicalPathway_AlertSeverity_High, ClinicalPathway_RecurrencePattern, ClinicalPathway_RecurrenceEnd_OnDate, ClinicalPathway_RecurrenceEnd_Never, ClinicalPathway_DueDate_$union, ClinicalPathway_DueDate_DaysFromNow, ClinicalPathway_DueDate_Tomorrow, ClinicalPathway_DueDate_Today, ClinicalPathway_TaskPriority_$union, ClinicalPathway_TaskPriority_Low, ClinicalPathway_TaskPriority_Medium, ClinicalPathway_TaskPriority_High, ClinicalPathway_TriggerTiming_$union, ClinicalPathway_TriggerTiming_OnFormLoad, ClinicalPathway_TriggerTiming_OnFormSubmit, ClinicalPathway_TriggerTiming_OnFormSave, ClinicalPathway_FieldEvaluator_$union, ClinicalPathway_FieldEvaluator_NotInSet, ClinicalPathway_FieldEvaluator_ContainsAll, ClinicalPathway_FieldEvaluator_LessOrEqual, ClinicalPathway_FieldEvaluator_LessThan, ClinicalPathway_FieldEvaluator_GreaterOrEqual, ClinicalPathway_FieldEvaluator_GreaterThan, ClinicalPathway_FieldEvaluator_NotEquals, ClinicalPathway_FieldEvaluator_Equals, ClinicalPathway_FieldEvaluator_InSet } from "../../../FormSpec.js";
|
|
3
3
|
import { join, trimStart, trim, split, replace, toConsoleError, printf, toFail } from "@fable-org/fable-library-js/String.js";
|
|
4
|
-
import { singleton, tryHead, append, cons, collect, mapIndexed, filter, empty,
|
|
4
|
+
import { singleton, tryHead, append, cons, collect, mapIndexed, filter, empty, map as map_1, item as item_3, length, tryFind as tryFind_1, head, tail, isEmpty, choose, ofArray, tryPick, FSharpList } from "@fable-org/fable-library-js/List.js";
|
|
5
5
|
import { tryParse, int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
6
6
|
import { FSharpRef } from "@fable-org/fable-library-js/Types.js";
|
|
7
7
|
import { item as item_2 } from "@fable-org/fable-library-js/Array.js";
|
|
8
8
|
import { fromDays, fromHours } from "@fable-org/fable-library-js/TimeSpan.js";
|
|
9
|
-
import { map, defaultArg, Option, value as value_7 } from "@fable-org/fable-library-js/Option.js";
|
|
9
|
+
import { map, defaultArg, bind, Option, value as value_7 } from "@fable-org/fable-library-js/Option.js";
|
|
10
10
|
import { addDays, now, add } from "@fable-org/fable-library-js/DateOffset.js";
|
|
11
11
|
import { FSharpMap, tryFind } from "@fable-org/fable-library-js/Map.js";
|
|
12
12
|
import { CoreMRFormMetadata, CoreMRTrigger, CoreMRItem, CoreMRTriggerCondition, CoreMRTriggerEvent } from "../../CorEMR/CoreMRTypes.js";
|
|
@@ -186,11 +186,36 @@ export function parseRecurrence(recurEvery: Option<string>, recurEnd: Option<str
|
|
|
186
186
|
* Convert CoreMR event to FormSpec ActionInfo
|
|
187
187
|
*/
|
|
188
188
|
export function convertEvent(event: CoreMRTriggerEvent): ClinicalPathway_ActionInfo_$union {
|
|
189
|
-
const
|
|
190
|
-
|
|
189
|
+
const tryEventParamInt = (keys: FSharpList<string>): Option<int32> => tryPick<string, int32>((key: string): Option<int32> => bind<string, int32>((raw: string): Option<int32> => {
|
|
190
|
+
let matchValue: [boolean, int32];
|
|
191
|
+
let outArg = 0;
|
|
192
|
+
matchValue = ([tryParse(raw, 511, false, 32, new FSharpRef<int32>((): int32 => outArg, (v: int32): void => {
|
|
193
|
+
outArg = (v | 0);
|
|
194
|
+
})), outArg] as [boolean, int32]);
|
|
195
|
+
let matchResult: int32;
|
|
196
|
+
if (matchValue[0]) {
|
|
197
|
+
if (matchValue[1] > 0) {
|
|
198
|
+
matchResult = 0;
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
matchResult = 1;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
matchResult = 1;
|
|
206
|
+
}
|
|
207
|
+
switch (matchResult) {
|
|
208
|
+
case 0:
|
|
209
|
+
return matchValue[1];
|
|
210
|
+
default:
|
|
211
|
+
return undefined;
|
|
212
|
+
}
|
|
213
|
+
}, tryFind<string, string>(key, event.EventParams)), keys);
|
|
214
|
+
const matchValue_1: string = event.EventType.toLocaleLowerCase();
|
|
215
|
+
switch (matchValue_1) {
|
|
191
216
|
case "alert": {
|
|
192
217
|
const category: string = defaultArg(tryFind<string, string>("category_desc", event.EventParams), "Alert");
|
|
193
|
-
return ClinicalPathway_ActionInfo_Alert(new ClinicalPathway_AlertAction(category, `Alert: ${category}`, ClinicalPathway_AlertSeverity_High(), undefined));
|
|
218
|
+
return ClinicalPathway_ActionInfo_Alert(new ClinicalPathway_AlertAction(tryEventParamInt(ofArray(["category_id", "id"])), category, `Alert: ${category}`, ClinicalPathway_AlertSeverity_High(), undefined));
|
|
194
219
|
}
|
|
195
220
|
case "task": {
|
|
196
221
|
const category_1: string = defaultArg(tryFind<string, string>("cat_desc", event.EventParams), "Task");
|
|
@@ -199,19 +224,20 @@ export function convertEvent(event: CoreMRTriggerEvent): ClinicalPathway_ActionI
|
|
|
199
224
|
const dateStr: string = defaultArg(tryFind<string, string>("date", event.EventParams), "Today");
|
|
200
225
|
const recurEvery: Option<string> = tryFind<string, string>("recur_every", event.EventParams);
|
|
201
226
|
const recurEnd: Option<string> = tryFind<string, string>("recur_end", event.EventParams);
|
|
227
|
+
const categoryId_1: Option<int32> = tryEventParamInt(ofArray(["cat_id", "category_id", "id"]));
|
|
202
228
|
let assignee: string;
|
|
203
229
|
const parts: string[] = split(category_1, ["-"], 2);
|
|
204
230
|
assignee = ((parts.length > 0) ? item_2(0, parts).trim() : "Staff");
|
|
205
|
-
return ClinicalPathway_ActionInfo_Task(new ClinicalPathway_TaskAction(category_1, description, convertPriority(priorityStr), parseDueDate(dateStr), assignee, parseRecurrence(recurEvery, recurEnd)));
|
|
231
|
+
return ClinicalPathway_ActionInfo_Task(new ClinicalPathway_TaskAction(categoryId_1, category_1, description, convertPriority(priorityStr), parseDueDate(dateStr), assignee, parseRecurrence(recurEvery, recurEnd)));
|
|
206
232
|
}
|
|
207
233
|
case "problem":
|
|
208
|
-
return ClinicalPathway_ActionInfo_Problem(new ClinicalPathway_ProblemAction("Problem", undefined, now(), ClinicalPathway_ProblemStatus_Active(), undefined));
|
|
234
|
+
return ClinicalPathway_ActionInfo_Problem(new ClinicalPathway_ProblemAction(tryEventParamInt(ofArray(["problem_list_id", "category_id", "id"])), "Problem", undefined, now(), ClinicalPathway_ProblemStatus_Active(), undefined));
|
|
209
235
|
case "medset":
|
|
210
236
|
return ClinicalPathway_ActionInfo_Medication(new ClinicalPathway_MedicationAction("Medication Set", "", "", "", "", false));
|
|
211
237
|
case "prescription":
|
|
212
238
|
return ClinicalPathway_ActionInfo_Prescription(new ClinicalPathway_PrescriptionAction("", "", "PO", "", "", 30, 0, true, undefined));
|
|
213
239
|
default:
|
|
214
|
-
return toFail(printf("Unknown CoreMR event type: %s"))(
|
|
240
|
+
return toFail(printf("Unknown CoreMR event type: %s"))(matchValue_1);
|
|
215
241
|
}
|
|
216
242
|
}
|
|
217
243
|
|
|
@@ -3,7 +3,7 @@ import { orElse, defaultArg, map, value as value_3, bind, unwrap, Option } from
|
|
|
3
3
|
import { int32, float64 } from "@fable-org/fable-library-js/Int32.js";
|
|
4
4
|
import { comparePrimitives, stringHash, uncurry2, IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
|
|
5
5
|
import { record_type, option_type, float64_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
6
|
-
import { exists, fold, contains, tail, mapIndexed, tryHead, choose, map as map_1,
|
|
6
|
+
import { exists, fold, contains, tail, mapIndexed, singleton, tryHead, choose, map as map_1, empty, tryFind, head, isEmpty, FSharpList, collect, filter } from "@fable-org/fable-library-js/List.js";
|
|
7
7
|
import { Shared_MatrixItemKey, Shared_MatrixAnswer, Spec_MultiChoiceInfo, Spec_SingleChoiceInfo, Shared_FieldOption, Shared_FieldOptionKey, Shared_FieldKey, Spec_FormSpec$1, Shared_FieldValue, Shared_FieldAnswer, Shared_PluginDataProperty, Shared_FieldValue_$union, Spec_FormStep$1, Spec_FormField$1, Spec_PluginFieldConfig, Spec_FieldType_$union } from "../../../FormSpec.js";
|
|
8
8
|
import { split, isNullOrWhiteSpace } from "@fable-org/fable-library-js/String.js";
|
|
9
9
|
import { tryParse } from "@fable-org/fable-library-js/Double.js";
|
|
@@ -280,12 +280,9 @@ function getOptionsFromFieldType(ft: Spec_FieldType_$union): FSharpList<Shared_F
|
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
function fieldToAnswers(field: Spec_FormField$1<Spec_FieldType_$union>, vitalsIdOpt: Option<int64>, anchor: CoreMRFieldAnchor): FSharpList<CoreMRAnswer> {
|
|
283
|
-
if (anchor.Encoding.IsSkip) {
|
|
283
|
+
if (anchor.Encoding.IsSkip ? true : anchor.Encoding.IsScaffold) {
|
|
284
284
|
return empty<CoreMRAnswer>();
|
|
285
285
|
}
|
|
286
|
-
else if (anchor.Encoding.IsScaffold) {
|
|
287
|
-
return singleton(new CoreMRAnswer(anchor.Sequence, 2n, undefined));
|
|
288
|
-
}
|
|
289
286
|
else {
|
|
290
287
|
const matchValue: Option<Shared_FieldValue_$union> = field.Value;
|
|
291
288
|
if (matchValue != null) {
|
|
@@ -506,10 +503,7 @@ function buildFieldByKeyMap(spec: Spec_FormSpec$1<Spec_FieldType_$union>): FShar
|
|
|
506
503
|
|
|
507
504
|
function anchorToAnswers(fieldMap: FSharpMap<string, Spec_FormField$1<Spec_FieldType_$union>>, vitalsIdOpt: Option<int64>, anchor: CoreMRFieldAnchor): FSharpList<CoreMRAnswer> {
|
|
508
505
|
const field: Option<Spec_FormField$1<Spec_FieldType_$union>> = tryFind_1<string, Spec_FormField$1<Spec_FieldType_$union>>(getFieldKeyGuid(anchor.FieldKey), fieldMap);
|
|
509
|
-
if (anchor.Encoding.IsSkip) {
|
|
510
|
-
return empty<CoreMRAnswer>();
|
|
511
|
-
}
|
|
512
|
-
else if (anchor.Encoding.IsScaffold) {
|
|
506
|
+
if (anchor.Encoding.IsSkip ? true : anchor.Encoding.IsScaffold) {
|
|
513
507
|
return empty<CoreMRAnswer>();
|
|
514
508
|
}
|
|
515
509
|
else if (field != null) {
|
|
@@ -548,7 +542,7 @@ export function encodeToFormAnswersWithVitals(provenancePayload: string, filledF
|
|
|
548
542
|
const formName: string = defaultArg(sourceMap.FormName, `CORE-${sourceMap.FormId}`);
|
|
549
543
|
const fieldMap: FSharpMap<string, Spec_FormField$1<Spec_FieldType_$union>> = buildFieldByKeyMap(filledFormSpec);
|
|
550
544
|
try {
|
|
551
|
-
return FSharpResult$2_Ok<CoreMRFormInsertRequest, string>(new CoreMRFormInsertRequest(sourceMap.FormId, formName, scaffoldMode ? undefined : ((acc = collect<CoreMRFieldAnchor, CoreMRAnswer>((anchor: CoreMRFieldAnchor): FSharpList<CoreMRAnswer> => anchorToAnswers(fieldMap, vitalsIdOpt, anchor), collect<CoreMRStepMap, CoreMRFieldAnchor>((step: CoreMRStepMap): FSharpList<CoreMRFieldAnchor> => step.FieldAnchors, sourceMap.Steps)), isEmpty(acc) ? undefined : acc)), dryRun));
|
|
545
|
+
return FSharpResult$2_Ok<CoreMRFormInsertRequest, string>(new CoreMRFormInsertRequest(sourceMap.FormId, formName, scaffoldMode ? undefined : ((acc = collect<CoreMRFieldAnchor, CoreMRAnswer>((anchor: CoreMRFieldAnchor): FSharpList<CoreMRAnswer> => anchorToAnswers(fieldMap, vitalsIdOpt, anchor), collect<CoreMRStepMap, CoreMRFieldAnchor>((step: CoreMRStepMap): FSharpList<CoreMRFieldAnchor> => step.FieldAnchors, sourceMap.Steps)), isEmpty(acc) ? undefined : acc)), dryRun, undefined));
|
|
552
546
|
}
|
|
553
547
|
catch (matchValue_1: any) {
|
|
554
548
|
const activePatternResult: Option<string> = Operators_FailurePattern(matchValue_1);
|
|
@@ -578,7 +572,7 @@ export function extractVitalsAndFormData(provenancePayload: string, filledFormSp
|
|
|
578
572
|
|
|
579
573
|
/**
|
|
580
574
|
* Encode filled FormSpec to CoreMR form-insert payload.
|
|
581
|
-
* scaffoldMode: when true, omit answers
|
|
575
|
+
* scaffoldMode: when true, omit answers.
|
|
582
576
|
* Iterates over provenance anchors (source of truth) so we never omit required items.
|
|
583
577
|
* LEGACY: Use extractVitalsAndFormData for new smart coordination.
|
|
584
578
|
*/
|
|
@@ -596,7 +590,7 @@ export function encodeToFormAnswers(provenancePayload: string, filledFormSpec: S
|
|
|
596
590
|
formName = defaultArg(orElse(sourceMap.FormName, isNullOrWhiteSpace(filledFormSpec.Title) ? undefined : filledFormSpec.Title), value);
|
|
597
591
|
const fieldMap: FSharpMap<string, Spec_FormField$1<Spec_FieldType_$union>> = buildFieldByKeyMap(filledFormSpec);
|
|
598
592
|
try {
|
|
599
|
-
return FSharpResult$2_Ok<CoreMRFormInsertRequest, string>(new CoreMRFormInsertRequest(sourceMap.FormId, formName, scaffoldMode ? undefined : ((acc = collect<CoreMRFieldAnchor, CoreMRAnswer>((anchor: CoreMRFieldAnchor): FSharpList<CoreMRAnswer> => anchorToAnswers(fieldMap, undefined, anchor), collect<CoreMRStepMap, CoreMRFieldAnchor>((step: CoreMRStepMap): FSharpList<CoreMRFieldAnchor> => step.FieldAnchors, sourceMap.Steps)), isEmpty(acc) ? undefined : acc)), dryRun));
|
|
593
|
+
return FSharpResult$2_Ok<CoreMRFormInsertRequest, string>(new CoreMRFormInsertRequest(sourceMap.FormId, formName, scaffoldMode ? undefined : ((acc = collect<CoreMRFieldAnchor, CoreMRAnswer>((anchor: CoreMRFieldAnchor): FSharpList<CoreMRAnswer> => anchorToAnswers(fieldMap, undefined, anchor), collect<CoreMRStepMap, CoreMRFieldAnchor>((step: CoreMRStepMap): FSharpList<CoreMRFieldAnchor> => step.FieldAnchors, sourceMap.Steps)), isEmpty(acc) ? undefined : acc)), dryRun, undefined));
|
|
600
594
|
}
|
|
601
595
|
catch (matchValue_1: any) {
|
|
602
596
|
const activePatternResult: Option<string> = Operators_FailurePattern(matchValue_1);
|
|
@@ -7,6 +7,7 @@ import { bool_type, list_type, option_type, int64_type, record_type, class_type,
|
|
|
7
7
|
import { fromInt32, toInt64, int64 } from "@fable-org/fable-library-js/BigInt.js";
|
|
8
8
|
import { defaultArg, toArray, value as value_6, map, bind, Option } from "@fable-org/fable-library-js/Option.js";
|
|
9
9
|
import { map as map_1, choose, mapIndexed, collect, head, tail, isEmpty, ofArray, empty, tryFind, FSharpList } from "@fable-org/fable-library-js/List.js";
|
|
10
|
+
import { TriggerActionDto_$reflection, TriggerActionDto } from "../../../TriggerActionDto.js";
|
|
10
11
|
import { Helpers_canonicalizeFieldKey } from "../../../Helpers.js";
|
|
11
12
|
import { isNullOrWhiteSpace } from "@fable-org/fable-library-js/String.js";
|
|
12
13
|
import { object, toString } from "../../../../Thoth.Json/packages/Thoth.Json/Encode.js";
|
|
@@ -53,17 +54,19 @@ export class CoreMRFormInsertRequest extends Record implements IEquatable<CoreMR
|
|
|
53
54
|
readonly FormName: string;
|
|
54
55
|
readonly Answers: Option<FSharpList<CoreMRAnswer>>;
|
|
55
56
|
readonly DryRun: Option<boolean>;
|
|
56
|
-
|
|
57
|
+
readonly TriggerActions: Option<FSharpList<TriggerActionDto>>;
|
|
58
|
+
constructor(FormId: int32, FormName: string, Answers: Option<FSharpList<CoreMRAnswer>>, DryRun: Option<boolean>, TriggerActions: Option<FSharpList<TriggerActionDto>>) {
|
|
57
59
|
super();
|
|
58
60
|
this.FormId = (FormId | 0);
|
|
59
61
|
this.FormName = FormName;
|
|
60
62
|
this.Answers = Answers;
|
|
61
63
|
this.DryRun = DryRun;
|
|
64
|
+
this.TriggerActions = TriggerActions;
|
|
62
65
|
}
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
export function CoreMRFormInsertRequest_$reflection(): TypeInfo {
|
|
66
|
-
return record_type("FormSpec.Integrations.CorEMR.CoreMRFormInsertRequest", [], CoreMRFormInsertRequest, () => [["FormId", int32_type], ["FormName", string_type], ["Answers", option_type(list_type(CoreMRAnswer_$reflection()))], ["DryRun", option_type(bool_type)]]);
|
|
69
|
+
return record_type("FormSpec.Integrations.CorEMR.CoreMRFormInsertRequest", [], CoreMRFormInsertRequest, () => [["FormId", int32_type], ["FormName", string_type], ["Answers", option_type(list_type(CoreMRAnswer_$reflection()))], ["DryRun", option_type(bool_type)], ["TriggerActions", option_type(list_type(TriggerActionDto_$reflection()))]]);
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
function FormSpecToCoreMRInsert_getScoreFromOption(options: FSharpList<Shared_FieldOption>, selectedValue: string): Option<int32> {
|
|
@@ -252,7 +255,7 @@ function FormSpecToCoreMRInsert_fieldToValueAndText(field: Spec_FormField$1<Spec
|
|
|
252
255
|
*/
|
|
253
256
|
export function FormSpecToCoreMRInsert_convertToCoreMRInsertPayload(filledFormSpec: Spec_FormSpec$1<Spec_FieldType_$union>, metadata: CoreMRPublishMetadata, scaffoldMode: boolean, dryRun: boolean): CoreMRFormInsertRequest {
|
|
254
257
|
let allFields: FSharpList<Spec_FormField$1<Spec_FieldType_$union>>, acc: FSharpList<CoreMRAnswer>;
|
|
255
|
-
return new CoreMRFormInsertRequest(metadata.FormId, metadata.FormName, scaffoldMode ? undefined : ((allFields = 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, filledFormSpec.Steps), (acc = (isEmpty_1<Shared_FieldKey, int32>(metadata.FieldKeyToSequence) ? mapIndexed<[int32, Option<string>], CoreMRAnswer>((i: int32, tupledArg: [int32, Option<string>]): CoreMRAnswer => (new CoreMRAnswer((2 * i) + 1, toInt64(fromInt32(tupledArg[0])), tupledArg[1])), choose<Spec_FormField$1<Spec_FieldType_$union>, [int32, Option<string>]>(FormSpecToCoreMRInsert_fieldToValueAndText, allFields)) : collect<Spec_FormField$1<Spec_FieldType_$union>, CoreMRAnswer>((f: Spec_FormField$1<Spec_FieldType_$union>): FSharpList<CoreMRAnswer> => FormSpecToCoreMRInsert_fieldToAnswers(f, metadata.FieldKeyToSequence), allFields)), isEmpty(acc) ? undefined : acc))), dryRun);
|
|
258
|
+
return new CoreMRFormInsertRequest(metadata.FormId, metadata.FormName, scaffoldMode ? undefined : ((allFields = 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, filledFormSpec.Steps), (acc = (isEmpty_1<Shared_FieldKey, int32>(metadata.FieldKeyToSequence) ? mapIndexed<[int32, Option<string>], CoreMRAnswer>((i: int32, tupledArg: [int32, Option<string>]): CoreMRAnswer => (new CoreMRAnswer((2 * i) + 1, toInt64(fromInt32(tupledArg[0])), tupledArg[1])), choose<Spec_FormField$1<Spec_FieldType_$union>, [int32, Option<string>]>(FormSpecToCoreMRInsert_fieldToValueAndText, allFields)) : collect<Spec_FormField$1<Spec_FieldType_$union>, CoreMRAnswer>((f: Spec_FormField$1<Spec_FieldType_$union>): FSharpList<CoreMRAnswer> => FormSpecToCoreMRInsert_fieldToAnswers(f, metadata.FieldKeyToSequence), allFields)), isEmpty(acc) ? undefined : acc))), dryRun, undefined);
|
|
256
259
|
}
|
|
257
260
|
|
|
258
261
|
const CoreMRPublishMetadataCustomData_key = "coremr_publish";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Helpers_generateDeterministicGuidRaw } from "../../Helpers.js";
|
|
2
2
|
import { ClinicalPathway_PathwayExecutionMode_MultiPathway, ClinicalPathway_MultiPathwayConfig, ClinicalPathway_ConflictResolution_CombineActions, ClinicalPathway_CombinationStrategy_AllMatching, ClinicalPathway_ClinicalPathwaySpec, ClinicalPathway_PathRequirement, ClinicalPathway_ConstraintDefinition, ClinicalPathway_PathwayExecutionMode_TriggerBased, ClinicalPathway_TriggerBasedConfig, ClinicalPathway_TransitionDefinition, Shared_TransitionKey, ClinicalPathway_StateType_Terminal, ClinicalPathway_TerminalInfo, ClinicalPathway_StateType_Action, ClinicalPathway_StateType_CompoundAction, ClinicalPathway_StateDefinition, ClinicalPathway_StateType_Evaluation, ClinicalPathway_EvaluationInfo, Shared_StateKey, ClinicalPathway_ActionInfo_$union, ClinicalPathway_ActionInfo_Documentation, ClinicalPathway_DocumentationAction, ClinicalPathway_ActionInfo_Problem, ClinicalPathway_ProblemAction, ClinicalPathway_ProblemStatus_Active, ClinicalPathway_ActionInfo_Medication, ClinicalPathway_MedicationAction, ClinicalPathway_ActionInfo_Task, ClinicalPathway_TaskAction, ClinicalPathway_ActionInfo_Alert, ClinicalPathway_AlertAction, ClinicalPathway_AlertSeverity_High, ClinicalPathway_TransitionCondition_Always, ClinicalPathway_TransitionCondition_CompositeCondition, ClinicalPathway_LogicalOp_And, ClinicalPathway_LogicalOp_Or, ClinicalPathway_TransitionCondition_$union, ClinicalPathway_TransitionCondition_FieldCondition, ClinicalPathway_TransitionCondition_PluginPropertyCondition, Shared_PluginPropertyKey, Shared_ConditionValue_Single, Shared_ConditionValue_Multiple, Shared_ConditionValue_$union, Shared_FieldKey, ClinicalPathway_RecurrencePattern, ClinicalPathway_RecurrenceEnd_AfterOccurrences, ClinicalPathway_RecurrenceEnd_OnDate, ClinicalPathway_RecurrenceEnd_$union, ClinicalPathway_DueDate_$union, ClinicalPathway_DueDate_DaysFromNow, ClinicalPathway_DueDate_Tomorrow, ClinicalPathway_DueDate_Today, ClinicalPathway_TaskPriority_$union, ClinicalPathway_TaskPriority_Medium, ClinicalPathway_TaskPriority_Low, ClinicalPathway_TaskPriority_High, ClinicalPathway_TriggerTiming_$union, ClinicalPathway_TriggerTiming_OnFormLoad, ClinicalPathway_TriggerTiming_OnFormSubmit, ClinicalPathway_TriggerTiming_OnFormSave, ClinicalPathway_FieldEvaluator_$union, ClinicalPathway_FieldEvaluator_MatchesPattern, ClinicalPathway_FieldEvaluator_NotInSet, ClinicalPathway_FieldEvaluator_ContainsAll, ClinicalPathway_FieldEvaluator_LessOrEqual, ClinicalPathway_FieldEvaluator_LessThan, ClinicalPathway_FieldEvaluator_GreaterOrEqual, ClinicalPathway_FieldEvaluator_GreaterThan, ClinicalPathway_FieldEvaluator_NotEquals, ClinicalPathway_FieldEvaluator_Equals, ClinicalPathway_FieldEvaluator_InSet } from "../../FormSpec.js";
|
|
3
3
|
import { bind, map as map_1, defaultArgWith, Option, value as value_1, defaultArg } from "@fable-org/fable-library-js/Option.js";
|
|
4
|
-
import { sortByDescending, append, indexed, singleton, collect, filter, empty,
|
|
4
|
+
import { sortByDescending, append, indexed, singleton, collect, filter, empty, length, tryFind as tryFind_1, ofArray, tryPick, map, tail, head, isEmpty, FSharpList, tryHead } from "@fable-org/fable-library-js/List.js";
|
|
5
5
|
import { tryParse, int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
6
6
|
import { substring, join, isNullOrEmpty, split, replace } from "@fable-org/fable-library-js/String.js";
|
|
7
7
|
import { FSharpRef } from "@fable-org/fable-library-js/Types.js";
|
|
@@ -206,42 +206,74 @@ function param(key: string, action: TriggerAction): string {
|
|
|
206
206
|
return defaultArg(tryFind<string, string>(key, action.Params), "");
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
+
function tryParsePositiveInt(value: string): Option<int32> {
|
|
210
|
+
let matchValue: [boolean, int32];
|
|
211
|
+
let outArg = 0;
|
|
212
|
+
matchValue = ([tryParse(value, 511, false, 32, new FSharpRef<int32>((): int32 => outArg, (v: int32): void => {
|
|
213
|
+
outArg = (v | 0);
|
|
214
|
+
})), outArg] as [boolean, int32]);
|
|
215
|
+
let matchResult: int32;
|
|
216
|
+
if (matchValue[0]) {
|
|
217
|
+
if (matchValue[1] > 0) {
|
|
218
|
+
matchResult = 0;
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
matchResult = 1;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
matchResult = 1;
|
|
226
|
+
}
|
|
227
|
+
switch (matchResult) {
|
|
228
|
+
case 0:
|
|
229
|
+
return matchValue[1];
|
|
230
|
+
default:
|
|
231
|
+
return undefined;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function paramInt(keys: FSharpList<string>, action: TriggerAction): Option<int32> {
|
|
236
|
+
return tryPick<string, int32>((key: string): Option<int32> => bind<string, int32>(tryParsePositiveInt, tryFind<string, string>(key, action.Params)), keys);
|
|
237
|
+
}
|
|
238
|
+
|
|
209
239
|
export function convertAction(action: TriggerAction): ClinicalPathway_ActionInfo_$union {
|
|
210
240
|
let s: string, s_1: string;
|
|
211
241
|
const matchValue: string = action.ActionType.toLowerCase();
|
|
212
242
|
switch (matchValue) {
|
|
213
243
|
case "alert": {
|
|
214
244
|
const categoryName: string = param("category_name", action);
|
|
215
|
-
return ClinicalPathway_ActionInfo_Alert(new ClinicalPathway_AlertAction(categoryName, `Alert: ${categoryName}`, ClinicalPathway_AlertSeverity_High(), undefined));
|
|
245
|
+
return ClinicalPathway_ActionInfo_Alert(new ClinicalPathway_AlertAction(paramInt(ofArray(["category_id", "id"]), action), categoryName, `Alert: ${categoryName}`, ClinicalPathway_AlertSeverity_High(), undefined));
|
|
216
246
|
}
|
|
217
247
|
case "task": {
|
|
218
248
|
const category: string = param("category_name", action);
|
|
249
|
+
const categoryId_1: Option<int32> = paramInt(ofArray(["id", "category_id", "cat_id"]), action);
|
|
219
250
|
let assignee: string;
|
|
220
251
|
const parts: string[] = split(category, ["-"], undefined, 0);
|
|
221
252
|
assignee = ((parts.length > 0) ? item_1(0, parts).trim() : "Staff");
|
|
222
|
-
return ClinicalPathway_ActionInfo_Task(new ClinicalPathway_TaskAction(category, param("description", action), convertPriority(param("priority", action)), parseDueDate(param("start", action)), assignee, undefined));
|
|
253
|
+
return ClinicalPathway_ActionInfo_Task(new ClinicalPathway_TaskAction(categoryId_1, category, param("description", action), convertPriority(param("priority", action)), parseDueDate(param("start", action)), assignee, undefined));
|
|
223
254
|
}
|
|
224
255
|
case "recurring_task": {
|
|
225
256
|
const category_1: string = param("category_name", action);
|
|
257
|
+
const categoryId_2: Option<int32> = paramInt(ofArray(["id", "category_id", "cat_id"]), action);
|
|
226
258
|
let assignee_1: string;
|
|
227
259
|
const parts_1: string[] = split(category_1, ["-"], undefined, 0);
|
|
228
260
|
assignee_1 = ((parts_1.length > 0) ? item_1(0, parts_1).trim() : "Staff");
|
|
229
|
-
return ClinicalPathway_ActionInfo_Task(new ClinicalPathway_TaskAction(category_1, param("description", action), convertPriority(param("priority", action)), parseDueDate(param("start", action)), assignee_1, parseRecurrence(tryFind<string, string>("end", action.Params))));
|
|
261
|
+
return ClinicalPathway_ActionInfo_Task(new ClinicalPathway_TaskAction(categoryId_2, category_1, param("description", action), convertPriority(param("priority", action)), parseDueDate(param("start", action)), assignee_1, parseRecurrence(tryFind<string, string>("end", action.Params))));
|
|
230
262
|
}
|
|
231
263
|
case "medset":
|
|
232
264
|
return ClinicalPathway_ActionInfo_Medication(new ClinicalPathway_MedicationAction(param("medset_name", action), "", "", "", "", false));
|
|
233
265
|
case "problem":
|
|
234
|
-
return ClinicalPathway_ActionInfo_Problem(new ClinicalPathway_ProblemAction((s = param("category_name", action), isNullOrEmpty(s) ? "Problem" : s), undefined, utcNow(), ClinicalPathway_ProblemStatus_Active(), undefined));
|
|
266
|
+
return ClinicalPathway_ActionInfo_Problem(new ClinicalPathway_ProblemAction(paramInt(ofArray(["problem_list_id", "category_id", "id"]), action), (s = param("category_name", action), isNullOrEmpty(s) ? "Problem" : s), undefined, utcNow(), ClinicalPathway_ProblemStatus_Active(), undefined));
|
|
235
267
|
case "treatment":
|
|
236
268
|
return ClinicalPathway_ActionInfo_Medication(new ClinicalPathway_MedicationAction((s_1 = param("category_name", action), isNullOrEmpty(s_1) ? "Treatment" : s_1), "", "", "", "", false));
|
|
237
269
|
case "taskcomplete":
|
|
238
|
-
return ClinicalPathway_ActionInfo_Task(new ClinicalPathway_TaskAction(`Complete: ${param("category_name", action)}`, "Mark task as complete", ClinicalPathway_TaskPriority_Medium(), ClinicalPathway_DueDate_Today(), "Staff", undefined));
|
|
270
|
+
return ClinicalPathway_ActionInfo_Task(new ClinicalPathway_TaskAction(undefined, `Complete: ${param("category_name", action)}`, "Mark task as complete", ClinicalPathway_TaskPriority_Medium(), ClinicalPathway_DueDate_Today(), "Staff", undefined));
|
|
239
271
|
case "approval":
|
|
240
|
-
return ClinicalPathway_ActionInfo_Task(new ClinicalPathway_TaskAction("Approval Required", param("description", action), ClinicalPathway_TaskPriority_High(), ClinicalPathway_DueDate_Today(), "Supervisor", undefined));
|
|
272
|
+
return ClinicalPathway_ActionInfo_Task(new ClinicalPathway_TaskAction(undefined, "Approval Required", param("description", action), ClinicalPathway_TaskPriority_High(), ClinicalPathway_DueDate_Today(), "Supervisor", undefined));
|
|
241
273
|
case "groups":
|
|
242
274
|
return ClinicalPathway_ActionInfo_Documentation(new ClinicalPathway_DocumentationAction("Group Assignment", param("category_name", action), false));
|
|
243
275
|
default:
|
|
244
|
-
return ClinicalPathway_ActionInfo_Task(new ClinicalPathway_TaskAction(`Unknown action: ${matchValue}`, join("; ", map<[string, string], string>((tupledArg: [string, string]): string => (`${tupledArg[0]}=${tupledArg[1]}`), toList<string, string>(action.Params))), ClinicalPathway_TaskPriority_Medium(), ClinicalPathway_DueDate_Today(), "Staff", undefined));
|
|
276
|
+
return ClinicalPathway_ActionInfo_Task(new ClinicalPathway_TaskAction(undefined, `Unknown action: ${matchValue}`, join("; ", map<[string, string], string>((tupledArg: [string, string]): string => (`${tupledArg[0]}=${tupledArg[1]}`), toList<string, string>(action.Params))), ClinicalPathway_TaskPriority_Medium(), ClinicalPathway_DueDate_Today(), "Staff", undefined));
|
|
245
277
|
}
|
|
246
278
|
}
|
|
247
279
|
|
|
@@ -732,7 +732,7 @@ export function createPluginField(fieldKeyString: string, label: string, config:
|
|
|
732
732
|
* TypeScript: createActionState(stateKey: string, label: string, taskDescription: string, priority?: string)
|
|
733
733
|
*/
|
|
734
734
|
export function createActionState(stateKeyString: string, label: string, taskDescription: string, priority: Option<string>): ClinicalPathway_StateDefinition {
|
|
735
|
-
return new ClinicalPathway_StateDefinition(new Shared_StateKey(parse(stateKeyString)), label, 1, ClinicalPathway_StateType_Action(ClinicalPathway_ActionInfo_Task(new ClinicalPathway_TaskAction("Clinical", taskDescription, (priority != null) ? ((value_19(priority) === "High") ? ClinicalPathway_TaskPriority_High() : ((value_19(priority) === "Low") ? ClinicalPathway_TaskPriority_Low() : ClinicalPathway_TaskPriority_Medium())) : ClinicalPathway_TaskPriority_Medium(), ClinicalPathway_DueDate_Today(), "Clinical Staff", undefined))), undefined);
|
|
735
|
+
return new ClinicalPathway_StateDefinition(new Shared_StateKey(parse(stateKeyString)), label, 1, ClinicalPathway_StateType_Action(ClinicalPathway_ActionInfo_Task(new ClinicalPathway_TaskAction(undefined, "Clinical", taskDescription, (priority != null) ? ((value_19(priority) === "High") ? ClinicalPathway_TaskPriority_High() : ((value_19(priority) === "Low") ? ClinicalPathway_TaskPriority_Low() : ClinicalPathway_TaskPriority_Medium())) : ClinicalPathway_TaskPriority_Medium(), ClinicalPathway_DueDate_Today(), "Clinical Staff", undefined))), undefined);
|
|
736
736
|
}
|
|
737
737
|
|
|
738
738
|
/**
|