@f1studio/form-spec 5.0.0-alpha.164 → 5.0.0-alpha.166
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FormSpec.FS/BlueprintValidation.js +1 -1
- package/FormSpec.FS/BlueprintValidation.js.map +1 -1
- package/FormSpec.FS/Designer.js +1 -1
- package/FormSpec.FS/Designer.js.map +1 -1
- package/FormSpec.FS/FormSpec.d.ts +14 -1
- package/FormSpec.FS/FormSpec.d.ts.map +1 -1
- package/FormSpec.FS/FormSpec.js +56 -1
- package/FormSpec.FS/FormSpec.js.map +1 -1
- package/FormSpec.FS/FormSpecHelpers.js +1 -1
- package/FormSpec.FS/FormSpecHelpers.js.map +1 -1
- package/FormSpec.FS/FormSpecValues.js +1 -1
- package/FormSpec.FS/FormSpecValues.js.map +1 -1
- package/FormSpec.FS/Helpers.js +11 -11
- package/FormSpec.FS/Helpers.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.d.ts +13 -3
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.js +19 -13
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.d.ts +20 -0
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.js +20 -40
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.d.ts +21 -9
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.js +46 -25
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.d.ts +13 -14
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.js +18 -61
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.d.ts +33 -8
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js +25 -29
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.d.ts +4 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js +4 -4
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRTriggerEnrichment.js +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRTriggerEnrichment.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.js +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.js.map +1 -1
- package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.d.ts +34 -10
- package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.js +191 -30
- package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.js.map +1 -1
- package/FormSpec.FS/Interop/Facade/FormItemLookup.d.ts +95 -0
- package/FormSpec.FS/Interop/Facade/FormItemLookup.d.ts.map +1 -0
- package/FormSpec.FS/Interop/Facade/FormItemLookup.js +155 -0
- package/FormSpec.FS/Interop/Facade/FormItemLookup.js.map +1 -0
- package/FormSpec.FS/Interop/FormSpec.Api.Helpers.js +4 -4
- package/FormSpec.FS/Interop/FormSpec.Api.Helpers.js.map +1 -1
- package/FormSpec.FS/Interop/FormSpec.Api.Option.d.ts +26 -2
- package/FormSpec.FS/Interop/FormSpec.Api.Option.d.ts.map +1 -1
- package/FormSpec.FS/Interop/FormSpec.Api.Option.js +77 -3
- package/FormSpec.FS/Interop/FormSpec.Api.Option.js.map +1 -1
- package/FormSpec.FS/Provenance.d.ts +20 -2
- package/FormSpec.FS/Provenance.d.ts.map +1 -1
- package/FormSpec.FS/Provenance.js +66 -3
- package/FormSpec.FS/Provenance.js.map +1 -1
- package/README.md +7 -7
- package/Thoth.Json/packages/Thoth.Json/Encode.js.map +1 -1
- package/package.json +5 -1
- package/src/FormSpec.FS/BlueprintValidation.ts +1 -1
- package/src/FormSpec.FS/Designer.ts +1 -1
- package/src/FormSpec.FS/FormSpec.ts +32 -2
- package/src/FormSpec.FS/FormSpecHelpers.ts +1 -1
- package/src/FormSpec.FS/FormSpecValues.ts +1 -1
- package/src/FormSpec.FS/Helpers.ts +11 -11
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.ts +25 -12
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.ts +41 -41
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.ts +62 -30
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.ts +28 -46
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts +52 -27
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts +7 -5
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRTriggerEnrichment.ts +1 -1
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.ts +1 -1
- package/src/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.ts +154 -42
- package/src/FormSpec.FS/Interop/Facade/FormItemLookup.ts +179 -0
- package/src/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts +4 -4
- package/src/FormSpec.FS/Interop/FormSpec.Api.Option.ts +63 -8
- package/src/FormSpec.FS/Provenance.ts +50 -4
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { Record } from "@fable-org/fable-library-js/Types.js";
|
|
1
|
+
import { Union, Record } from "@fable-org/fable-library-js/Types.js";
|
|
2
2
|
import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { bool_type, class_type, list_type, record_type, option_type, string_type, int64_type, int32_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
7
|
-
import {
|
|
3
|
+
import { int64 } from "@fable-org/fable-library-js/BigInt.js";
|
|
4
|
+
import { defaultArg, Option } from "@fable-org/fable-library-js/Option.js";
|
|
5
|
+
import { uncurry2, comparePrimitives, IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
|
|
6
|
+
import { union_type, bool_type, class_type, list_type, record_type, option_type, string_type, int64_type, int32_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
7
|
+
import { empty, FSharpList } from "@fable-org/fable-library-js/List.js";
|
|
8
8
|
import { empty as empty_1, ofList, FSharpMap } from "@fable-org/fable-library-js/Map.js";
|
|
9
9
|
import { Auto_generateBoxedDecoder_Z6670B51 } from "../../../Thoth.Json/packages/Thoth.Json/Decode.js";
|
|
10
10
|
import { FSharpResult$2_$union } from "@fable-org/fable-library-js/Result.js";
|
|
11
11
|
import { ErrorReason_$union } from "../../../Thoth.Json/packages/Thoth.Json/Types.js";
|
|
12
|
-
import { fromString, bool, list
|
|
13
|
-
import {
|
|
14
|
-
import { isNullOrEmpty } from "@fable-org/fable-library-js/String.js";
|
|
12
|
+
import { fromString, bool, list, IOptionalGetter, IGetters, string, int, IRequiredGetter, object, map, keyValuePairs } from "../../../Thoth.Json/packages/Thoth.Json/Decode.js";
|
|
13
|
+
import { printf, toFail } from "@fable-org/fable-library-js/String.js";
|
|
15
14
|
|
|
16
15
|
export class TemplateChoice extends Record implements IEquatable<TemplateChoice>, IComparable<TemplateChoice> {
|
|
17
16
|
readonly ChoiceId: int32;
|
|
@@ -230,19 +229,53 @@ export function TemplateForm_$reflection(): TypeInfo {
|
|
|
230
229
|
}
|
|
231
230
|
|
|
232
231
|
export class ElementTypeEntry extends Record implements IEquatable<ElementTypeEntry>, IComparable<ElementTypeEntry> {
|
|
233
|
-
readonly
|
|
234
|
-
readonly
|
|
235
|
-
|
|
236
|
-
constructor(Code: string, ValueEncoding: string, TextField: string) {
|
|
232
|
+
readonly Label: string;
|
|
233
|
+
readonly Control: string;
|
|
234
|
+
constructor(Label: string, Control: string) {
|
|
237
235
|
super();
|
|
238
|
-
this.
|
|
239
|
-
this.
|
|
240
|
-
this.TextField = TextField;
|
|
236
|
+
this.Label = Label;
|
|
237
|
+
this.Control = Control;
|
|
241
238
|
}
|
|
242
239
|
}
|
|
243
240
|
|
|
244
241
|
export function ElementTypeEntry_$reflection(): TypeInfo {
|
|
245
|
-
return record_type("FormSpec.Integrations.CorEMR.TemplateManifestDecoder.ElementTypeEntry", [], ElementTypeEntry, () => [["
|
|
242
|
+
return record_type("FormSpec.Integrations.CorEMR.TemplateManifestDecoder.ElementTypeEntry", [], ElementTypeEntry, () => [["Label", string_type], ["Control", string_type]]);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export type ElementTypesFrom_$union =
|
|
246
|
+
| ElementTypesFrom<0>
|
|
247
|
+
| ElementTypesFrom<1>
|
|
248
|
+
| ElementTypesFrom<2>
|
|
249
|
+
|
|
250
|
+
export type ElementTypesFrom_$cases = {
|
|
251
|
+
0: ["StatedBy", [string, string, string]],
|
|
252
|
+
1: ["DeclaredByConduit", [string]],
|
|
253
|
+
2: ["NotInRelease", [string]]
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export function ElementTypesFrom_StatedBy(table: string, key: string, label: string) {
|
|
257
|
+
return new ElementTypesFrom<0>(0, [table, key, label]);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export function ElementTypesFrom_DeclaredByConduit(because: string) {
|
|
261
|
+
return new ElementTypesFrom<1>(1, [because]);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export function ElementTypesFrom_NotInRelease(because: string) {
|
|
265
|
+
return new ElementTypesFrom<2>(2, [because]);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export class ElementTypesFrom<Tag extends keyof ElementTypesFrom_$cases> extends Union<Tag, ElementTypesFrom_$cases[Tag][0]> {
|
|
269
|
+
constructor(readonly tag: Tag, readonly fields: ElementTypesFrom_$cases[Tag][1]) {
|
|
270
|
+
super();
|
|
271
|
+
}
|
|
272
|
+
cases() {
|
|
273
|
+
return ["StatedBy", "DeclaredByConduit", "NotInRelease"];
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export function ElementTypesFrom_$reflection(): TypeInfo {
|
|
278
|
+
return union_type("FormSpec.Integrations.CorEMR.TemplateManifestDecoder.ElementTypesFrom", [], ElementTypesFrom, () => [[["table", string_type], ["key", string_type], ["label", string_type]], [["because", string_type]], [["because", string_type]]]);
|
|
246
279
|
}
|
|
247
280
|
|
|
248
281
|
export class InstrumentMapEntry extends Record implements IEquatable<InstrumentMapEntry>, IComparable<InstrumentMapEntry> {
|
|
@@ -372,11 +405,12 @@ export class TemplateManifest extends Record implements IEquatable<TemplateManif
|
|
|
372
405
|
readonly GeneratedFrom: string;
|
|
373
406
|
readonly CoreEmr: CoreEmrInfo;
|
|
374
407
|
readonly Stats: TemplateStats;
|
|
375
|
-
readonly ElementTypes: FSharpMap<string, ElementTypeEntry
|
|
408
|
+
readonly ElementTypes: Option<FSharpMap<string, ElementTypeEntry>>;
|
|
409
|
+
readonly ElementTypesFrom: ElementTypesFrom_$union;
|
|
376
410
|
readonly Forms: FSharpMap<string, TemplateForm>;
|
|
377
411
|
readonly InstrumentMap: FSharpMap<string, InstrumentMapEntry>;
|
|
378
412
|
readonly InstrumentMapStats: InstrumentMapStats;
|
|
379
|
-
constructor(Schema: Option<string>, Version: int32, GeneratedAt: string, GeneratedFrom: string, CoreEmr: CoreEmrInfo, Stats: TemplateStats, ElementTypes: FSharpMap<string, ElementTypeEntry
|
|
413
|
+
constructor(Schema: Option<string>, Version: int32, GeneratedAt: string, GeneratedFrom: string, CoreEmr: CoreEmrInfo, Stats: TemplateStats, ElementTypes: Option<FSharpMap<string, ElementTypeEntry>>, ElementTypesFrom: ElementTypesFrom_$union, Forms: FSharpMap<string, TemplateForm>, InstrumentMap: FSharpMap<string, InstrumentMapEntry>, InstrumentMapStats: InstrumentMapStats) {
|
|
380
414
|
super();
|
|
381
415
|
this.Schema = Schema;
|
|
382
416
|
this.Version = (Version | 0);
|
|
@@ -385,6 +419,7 @@ export class TemplateManifest extends Record implements IEquatable<TemplateManif
|
|
|
385
419
|
this.CoreEmr = CoreEmr;
|
|
386
420
|
this.Stats = Stats;
|
|
387
421
|
this.ElementTypes = ElementTypes;
|
|
422
|
+
this.ElementTypesFrom = ElementTypesFrom;
|
|
388
423
|
this.Forms = Forms;
|
|
389
424
|
this.InstrumentMap = InstrumentMap;
|
|
390
425
|
this.InstrumentMapStats = InstrumentMapStats;
|
|
@@ -392,7 +427,7 @@ export class TemplateManifest extends Record implements IEquatable<TemplateManif
|
|
|
392
427
|
}
|
|
393
428
|
|
|
394
429
|
export function TemplateManifest_$reflection(): TypeInfo {
|
|
395
|
-
return record_type("FormSpec.Integrations.CorEMR.TemplateManifestDecoder.TemplateManifest", [], TemplateManifest, () => [["Schema", option_type(string_type)], ["Version", int32_type], ["GeneratedAt", string_type], ["GeneratedFrom", string_type], ["CoreEmr", CoreEmrInfo_$reflection()], ["Stats", TemplateStats_$reflection()], ["ElementTypes", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, ElementTypeEntry_$reflection()])], ["Forms", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, TemplateForm_$reflection()])], ["InstrumentMap", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, InstrumentMapEntry_$reflection()])], ["InstrumentMapStats", InstrumentMapStats_$reflection()]]);
|
|
430
|
+
return record_type("FormSpec.Integrations.CorEMR.TemplateManifestDecoder.TemplateManifest", [], TemplateManifest, () => [["Schema", option_type(string_type)], ["Version", int32_type], ["GeneratedAt", string_type], ["GeneratedFrom", string_type], ["CoreEmr", CoreEmrInfo_$reflection()], ["Stats", TemplateStats_$reflection()], ["ElementTypes", option_type(class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, ElementTypeEntry_$reflection()]))], ["ElementTypesFrom", ElementTypesFrom_$reflection()], ["Forms", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, TemplateForm_$reflection()])], ["InstrumentMap", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, InstrumentMapEntry_$reflection()])], ["InstrumentMapStats", InstrumentMapStats_$reflection()]]);
|
|
396
431
|
}
|
|
397
432
|
|
|
398
433
|
const liberatedInt64Decoder: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<int64, [string, ErrorReason_$union]>)) = Auto_generateBoxedDecoder_Z6670B51(int64_type, undefined, undefined);
|
|
@@ -416,7 +451,7 @@ const choiceDecoder = (path_2: string): ((arg0: any) => FSharpResult$2_$union<Te
|
|
|
416
451
|
|
|
417
452
|
const triggerConditionDecoder = (path_6: string): ((arg0: any) => FSharpResult$2_$union<TriggerCondition, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<TriggerCondition, [string, ErrorReason_$union]> => object<TriggerCondition>((get$: IGetters): TriggerCondition => {
|
|
418
453
|
let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter, objectArg_2: IRequiredGetter, objectArg_3: IRequiredGetter, objectArg_4: IOptionalGetter, objectArg_5: IOptionalGetter, objectArg_6: IOptionalGetter;
|
|
419
|
-
return new TriggerCondition((objectArg = get$.Required, objectArg.Field<int32>("conditionId", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<int32>("sourceFieldId", uncurry2(int))), (objectArg_2 = get$.Required, objectArg_2.Field<string>("source", string)), (objectArg_3 = get$.Required, objectArg_3.Field<string>("operator", string)), defaultArg((objectArg_4 = get$.Optional, objectArg_4.Field<FSharpList<string>>("values", (path_3: string, value_3: any): FSharpResult$2_$union<FSharpList<string>, [string, ErrorReason_$union]> =>
|
|
454
|
+
return new TriggerCondition((objectArg = get$.Required, objectArg.Field<int32>("conditionId", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<int32>("sourceFieldId", uncurry2(int))), (objectArg_2 = get$.Required, objectArg_2.Field<string>("source", string)), (objectArg_3 = get$.Required, objectArg_3.Field<string>("operator", string)), defaultArg((objectArg_4 = get$.Optional, objectArg_4.Field<FSharpList<string>>("values", (path_3: string, value_3: any): FSharpResult$2_$union<FSharpList<string>, [string, ErrorReason_$union]> => list<string>(string, path_3, value_3))), empty<string>()), defaultArg((objectArg_5 = get$.Optional, objectArg_5.Field<FSharpList<int32>>("rawChoiceIds", (path_4: string, value_5: any): FSharpResult$2_$union<FSharpList<int32>, [string, ErrorReason_$union]> => list<int32>(uncurry2(int), path_4, value_5))), empty<int32>()), defaultArg((objectArg_6 = get$.Optional, objectArg_6.Field<string>("booleanOperator", string)), "&&"));
|
|
420
455
|
}, path_6, v));
|
|
421
456
|
|
|
422
457
|
const triggerActionDecoder = (path_2: string): ((arg0: any) => FSharpResult$2_$union<TriggerAction, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<TriggerAction, [string, ErrorReason_$union]> => object<TriggerAction>((get$: IGetters): TriggerAction => {
|
|
@@ -428,12 +463,12 @@ const triggerActionDecoder = (path_2: string): ((arg0: any) => FSharpResult$2_$u
|
|
|
428
463
|
|
|
429
464
|
const itemTriggerDecoder = (path_5: string): ((arg0: any) => FSharpResult$2_$union<ItemTrigger, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<ItemTrigger, [string, ErrorReason_$union]> => object<ItemTrigger>((get$: IGetters): ItemTrigger => {
|
|
430
465
|
let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter, objectArg_2: IOptionalGetter, objectArg_3: IOptionalGetter, objectArg_4: IOptionalGetter, objectArg_5: IOptionalGetter;
|
|
431
|
-
return new ItemTrigger((objectArg = get$.Required, objectArg.Field<int32>("triggerId", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<string>("eventName", string)), defaultArg((objectArg_2 = get$.Optional, objectArg_2.Field<boolean>("enabled", bool)), true), (objectArg_3 = get$.Optional, objectArg_3.Field<string>("exclusiveTag", string)), defaultArg((objectArg_4 = get$.Optional, objectArg_4.Field<FSharpList<TriggerCondition>>("conditions", (path_3: string, value_4: any): FSharpResult$2_$union<FSharpList<TriggerCondition>, [string, ErrorReason_$union]> =>
|
|
466
|
+
return new ItemTrigger((objectArg = get$.Required, objectArg.Field<int32>("triggerId", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<string>("eventName", string)), defaultArg((objectArg_2 = get$.Optional, objectArg_2.Field<boolean>("enabled", bool)), true), (objectArg_3 = get$.Optional, objectArg_3.Field<string>("exclusiveTag", string)), defaultArg((objectArg_4 = get$.Optional, objectArg_4.Field<FSharpList<TriggerCondition>>("conditions", (path_3: string, value_4: any): FSharpResult$2_$union<FSharpList<TriggerCondition>, [string, ErrorReason_$union]> => list<TriggerCondition>(uncurry2(triggerConditionDecoder), path_3, value_4))), empty<TriggerCondition>()), defaultArg((objectArg_5 = get$.Optional, objectArg_5.Field<FSharpList<TriggerAction>>("actions", (path_4: string, value_6: any): FSharpResult$2_$union<FSharpList<TriggerAction>, [string, ErrorReason_$union]> => list<TriggerAction>(uncurry2(triggerActionDecoder), path_4, value_6))), empty<TriggerAction>()));
|
|
432
467
|
}, path_5, v));
|
|
433
468
|
|
|
434
469
|
const itemDecoder = (path_8: string): ((arg0: any) => FSharpResult$2_$union<TemplateItem, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<TemplateItem, [string, ErrorReason_$union]> => object<TemplateItem>((get$: IGetters): TemplateItem => {
|
|
435
470
|
let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter, objectArg_2: IRequiredGetter, objectArg_3: IRequiredGetter, objectArg_4: IRequiredGetter, objectArg_5: IRequiredGetter, objectArg_6: IOptionalGetter, objectArg_7: IOptionalGetter, objectArg_8: IOptionalGetter, objectArg_9: IOptionalGetter, objectArg_10: IOptionalGetter, objectArg_11: IRequiredGetter, objectArg_12: IOptionalGetter;
|
|
436
|
-
return new TemplateItem((objectArg = get$.Required, objectArg.Field<int32>("itemId", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<int32>("sequence", uncurry2(int))), (objectArg_2 = get$.Required, objectArg_2.Field<int32>("type", uncurry2(int))), (objectArg_3 = get$.Required, objectArg_3.Field<int32>("nestingLevel", uncurry2(int))), (objectArg_4 = get$.Required, objectArg_4.Field<boolean>("isRequired", bool)), (objectArg_5 = get$.Required, objectArg_5.Field<string>("text", string)), (objectArg_6 = get$.Optional, objectArg_6.Field<string>("sequenceText", string)), (objectArg_7 = get$.Optional, objectArg_7.Field<string>("code", string)), (objectArg_8 = get$.Optional, objectArg_8.Field<string>("uuid", string)), (objectArg_9 = get$.Optional, objectArg_9.Field<string>("genderRequired", string)), (objectArg_10 = get$.Optional, objectArg_10.Field<int32>("highlight", uncurry2(int))), (objectArg_11 = get$.Required, objectArg_11.Field<FSharpList<TemplateChoice>>("choices", (path_6: string, value_6: any): FSharpResult$2_$union<FSharpList<TemplateChoice>, [string, ErrorReason_$union]> =>
|
|
471
|
+
return new TemplateItem((objectArg = get$.Required, objectArg.Field<int32>("itemId", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<int32>("sequence", uncurry2(int))), (objectArg_2 = get$.Required, objectArg_2.Field<int32>("type", uncurry2(int))), (objectArg_3 = get$.Required, objectArg_3.Field<int32>("nestingLevel", uncurry2(int))), (objectArg_4 = get$.Required, objectArg_4.Field<boolean>("isRequired", bool)), (objectArg_5 = get$.Required, objectArg_5.Field<string>("text", string)), (objectArg_6 = get$.Optional, objectArg_6.Field<string>("sequenceText", string)), (objectArg_7 = get$.Optional, objectArg_7.Field<string>("code", string)), (objectArg_8 = get$.Optional, objectArg_8.Field<string>("uuid", string)), (objectArg_9 = get$.Optional, objectArg_9.Field<string>("genderRequired", string)), (objectArg_10 = get$.Optional, objectArg_10.Field<int32>("highlight", uncurry2(int))), (objectArg_11 = get$.Required, objectArg_11.Field<FSharpList<TemplateChoice>>("choices", (path_6: string, value_6: any): FSharpResult$2_$union<FSharpList<TemplateChoice>, [string, ErrorReason_$union]> => list<TemplateChoice>(uncurry2(choiceDecoder), path_6, value_6))), defaultArg((objectArg_12 = get$.Optional, objectArg_12.Field<FSharpList<ItemTrigger>>("triggers", (path_7: string, value_7: any): FSharpResult$2_$union<FSharpList<ItemTrigger>, [string, ErrorReason_$union]> => list<ItemTrigger>(uncurry2(itemTriggerDecoder), path_7, value_7))), empty<ItemTrigger>()));
|
|
437
472
|
}, path_8, v));
|
|
438
473
|
|
|
439
474
|
const encounterTypesDecoder = (path_4: string): ((arg0: any) => FSharpResult$2_$union<EncounterTypes, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<EncounterTypes, [string, ErrorReason_$union]> => object<EncounterTypes>((get$: IGetters): EncounterTypes => {
|
|
@@ -448,18 +483,35 @@ const scoringLabelDecoder = (path_1: string): ((arg0: any) => FSharpResult$2_$un
|
|
|
448
483
|
|
|
449
484
|
const formScoringDecoder = (path_2: string): ((arg0: any) => FSharpResult$2_$union<FormScoring, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<FormScoring, [string, ErrorReason_$union]> => object<FormScoring>((get$: IGetters): FormScoring => {
|
|
450
485
|
let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter, objectArg_2: IRequiredGetter, arg_7: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<FSharpMap<string, int32>, [string, ErrorReason_$union]>)), objectArg_3: IRequiredGetter;
|
|
451
|
-
return new FormScoring((objectArg = get$.Required, objectArg.Field<int32>("scoreId", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<string>("scoreName", string)), (objectArg_2 = get$.Required, objectArg_2.Field<FSharpList<ScoringLabel>>("labels", (path_1: string, value_1: any): FSharpResult$2_$union<FSharpList<ScoringLabel>, [string, ErrorReason_$union]> =>
|
|
486
|
+
return new FormScoring((objectArg = get$.Required, objectArg.Field<int32>("scoreId", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<string>("scoreName", string)), (objectArg_2 = get$.Required, objectArg_2.Field<FSharpList<ScoringLabel>>("labels", (path_1: string, value_1: any): FSharpResult$2_$union<FSharpList<ScoringLabel>, [string, ErrorReason_$union]> => list<ScoringLabel>(uncurry2(scoringLabelDecoder), path_1, value_1))), (arg_7 = dictDecoder<int32>(uncurry2(int)), (objectArg_3 = get$.Required, objectArg_3.Field<FSharpMap<string, int32>>("choiceScores", uncurry2(arg_7)))));
|
|
452
487
|
}, path_2, v));
|
|
453
488
|
|
|
454
489
|
const formDecoder = (path_13: string): ((arg0: any) => FSharpResult$2_$union<TemplateForm, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<TemplateForm, [string, ErrorReason_$union]> => object<TemplateForm>((get$: IGetters): TemplateForm => {
|
|
455
490
|
let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter, objectArg_2: IRequiredGetter, objectArg_3: IRequiredGetter, objectArg_4: IRequiredGetter, objectArg_5: IRequiredGetter, objectArg_6: IRequiredGetter, objectArg_7: IRequiredGetter, objectArg_8: IRequiredGetter, objectArg_9: IRequiredGetter, objectArg_10: IRequiredGetter, objectArg_11: IRequiredGetter, objectArg_12: IRequiredGetter, objectArg_13: IRequiredGetter, objectArg_14: IRequiredGetter, objectArg_15: IRequiredGetter, objectArg_16: IOptionalGetter;
|
|
456
|
-
return new TemplateForm((objectArg = get$.Required, objectArg.Field<int32>("formId", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<string>("name", string)), (objectArg_2 = get$.Required, objectArg_2.Field<string>("formCode", string)), (objectArg_3 = get$.Required, objectArg_3.Field<string>("formCodeSource", string)), (objectArg_4 = get$.Required, objectArg_4.Field<string>("description", string)), (objectArg_5 = get$.Required, objectArg_5.Field<int64>("currentVersionId", uncurry2(liberatedInt64Decoder))), (objectArg_6 = get$.Required, objectArg_6.Field<boolean>("isIntake", bool)), (objectArg_7 = get$.Required, objectArg_7.Field<string>("usage", string)), (objectArg_8 = get$.Required, objectArg_8.Field<boolean>("requiresSignature", bool)), (objectArg_9 = get$.Required, objectArg_9.Field<EncounterTypes>("encounterTypes", uncurry2(encounterTypesDecoder))), (objectArg_10 = get$.Required, objectArg_10.Field<boolean>("onceAYear", bool)), (objectArg_11 = get$.Required, objectArg_11.Field<string>("structureHash", string)), (objectArg_12 = get$.Required, objectArg_12.Field<string>("clinicalHash", string)), (objectArg_13 = get$.Required, objectArg_13.Field<string>("cosmeticHash", string)), (objectArg_14 = get$.Required, objectArg_14.Field<string>("hash", string)), (objectArg_15 = get$.Required, objectArg_15.Field<FSharpList<TemplateItem>>("items", (path_12: string, value_12: any): FSharpResult$2_$union<FSharpList<TemplateItem>, [string, ErrorReason_$union]> =>
|
|
491
|
+
return new TemplateForm((objectArg = get$.Required, objectArg.Field<int32>("formId", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<string>("name", string)), (objectArg_2 = get$.Required, objectArg_2.Field<string>("formCode", string)), (objectArg_3 = get$.Required, objectArg_3.Field<string>("formCodeSource", string)), (objectArg_4 = get$.Required, objectArg_4.Field<string>("description", string)), (objectArg_5 = get$.Required, objectArg_5.Field<int64>("currentVersionId", uncurry2(liberatedInt64Decoder))), (objectArg_6 = get$.Required, objectArg_6.Field<boolean>("isIntake", bool)), (objectArg_7 = get$.Required, objectArg_7.Field<string>("usage", string)), (objectArg_8 = get$.Required, objectArg_8.Field<boolean>("requiresSignature", bool)), (objectArg_9 = get$.Required, objectArg_9.Field<EncounterTypes>("encounterTypes", uncurry2(encounterTypesDecoder))), (objectArg_10 = get$.Required, objectArg_10.Field<boolean>("onceAYear", bool)), (objectArg_11 = get$.Required, objectArg_11.Field<string>("structureHash", string)), (objectArg_12 = get$.Required, objectArg_12.Field<string>("clinicalHash", string)), (objectArg_13 = get$.Required, objectArg_13.Field<string>("cosmeticHash", string)), (objectArg_14 = get$.Required, objectArg_14.Field<string>("hash", string)), (objectArg_15 = get$.Required, objectArg_15.Field<FSharpList<TemplateItem>>("items", (path_12: string, value_12: any): FSharpResult$2_$union<FSharpList<TemplateItem>, [string, ErrorReason_$union]> => list<TemplateItem>(uncurry2(itemDecoder), path_12, value_12))), (objectArg_16 = get$.Optional, objectArg_16.Field<FormScoring>("scoring", uncurry2(formScoringDecoder))));
|
|
457
492
|
}, path_13, v));
|
|
458
493
|
|
|
459
|
-
const elementTypeDecoder = (
|
|
460
|
-
let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter
|
|
461
|
-
return new ElementTypeEntry((objectArg = get$.Required, objectArg.Field<string>("
|
|
462
|
-
},
|
|
494
|
+
const elementTypeDecoder = (path_2: string): ((arg0: any) => FSharpResult$2_$union<ElementTypeEntry, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<ElementTypeEntry, [string, ErrorReason_$union]> => object<ElementTypeEntry>((get$: IGetters): ElementTypeEntry => {
|
|
495
|
+
let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter;
|
|
496
|
+
return new ElementTypeEntry((objectArg = get$.Required, objectArg.Field<string>("label", string)), (objectArg_1 = get$.Required, objectArg_1.Field<string>("control", string)));
|
|
497
|
+
}, path_2, v));
|
|
498
|
+
|
|
499
|
+
const elementTypesFromDecoder = (path_6: string): ((arg0: any) => FSharpResult$2_$union<ElementTypesFrom_$union, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<ElementTypesFrom_$union, [string, ErrorReason_$union]> => object<ElementTypesFrom_$union>((get$: IGetters): ElementTypesFrom_$union => {
|
|
500
|
+
let objectArg_1: IRequiredGetter, objectArg_2: IRequiredGetter, objectArg_3: IRequiredGetter, objectArg_4: IRequiredGetter, objectArg_5: IRequiredGetter;
|
|
501
|
+
let matchValue: string;
|
|
502
|
+
const objectArg: IRequiredGetter = get$.Required;
|
|
503
|
+
matchValue = objectArg.Field<string>("statedBy", string);
|
|
504
|
+
switch (matchValue) {
|
|
505
|
+
case "site":
|
|
506
|
+
return ElementTypesFrom_StatedBy((objectArg_1 = get$.Required, objectArg_1.Field<string>("table", string)), (objectArg_2 = get$.Required, objectArg_2.Field<string>("key", string)), (objectArg_3 = get$.Required, objectArg_3.Field<string>("label", string)));
|
|
507
|
+
case "conduit":
|
|
508
|
+
return ElementTypesFrom_DeclaredByConduit((objectArg_4 = get$.Required, objectArg_4.Field<string>("because", string)));
|
|
509
|
+
case "nobody":
|
|
510
|
+
return ElementTypesFrom_NotInRelease((objectArg_5 = get$.Required, objectArg_5.Field<string>("because", string)));
|
|
511
|
+
default:
|
|
512
|
+
return toFail(printf("elementTypesFrom.statedBy = %s is not a provenance this build understands (site | conduit | nobody)"))(matchValue);
|
|
513
|
+
}
|
|
514
|
+
}, path_6, v));
|
|
463
515
|
|
|
464
516
|
const instrumentMapEntryDecoder = (path_5: string): ((arg0: any) => FSharpResult$2_$union<InstrumentMapEntry, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<InstrumentMapEntry, [string, ErrorReason_$union]> => object<InstrumentMapEntry>((get$: IGetters): InstrumentMapEntry => {
|
|
465
517
|
let objectArg: IRequiredGetter, objectArg_1: IOptionalGetter, objectArg_2: IOptionalGetter, objectArg_3: IRequiredGetter, objectArg_4: IRequiredGetter, objectArg_5: IRequiredGetter;
|
|
@@ -494,23 +546,83 @@ const instrumentMapStatsDecoder = (path: string): ((arg0: any) => FSharpResult$2
|
|
|
494
546
|
}, path, v));
|
|
495
547
|
|
|
496
548
|
const manifestDecoder = (path_3: string): ((arg0: any) => FSharpResult$2_$union<TemplateManifest, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<TemplateManifest, [string, ErrorReason_$union]> => object<TemplateManifest>((get$: IGetters): TemplateManifest => {
|
|
497
|
-
let objectArg: IOptionalGetter, objectArg_1: IRequiredGetter, objectArg_2: IRequiredGetter, objectArg_3: IRequiredGetter, objectArg_4: IRequiredGetter, objectArg_5: IRequiredGetter, arg_13: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<FSharpMap<string, ElementTypeEntry>, [string, ErrorReason_$union]>)), objectArg_6:
|
|
498
|
-
return new TemplateManifest((objectArg = get$.Optional, objectArg.Field<string>("$schema", string)), (objectArg_1 = get$.Required, objectArg_1.Field<int32>("version", uncurry2(int))), (objectArg_2 = get$.Required, objectArg_2.Field<string>("generatedAt", string)), (objectArg_3 = get$.Required, objectArg_3.Field<string>("generatedFrom", string)), (objectArg_4 = get$.Required, objectArg_4.Field<CoreEmrInfo>("coreEmr", uncurry2(coreEmrDecoder))), (objectArg_5 = get$.Required, objectArg_5.Field<TemplateStats>("stats", uncurry2(statsDecoder))), (arg_13 = dictDecoder<ElementTypeEntry>(uncurry2(elementTypeDecoder)), (objectArg_6 = get$.
|
|
549
|
+
let objectArg: IOptionalGetter, objectArg_1: IRequiredGetter, objectArg_2: IRequiredGetter, objectArg_3: IRequiredGetter, objectArg_4: IRequiredGetter, objectArg_5: IRequiredGetter, arg_13: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<FSharpMap<string, ElementTypeEntry>, [string, ErrorReason_$union]>)), objectArg_6: IOptionalGetter, objectArg_7: IOptionalGetter, arg_17: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<FSharpMap<string, TemplateForm>, [string, ErrorReason_$union]>)), objectArg_8: IRequiredGetter, arg_19: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<FSharpMap<string, InstrumentMapEntry>, [string, ErrorReason_$union]>)), objectArg_9: IRequiredGetter, objectArg_10: IRequiredGetter;
|
|
550
|
+
return new TemplateManifest((objectArg = get$.Optional, objectArg.Field<string>("$schema", string)), (objectArg_1 = get$.Required, objectArg_1.Field<int32>("version", uncurry2(int))), (objectArg_2 = get$.Required, objectArg_2.Field<string>("generatedAt", string)), (objectArg_3 = get$.Required, objectArg_3.Field<string>("generatedFrom", string)), (objectArg_4 = get$.Required, objectArg_4.Field<CoreEmrInfo>("coreEmr", uncurry2(coreEmrDecoder))), (objectArg_5 = get$.Required, objectArg_5.Field<TemplateStats>("stats", uncurry2(statsDecoder))), (arg_13 = dictDecoder<ElementTypeEntry>(uncurry2(elementTypeDecoder)), (objectArg_6 = get$.Optional, objectArg_6.Field<FSharpMap<string, ElementTypeEntry>>("elementTypes", uncurry2(arg_13)))), defaultArg((objectArg_7 = get$.Optional, objectArg_7.Field<ElementTypesFrom_$union>("elementTypesFrom", uncurry2(elementTypesFromDecoder))), ElementTypesFrom_NotInRelease("the manifest carried no `elementTypesFrom`, so no provenance for the item-type vocabulary was stated")), (arg_17 = dictDecoder<TemplateForm>(uncurry2(formDecoder)), (objectArg_8 = get$.Required, objectArg_8.Field<FSharpMap<string, TemplateForm>>("forms", uncurry2(arg_17)))), (arg_19 = dictDecoder<InstrumentMapEntry>(uncurry2(instrumentMapEntryDecoder)), (objectArg_9 = get$.Required, objectArg_9.Field<FSharpMap<string, InstrumentMapEntry>>("instrumentMap", uncurry2(arg_19)))), (objectArg_10 = get$.Required, objectArg_10.Field<InstrumentMapStats>("instrumentMapStats", uncurry2(instrumentMapStatsDecoder))));
|
|
499
551
|
}, path_3, v));
|
|
500
552
|
|
|
501
|
-
function toCoreMRChoice(itemId: int32, c: TemplateChoice): CoreMRChoice {
|
|
502
|
-
return new CoreMRChoice(c.ChoiceId, itemId, c.Sequence, c.Text, c.Score, c.BitPosition, c.Code, map_1<int32, string>(int32ToString, c.Highlight));
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
function toCoreMRItem(item: TemplateItem): CoreMRItem {
|
|
506
|
-
return new CoreMRItem(item.ItemId, item.Sequence, item.NestingLevel, item.SequenceText, item.Type, int32ToString(item.Type), !isEmpty(item.Choices), true, false, item.Text, item.IsRequired, item.GenderRequired, map_1<int32, string>(int32ToString, item.Highlight), item.Code, item.Uuid, undefined, undefined, 0, 0, undefined);
|
|
507
|
-
}
|
|
508
|
-
|
|
509
553
|
/**
|
|
510
|
-
* Convert a
|
|
554
|
+
* Convert a TemplateChoice to CoreMRChoice (FormSpec type).
|
|
555
|
+
* Score stays int64 — raw scores can reach 2^31 for bitmask forms.
|
|
556
|
+
* Does this control carry free text, and does it carry a date?
|
|
557
|
+
*
|
|
558
|
+
* ⭐ THE ONE IMPLEMENTATION. It lives here because this file compiles before every adapter that needs
|
|
559
|
+
* it, so nothing downstream has an excuse to write a second one. ⛔ It follows from the CONTROL, which
|
|
560
|
+
* the site states (5.5.0+9704) or conduit declares (5.5.0+10245) — never from the invented `textField`
|
|
561
|
+
* word, which nothing publishes any more.
|
|
562
|
+
* ⚠️ It says what the UI OFFERS, not what a given item's answers contain: type 130 is a vitals widget
|
|
563
|
+
* and 35,427 of its answers carry text anyway.
|
|
511
564
|
*/
|
|
512
|
-
export function
|
|
513
|
-
|
|
565
|
+
export function carriesTextOrDate(control: string): [boolean, boolean] {
|
|
566
|
+
let matchResult: int32, c_3: string;
|
|
567
|
+
switch (control) {
|
|
568
|
+
case "DateField":
|
|
569
|
+
case "DateFieldWithTime": {
|
|
570
|
+
matchResult = 0;
|
|
571
|
+
break;
|
|
572
|
+
}
|
|
573
|
+
case "SignatureAndDate":
|
|
574
|
+
case "SignatureAndDateWithTime": {
|
|
575
|
+
matchResult = 1;
|
|
576
|
+
break;
|
|
577
|
+
}
|
|
578
|
+
case "ShortAnswer":
|
|
579
|
+
case "NoteEssay": {
|
|
580
|
+
matchResult = 2;
|
|
581
|
+
break;
|
|
582
|
+
}
|
|
583
|
+
case "PatientVitals": {
|
|
584
|
+
if (control.endsWith("PlusNotes")) {
|
|
585
|
+
matchResult = 3;
|
|
586
|
+
c_3 = control;
|
|
587
|
+
}
|
|
588
|
+
else {
|
|
589
|
+
matchResult = 4;
|
|
590
|
+
}
|
|
591
|
+
break;
|
|
592
|
+
}
|
|
593
|
+
case "AllergyFinder": {
|
|
594
|
+
if (control.endsWith("PlusNotes")) {
|
|
595
|
+
matchResult = 3;
|
|
596
|
+
c_3 = control;
|
|
597
|
+
}
|
|
598
|
+
else {
|
|
599
|
+
matchResult = 4;
|
|
600
|
+
}
|
|
601
|
+
break;
|
|
602
|
+
}
|
|
603
|
+
default:
|
|
604
|
+
if (control.endsWith("PlusNotes")) {
|
|
605
|
+
matchResult = 3;
|
|
606
|
+
c_3 = control;
|
|
607
|
+
}
|
|
608
|
+
else {
|
|
609
|
+
matchResult = 5;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
switch (matchResult) {
|
|
613
|
+
case 0:
|
|
614
|
+
return [true, true] as [boolean, boolean];
|
|
615
|
+
case 1:
|
|
616
|
+
return [true, true] as [boolean, boolean];
|
|
617
|
+
case 2:
|
|
618
|
+
return [true, false] as [boolean, boolean];
|
|
619
|
+
case 3:
|
|
620
|
+
return [true, false] as [boolean, boolean];
|
|
621
|
+
case 4:
|
|
622
|
+
return [true, false] as [boolean, boolean];
|
|
623
|
+
default:
|
|
624
|
+
return [false, false] as [boolean, boolean];
|
|
625
|
+
}
|
|
514
626
|
}
|
|
515
627
|
|
|
516
628
|
/**
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { class_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
2
|
+
import { isNullOrWhiteSpace } from "@fable-org/fable-library-js/String.js";
|
|
3
|
+
import { equals } from "@fable-org/fable-library-js/Util.js";
|
|
4
|
+
import { filter, tryLast, FSharpList, map, toArray } from "@fable-org/fable-library-js/List.js";
|
|
5
|
+
import { Spec_VendorScoreBand, Spec_FormSpec$1, Spec_VendorScore, Spec_FormField$1, Spec_FieldType_$union, Shared_FieldOption } from "../../FormSpec.js";
|
|
6
|
+
import { bind, value, Option, map as map_1 } from "@fable-org/fable-library-js/Option.js";
|
|
7
|
+
import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
8
|
+
|
|
9
|
+
export type ItemKindAuthority =
|
|
10
|
+
| "site"
|
|
11
|
+
| "conduit"
|
|
12
|
+
| "nobody"
|
|
13
|
+
|
|
14
|
+
export class ItemKindInfoTS {
|
|
15
|
+
readonly "label@65": string;
|
|
16
|
+
readonly "isResolved@65": boolean;
|
|
17
|
+
readonly "control@65": string;
|
|
18
|
+
readonly "authority@65": ItemKindAuthority;
|
|
19
|
+
constructor(control: string, label: string, authority: ItemKindAuthority, isResolved: boolean) {
|
|
20
|
+
this["control@65"] = control;
|
|
21
|
+
this["label@65"] = label;
|
|
22
|
+
this["authority@65"] = authority;
|
|
23
|
+
this["isResolved@65"] = isResolved;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function ItemKindInfoTS_$reflection(): TypeInfo {
|
|
28
|
+
return class_type("F1.Studio.FormItemLookup.ItemKindInfoTS", undefined, ItemKindInfoTS);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function ItemKindInfoTS_$ctor_Z4A082755(control: string, label: string, authority: ItemKindAuthority, isResolved: boolean): ItemKindInfoTS {
|
|
32
|
+
return new ItemKindInfoTS(control, label, authority, isResolved);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The control the vendor renders.
|
|
37
|
+
*/
|
|
38
|
+
export function ItemKindInfoTS__get_control(_: ItemKindInfoTS): string {
|
|
39
|
+
return _["control@65"];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The source's own words for it, or conduit's where the release states none.
|
|
44
|
+
*/
|
|
45
|
+
export function ItemKindInfoTS__get_label(_: ItemKindInfoTS): string {
|
|
46
|
+
return _["label@65"];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* ⭐ WHOSE WORD THIS IS.
|
|
51
|
+
*/
|
|
52
|
+
export function ItemKindInfoTS__get_authority(_: ItemKindInfoTS): ItemKindAuthority {
|
|
53
|
+
return _["authority@65"];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* ⛔ `false` when nothing states this kind. The item still exists and still has answers — what
|
|
58
|
+
* is missing is a MEANING, and a screen must say so rather than paint a plausible default.
|
|
59
|
+
*/
|
|
60
|
+
export function ItemKindInfoTS__get_isResolved(_: ItemKindInfoTS): boolean {
|
|
61
|
+
return _["isResolved@65"];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export class StatedOptionTS {
|
|
65
|
+
readonly "text@81": string;
|
|
66
|
+
readonly "optionKey@81": string;
|
|
67
|
+
constructor(optionKey: string, text: string) {
|
|
68
|
+
this["optionKey@81"] = optionKey;
|
|
69
|
+
this["text@81"] = text;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function StatedOptionTS_$reflection(): TypeInfo {
|
|
74
|
+
return class_type("F1.Studio.FormItemLookup.StatedOptionTS", undefined, StatedOptionTS);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function StatedOptionTS_$ctor_Z384F8060(optionKey: string, text: string): StatedOptionTS {
|
|
78
|
+
return new StatedOptionTS(optionKey, text);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function StatedOptionTS__get_optionKey(_: StatedOptionTS): string {
|
|
82
|
+
return _["optionKey@81"];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function StatedOptionTS__get_text(_: StatedOptionTS): string {
|
|
86
|
+
return _["text@81"];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* What kind is this item, and whose word is that?
|
|
91
|
+
*
|
|
92
|
+
* ⭐ THE REPLACEMENT FOR `getFieldCoreMRAnchor` + `getBitmaskChoiceAnalysis` in a diagnostics
|
|
93
|
+
* panel: it answers "what is this field, and can we trust the answer" without naming an
|
|
94
|
+
* encoding, a bit or a vendor integer.
|
|
95
|
+
*
|
|
96
|
+
* ⛔ An unresolved kind is NAMED (`isResolved = false`), never defaulted. Conduit spells an
|
|
97
|
+
* unstated kind `unresolved_<code>`; this reads that and says so rather than passing it on as
|
|
98
|
+
* if it were a control.
|
|
99
|
+
*/
|
|
100
|
+
export function Lookup_getItemKindInfo(control: string, label: string, statedBy: string): ItemKindInfoTS {
|
|
101
|
+
const authority: ItemKindAuthority = (statedBy === "site") ? "site" : ((statedBy === "conduit") ? "conduit" : "nobody");
|
|
102
|
+
return ItemKindInfoTS_$ctor_Z4A082755(control, label, authority, (!isNullOrWhiteSpace(control) && !control.startsWith("unresolved_")) && !equals(authority, "nobody"));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The options a field states, as identity + the site's own text.
|
|
107
|
+
*
|
|
108
|
+
* ⭐ THE REPLACEMENT FOR `getFieldBitmaskChoiceTable`. That helper's table had `score` and
|
|
109
|
+
* `bitPosition` columns; neither is a fact about the option, both are CoreMR's encoding of it.
|
|
110
|
+
* ⛔ Whether one or several may be chosen is NOT answered here: it is a property of the item's
|
|
111
|
+
* own stated options, resolved in conduit, and a TypeScript panel has no business re-deciding it.
|
|
112
|
+
*/
|
|
113
|
+
export function Lookup_getStatedOptions(field: Spec_FormField$1<Spec_FieldType_$union>): StatedOptionTS[] {
|
|
114
|
+
const ofOptions = (options: FSharpList<Shared_FieldOption>): StatedOptionTS[] => toArray<StatedOptionTS>(map<Shared_FieldOption, StatedOptionTS>((o: Shared_FieldOption): StatedOptionTS => StatedOptionTS_$ctor_Z384F8060(o.OptionKey.fields[0], o.Description), options));
|
|
115
|
+
const matchValue: Spec_FieldType_$union = field.FieldType;
|
|
116
|
+
switch (matchValue.tag) {
|
|
117
|
+
case /* Radio */ 12:
|
|
118
|
+
return ofOptions(matchValue.fields[0].Options);
|
|
119
|
+
case /* Dropdown */ 14:
|
|
120
|
+
return ofOptions(matchValue.fields[0].Options);
|
|
121
|
+
case /* CheckboxList */ 16:
|
|
122
|
+
return ofOptions(matchValue.fields[0].Options);
|
|
123
|
+
default:
|
|
124
|
+
return [];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Does this field offer options at all?
|
|
130
|
+
*
|
|
131
|
+
* ⭐ STRUCTURAL, per field — never per item type. Measured at St Johns: 21 items of type 20
|
|
132
|
+
* state no options while 73 of 132 type-140 items DO, so any type-level answer is wrong for
|
|
133
|
+
* every one of them (conduit `audit/260923-1655`).
|
|
134
|
+
*/
|
|
135
|
+
export function Lookup_fieldStatesOptions(field: Spec_FormField$1<Spec_FieldType_$union>): boolean {
|
|
136
|
+
return Lookup_getStatedOptions(field).length > 0;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* The scale a SOURCE stated for this form, if it stated one.
|
|
141
|
+
*
|
|
142
|
+
* ⛔ `Score` is NOT consulted: that is the f1 designer's authored scale, a different fact with a
|
|
143
|
+
* different author. ⚠️ And there is no maximum here because nothing states one — CoreMR's
|
|
144
|
+
* `form_scores` is `id · name · form_name · labels · deleted`.
|
|
145
|
+
*/
|
|
146
|
+
export function Lookup_getVendorScaleName(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): Option<string> {
|
|
147
|
+
return map_1<Spec_VendorScore, string>((v: Spec_VendorScore): string => v.ScaleName, formSpec.VendorScore);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* The bands a source stated, lowest first, as `[label, minimum]` pairs.
|
|
152
|
+
*
|
|
153
|
+
* ⭐ A band runs from its own minimum to the NEXT band's, and the last is unbounded — which is
|
|
154
|
+
* why no maximum is carried. Deriving the upper edge at the paint is correct; storing it is how
|
|
155
|
+
* bands acquire gaps and overlaps nobody stated.
|
|
156
|
+
*/
|
|
157
|
+
export function Lookup_getVendorScaleBands(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): [string, int32][] {
|
|
158
|
+
const matchValue: Option<Spec_VendorScore> = formSpec.VendorScore;
|
|
159
|
+
if (matchValue != null) {
|
|
160
|
+
return toArray<[string, int32]>(map<Spec_VendorScoreBand, [string, int32]>((b: Spec_VendorScoreBand): [string, int32] => ([b.Label, b.Min] as [string, int32]), value(matchValue).Bands));
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
return [];
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Which stated band a total falls in, or `None` when no source stated a scale.
|
|
169
|
+
*
|
|
170
|
+
* ⛔ REFUSES to guess. If the form carries no stated scale there is no band, and a screen must
|
|
171
|
+
* show that rather than invent one. This function existing in F# is the whole point: until
|
|
172
|
+
* 2026-09-23 an importer invented Low/Medium/High at thirds and a CoreMR "Severe" rendered as
|
|
173
|
+
* "Low Risk" on five published instruments.
|
|
174
|
+
*/
|
|
175
|
+
export function Lookup_getVendorScaleBandFor(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, total: int32): Option<string> {
|
|
176
|
+
return map_1<Spec_VendorScoreBand, string>((b_1: Spec_VendorScoreBand): string => b_1.Label, bind<Spec_VendorScore, Spec_VendorScoreBand>((v: Spec_VendorScore): Option<Spec_VendorScoreBand> => tryLast<Spec_VendorScoreBand>(filter<Spec_VendorScoreBand>((b: Spec_VendorScoreBand): boolean => (total >= b.Min), v.Bands)), formSpec.VendorScore));
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
//# sourceMappingURL=FormItemLookup.ts.map
|
|
@@ -700,7 +700,7 @@ export function createFormStep(stepOrder: int32, stepLabel: string, fields: Spec
|
|
|
700
700
|
* TypeScript: createFormSpec(id: string, title: string, steps: FormStep[])
|
|
701
701
|
*/
|
|
702
702
|
export function createFormSpec(idString: string, title: string, steps: Spec_FormStep$1<Spec_FieldType_$union>[]): Spec_FormSpec$1<Spec_FieldType_$union> {
|
|
703
|
-
return new Spec_FormSpec$1(parse(idString), "DYN", title, "Dynamically created FormSpec", "1.0.0", "2.0.5", ofSeq_1<Spec_FormStep$1<Spec_FieldType_$union>>(steps), empty<string>(), undefined, empty<string>(), false, false, undefined, Spec_FormLifecycle_Blueprint(), undefined, undefined, undefined, Spec_FormClassification_General());
|
|
703
|
+
return new Spec_FormSpec$1(parse(idString), "DYN", title, "Dynamically created FormSpec", "1.0.0", "2.0.5", ofSeq_1<Spec_FormStep$1<Spec_FieldType_$union>>(steps), empty<string>(), undefined, undefined, empty<string>(), false, false, undefined, Spec_FormLifecycle_Blueprint(), undefined, undefined, undefined, Spec_FormClassification_General());
|
|
704
704
|
}
|
|
705
705
|
|
|
706
706
|
/**
|
|
@@ -766,7 +766,7 @@ export function createClinicalPathway(name: string, states: ClinicalPathway_Stat
|
|
|
766
766
|
* TypeScript: addPathwayToFormSpec(formSpec: FormSpec, pathway: ClinicalPathwaySpec)
|
|
767
767
|
*/
|
|
768
768
|
export function addPathwayToFormSpec(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, pathway: ClinicalPathway_ClinicalPathwaySpec): Spec_FormSpec$1<Spec_FieldType_$union> {
|
|
769
|
-
return new Spec_FormSpec$1(formSpec.Id, formSpec.Code, formSpec.Title, formSpec.Abstract, formSpec.Version, formSpec.FormSpecVersion, formSpec.Steps, formSpec.CategoryTags, formSpec.Score, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, pathway, formSpec.Lifecycle, formSpec.FilledMeta, formSpec.CustomData, formSpec.Provenance, formSpec.Classification);
|
|
769
|
+
return new Spec_FormSpec$1(formSpec.Id, formSpec.Code, formSpec.Title, formSpec.Abstract, formSpec.Version, formSpec.FormSpecVersion, formSpec.Steps, formSpec.CategoryTags, formSpec.Score, formSpec.VendorScore, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, pathway, formSpec.Lifecycle, formSpec.FilledMeta, formSpec.CustomData, formSpec.Provenance, formSpec.Classification);
|
|
770
770
|
}
|
|
771
771
|
|
|
772
772
|
/**
|
|
@@ -835,7 +835,7 @@ export function createTestFormSpec(): Spec_FormSpec$1<Spec_FieldType_$union> {
|
|
|
835
835
|
const option1: Shared_FieldOption = new Shared_FieldOption("Option 1", "opt1", new Shared_FieldOptionKey(newGuid()), undefined);
|
|
836
836
|
const option2: Shared_FieldOption = new Shared_FieldOption("Option 2", "opt2", new Shared_FieldOptionKey(newGuid()), undefined);
|
|
837
837
|
const testStep: Spec_FormStep$1<Spec_FieldType_$union> = new Spec_FormStep$1(1, "Test Step", ofArray_2([new Spec_FormField$1(1, new Shared_FieldKey("11111111-1111-1111-1111-111111111111"), "Test Text Field", undefined, undefined, false, false, false, Spec_FieldType_Text(new Spec_TextInfo(undefined)), undefined), new Spec_FormField$1(2, new Shared_FieldKey("22222222-2222-2222-2222-222222222222"), "Test Checkbox List", undefined, undefined, false, false, false, Spec_FieldType_CheckboxList(new Spec_MultiChoiceInfo(ofArray_2([option1, option2]))), undefined), new Spec_FormField$1(3, new Shared_FieldKey("33333333-3333-3333-3333-333333333333"), "Test Matrix", undefined, undefined, false, false, false, Spec_FieldType_Matrix(new Spec_MatrixInfo(ofArray_2([option1, option2]), ofArray_2([new Shared_FieldOption("Scale 1", "1", new Shared_FieldOptionKey(newGuid()), 1), new Shared_FieldOption("Scale 2", "2", new Shared_FieldOptionKey(newGuid()), 2)]))), undefined), new Spec_FormField$1(4, new Shared_FieldKey("44444444-4444-4444-4444-444444444444"), "Test Plugin Field", undefined, undefined, false, false, false, Spec_FieldType_PluginField(new Spec_PluginFieldConfig("test.plugin", undefined, undefined)), undefined)]));
|
|
838
|
-
return new Spec_FormSpec$1(newGuid(), "TEST-001", "Test Form", "Test form for buildDynamicFormResultData", "1.0.0", "5.0.0", singleton_1(testStep), empty<string>(), undefined, empty<string>(), false, false, undefined, Spec_FormLifecycle_Blueprint(), undefined, undefined, undefined, Spec_FormClassification_General());
|
|
838
|
+
return new Spec_FormSpec$1(newGuid(), "TEST-001", "Test Form", "Test form for buildDynamicFormResultData", "1.0.0", "5.0.0", singleton_1(testStep), empty<string>(), undefined, undefined, empty<string>(), false, false, undefined, Spec_FormLifecycle_Blueprint(), undefined, undefined, undefined, Spec_FormClassification_General());
|
|
839
839
|
}
|
|
840
840
|
|
|
841
841
|
/**
|
|
@@ -1613,7 +1613,7 @@ export function getFieldCoreMRAnchor(formSpec: Spec_FormSpec$1<Spec_FieldType_$u
|
|
|
1613
1613
|
const matchValue: Option<IntegrationProvenance> = formSpec.Provenance;
|
|
1614
1614
|
let matchResult: int32, provenance_1: IntegrationProvenance;
|
|
1615
1615
|
if (matchValue != null) {
|
|
1616
|
-
if (value_19(matchValue).
|
|
1616
|
+
if (value_19(matchValue).Vendor === "coremr") {
|
|
1617
1617
|
matchResult = 0;
|
|
1618
1618
|
provenance_1 = value_19(matchValue);
|
|
1619
1619
|
}
|