@f1studio/form-spec 5.0.0-alpha.102 → 5.0.0-alpha.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FormSpec.TS/Designer.js +2 -2
- package/FormSpec.TS/Designer.js.map +1 -1
- package/FormSpec.TS/Designer.ts.map +1 -1
- package/FormSpec.TS/FormSpec.js +210 -143
- package/FormSpec.TS/FormSpec.js.map +1 -1
- package/FormSpec.TS/FormSpec.ts.map +1 -1
- package/FormSpec.TS/FormSpecHelpers.js +62 -40
- package/FormSpec.TS/FormSpecHelpers.js.map +1 -1
- package/FormSpec.TS/FormSpecHelpers.ts.map +1 -1
- package/FormSpec.TS/FormSpecValues.js +207 -0
- package/FormSpec.TS/FormSpecValues.js.map +1 -0
- package/FormSpec.TS/FormSpecValues.ts.map +1 -0
- package/FormSpec.TS/Helpers.js +26 -25
- package/FormSpec.TS/Helpers.js.map +1 -1
- package/FormSpec.TS/Helpers.ts.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Api.Helpers.js +85 -125
- package/FormSpec.TS/Interop/FormSpec.Api.Helpers.js.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Api.Helpers.ts.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Api.Option.js +37 -7
- package/FormSpec.TS/Interop/FormSpec.Api.Option.js.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Api.Option.ts.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.js +103 -80
- package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.js.map +1 -1
- package/FormSpec.TS/Interop/FormSpec.Values.Api.Option.ts.map +1 -1
- package/FormSpec.TS/PathwayExecutor.js +371 -125
- package/FormSpec.TS/PathwayExecutor.js.map +1 -1
- package/FormSpec.TS/PathwayExecutor.ts.map +1 -1
- package/FormSpec.TS/PathwayValidator.js +14 -26
- package/FormSpec.TS/PathwayValidator.js.map +1 -1
- package/FormSpec.TS/PathwayValidator.ts.map +1 -1
- package/FormSpec.TS/Renderers/FormSpecMarkdownRenderer.ts.map +1 -1
- package/FormSpec.TS/Renderers/PathwayRenderers.js +35 -26
- package/FormSpec.TS/Renderers/PathwayRenderers.js.map +1 -1
- package/FormSpec.TS/Renderers/PathwayRenderers.ts.map +1 -1
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.js.map +1 -1
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.ts.map +1 -1
- package/FormSpec.TS/fable_modules/project_cracked.json +1 -1
- package/FormSpec.d.ts +56 -43
- package/FormSpec.d.ts.map +1 -1
- package/FormSpecHelpers.d.ts +18 -12
- package/FormSpecHelpers.d.ts.map +1 -1
- package/FormSpecValues.d.ts +62 -0
- package/FormSpecValues.d.ts.map +1 -0
- package/Helpers.d.ts +11 -10
- package/Helpers.d.ts.map +1 -1
- package/Interop/FormSpec.Api.Helpers.d.ts +25 -28
- package/Interop/FormSpec.Api.Helpers.d.ts.map +1 -1
- package/Interop/FormSpec.Api.Option.d.ts +10 -6
- package/Interop/FormSpec.Api.Option.d.ts.map +1 -1
- package/Interop/FormSpec.Values.Api.Option.d.ts +35 -22
- package/Interop/FormSpec.Values.Api.Option.d.ts.map +1 -1
- package/PathwayExecutor.d.ts +63 -33
- package/PathwayExecutor.d.ts.map +1 -1
- package/PathwayValidator.d.ts.map +1 -1
- package/README.md +18 -7
- package/Renderers/FormSpecMarkdownRenderer.d.ts +3 -2
- package/Renderers/FormSpecMarkdownRenderer.d.ts.map +1 -1
- package/Renderers/PathwayRenderers.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Designer.ts +2 -2
- package/src/FormSpec.ts +123 -83
- package/src/FormSpecHelpers.ts +71 -48
- package/src/FormSpecValues.ts +158 -0
- package/src/Helpers.ts +52 -51
- package/src/Interop/FormSpec.Api.Helpers.ts +111 -148
- package/src/Interop/FormSpec.Api.Option.ts +32 -13
- package/src/Interop/FormSpec.Values.Api.Option.ts +156 -129
- package/src/PathwayExecutor.ts +431 -154
- package/src/PathwayValidator.ts +17 -23
- package/src/Renderers/FormSpecMarkdownRenderer.ts +6 -5
- package/src/Renderers/PathwayRenderers.ts +37 -29
package/src/FormSpec.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { FSharpRef, Record, Union } from "@fable-org/fable-library-js/Types.js";
|
|
2
|
-
import { obj_type, float64_type, tuple_type, bool_type,
|
|
2
|
+
import { obj_type, float64_type, tuple_type, bool_type, list_type, record_type, option_type, int32_type, string_type, union_type, class_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
3
|
+
import { Option } from "@fable-org/fable-library-js/Option.js";
|
|
4
|
+
import { float64, int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
3
5
|
import { IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
|
|
4
6
|
import { FSharpMap } from "@fable-org/fable-library-js/Map.js";
|
|
5
|
-
import { Option } from "@fable-org/fable-library-js/Option.js";
|
|
6
7
|
import { FSharpSet } from "@fable-org/fable-library-js/Set.js";
|
|
7
8
|
import { ofArray, FSharpList } from "@fable-org/fable-library-js/List.js";
|
|
8
|
-
import { float64, int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
9
9
|
import { newGuid, tryParse } from "@fable-org/fable-library-js/Guid.js";
|
|
10
10
|
import { item } from "@fable-org/fable-library-js/Array.js";
|
|
11
11
|
import { split } from "@fable-org/fable-library-js/String.js";
|
|
@@ -116,16 +116,18 @@ export class Shared_FieldOption extends Record implements IEquatable<Shared_Fiel
|
|
|
116
116
|
readonly Description: string;
|
|
117
117
|
readonly Value: string;
|
|
118
118
|
readonly OptionKey: Shared_FieldOptionKey;
|
|
119
|
-
|
|
119
|
+
readonly Score: Option<int32>;
|
|
120
|
+
constructor(Description: string, Value: string, OptionKey: Shared_FieldOptionKey, Score: Option<int32>) {
|
|
120
121
|
super();
|
|
121
122
|
this.Description = Description;
|
|
122
123
|
this.Value = Value;
|
|
123
124
|
this.OptionKey = OptionKey;
|
|
125
|
+
this.Score = Score;
|
|
124
126
|
}
|
|
125
127
|
}
|
|
126
128
|
|
|
127
129
|
export function Shared_FieldOption_$reflection(): TypeInfo {
|
|
128
|
-
return record_type("F1.Studio.Shared.FieldOption", [], Shared_FieldOption, () => [["Description", string_type], ["Value", string_type], ["OptionKey", Shared_FieldOptionKey_$reflection()]]);
|
|
130
|
+
return record_type("F1.Studio.Shared.FieldOption", [], Shared_FieldOption, () => [["Description", string_type], ["Value", string_type], ["OptionKey", Shared_FieldOptionKey_$reflection()], ["Score", option_type(int32_type)]]);
|
|
129
131
|
}
|
|
130
132
|
|
|
131
133
|
export class Shared_FieldAnswer extends Record implements IEquatable<Shared_FieldAnswer>, IComparable<Shared_FieldAnswer> {
|
|
@@ -1147,7 +1149,8 @@ export class Spec_FormField$1<FieldType> extends Record implements IEquatable<Sp
|
|
|
1147
1149
|
readonly IsOptional: boolean;
|
|
1148
1150
|
readonly IsDeprecated: boolean;
|
|
1149
1151
|
readonly FieldType: FieldType;
|
|
1150
|
-
|
|
1152
|
+
readonly Value: Option<Shared_FieldValue_$union>;
|
|
1153
|
+
constructor(FieldOrder: int32, FieldKey: Shared_FieldKey, Label: string, Notes: Option<string>, DependsOn: Option<Spec_DependsOn>, IsOptional: boolean, IsDeprecated: boolean, FieldType: FieldType, Value: Option<Shared_FieldValue_$union>) {
|
|
1151
1154
|
super();
|
|
1152
1155
|
this.FieldOrder = (FieldOrder | 0);
|
|
1153
1156
|
this.FieldKey = FieldKey;
|
|
@@ -1157,11 +1160,12 @@ export class Spec_FormField$1<FieldType> extends Record implements IEquatable<Sp
|
|
|
1157
1160
|
this.IsOptional = IsOptional;
|
|
1158
1161
|
this.IsDeprecated = IsDeprecated;
|
|
1159
1162
|
this.FieldType = FieldType;
|
|
1163
|
+
this.Value = Value;
|
|
1160
1164
|
}
|
|
1161
1165
|
}
|
|
1162
1166
|
|
|
1163
1167
|
export function Spec_FormField$1_$reflection(gen0: TypeInfo): TypeInfo {
|
|
1164
|
-
return record_type("F1.Studio.Spec.FormField`1", [gen0], Spec_FormField$1, () => [["FieldOrder", int32_type], ["FieldKey", Shared_FieldKey_$reflection()], ["Label", string_type], ["Notes", option_type(string_type)], ["DependsOn", option_type(Spec_DependsOn_$reflection())], ["IsOptional", bool_type], ["IsDeprecated", bool_type], ["FieldType", gen0]]);
|
|
1168
|
+
return record_type("F1.Studio.Spec.FormField`1", [gen0], Spec_FormField$1, () => [["FieldOrder", int32_type], ["FieldKey", Shared_FieldKey_$reflection()], ["Label", string_type], ["Notes", option_type(string_type)], ["DependsOn", option_type(Spec_DependsOn_$reflection())], ["IsOptional", bool_type], ["IsDeprecated", bool_type], ["FieldType", gen0], ["Value", option_type(Shared_FieldValue_$reflection())]]);
|
|
1165
1169
|
}
|
|
1166
1170
|
|
|
1167
1171
|
export class Spec_FormStep$1<FieldType> extends Record implements IEquatable<Spec_FormStep$1<FieldType>>, IComparable<Spec_FormStep$1<FieldType>> {
|
|
@@ -1274,6 +1278,72 @@ export function Spec_Score_$reflection(): TypeInfo {
|
|
|
1274
1278
|
return record_type("F1.Studio.Spec.Score", [], Spec_Score, () => [["MaxScore", int32_type], ["ScoreRanges", list_type(Spec_ScoreRange_$reflection())]]);
|
|
1275
1279
|
}
|
|
1276
1280
|
|
|
1281
|
+
export type Spec_FormLifecycle_$union =
|
|
1282
|
+
| Spec_FormLifecycle<0>
|
|
1283
|
+
| Spec_FormLifecycle<1>
|
|
1284
|
+
| Spec_FormLifecycle<2>
|
|
1285
|
+
| Spec_FormLifecycle<3>
|
|
1286
|
+
|
|
1287
|
+
export type Spec_FormLifecycle_$cases = {
|
|
1288
|
+
0: ["Blueprint", []],
|
|
1289
|
+
1: ["Draft", [string]],
|
|
1290
|
+
2: ["Submitted", [string]],
|
|
1291
|
+
3: ["Signed", [string]]
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
export function Spec_FormLifecycle_Blueprint() {
|
|
1295
|
+
return new Spec_FormLifecycle<0>(0, []);
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
export function Spec_FormLifecycle_Draft(instanceId: string) {
|
|
1299
|
+
return new Spec_FormLifecycle<1>(1, [instanceId]);
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
export function Spec_FormLifecycle_Submitted(instanceId: string) {
|
|
1303
|
+
return new Spec_FormLifecycle<2>(2, [instanceId]);
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
export function Spec_FormLifecycle_Signed(instanceId: string) {
|
|
1307
|
+
return new Spec_FormLifecycle<3>(3, [instanceId]);
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
export class Spec_FormLifecycle<Tag extends keyof Spec_FormLifecycle_$cases> extends Union<Tag, Spec_FormLifecycle_$cases[Tag][0]> {
|
|
1311
|
+
constructor(readonly tag: Tag, readonly fields: Spec_FormLifecycle_$cases[Tag][1]) {
|
|
1312
|
+
super();
|
|
1313
|
+
}
|
|
1314
|
+
cases() {
|
|
1315
|
+
return ["Blueprint", "Draft", "Submitted", "Signed"];
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
export function Spec_FormLifecycle_$reflection(): TypeInfo {
|
|
1320
|
+
return union_type("F1.Studio.Spec.FormLifecycle", [], Spec_FormLifecycle, () => [[], [["instanceId", class_type("System.Guid")]], [["instanceId", class_type("System.Guid")]], [["instanceId", class_type("System.Guid")]]]);
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
export class Spec_FilledMeta extends Record implements IEquatable<Spec_FilledMeta>, IComparable<Spec_FilledMeta> {
|
|
1324
|
+
readonly InstanceId: string;
|
|
1325
|
+
readonly SourceBlueprintId: string;
|
|
1326
|
+
readonly FilledBy: Option<string>;
|
|
1327
|
+
readonly FilledAt: Option<Date>;
|
|
1328
|
+
readonly LastModifiedAt: Option<Date>;
|
|
1329
|
+
readonly Signatures: FSharpList<Values_Signature>;
|
|
1330
|
+
readonly Notes: Option<string>;
|
|
1331
|
+
constructor(InstanceId: string, SourceBlueprintId: string, FilledBy: Option<string>, FilledAt: Option<Date>, LastModifiedAt: Option<Date>, Signatures: FSharpList<Values_Signature>, Notes: Option<string>) {
|
|
1332
|
+
super();
|
|
1333
|
+
this.InstanceId = InstanceId;
|
|
1334
|
+
this.SourceBlueprintId = SourceBlueprintId;
|
|
1335
|
+
this.FilledBy = FilledBy;
|
|
1336
|
+
this.FilledAt = FilledAt;
|
|
1337
|
+
this.LastModifiedAt = LastModifiedAt;
|
|
1338
|
+
this.Signatures = Signatures;
|
|
1339
|
+
this.Notes = Notes;
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
export function Spec_FilledMeta_$reflection(): TypeInfo {
|
|
1344
|
+
return record_type("F1.Studio.Spec.FilledMeta", [], Spec_FilledMeta, () => [["InstanceId", class_type("System.Guid")], ["SourceBlueprintId", class_type("System.Guid")], ["FilledBy", option_type(string_type)], ["FilledAt", option_type(class_type("System.DateTimeOffset"))], ["LastModifiedAt", option_type(class_type("System.DateTimeOffset"))], ["Signatures", list_type(Values_Signature_$reflection())], ["Notes", option_type(string_type)]]);
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1277
1347
|
export class Spec_FormSpec$1<FieldType> extends Record implements IEquatable<Spec_FormSpec$1<FieldType>>, IComparable<Spec_FormSpec$1<FieldType>> {
|
|
1278
1348
|
readonly Id: string;
|
|
1279
1349
|
readonly Code: Option<string>;
|
|
@@ -1288,7 +1358,9 @@ export class Spec_FormSpec$1<FieldType> extends Record implements IEquatable<Spe
|
|
|
1288
1358
|
readonly RequiresReview: boolean;
|
|
1289
1359
|
readonly RequiresReviewAndApproval: boolean;
|
|
1290
1360
|
readonly ClinicalPathway: Option<ClinicalPathway_ClinicalPathwaySpec>;
|
|
1291
|
-
|
|
1361
|
+
readonly Lifecycle: Spec_FormLifecycle_$union;
|
|
1362
|
+
readonly FilledMeta: Option<Spec_FilledMeta>;
|
|
1363
|
+
constructor(Id: string, Code: Option<string>, Title: string, Abstract: string, Version: string, FormSpecVersion: string, Steps: FSharpList<Spec_FormStep$1<FieldType>>, CategoryTags: FSharpList<string>, Score: Option<Spec_Score>, AssociatedCodes: FSharpList<string>, RequiresReview: boolean, RequiresReviewAndApproval: boolean, ClinicalPathway: Option<ClinicalPathway_ClinicalPathwaySpec>, Lifecycle: Spec_FormLifecycle_$union, FilledMeta: Option<Spec_FilledMeta>) {
|
|
1292
1364
|
super();
|
|
1293
1365
|
this.Id = Id;
|
|
1294
1366
|
this.Code = Code;
|
|
@@ -1303,11 +1375,13 @@ export class Spec_FormSpec$1<FieldType> extends Record implements IEquatable<Spe
|
|
|
1303
1375
|
this.RequiresReview = RequiresReview;
|
|
1304
1376
|
this.RequiresReviewAndApproval = RequiresReviewAndApproval;
|
|
1305
1377
|
this.ClinicalPathway = ClinicalPathway;
|
|
1378
|
+
this.Lifecycle = Lifecycle;
|
|
1379
|
+
this.FilledMeta = FilledMeta;
|
|
1306
1380
|
}
|
|
1307
1381
|
}
|
|
1308
1382
|
|
|
1309
1383
|
export function Spec_FormSpec$1_$reflection(gen0: TypeInfo): TypeInfo {
|
|
1310
|
-
return record_type("F1.Studio.Spec.FormSpec`1", [gen0], Spec_FormSpec$1, () => [["Id", class_type("System.Guid")], ["Code", option_type(string_type)], ["Title", string_type], ["Abstract", string_type], ["Version", string_type], ["FormSpecVersion", string_type], ["Steps", list_type(Spec_FormStep$1_$reflection(gen0))], ["CategoryTags", list_type(string_type)], ["Score", option_type(Spec_Score_$reflection())], ["AssociatedCodes", list_type(string_type)], ["RequiresReview", bool_type], ["RequiresReviewAndApproval", bool_type], ["ClinicalPathway", option_type(ClinicalPathway_ClinicalPathwaySpec_$reflection())]]);
|
|
1384
|
+
return record_type("F1.Studio.Spec.FormSpec`1", [gen0], Spec_FormSpec$1, () => [["Id", class_type("System.Guid")], ["Code", option_type(string_type)], ["Title", string_type], ["Abstract", string_type], ["Version", string_type], ["FormSpecVersion", string_type], ["Steps", list_type(Spec_FormStep$1_$reflection(gen0))], ["CategoryTags", list_type(string_type)], ["Score", option_type(Spec_Score_$reflection())], ["AssociatedCodes", list_type(string_type)], ["RequiresReview", bool_type], ["RequiresReviewAndApproval", bool_type], ["ClinicalPathway", option_type(ClinicalPathway_ClinicalPathwaySpec_$reflection())], ["Lifecycle", Spec_FormLifecycle_$reflection()], ["FilledMeta", option_type(Spec_FilledMeta_$reflection())]]);
|
|
1311
1385
|
}
|
|
1312
1386
|
|
|
1313
1387
|
export function Spec_Evaluator__get_Key(x: Spec_Evaluator_$union): string {
|
|
@@ -2215,15 +2289,19 @@ export type ClinicalPathway_TransitionCondition_$union =
|
|
|
2215
2289
|
| ClinicalPathway_TransitionCondition<4>
|
|
2216
2290
|
| ClinicalPathway_TransitionCondition<5>
|
|
2217
2291
|
| ClinicalPathway_TransitionCondition<6>
|
|
2292
|
+
| ClinicalPathway_TransitionCondition<7>
|
|
2293
|
+
| ClinicalPathway_TransitionCondition<8>
|
|
2218
2294
|
|
|
2219
2295
|
export type ClinicalPathway_TransitionCondition_$cases = {
|
|
2220
2296
|
0: ["FieldCondition", [Shared_FieldKey, ClinicalPathway_FieldEvaluator_$union, Shared_ConditionValue_$union]],
|
|
2221
2297
|
1: ["FieldOptionCondition", [Shared_FieldKey, Option<Shared_MatrixItemKey>, Shared_FieldOptionKey, ClinicalPathway_FieldEvaluator_$union, Shared_ConditionValue_$union]],
|
|
2222
2298
|
2: ["PluginPropertyCondition", [Shared_FieldKey, Shared_PluginPropertyKey, ClinicalPathway_FieldEvaluator_$union, Shared_ConditionValue_$union]],
|
|
2223
|
-
3: ["
|
|
2224
|
-
4: ["
|
|
2225
|
-
5: ["
|
|
2226
|
-
6: ["
|
|
2299
|
+
3: ["ScoreInRange", [int32, int32]],
|
|
2300
|
+
4: ["FieldScoreInRange", [Shared_FieldKey, int32, int32]],
|
|
2301
|
+
5: ["StateCondition", [Shared_StateKey, ClinicalPathway_StateEvaluator_$union]],
|
|
2302
|
+
6: ["CompositeCondition", [ClinicalPathway_LogicalOp_$union, FSharpList<ClinicalPathway_TransitionCondition_$union>]],
|
|
2303
|
+
7: ["TestResultCondition", [string, string]],
|
|
2304
|
+
8: ["Always", []]
|
|
2227
2305
|
}
|
|
2228
2306
|
|
|
2229
2307
|
export function ClinicalPathway_TransitionCondition_FieldCondition(fieldKey: Shared_FieldKey, evaluator: ClinicalPathway_FieldEvaluator_$union, value: Shared_ConditionValue_$union) {
|
|
@@ -2238,20 +2316,28 @@ export function ClinicalPathway_TransitionCondition_PluginPropertyCondition(fiel
|
|
|
2238
2316
|
return new ClinicalPathway_TransitionCondition<2>(2, [fieldKey, propertyKey, evaluator, value]);
|
|
2239
2317
|
}
|
|
2240
2318
|
|
|
2319
|
+
export function ClinicalPathway_TransitionCondition_ScoreInRange(min: int32, max: int32) {
|
|
2320
|
+
return new ClinicalPathway_TransitionCondition<3>(3, [min, max]);
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
export function ClinicalPathway_TransitionCondition_FieldScoreInRange(fieldKey: Shared_FieldKey, min: int32, max: int32) {
|
|
2324
|
+
return new ClinicalPathway_TransitionCondition<4>(4, [fieldKey, min, max]);
|
|
2325
|
+
}
|
|
2326
|
+
|
|
2241
2327
|
export function ClinicalPathway_TransitionCondition_StateCondition(stateKey: Shared_StateKey, stateEvaluator: ClinicalPathway_StateEvaluator_$union) {
|
|
2242
|
-
return new ClinicalPathway_TransitionCondition<
|
|
2328
|
+
return new ClinicalPathway_TransitionCondition<5>(5, [stateKey, stateEvaluator]);
|
|
2243
2329
|
}
|
|
2244
2330
|
|
|
2245
2331
|
export function ClinicalPathway_TransitionCondition_CompositeCondition(logicalOp: ClinicalPathway_LogicalOp_$union, conditions: FSharpList<ClinicalPathway_TransitionCondition_$union>) {
|
|
2246
|
-
return new ClinicalPathway_TransitionCondition<
|
|
2332
|
+
return new ClinicalPathway_TransitionCondition<6>(6, [logicalOp, conditions]);
|
|
2247
2333
|
}
|
|
2248
2334
|
|
|
2249
2335
|
export function ClinicalPathway_TransitionCondition_TestResultCondition(testName: string, result: string) {
|
|
2250
|
-
return new ClinicalPathway_TransitionCondition<
|
|
2336
|
+
return new ClinicalPathway_TransitionCondition<7>(7, [testName, result]);
|
|
2251
2337
|
}
|
|
2252
2338
|
|
|
2253
2339
|
export function ClinicalPathway_TransitionCondition_Always() {
|
|
2254
|
-
return new ClinicalPathway_TransitionCondition<
|
|
2340
|
+
return new ClinicalPathway_TransitionCondition<8>(8, []);
|
|
2255
2341
|
}
|
|
2256
2342
|
|
|
2257
2343
|
export class ClinicalPathway_TransitionCondition<Tag extends keyof ClinicalPathway_TransitionCondition_$cases> extends Union<Tag, ClinicalPathway_TransitionCondition_$cases[Tag][0]> {
|
|
@@ -2259,12 +2345,12 @@ export class ClinicalPathway_TransitionCondition<Tag extends keyof ClinicalPathw
|
|
|
2259
2345
|
super();
|
|
2260
2346
|
}
|
|
2261
2347
|
cases() {
|
|
2262
|
-
return ["FieldCondition", "FieldOptionCondition", "PluginPropertyCondition", "StateCondition", "CompositeCondition", "TestResultCondition", "Always"];
|
|
2348
|
+
return ["FieldCondition", "FieldOptionCondition", "PluginPropertyCondition", "ScoreInRange", "FieldScoreInRange", "StateCondition", "CompositeCondition", "TestResultCondition", "Always"];
|
|
2263
2349
|
}
|
|
2264
2350
|
}
|
|
2265
2351
|
|
|
2266
2352
|
export function ClinicalPathway_TransitionCondition_$reflection(): TypeInfo {
|
|
2267
|
-
return union_type("F1.Studio.ClinicalPathway.TransitionCondition", [], ClinicalPathway_TransitionCondition, () => [[["fieldKey", Shared_FieldKey_$reflection()], ["evaluator", ClinicalPathway_FieldEvaluator_$reflection()], ["value", Shared_ConditionValue_$reflection()]], [["fieldKey", Shared_FieldKey_$reflection()], ["fieldItemKey", option_type(Shared_MatrixItemKey_$reflection())], ["optionKey", Shared_FieldOptionKey_$reflection()], ["evaluator", ClinicalPathway_FieldEvaluator_$reflection()], ["value", Shared_ConditionValue_$reflection()]], [["fieldKey", Shared_FieldKey_$reflection()], ["propertyKey", Shared_PluginPropertyKey_$reflection()], ["evaluator", ClinicalPathway_FieldEvaluator_$reflection()], ["value", Shared_ConditionValue_$reflection()]], [["stateKey", Shared_StateKey_$reflection()], ["stateEvaluator", ClinicalPathway_StateEvaluator_$reflection()]], [["logicalOp", ClinicalPathway_LogicalOp_$reflection()], ["conditions", list_type(ClinicalPathway_TransitionCondition_$reflection())]], [["testName", string_type], ["result", string_type]], []]);
|
|
2353
|
+
return union_type("F1.Studio.ClinicalPathway.TransitionCondition", [], ClinicalPathway_TransitionCondition, () => [[["fieldKey", Shared_FieldKey_$reflection()], ["evaluator", ClinicalPathway_FieldEvaluator_$reflection()], ["value", Shared_ConditionValue_$reflection()]], [["fieldKey", Shared_FieldKey_$reflection()], ["fieldItemKey", option_type(Shared_MatrixItemKey_$reflection())], ["optionKey", Shared_FieldOptionKey_$reflection()], ["evaluator", ClinicalPathway_FieldEvaluator_$reflection()], ["value", Shared_ConditionValue_$reflection()]], [["fieldKey", Shared_FieldKey_$reflection()], ["propertyKey", Shared_PluginPropertyKey_$reflection()], ["evaluator", ClinicalPathway_FieldEvaluator_$reflection()], ["value", Shared_ConditionValue_$reflection()]], [["min", int32_type], ["max", int32_type]], [["fieldKey", Shared_FieldKey_$reflection()], ["min", int32_type], ["max", int32_type]], [["stateKey", Shared_StateKey_$reflection()], ["stateEvaluator", ClinicalPathway_StateEvaluator_$reflection()]], [["logicalOp", ClinicalPathway_LogicalOp_$reflection()], ["conditions", list_type(ClinicalPathway_TransitionCondition_$reflection())]], [["testName", string_type], ["result", string_type]], []]);
|
|
2268
2354
|
}
|
|
2269
2355
|
|
|
2270
2356
|
export type ClinicalPathway_FieldEvaluator_$union =
|
|
@@ -2892,28 +2978,6 @@ export function Values_StepOrder_$reflection(): TypeInfo {
|
|
|
2892
2978
|
return union_type("F1.Studio.Values.StepOrder", [], Values_StepOrder, () => [[["Item", int32_type]]]);
|
|
2893
2979
|
}
|
|
2894
2980
|
|
|
2895
|
-
export class Values_FieldDetails$1<FieldType> extends Record implements IEquatable<Values_FieldDetails$1<FieldType>>, IComparable<Values_FieldDetails$1<FieldType>> {
|
|
2896
|
-
readonly FieldOrder: int32;
|
|
2897
|
-
readonly Key: Shared_FieldKey;
|
|
2898
|
-
readonly Label: string;
|
|
2899
|
-
readonly FieldValue: Shared_FieldValue_$union;
|
|
2900
|
-
readonly FieldType: FieldType;
|
|
2901
|
-
readonly Options: FSharpList<Shared_FieldOption>;
|
|
2902
|
-
constructor(FieldOrder: int32, Key: Shared_FieldKey, Label: string, FieldValue: Shared_FieldValue_$union, FieldType: FieldType, Options: FSharpList<Shared_FieldOption>) {
|
|
2903
|
-
super();
|
|
2904
|
-
this.FieldOrder = (FieldOrder | 0);
|
|
2905
|
-
this.Key = Key;
|
|
2906
|
-
this.Label = Label;
|
|
2907
|
-
this.FieldValue = FieldValue;
|
|
2908
|
-
this.FieldType = FieldType;
|
|
2909
|
-
this.Options = Options;
|
|
2910
|
-
}
|
|
2911
|
-
}
|
|
2912
|
-
|
|
2913
|
-
export function Values_FieldDetails$1_$reflection(gen0: TypeInfo): TypeInfo {
|
|
2914
|
-
return record_type("F1.Studio.Values.FieldDetails`1", [gen0], Values_FieldDetails$1, () => [["FieldOrder", int32_type], ["Key", Shared_FieldKey_$reflection()], ["Label", string_type], ["FieldValue", Shared_FieldValue_$reflection()], ["FieldType", gen0], ["Options", list_type(Shared_FieldOption_$reflection())]]);
|
|
2915
|
-
}
|
|
2916
|
-
|
|
2917
2981
|
export type Values_FormStatus_$union =
|
|
2918
2982
|
| Values_FormStatus<0>
|
|
2919
2983
|
| Values_FormStatus<1>
|
|
@@ -3012,56 +3076,16 @@ export function Values_Signature_$reflection(): TypeInfo {
|
|
|
3012
3076
|
return record_type("F1.Studio.Values.Signature", [], Values_Signature, () => [["ApprovedById", class_type("System.Guid")], ["ApprovedByFullName", string_type], ["ApprovedByDate", class_type("System.DateTime")], ["ApprovalSignature", string_type], ["SignatureType", Values_SignatureType_$reflection()]]);
|
|
3013
3077
|
}
|
|
3014
3078
|
|
|
3015
|
-
export class Values_DynamicFormSpecDetails extends Record implements IEquatable<Values_DynamicFormSpecDetails>, IComparable<Values_DynamicFormSpecDetails> {
|
|
3016
|
-
readonly FormSpecId: string;
|
|
3017
|
-
readonly FormSpecCode: Option<string>;
|
|
3018
|
-
readonly FormSpecVersion: string;
|
|
3019
|
-
readonly DynamicVersion: string;
|
|
3020
|
-
readonly MaxScore: Option<Spec_Score>;
|
|
3021
|
-
readonly Status: Values_FormStatus_$union;
|
|
3022
|
-
readonly Signatures: FSharpList<Values_Signature>;
|
|
3023
|
-
constructor(FormSpecId: string, FormSpecCode: Option<string>, FormSpecVersion: string, DynamicVersion: string, MaxScore: Option<Spec_Score>, Status: Values_FormStatus_$union, Signatures: FSharpList<Values_Signature>) {
|
|
3024
|
-
super();
|
|
3025
|
-
this.FormSpecId = FormSpecId;
|
|
3026
|
-
this.FormSpecCode = FormSpecCode;
|
|
3027
|
-
this.FormSpecVersion = FormSpecVersion;
|
|
3028
|
-
this.DynamicVersion = DynamicVersion;
|
|
3029
|
-
this.MaxScore = MaxScore;
|
|
3030
|
-
this.Status = Status;
|
|
3031
|
-
this.Signatures = Signatures;
|
|
3032
|
-
}
|
|
3033
|
-
}
|
|
3034
|
-
|
|
3035
|
-
export function Values_DynamicFormSpecDetails_$reflection(): TypeInfo {
|
|
3036
|
-
return record_type("F1.Studio.Values.DynamicFormSpecDetails", [], Values_DynamicFormSpecDetails, () => [["FormSpecId", class_type("System.Guid")], ["FormSpecCode", option_type(string_type)], ["FormSpecVersion", string_type], ["DynamicVersion", string_type], ["MaxScore", option_type(Spec_Score_$reflection())], ["Status", Values_FormStatus_$reflection()], ["Signatures", list_type(Values_Signature_$reflection())]]);
|
|
3037
|
-
}
|
|
3038
|
-
|
|
3039
3079
|
export class Values_DynamicForm$1<FableFormModel> extends Record implements IEquatable<Values_DynamicForm$1<FableFormModel>>, IComparable<Values_DynamicForm$1<FableFormModel>> {
|
|
3040
|
-
readonly DynamicFormSpecDetails: Values_DynamicFormSpecDetails;
|
|
3041
3080
|
readonly Steps: FSharpMap<Values_StepOrder, FableFormModel>;
|
|
3042
|
-
constructor(
|
|
3081
|
+
constructor(Steps: FSharpMap<Values_StepOrder, FableFormModel>) {
|
|
3043
3082
|
super();
|
|
3044
|
-
this.DynamicFormSpecDetails = DynamicFormSpecDetails;
|
|
3045
3083
|
this.Steps = Steps;
|
|
3046
3084
|
}
|
|
3047
3085
|
}
|
|
3048
3086
|
|
|
3049
3087
|
export function Values_DynamicForm$1_$reflection(gen0: TypeInfo): TypeInfo {
|
|
3050
|
-
return record_type("F1.Studio.Values.DynamicForm`1", [gen0], Values_DynamicForm$1, () => [["
|
|
3051
|
-
}
|
|
3052
|
-
|
|
3053
|
-
export class Values_DynamicFormResultData$1<FieldType> extends Record implements IEquatable<Values_DynamicFormResultData$1<FieldType>>, IComparable<Values_DynamicFormResultData$1<FieldType>> {
|
|
3054
|
-
readonly ResultFormSpecDetails: Values_DynamicFormSpecDetails;
|
|
3055
|
-
readonly ResultSteps: FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, Values_FieldDetails$1<FieldType>>>;
|
|
3056
|
-
constructor(ResultFormSpecDetails: Values_DynamicFormSpecDetails, ResultSteps: FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, Values_FieldDetails$1<FieldType>>>) {
|
|
3057
|
-
super();
|
|
3058
|
-
this.ResultFormSpecDetails = ResultFormSpecDetails;
|
|
3059
|
-
this.ResultSteps = ResultSteps;
|
|
3060
|
-
}
|
|
3061
|
-
}
|
|
3062
|
-
|
|
3063
|
-
export function Values_DynamicFormResultData$1_$reflection(gen0: TypeInfo): TypeInfo {
|
|
3064
|
-
return record_type("F1.Studio.Values.DynamicFormResultData`1", [gen0], Values_DynamicFormResultData$1, () => [["ResultFormSpecDetails", Values_DynamicFormSpecDetails_$reflection()], ["ResultSteps", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [Values_StepOrder_$reflection(), class_type("Microsoft.FSharp.Collections.FSharpMap`2", [Shared_FieldKey_$reflection(), Values_FieldDetails$1_$reflection(gen0)])])]]);
|
|
3088
|
+
return record_type("F1.Studio.Values.DynamicForm`1", [gen0], Values_DynamicForm$1, () => [["Steps", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [Values_StepOrder_$reflection(), gen0])]]);
|
|
3065
3089
|
}
|
|
3066
3090
|
|
|
3067
3091
|
export function Values_FormStatus__get_toString(x: Values_FormStatus_$union): string {
|
|
@@ -3111,4 +3135,20 @@ export function Values_formStatusFromString(formStatusString: string): Values_Fo
|
|
|
3111
3135
|
}
|
|
3112
3136
|
}
|
|
3113
3137
|
|
|
3138
|
+
/**
|
|
3139
|
+
* Project FormLifecycle to FormStatus for API/TS interop.
|
|
3140
|
+
*/
|
|
3141
|
+
export function Values_formLifecycleToFormStatus(lifecycle: Spec_FormLifecycle_$union): Values_FormStatus_$union {
|
|
3142
|
+
switch (lifecycle.tag) {
|
|
3143
|
+
case /* Draft */ 1:
|
|
3144
|
+
return Values_FormStatus_Draft(lifecycle.fields[0]);
|
|
3145
|
+
case /* Submitted */ 2:
|
|
3146
|
+
return Values_FormStatus_WaitingForReview();
|
|
3147
|
+
case /* Signed */ 3:
|
|
3148
|
+
return Values_FormStatus_Complete();
|
|
3149
|
+
default:
|
|
3150
|
+
return Values_FormStatus_Pending();
|
|
3151
|
+
}
|
|
3152
|
+
}
|
|
3153
|
+
|
|
3114
3154
|
//# sourceMappingURL=FormSpec.ts.map
|
package/src/FormSpecHelpers.ts
CHANGED
|
@@ -1,29 +1,48 @@
|
|
|
1
|
+
import { singleton, head, isEmpty, ofSeq, iterate, forAll, exists, FSharpList, empty, sortBy, mapIndexed, map } from "@fable-org/fable-library-js/List.js";
|
|
2
|
+
import { float64, int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
3
|
+
import { getFieldDetails, FormSpecMetadata, FieldDetails$1 } from "./FormSpecValues.js";
|
|
4
|
+
import { Shared_FieldValue_Single, Shared_FieldValue_PluginData, Shared_FieldValue_Matrix, Shared_MatrixAnswer, Shared_FieldValue_Multiple, Shared_ConditionValue_Single, Shared_ConditionValue_PluginData, Shared_ConditionValue_Matrix, Shared_ConditionValue_Multiple, ClinicalPathway_ConstraintDefinition, ClinicalPathway_ConstraintType_$union, ClinicalPathway_TransitionDefinition, ClinicalPathway_ClinicalPathwaySpec, ClinicalPathway_TransitionCondition_$union, ClinicalPathway_LogicalOp_$union, Shared_PluginPropertyKey, Shared_FieldOptionKey, Shared_ConditionValue_$union, ClinicalPathway_FieldEvaluator_$union, Shared_PluginDataProperty_$reflection, Shared_PluginDataProperty, Shared_MatrixItemKey, Shared_FieldAnswer, Shared_FieldValue_$union, Spec_FormSpec$1, Spec_FormLifecycle_Draft, Values_StepOrder, Spec_FormStep$1, Shared_FieldKey, Spec_FormField$1, Spec_FieldType_$union } from "./FormSpec.js";
|
|
5
|
+
import { FSharpMap, toList } from "@fable-org/fable-library-js/Map.js";
|
|
6
|
+
import { compare, comparePrimitives } from "@fable-org/fable-library-js/Util.js";
|
|
7
|
+
import { newGuid } from "@fable-org/fable-library-js/Guid.js";
|
|
1
8
|
import { value as value_2, Option, bind } from "@fable-org/fable-library-js/Option.js";
|
|
2
|
-
import { Shared_FieldValue_Single, Shared_FieldValue_PluginData, Shared_FieldValue_Matrix, Shared_MatrixAnswer, Shared_FieldValue_Multiple, Shared_ConditionValue_Single, Shared_ConditionValue_PluginData, Shared_ConditionValue_Matrix, Shared_ConditionValue_Multiple, Spec_FormSpec$1, ClinicalPathway_ConstraintDefinition, ClinicalPathway_ConstraintType_$union, ClinicalPathway_TransitionDefinition, ClinicalPathway_ClinicalPathwaySpec, Spec_FormStep$1, Spec_FormField$1, ClinicalPathway_TransitionCondition_$union, ClinicalPathway_LogicalOp_$union, Shared_PluginPropertyKey, Shared_FieldOptionKey, Shared_ConditionValue_$union, ClinicalPathway_FieldEvaluator_$union, Values_DynamicFormResultData$1, Values_StepOrder, Shared_FieldKey, Spec_FieldType_$union, Values_FieldDetails$1, Shared_PluginDataProperty_$reflection, Shared_PluginDataProperty, Shared_MatrixItemKey, Shared_FieldAnswer, Shared_FieldValue_$union } from "./FormSpec.js";
|
|
3
9
|
import { join } from "@fable-org/fable-library-js/String.js";
|
|
4
|
-
import {
|
|
5
|
-
import { map as map_1, toList } from "@fable-org/fable-library-js/Set.js";
|
|
6
|
-
import { iterate as iterate_1, FSharpMap, tryFind, toList as toList_1 } from "@fable-org/fable-library-js/Map.js";
|
|
10
|
+
import { map as map_1, toList as toList_1 } from "@fable-org/fable-library-js/Set.js";
|
|
7
11
|
import { Auto_generateBoxedEncoder_437914C6, toString } from "./fable_modules/Thoth.Json.10.4.1/Encode.fs.js";
|
|
8
12
|
import { list_type } from "@fable-org/fable-library-js/Reflection.js";
|
|
9
|
-
import { int32, float64 } from "@fable-org/fable-library-js/Int32.js";
|
|
10
13
|
import { tryParse } from "@fable-org/fable-library-js/Double.js";
|
|
11
14
|
import { FSharpRef } from "@fable-org/fable-library-js/Types.js";
|
|
12
15
|
import { FSharpResult$2_$union, FSharpResult$2_Error, FSharpResult$2_Ok } from "@fable-org/fable-library-js/Result.js";
|
|
13
16
|
import { addRangeInPlace } from "@fable-org/fable-library-js/Array.js";
|
|
14
|
-
import { compare, comparePrimitives } from "@fable-org/fable-library-js/Util.js";
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
|
-
*
|
|
19
|
+
* Build minimal FormSpec structure from ResultSteps Map (for TS interop when formSpec not available)
|
|
18
20
|
*/
|
|
19
|
-
export function
|
|
20
|
-
return
|
|
21
|
+
export function buildFormSpecFromResultStepsMap(details: FormSpecMetadata, stepsMap: FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>>): Spec_FormSpec$1<Spec_FieldType_$union> {
|
|
22
|
+
return new Spec_FormSpec$1(details.FormSpecId, details.FormSpecCode, "", "", details.DynamicVersion, details.FormSpecVersion, map<[Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>], Spec_FormStep$1<Spec_FieldType_$union>>((tupledArg_1: [Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>]): Spec_FormStep$1<Spec_FieldType_$union> => {
|
|
23
|
+
const stepOrder: int32 = tupledArg_1[0].fields[0] | 0;
|
|
24
|
+
return new Spec_FormStep$1(stepOrder, `Step ${stepOrder}`, mapIndexed<[Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>], Spec_FormField$1<Spec_FieldType_$union>>((i: int32, tupledArg_3: [Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>]): Spec_FormField$1<Spec_FieldType_$union> => {
|
|
25
|
+
const fd_1: FieldDetails$1<Spec_FieldType_$union> = tupledArg_3[1];
|
|
26
|
+
return new Spec_FormField$1(i + 1, tupledArg_3[0], fd_1.Label, undefined, undefined, false, false, fd_1.FieldType, fd_1.FieldValue);
|
|
27
|
+
}, sortBy<[Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>], int32>((tupledArg_2: [Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>]): int32 => tupledArg_2[1].FieldOrder, toList<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>(tupledArg_1[1]), {
|
|
28
|
+
Compare: comparePrimitives,
|
|
29
|
+
})));
|
|
30
|
+
}, sortBy<[Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>], int32>((tupledArg: [Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>]): int32 => tupledArg[0].fields[0], toList<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>>(stepsMap), {
|
|
31
|
+
Compare: comparePrimitives,
|
|
32
|
+
})), empty<string>(), details.MaxScore, empty<string>(), false, false, undefined, Spec_FormLifecycle_Draft(newGuid()), undefined);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Extract a field value as a string from FormSpec
|
|
37
|
+
*/
|
|
38
|
+
export function getFieldValue(fieldKey: Shared_FieldKey, formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): Option<string> {
|
|
39
|
+
return bind<FieldDetails$1<Spec_FieldType_$union>, string>((fieldDetails: FieldDetails$1<Spec_FieldType_$union>): Option<string> => {
|
|
21
40
|
const matchValue: Shared_FieldValue_$union = fieldDetails.FieldValue;
|
|
22
41
|
switch (matchValue.tag) {
|
|
23
42
|
case /* Multiple */ 1:
|
|
24
|
-
return join(",", map<Shared_FieldAnswer, string>((a: Shared_FieldAnswer): string => a.Value,
|
|
43
|
+
return join(",", map<Shared_FieldAnswer, string>((a: Shared_FieldAnswer): string => a.Value, toList_1<Shared_FieldAnswer>(matchValue.fields[0])));
|
|
25
44
|
case /* Matrix */ 2:
|
|
26
|
-
return join(",", map<[Shared_MatrixItemKey, string], string>((tuple: [Shared_MatrixItemKey, string]): string => tuple[1],
|
|
45
|
+
return join(",", map<[Shared_MatrixItemKey, string], string>((tuple: [Shared_MatrixItemKey, string]): string => tuple[1], toList<Shared_MatrixItemKey, string>(matchValue.fields[0].Values)));
|
|
27
46
|
case /* PluginData */ 3: {
|
|
28
47
|
const pluginData: FSharpList<Shared_PluginDataProperty> = matchValue.fields[0];
|
|
29
48
|
return toString(0, Auto_generateBoxedEncoder_437914C6(list_type(Shared_PluginDataProperty_$reflection()), undefined, undefined, undefined)(pluginData));
|
|
@@ -31,14 +50,14 @@ export function getFieldValue(fieldKey: Shared_FieldKey, formData: Values_Dynami
|
|
|
31
50
|
default:
|
|
32
51
|
return matchValue.fields[0].Value;
|
|
33
52
|
}
|
|
34
|
-
},
|
|
53
|
+
}, getFieldDetails(formSpec, fieldKey));
|
|
35
54
|
}
|
|
36
55
|
|
|
37
56
|
/**
|
|
38
57
|
* Check if a field has a specific value
|
|
39
58
|
*/
|
|
40
|
-
export function fieldHasValue(fieldKey: Shared_FieldKey, expectedValue: string,
|
|
41
|
-
const matchValue: Option<string> = getFieldValue(fieldKey,
|
|
59
|
+
export function fieldHasValue(fieldKey: Shared_FieldKey, expectedValue: string, formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): boolean {
|
|
60
|
+
const matchValue: Option<string> = getFieldValue(fieldKey, formSpec);
|
|
42
61
|
if (matchValue == null) {
|
|
43
62
|
return false;
|
|
44
63
|
}
|
|
@@ -50,8 +69,8 @@ export function fieldHasValue(fieldKey: Shared_FieldKey, expectedValue: string,
|
|
|
50
69
|
/**
|
|
51
70
|
* Check if a field value is greater than a threshold
|
|
52
71
|
*/
|
|
53
|
-
export function fieldGreaterThan(fieldKey: Shared_FieldKey, threshold: float64,
|
|
54
|
-
const matchValue: Option<string> = getFieldValue(fieldKey,
|
|
72
|
+
export function fieldGreaterThan(fieldKey: Shared_FieldKey, threshold: float64, formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): boolean {
|
|
73
|
+
const matchValue: Option<string> = getFieldValue(fieldKey, formSpec);
|
|
55
74
|
if (matchValue == null) {
|
|
56
75
|
return false;
|
|
57
76
|
}
|
|
@@ -73,8 +92,8 @@ export function fieldGreaterThan(fieldKey: Shared_FieldKey, threshold: float64,
|
|
|
73
92
|
/**
|
|
74
93
|
* Check if a field value is less than a threshold
|
|
75
94
|
*/
|
|
76
|
-
export function fieldLessThan(fieldKey: Shared_FieldKey, threshold: float64,
|
|
77
|
-
const matchValue: Option<string> = getFieldValue(fieldKey,
|
|
95
|
+
export function fieldLessThan(fieldKey: Shared_FieldKey, threshold: float64, formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): boolean {
|
|
96
|
+
const matchValue: Option<string> = getFieldValue(fieldKey, formSpec);
|
|
78
97
|
if (matchValue == null) {
|
|
79
98
|
return false;
|
|
80
99
|
}
|
|
@@ -96,12 +115,12 @@ export function fieldLessThan(fieldKey: Shared_FieldKey, threshold: float64, for
|
|
|
96
115
|
/**
|
|
97
116
|
* Evaluate a single field condition (string-based, for backward compatibility)
|
|
98
117
|
*/
|
|
99
|
-
export function evaluateFieldCondition(fieldKey: Shared_FieldKey, evaluator: ClinicalPathway_FieldEvaluator_$union, expectedValue: string,
|
|
118
|
+
export function evaluateFieldCondition(fieldKey: Shared_FieldKey, evaluator: ClinicalPathway_FieldEvaluator_$union, expectedValue: string, formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): boolean {
|
|
100
119
|
switch (evaluator.tag) {
|
|
101
120
|
case /* Equals */ 0:
|
|
102
|
-
return fieldHasValue(fieldKey, expectedValue,
|
|
121
|
+
return fieldHasValue(fieldKey, expectedValue, formSpec);
|
|
103
122
|
case /* NotEquals */ 1:
|
|
104
|
-
return !fieldHasValue(fieldKey, expectedValue,
|
|
123
|
+
return !fieldHasValue(fieldKey, expectedValue, formSpec);
|
|
105
124
|
case /* GreaterThan */ 5: {
|
|
106
125
|
let matchValue: [boolean, float64];
|
|
107
126
|
let outArg = 0;
|
|
@@ -109,7 +128,7 @@ export function evaluateFieldCondition(fieldKey: Shared_FieldKey, evaluator: Cli
|
|
|
109
128
|
outArg = v;
|
|
110
129
|
})), outArg] as [boolean, float64]);
|
|
111
130
|
if (matchValue[0]) {
|
|
112
|
-
return fieldGreaterThan(fieldKey, matchValue[1],
|
|
131
|
+
return fieldGreaterThan(fieldKey, matchValue[1], formSpec);
|
|
113
132
|
}
|
|
114
133
|
else {
|
|
115
134
|
return false;
|
|
@@ -122,7 +141,7 @@ export function evaluateFieldCondition(fieldKey: Shared_FieldKey, evaluator: Cli
|
|
|
122
141
|
outArg_1 = v_1;
|
|
123
142
|
})), outArg_1] as [boolean, float64]);
|
|
124
143
|
if (matchValue_1[0]) {
|
|
125
|
-
return fieldLessThan(fieldKey, matchValue_1[1],
|
|
144
|
+
return fieldLessThan(fieldKey, matchValue_1[1], formSpec);
|
|
126
145
|
}
|
|
127
146
|
else {
|
|
128
147
|
return false;
|
|
@@ -135,11 +154,11 @@ export function evaluateFieldCondition(fieldKey: Shared_FieldKey, evaluator: Cli
|
|
|
135
154
|
outArg_2 = v_2;
|
|
136
155
|
})), outArg_2] as [boolean, float64]);
|
|
137
156
|
if (matchValue_2[0]) {
|
|
138
|
-
if (fieldGreaterThan(fieldKey, matchValue_2[1],
|
|
157
|
+
if (fieldGreaterThan(fieldKey, matchValue_2[1], formSpec)) {
|
|
139
158
|
return true;
|
|
140
159
|
}
|
|
141
160
|
else {
|
|
142
|
-
return fieldHasValue(fieldKey, expectedValue,
|
|
161
|
+
return fieldHasValue(fieldKey, expectedValue, formSpec);
|
|
143
162
|
}
|
|
144
163
|
}
|
|
145
164
|
else {
|
|
@@ -153,11 +172,11 @@ export function evaluateFieldCondition(fieldKey: Shared_FieldKey, evaluator: Cli
|
|
|
153
172
|
outArg_3 = v_3;
|
|
154
173
|
})), outArg_3] as [boolean, float64]);
|
|
155
174
|
if (matchValue_3[0]) {
|
|
156
|
-
if (fieldLessThan(fieldKey, matchValue_3[1],
|
|
175
|
+
if (fieldLessThan(fieldKey, matchValue_3[1], formSpec)) {
|
|
157
176
|
return true;
|
|
158
177
|
}
|
|
159
178
|
else {
|
|
160
|
-
return fieldHasValue(fieldKey, expectedValue,
|
|
179
|
+
return fieldHasValue(fieldKey, expectedValue, formSpec);
|
|
161
180
|
}
|
|
162
181
|
}
|
|
163
182
|
else {
|
|
@@ -172,11 +191,15 @@ export function evaluateFieldCondition(fieldKey: Shared_FieldKey, evaluator: Cli
|
|
|
172
191
|
/**
|
|
173
192
|
* Recursively evaluate a transition condition
|
|
174
193
|
*/
|
|
175
|
-
export function evaluateCondition(
|
|
194
|
+
export function evaluateCondition(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, condition: ClinicalPathway_TransitionCondition_$union): boolean {
|
|
176
195
|
switch (condition.tag) {
|
|
196
|
+
case /* ScoreInRange */ 3:
|
|
197
|
+
return false;
|
|
198
|
+
case /* FieldScoreInRange */ 4:
|
|
199
|
+
return false;
|
|
177
200
|
case /* FieldCondition */ 0: {
|
|
178
201
|
const conditionValue: Shared_ConditionValue_$union = condition.fields[2];
|
|
179
|
-
return evaluateFieldCondition(condition.fields[0], condition.fields[1], (conditionValue.tag === /* Multiple */ 1) ? join(",",
|
|
202
|
+
return evaluateFieldCondition(condition.fields[0], condition.fields[1], (conditionValue.tag === /* Multiple */ 1) ? join(",", toList_1<string>(conditionValue.fields[0])) : ((conditionValue.tag === /* Matrix */ 2) ? join(",", map<[Shared_MatrixItemKey, string], string>((tupledArg: [Shared_MatrixItemKey, string]): string => tupledArg[1], toList<Shared_MatrixItemKey, string>(conditionValue.fields[0]))) : ((conditionValue.tag === /* PluginData */ 3) ? conditionValue.fields[0].Value : conditionValue.fields[0])), formSpec);
|
|
180
203
|
}
|
|
181
204
|
case /* FieldOptionCondition */ 1: {
|
|
182
205
|
const optionKey: Shared_FieldOptionKey = condition.fields[2];
|
|
@@ -184,31 +207,31 @@ export function evaluateCondition(formData: Values_DynamicFormResultData$1<Spec_
|
|
|
184
207
|
const fieldItemKey: Option<Shared_MatrixItemKey> = condition.fields[1];
|
|
185
208
|
const evaluator_1: ClinicalPathway_FieldEvaluator_$union = condition.fields[3];
|
|
186
209
|
const conditionValue_1: Shared_ConditionValue_$union = condition.fields[4];
|
|
187
|
-
return evaluateFieldCondition((fieldItemKey == null) ? fieldKey_1 : (new Shared_FieldKey(value_2(fieldItemKey).fields[0])), evaluator_1, (conditionValue_1.tag === /* Multiple */ 1) ? join(",",
|
|
210
|
+
return evaluateFieldCondition((fieldItemKey == null) ? fieldKey_1 : (new Shared_FieldKey(value_2(fieldItemKey).fields[0])), evaluator_1, (conditionValue_1.tag === /* Multiple */ 1) ? join(",", toList_1<string>(conditionValue_1.fields[0])) : ((conditionValue_1.tag === /* Matrix */ 2) ? join(",", map<[Shared_MatrixItemKey, string], string>((tupledArg_1: [Shared_MatrixItemKey, string]): string => tupledArg_1[1], toList<Shared_MatrixItemKey, string>(conditionValue_1.fields[0]))) : ((conditionValue_1.tag === /* PluginData */ 3) ? conditionValue_1.fields[0].Value : conditionValue_1.fields[0])), formSpec);
|
|
188
211
|
}
|
|
189
212
|
case /* PluginPropertyCondition */ 2: {
|
|
190
213
|
const propertyKey: Shared_PluginPropertyKey = condition.fields[1];
|
|
191
214
|
const fieldKey_2: Shared_FieldKey = condition.fields[0];
|
|
192
215
|
const evaluator_2: ClinicalPathway_FieldEvaluator_$union = condition.fields[2];
|
|
193
216
|
const conditionValue_2: Shared_ConditionValue_$union = condition.fields[3];
|
|
194
|
-
const expectedValueStr_2: string = (conditionValue_2.tag === /* Multiple */ 1) ? join(",",
|
|
217
|
+
const expectedValueStr_2: string = (conditionValue_2.tag === /* Multiple */ 1) ? join(",", toList_1<string>(conditionValue_2.fields[0])) : ((conditionValue_2.tag === /* Matrix */ 2) ? join(",", map<[Shared_MatrixItemKey, string], string>((tupledArg_2: [Shared_MatrixItemKey, string]): string => tupledArg_2[1], toList<Shared_MatrixItemKey, string>(conditionValue_2.fields[0]))) : ((conditionValue_2.tag === /* PluginData */ 3) ? conditionValue_2.fields[0].Value : conditionValue_2.fields[0]));
|
|
195
218
|
return false;
|
|
196
219
|
}
|
|
197
|
-
case /* CompositeCondition */
|
|
220
|
+
case /* CompositeCondition */ 6: {
|
|
198
221
|
const operator: ClinicalPathway_LogicalOp_$union = condition.fields[0];
|
|
199
222
|
const conditions: FSharpList<ClinicalPathway_TransitionCondition_$union> = condition.fields[1];
|
|
200
223
|
switch (operator.tag) {
|
|
201
224
|
case /* Or */ 1:
|
|
202
|
-
return exists<ClinicalPathway_TransitionCondition_$union>((condition_2: ClinicalPathway_TransitionCondition_$union): boolean => evaluateCondition(
|
|
225
|
+
return exists<ClinicalPathway_TransitionCondition_$union>((condition_2: ClinicalPathway_TransitionCondition_$union): boolean => evaluateCondition(formSpec, condition_2), conditions);
|
|
203
226
|
case /* Not */ 2:
|
|
204
227
|
throw new Error("Not operator should not be used directly with CompositeCondition");
|
|
205
228
|
default:
|
|
206
|
-
return forAll<ClinicalPathway_TransitionCondition_$union>((condition_1: ClinicalPathway_TransitionCondition_$union): boolean => evaluateCondition(
|
|
229
|
+
return forAll<ClinicalPathway_TransitionCondition_$union>((condition_1: ClinicalPathway_TransitionCondition_$union): boolean => evaluateCondition(formSpec, condition_1), conditions);
|
|
207
230
|
}
|
|
208
231
|
}
|
|
209
|
-
case /* StateCondition */
|
|
232
|
+
case /* StateCondition */ 5:
|
|
210
233
|
return true;
|
|
211
|
-
case /* TestResultCondition */
|
|
234
|
+
case /* TestResultCondition */ 7:
|
|
212
235
|
return true;
|
|
213
236
|
default:
|
|
214
237
|
return true;
|
|
@@ -252,7 +275,7 @@ export function validateFormSpecFieldKeys(formSpec: Spec_FormSpec$1<Spec_FieldTy
|
|
|
252
275
|
}
|
|
253
276
|
break;
|
|
254
277
|
}
|
|
255
|
-
case /* CompositeCondition */
|
|
278
|
+
case /* CompositeCondition */ 6: {
|
|
256
279
|
iterate<ClinicalPathway_TransitionCondition_$union>(validateCondition, condition.fields[1]);
|
|
257
280
|
break;
|
|
258
281
|
}
|
|
@@ -280,17 +303,17 @@ export function validateFormSpecFieldKeys(formSpec: Spec_FormSpec$1<Spec_FieldTy
|
|
|
280
303
|
}
|
|
281
304
|
|
|
282
305
|
/**
|
|
283
|
-
* Validate that
|
|
306
|
+
* Validate that FormSpec only contains GUID field keys (for form data validation)
|
|
284
307
|
*/
|
|
285
|
-
export function validateFormDataFieldKeys(
|
|
308
|
+
export function validateFormDataFieldKeys(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): FSharpResult$2_$union<void, FSharpList<string>> {
|
|
286
309
|
const errors: string[] = [];
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
if (
|
|
290
|
-
void (errors.push(`Step ${
|
|
310
|
+
iterate<Spec_FormStep$1<Spec_FieldType_$union>>((step: Spec_FormStep$1<Spec_FieldType_$union>): void => {
|
|
311
|
+
iterate<Spec_FormField$1<Spec_FieldType_$union>>((field: Spec_FormField$1<Spec_FieldType_$union>): void => {
|
|
312
|
+
if (field.FieldKey.fields[0] === "00000000-0000-0000-0000-000000000000") {
|
|
313
|
+
void (errors.push(`Step ${step.StepOrder} contains field with empty GUID`));
|
|
291
314
|
}
|
|
292
|
-
},
|
|
293
|
-
},
|
|
315
|
+
}, step.Fields);
|
|
316
|
+
}, formSpec.Steps);
|
|
294
317
|
if (errors.length === 0) {
|
|
295
318
|
return FSharpResult$2_Ok<void, FSharpList<string>>(undefined);
|
|
296
319
|
}
|
|
@@ -302,7 +325,7 @@ export function validateFormDataFieldKeys(formData: Values_DynamicFormResultData
|
|
|
302
325
|
/**
|
|
303
326
|
* Comprehensive validation that ensures FormSpec only works with GUID keys
|
|
304
327
|
*/
|
|
305
|
-
export function validateGuidOnlyFormSpec(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>,
|
|
328
|
+
export function validateGuidOnlyFormSpec(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, formSpecWithValues: Option<Spec_FormSpec$1<Spec_FieldType_$union>>): FSharpResult$2_$union<void, FSharpList<string>> {
|
|
306
329
|
const errors: string[] = [];
|
|
307
330
|
const matchValue: FSharpResult$2_$union<void, FSharpList<string>> = validateFormSpecFieldKeys(formSpec);
|
|
308
331
|
if (matchValue.tag === /* Ok */ 0) {
|
|
@@ -310,10 +333,10 @@ export function validateGuidOnlyFormSpec(formSpec: Spec_FormSpec$1<Spec_FieldTyp
|
|
|
310
333
|
else {
|
|
311
334
|
addRangeInPlace(matchValue.fields[0], errors);
|
|
312
335
|
}
|
|
313
|
-
if (
|
|
336
|
+
if (formSpecWithValues == null) {
|
|
314
337
|
}
|
|
315
338
|
else {
|
|
316
|
-
const matchValue_1: FSharpResult$2_$union<void, FSharpList<string>> = validateFormDataFieldKeys(value_2(
|
|
339
|
+
const matchValue_1: FSharpResult$2_$union<void, FSharpList<string>> = validateFormDataFieldKeys(value_2(formSpecWithValues));
|
|
317
340
|
if (matchValue_1.tag === /* Ok */ 0) {
|
|
318
341
|
}
|
|
319
342
|
else {
|