@f1studio/form-spec 5.0.0-alpha.112 → 5.0.0-alpha.116
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FormSpec.FS/BitmaskHelpers.d.ts +3 -2
- package/FormSpec.FS/BitmaskHelpers.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.d.ts +3 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.d.ts +5 -2
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.d.ts +3 -2
- package/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.d.ts +3 -2
- package/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.d.ts.map +1 -1
- package/FormSpec.FS/Interop/FormSpec.Api.Helpers.d.ts +7 -0
- package/FormSpec.FS/Interop/FormSpec.Api.Helpers.d.ts.map +1 -1
- package/FormSpec.FS/Interop/PluginPropertyKeyRegistry.d.ts +16 -0
- package/FormSpec.FS/Interop/PluginPropertyKeyRegistry.d.ts.map +1 -0
- package/FormSpec.TS/FormSpec.FS/BitmaskHelpers.js +2 -2
- package/FormSpec.TS/FormSpec.FS/BitmaskHelpers.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/BitmaskHelpers.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.js +2 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.js +3 -2
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.js +2 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.js +1 -2
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js +5 -4
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js +62 -131
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js +19 -5
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.js +7 -6
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/ReactHookForm/ReactHookFormAdapter.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/ReactHookForm/ReactHookFormAdapter.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.js +2 -2
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js +103 -38
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Interop/PluginPropertyKeyRegistry.js +121 -0
- package/FormSpec.TS/FormSpec.FS/Interop/PluginPropertyKeyRegistry.js.map +1 -0
- package/FormSpec.TS/FormSpec.FS/Interop/PluginPropertyKeyRegistry.ts.map +1 -0
- 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/README.md +7 -7
- package/package.json +1 -1
- package/src/FormSpec.FS/BitmaskHelpers.ts +7 -6
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.ts +2 -1
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.ts +5 -4
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.ts +2 -1
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.ts +2 -2
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts +5 -4
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts +74 -138
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts +25 -14
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.ts +10 -9
- package/src/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.ts +6 -5
- package/src/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts +98 -53
- package/src/FormSpec.FS/Interop/PluginPropertyKeyRegistry.ts +96 -0
|
@@ -1,34 +1,35 @@
|
|
|
1
|
+
import { CoreMRStepMap, CoreMRSourceMap, CoreMRSourceMap_$reflection, CoreMRFieldAnchor, CoreMRFieldAnchor_$reflection, CoreMRMatrixItemAnchor, CoreMRMatrixItemAnchor_$reflection, CoreMRChoiceAnchor, CoreMRChoiceAnchor_$reflection, ValueEncodingInfo, ValueEncodingInfo_$reflection, coreMRExtra } from "./CoreMRSourceMap.js";
|
|
2
|
+
import { CaseStrategy_CamelCase, ErrorReason_$union, ExtraCoders } from "../../../../fable_modules/Thoth.Json.10.4.1/Types.fs.js";
|
|
1
3
|
import { fromString, Auto_generateBoxedDecoder_Z6670B51 } from "../../../../fable_modules/Thoth.Json.10.4.1/Decode.fs.js";
|
|
2
|
-
import { CoreMRStepMap, CoreMRSourceMap, CoreMRSourceMap_$reflection, CoreMRFieldAnchor, CoreMRFieldAnchor_$reflection, CoreMRMatrixItemAnchor, CoreMRMatrixItemAnchor_$reflection, CoreMRChoiceAnchor, CoreMRChoiceAnchor_$reflection, ValueEncodingInfo, ValueEncodingInfo_$reflection } from "./CoreMRSourceMap.js";
|
|
3
4
|
import { FSharpResult$2_Ok, FSharpResult$2_Error, FSharpResult$2_$union } from "@fable-org/fable-library-js/Result.js";
|
|
4
|
-
import {
|
|
5
|
-
import { Spec_FormSpec$1, Spec_FormStep$1, Spec_FormField$1, Shared_PluginDataProperty, Shared_MatrixItemKey, Shared_MatrixAnswer, Shared_FieldAnswer, Shared_FieldValue, Shared_FieldValue_$union, Spec_FieldType_$union, Spec_MultiChoiceInfo, Spec_SingleChoiceInfo, Shared_FieldOption, Shared_FieldOptionKey, Shared_FieldKey, Shared_FieldKey_$reflection } from "../../../FormSpec.js";
|
|
5
|
+
import { Spec_FormSpec$1, Spec_FormStep$1, Shared_PluginDataProperty, Shared_MatrixAnswer, Shared_FieldValue_$union, Shared_MatrixItemKey, Shared_FieldAnswer, Shared_FieldValue, Spec_FormField$1, Spec_FieldType_$union, Spec_MultiChoiceInfo, Spec_SingleChoiceInfo, Shared_FieldOption, Shared_FieldOptionKey, Shared_FieldKey, Shared_FieldKey_$reflection } from "../../../FormSpec.js";
|
|
6
6
|
import { toString, Auto_generateBoxedEncoder_437914C6 } from "../../../../fable_modules/Thoth.Json.10.4.1/Encode.fs.js";
|
|
7
7
|
import { newGuid } from "@fable-org/fable-library-js/Guid.js";
|
|
8
8
|
import { FSharpMap, ofList, tryFind as tryFind_1, add } from "@fable-org/fable-library-js/Map.js";
|
|
9
9
|
import { IOptionalGetter, IRequiredGetter, IGetters, list as list_9, bool, string, int, object } from "../../../../fable_modules/Thoth.Json.10.4.1/Decode.fs.js";
|
|
10
10
|
import { comparePrimitives, uncurry2 } from "@fable-org/fable-library-js/Util.js";
|
|
11
11
|
import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
12
|
-
import { collect, exists,
|
|
13
|
-
import { orElse,
|
|
14
|
-
import { empty as empty_1 } from "../../../../fable_modules/Thoth.Json.10.4.1/Extra.fs.js";
|
|
12
|
+
import { collect, exists, map as map_1, choose, singleton, cons, tail, head, isEmpty, tryFind, empty, FSharpList } from "@fable-org/fable-library-js/List.js";
|
|
13
|
+
import { orElse, value as value_10, Option, map, bind, defaultArg } from "@fable-org/fable-library-js/Option.js";
|
|
15
14
|
import { CoreMRAnswer, CoreMRFormInsertRequest, CoreMRFormInsertRequest_$reflection } from "./FormSpecToCoreMRInsert.js";
|
|
16
15
|
import { isNullOrWhiteSpace } from "@fable-org/fable-library-js/String.js";
|
|
17
|
-
import {
|
|
18
|
-
import { toInt32 } from "@fable-org/fable-library-js/BigInt.js";
|
|
16
|
+
import { int64, fromInt32, toInt64 } from "@fable-org/fable-library-js/BigInt.js";
|
|
19
17
|
import { computeBitmask } from "../../../BitmaskHelpers.js";
|
|
18
|
+
import { FSharpSet, toList } from "@fable-org/fable-library-js/Set.js";
|
|
19
|
+
|
|
20
|
+
const baseExtra: ExtraCoders = coreMRExtra;
|
|
20
21
|
|
|
21
22
|
const sourceMapExtra: ExtraCoders = (() => {
|
|
22
23
|
let copyOfStruct: string;
|
|
23
|
-
const valueEncodingDecoder: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<ValueEncodingInfo, [string, ErrorReason_$union]>)) = Auto_generateBoxedDecoder_Z6670B51(ValueEncodingInfo_$reflection(), undefined,
|
|
24
|
-
const choiceAnchorDecoder: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<CoreMRChoiceAnchor, [string, ErrorReason_$union]>)) = Auto_generateBoxedDecoder_Z6670B51(CoreMRChoiceAnchor_$reflection(), undefined,
|
|
25
|
-
const fieldKeyDecoder: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<Shared_FieldKey, [string, ErrorReason_$union]>)) = Auto_generateBoxedDecoder_Z6670B51(Shared_FieldKey_$reflection(), undefined,
|
|
26
|
-
const matrixItemAnchorDecoder: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<CoreMRMatrixItemAnchor, [string, ErrorReason_$union]>)) = Auto_generateBoxedDecoder_Z6670B51(CoreMRMatrixItemAnchor_$reflection(), undefined,
|
|
27
|
-
const encoder: ((arg0: CoreMRFieldAnchor) => any) = Auto_generateBoxedEncoder_437914C6(CoreMRFieldAnchor_$reflection(), undefined,
|
|
24
|
+
const valueEncodingDecoder: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<ValueEncodingInfo, [string, ErrorReason_$union]>)) = Auto_generateBoxedDecoder_Z6670B51(ValueEncodingInfo_$reflection(), undefined, baseExtra);
|
|
25
|
+
const choiceAnchorDecoder: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<CoreMRChoiceAnchor, [string, ErrorReason_$union]>)) = Auto_generateBoxedDecoder_Z6670B51(CoreMRChoiceAnchor_$reflection(), undefined, baseExtra);
|
|
26
|
+
const fieldKeyDecoder: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<Shared_FieldKey, [string, ErrorReason_$union]>)) = Auto_generateBoxedDecoder_Z6670B51(Shared_FieldKey_$reflection(), undefined, baseExtra);
|
|
27
|
+
const matrixItemAnchorDecoder: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<CoreMRMatrixItemAnchor, [string, ErrorReason_$union]>)) = Auto_generateBoxedDecoder_Z6670B51(CoreMRMatrixItemAnchor_$reflection(), undefined, baseExtra);
|
|
28
|
+
const encoder: ((arg0: CoreMRFieldAnchor) => any) = Auto_generateBoxedEncoder_437914C6(CoreMRFieldAnchor_$reflection(), undefined, baseExtra, undefined);
|
|
28
29
|
return new ExtraCoders((copyOfStruct = newGuid(), copyOfStruct), add<string, [((arg0: any) => any), ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<any, [string, ErrorReason_$union]>))]>("FormSpec.Integrations.CorEMR.CoreMRSourceMap.CoreMRFieldAnchor", [encoder, (path_8: string): ((arg0: any) => FSharpResult$2_$union<CoreMRFieldAnchor, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<CoreMRFieldAnchor, [string, ErrorReason_$union]> => object<CoreMRFieldAnchor>((get$: IGetters): CoreMRFieldAnchor => {
|
|
29
30
|
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: IRequiredGetter, objectArg_11: IRequiredGetter, objectArg_12: IRequiredGetter, objectArg_13: IOptionalGetter;
|
|
30
31
|
return new CoreMRFieldAnchor((objectArg = get$.Required, objectArg.Field<int32>("ItemId", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<int32>("ItemTypeId", uncurry2(int))), (objectArg_2 = get$.Required, objectArg_2.Field<int32>("Sequence", uncurry2(int))), (objectArg_3 = get$.Required, objectArg_3.Field<int32>("NestingLevel", uncurry2(int))), (objectArg_4 = get$.Required, objectArg_4.Field<string>("Label", string)), (objectArg_5 = get$.Required, objectArg_5.Field<boolean>("IsRequired", bool)), (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$.Required, objectArg_10.Field<ValueEncodingInfo>("Encoding", uncurry2(valueEncodingDecoder))), (objectArg_11 = get$.Required, objectArg_11.Field<FSharpList<CoreMRChoiceAnchor>>("Choices", (path_6: string, value_6: any): FSharpResult$2_$union<FSharpList<CoreMRChoiceAnchor>, [string, ErrorReason_$union]> => list_9<CoreMRChoiceAnchor>(uncurry2(choiceAnchorDecoder), path_6, value_6))), (objectArg_12 = get$.Required, objectArg_12.Field<Shared_FieldKey>("FieldKey", uncurry2(fieldKeyDecoder))), defaultArg((objectArg_13 = get$.Optional, objectArg_13.Field<FSharpList<CoreMRMatrixItemAnchor>>("MatrixItemAnchors", (path_7: string, value_7: any): FSharpResult$2_$union<FSharpList<CoreMRMatrixItemAnchor>, [string, ErrorReason_$union]> => list_9<CoreMRMatrixItemAnchor>(uncurry2(matrixItemAnchorDecoder), path_7, value_7))), empty<CoreMRMatrixItemAnchor>()));
|
|
31
|
-
}, path_8, v))] as [((arg0: any) => any), ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<any, [string, ErrorReason_$union]>))],
|
|
32
|
+
}, path_8, v))] as [((arg0: any) => any), ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<any, [string, ErrorReason_$union]>))], baseExtra.Coders));
|
|
32
33
|
})();
|
|
33
34
|
|
|
34
35
|
/**
|
|
@@ -41,10 +42,12 @@ export function tryDecodeSourceMap(payloadJson: string): FSharpResult$2_$union<C
|
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
/**
|
|
44
|
-
* Serialize CoreMRFormInsertRequest to JSON for bridge POST body
|
|
45
|
+
* Serialize CoreMRFormInsertRequest to JSON for bridge POST body.
|
|
46
|
+
* Uses coreMRExtra for int64 support (CoreMRAnswer.Value).
|
|
47
|
+
* Uses CamelCase so bridge receives formId, formName, answers, dryRun (Zod schema).
|
|
45
48
|
*/
|
|
46
49
|
export function serializeRequest(req: CoreMRFormInsertRequest): string {
|
|
47
|
-
return toString(0, Auto_generateBoxedEncoder_437914C6(CoreMRFormInsertRequest_$reflection(),
|
|
50
|
+
return toString(0, Auto_generateBoxedEncoder_437914C6(CoreMRFormInsertRequest_$reflection(), CaseStrategy_CamelCase(), baseExtra, undefined)(req));
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
function canonicalize(s: string): string {
|
|
@@ -64,9 +67,9 @@ function getFieldOptionKeyGuid(_arg: Shared_FieldOptionKey): string {
|
|
|
64
67
|
return _arg.fields[0];
|
|
65
68
|
}
|
|
66
69
|
|
|
67
|
-
function getScoreFromOption(options: FSharpList<Shared_FieldOption>, selectedValue: string): Option<
|
|
70
|
+
function getScoreFromOption(options: FSharpList<Shared_FieldOption>, selectedValue: string): Option<int64> {
|
|
68
71
|
const canonicalSelected: string = canonicalize(selectedValue);
|
|
69
|
-
return bind<Shared_FieldOption,
|
|
72
|
+
return bind<Shared_FieldOption, int64>((opt_1: Shared_FieldOption): Option<int64> => map<int32, int64>((value: int32): int64 => toInt64(fromInt32(value)), opt_1.Score), tryFind<Shared_FieldOption>((opt: Shared_FieldOption): boolean => (canonicalize(opt.Value) === canonicalSelected), options));
|
|
70
73
|
}
|
|
71
74
|
|
|
72
75
|
function getOptionsFromFieldType(ft: Spec_FieldType_$union): FSharpList<Shared_FieldOption> {
|
|
@@ -126,131 +129,64 @@ function getOptionsFromFieldType(ft: Spec_FieldType_$union): FSharpList<Shared_F
|
|
|
126
129
|
}
|
|
127
130
|
}
|
|
128
131
|
|
|
132
|
+
function withDocumentation(field: Spec_FormField$1<Spec_FieldType_$union>, answers: FSharpList<CoreMRAnswer>): FSharpList<CoreMRAnswer> {
|
|
133
|
+
if (!field.NeedsDocumentation) {
|
|
134
|
+
return answers;
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
const matchValue: Option<string> = field.Documentation;
|
|
138
|
+
let matchResult: int32, doc: string;
|
|
139
|
+
if (matchValue != null) {
|
|
140
|
+
if (value_10(matchValue) === "") {
|
|
141
|
+
matchResult = 0;
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
matchResult = 1;
|
|
145
|
+
doc = value_10(matchValue);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
matchResult = 0;
|
|
150
|
+
}
|
|
151
|
+
switch (matchResult) {
|
|
152
|
+
case 0:
|
|
153
|
+
return answers;
|
|
154
|
+
default:
|
|
155
|
+
if (!isEmpty(answers)) {
|
|
156
|
+
const first: CoreMRAnswer = head(answers);
|
|
157
|
+
return cons(new CoreMRAnswer(first.Sequence, first.Value, doc!), tail(answers));
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
return answers;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
129
166
|
function fieldToAnswers(field: Spec_FormField$1<Spec_FieldType_$union>, anchor: CoreMRFieldAnchor): FSharpList<CoreMRAnswer> {
|
|
130
|
-
let canonicalAnswer: string;
|
|
167
|
+
let matchValue: Option<Shared_FieldValue_$union>, answers: FSharpSet<Shared_FieldAnswer>, options_1: FSharpList<Shared_FieldOption>, choicesWithBitPos: FSharpList<[string, int32]>, matrixAnswer: Shared_MatrixAnswer, options_2: FSharpList<Shared_FieldOption>, props: FSharpList<Shared_PluginDataProperty>, answer: Shared_FieldAnswer, options: FSharpList<Shared_FieldOption>, matchValue_2: string, matchValue_3: Option<int64>, canonicalAnswer: string, valStr: string, matchValue_1: string;
|
|
131
168
|
if (anchor.Encoding.IsSkip) {
|
|
132
169
|
return empty<CoreMRAnswer>();
|
|
133
170
|
}
|
|
134
171
|
else if (anchor.Encoding.IsScaffold) {
|
|
135
|
-
return singleton(new CoreMRAnswer(anchor.Sequence,
|
|
172
|
+
return singleton(new CoreMRAnswer(anchor.Sequence, 2n, undefined));
|
|
136
173
|
}
|
|
137
174
|
else {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
case /* Multiple */ 1: {
|
|
142
|
-
const answers: FSharpSet<Shared_FieldAnswer> = (value_10(matchValue) as Shared_FieldValue<1>).fields[0];
|
|
143
|
-
if (anchor.Encoding.ValueEncoding !== "choice_score") {
|
|
144
|
-
return empty<CoreMRAnswer>();
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
const options_1: FSharpList<Shared_FieldOption> = getOptionsFromFieldType(field.FieldType);
|
|
148
|
-
const choicesWithBitPos: FSharpList<[string, int32]> = choose<CoreMRChoiceAnchor, [string, int32]>((c_2: CoreMRChoiceAnchor): Option<[string, int32]> => {
|
|
149
|
-
if (c_2.BitPosition != null) {
|
|
150
|
-
return [getFieldOptionKeyGuid(c_2.FieldOptionKey), value_10(c_2.BitPosition)] as [string, int32];
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
return undefined;
|
|
154
|
-
}
|
|
155
|
-
}, anchor.Choices);
|
|
156
|
-
if (isEmpty(choicesWithBitPos)) {
|
|
157
|
-
return empty<CoreMRAnswer>();
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
return singleton(new CoreMRAnswer(anchor.Sequence, ~~toInt32(computeBitmask(choose<string, int32>((key: string): Option<int32> => map<[string, int32], int32>((tuple: [string, int32]): int32 => tuple[1], tryFind<[string, int32]>((tupledArg: [string, int32]): boolean => (tupledArg[0] === key), choicesWithBitPos)), choose<string, string>((valStr_1: string): Option<string> => map<Shared_FieldOption, string>((opt_2: Shared_FieldOption): string => getFieldOptionKeyGuid(opt_2.OptionKey), tryFind<Shared_FieldOption>((opt_1: Shared_FieldOption): boolean => (canonicalize(opt_1.Value) === canonicalize(valStr_1)), options_1)), map_1<Shared_FieldAnswer, string>((a: Shared_FieldAnswer): string => a.Value, toList<Shared_FieldAnswer>(answers)))))), undefined));
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
case /* Matrix */ 2: {
|
|
165
|
-
const matrixAnswer: Shared_MatrixAnswer = (value_10(matchValue) as Shared_FieldValue<2>).fields[0];
|
|
166
|
-
if (isEmpty(anchor.MatrixItemAnchors)) {
|
|
167
|
-
return empty<CoreMRAnswer>();
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
const options_2: FSharpList<Shared_FieldOption> = getOptionsFromFieldType(field.FieldType);
|
|
171
|
-
return choose<CoreMRMatrixItemAnchor, CoreMRAnswer>((rowAnchor: CoreMRMatrixItemAnchor): Option<CoreMRAnswer> => map<string, CoreMRAnswer>((selectedValue: string): CoreMRAnswer => (new CoreMRAnswer(rowAnchor.Sequence, defaultArg(getScoreFromOption(options_2, selectedValue), 0), undefined)), tryFind_1<Shared_MatrixItemKey, string>(rowAnchor.MatrixItemKey, matrixAnswer.Values)), anchor.MatrixItemAnchors);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
case /* PluginData */ 3: {
|
|
175
|
-
const props: FSharpList<Shared_PluginDataProperty> = (value_10(matchValue) as Shared_FieldValue<3>).fields[0];
|
|
176
|
-
let matchResult: int32, p_1: Shared_PluginDataProperty;
|
|
177
|
-
if (!isEmpty(props)) {
|
|
178
|
-
if (isEmpty(tail(props))) {
|
|
179
|
-
if (!isNullOrWhiteSpace(head(props).Value)) {
|
|
180
|
-
matchResult = 0;
|
|
181
|
-
p_1 = head(props);
|
|
182
|
-
}
|
|
183
|
-
else {
|
|
184
|
-
matchResult = 1;
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
matchResult = 1;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
matchResult = 1;
|
|
193
|
-
}
|
|
194
|
-
switch (matchResult) {
|
|
195
|
-
case 0:
|
|
196
|
-
return singleton(new CoreMRAnswer(anchor.Sequence, 0, p_1!.Value));
|
|
197
|
-
default:
|
|
198
|
-
return empty<CoreMRAnswer>();
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
default: {
|
|
202
|
-
const answer: Shared_FieldAnswer = (value_10(matchValue) as Shared_FieldValue<0>).fields[0];
|
|
203
|
-
const options: FSharpList<Shared_FieldOption> = getOptionsFromFieldType(field.FieldType);
|
|
204
|
-
const matchValue_2: string = anchor.Encoding.ValueEncoding;
|
|
205
|
-
switch (matchValue_2) {
|
|
206
|
-
case "choice_score": {
|
|
207
|
-
const matchValue_3: Option<int32> = orElse(getScoreFromOption(options, answer.Value), (canonicalAnswer = canonicalize(answer.Value), map<CoreMRChoiceAnchor, int32>((c_1: CoreMRChoiceAnchor): int32 => c_1.Score, tryFind<CoreMRChoiceAnchor>((c: CoreMRChoiceAnchor): boolean => exists<Shared_FieldOption>((opt: Shared_FieldOption): boolean => {
|
|
208
|
-
if (getFieldOptionKeyGuid(opt.OptionKey) === getFieldOptionKeyGuid(c.FieldOptionKey)) {
|
|
209
|
-
return canonicalize(opt.Value) === canonicalAnswer;
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
212
|
-
return false;
|
|
213
|
-
}
|
|
214
|
-
}, options), anchor.Choices))));
|
|
215
|
-
if (matchValue_3 == null) {
|
|
216
|
-
return singleton(new CoreMRAnswer(anchor.Sequence, 0, undefined));
|
|
217
|
-
}
|
|
218
|
-
else {
|
|
219
|
-
return singleton(new CoreMRAnswer(anchor.Sequence, value_10(matchValue_3), undefined));
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
case "1_yes_2_no": {
|
|
223
|
-
const valStr: string = canonicalize(answer.Value);
|
|
224
|
-
return singleton(new CoreMRAnswer(anchor.Sequence, (((valStr === "yes") ? true : (valStr === "true")) ? true : (valStr === "1")) ? 1 : 2, undefined));
|
|
225
|
-
}
|
|
226
|
-
case "zero":
|
|
227
|
-
case "scaffold":
|
|
228
|
-
case "unknown":
|
|
229
|
-
return singleton(new CoreMRAnswer(anchor.Sequence, 0, answer.Value));
|
|
230
|
-
default:
|
|
231
|
-
return singleton(new CoreMRAnswer(anchor.Sequence, 0, answer.Value));
|
|
232
|
-
}
|
|
233
|
-
}
|
|
175
|
+
return withDocumentation(field, (matchValue = field.Value, (matchValue != null) ? ((value_10(matchValue).tag === /* Multiple */ 1) ? ((answers = (value_10(matchValue) as Shared_FieldValue<1>).fields[0], (anchor.Encoding.ValueEncoding !== "choice_score") ? empty<CoreMRAnswer>() : ((options_1 = getOptionsFromFieldType(field.FieldType), (choicesWithBitPos = choose<CoreMRChoiceAnchor, [string, int32]>((c_2: CoreMRChoiceAnchor): Option<[string, int32]> => {
|
|
176
|
+
if (c_2.BitPosition != null) {
|
|
177
|
+
return [getFieldOptionKeyGuid(c_2.FieldOptionKey), value_10(c_2.BitPosition)] as [string, int32];
|
|
234
178
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
const matchValue_1: string = anchor.Encoding.ValueEncoding;
|
|
238
|
-
switch (matchValue_1) {
|
|
239
|
-
case "1_yes_2_no":
|
|
240
|
-
return singleton(new CoreMRAnswer(anchor.Sequence, 2, undefined));
|
|
241
|
-
case "choice_score":
|
|
242
|
-
if (isEmpty(anchor.Choices)) {
|
|
243
|
-
return empty<CoreMRAnswer>();
|
|
244
|
-
}
|
|
245
|
-
else {
|
|
246
|
-
return singleton(new CoreMRAnswer(anchor.Sequence, 0, undefined));
|
|
247
|
-
}
|
|
248
|
-
case "zero":
|
|
249
|
-
return singleton(new CoreMRAnswer(anchor.Sequence, 0, undefined));
|
|
250
|
-
default:
|
|
251
|
-
return empty<CoreMRAnswer>();
|
|
179
|
+
else {
|
|
180
|
+
return undefined;
|
|
252
181
|
}
|
|
253
|
-
}
|
|
182
|
+
}, anchor.Choices), isEmpty(choicesWithBitPos) ? empty<CoreMRAnswer>() : singleton(new CoreMRAnswer(anchor.Sequence, computeBitmask(choose<string, int32>((key: string): Option<int32> => map<[string, int32], int32>((tuple: [string, int32]): int32 => tuple[1], tryFind<[string, int32]>((tupledArg: [string, int32]): boolean => (tupledArg[0] === key), choicesWithBitPos)), choose<string, string>((valStr_1: string): Option<string> => map<Shared_FieldOption, string>((opt_2: Shared_FieldOption): string => getFieldOptionKeyGuid(opt_2.OptionKey), tryFind<Shared_FieldOption>((opt_1: Shared_FieldOption): boolean => (canonicalize(opt_1.Value) === canonicalize(valStr_1)), options_1)), map_1<Shared_FieldAnswer, string>((a: Shared_FieldAnswer): string => a.Value, toList<Shared_FieldAnswer>(answers))))), undefined))))))) : ((value_10(matchValue).tag === /* Matrix */ 2) ? ((matrixAnswer = (value_10(matchValue) as Shared_FieldValue<2>).fields[0], isEmpty(anchor.MatrixItemAnchors) ? empty<CoreMRAnswer>() : ((options_2 = getOptionsFromFieldType(field.FieldType), choose<CoreMRMatrixItemAnchor, CoreMRAnswer>((rowAnchor: CoreMRMatrixItemAnchor): Option<CoreMRAnswer> => map<string, CoreMRAnswer>((selectedValue: string): CoreMRAnswer => (new CoreMRAnswer(rowAnchor.Sequence, defaultArg(getScoreFromOption(options_2, selectedValue), 0n), undefined)), tryFind_1<Shared_MatrixItemKey, string>(rowAnchor.MatrixItemKey, matrixAnswer.Values)), anchor.MatrixItemAnchors))))) : ((value_10(matchValue).tag === /* PluginData */ 3) ? ((props = (value_10(matchValue) as Shared_FieldValue<3>).fields[0], !isEmpty(props) ? (isEmpty(tail(props)) ? (!isNullOrWhiteSpace(head(props).Value) ? singleton(new CoreMRAnswer(anchor.Sequence, 0n, head(props).Value)) : empty<CoreMRAnswer>()) : empty<CoreMRAnswer>()) : empty<CoreMRAnswer>())) : ((answer = (value_10(matchValue) as Shared_FieldValue<0>).fields[0], (options = getOptionsFromFieldType(field.FieldType), (matchValue_2 = anchor.Encoding.ValueEncoding, (matchValue_2 === "choice_score") ? ((matchValue_3 = orElse(getScoreFromOption(options, answer.Value), (canonicalAnswer = canonicalize(answer.Value), map<CoreMRChoiceAnchor, int64>((c_1: CoreMRChoiceAnchor): int64 => c_1.Score, tryFind<CoreMRChoiceAnchor>((c: CoreMRChoiceAnchor): boolean => exists<Shared_FieldOption>((opt: Shared_FieldOption): boolean => {
|
|
183
|
+
if (getFieldOptionKeyGuid(opt.OptionKey) === getFieldOptionKeyGuid(c.FieldOptionKey)) {
|
|
184
|
+
return canonicalize(opt.Value) === canonicalAnswer;
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
}, options), anchor.Choices)))), (matchValue_3 == null) ? singleton(new CoreMRAnswer(anchor.Sequence, 0n, undefined)) : singleton(new CoreMRAnswer(anchor.Sequence, value_10(matchValue_3), undefined)))) : ((matchValue_2 === "1_yes_2_no") ? ((valStr = canonicalize(answer.Value), singleton(new CoreMRAnswer(anchor.Sequence, (((valStr === "yes") ? true : (valStr === "true")) ? true : (valStr === "1")) ? (1n) : (2n), undefined)))) : ((matchValue_2 === "zero") ? singleton(new CoreMRAnswer(anchor.Sequence, 0n, answer.Value)) : ((matchValue_2 === "scaffold") ? singleton(new CoreMRAnswer(anchor.Sequence, 0n, answer.Value)) : ((matchValue_2 === "unknown") ? singleton(new CoreMRAnswer(anchor.Sequence, 0n, answer.Value)) : singleton(new CoreMRAnswer(anchor.Sequence, 0n, answer.Value))))))))))))) : ((matchValue_1 = anchor.Encoding.ValueEncoding, (matchValue_1 === "1_yes_2_no") ? singleton(new CoreMRAnswer(anchor.Sequence, 2n, undefined)) : ((matchValue_1 === "choice_score") ? (isEmpty(anchor.Choices) ? empty<CoreMRAnswer>() : singleton(new CoreMRAnswer(anchor.Sequence, 0n, undefined))) : ((matchValue_1 === "zero") ? singleton(new CoreMRAnswer(anchor.Sequence, 0n, undefined)) : empty<CoreMRAnswer>()))))));
|
|
254
190
|
}
|
|
255
191
|
}
|
|
256
192
|
|
|
@@ -266,7 +202,7 @@ function anchorToAnswers(fieldMap: FSharpMap<string, Spec_FormField$1<Spec_Field
|
|
|
266
202
|
return empty<CoreMRAnswer>();
|
|
267
203
|
}
|
|
268
204
|
else if (anchor.Encoding.IsScaffold) {
|
|
269
|
-
return singleton(new CoreMRAnswer(anchor.Sequence,
|
|
205
|
+
return singleton(new CoreMRAnswer(anchor.Sequence, 2n, undefined));
|
|
270
206
|
}
|
|
271
207
|
else if (field != null) {
|
|
272
208
|
return fieldToAnswers(value_10(field), anchor);
|
|
@@ -275,16 +211,16 @@ function anchorToAnswers(fieldMap: FSharpMap<string, Spec_FormField$1<Spec_Field
|
|
|
275
211
|
const matchValue: string = anchor.Encoding.ValueEncoding;
|
|
276
212
|
switch (matchValue) {
|
|
277
213
|
case "1_yes_2_no":
|
|
278
|
-
return singleton(new CoreMRAnswer(anchor.Sequence,
|
|
214
|
+
return singleton(new CoreMRAnswer(anchor.Sequence, 2n, undefined));
|
|
279
215
|
case "choice_score":
|
|
280
216
|
if (isEmpty(anchor.Choices)) {
|
|
281
217
|
return empty<CoreMRAnswer>();
|
|
282
218
|
}
|
|
283
219
|
else {
|
|
284
|
-
return singleton(new CoreMRAnswer(anchor.Sequence,
|
|
220
|
+
return singleton(new CoreMRAnswer(anchor.Sequence, 0n, undefined));
|
|
285
221
|
}
|
|
286
222
|
case "zero":
|
|
287
|
-
return singleton(new CoreMRAnswer(anchor.Sequence,
|
|
223
|
+
return singleton(new CoreMRAnswer(anchor.Sequence, 0n, undefined));
|
|
288
224
|
default:
|
|
289
225
|
return empty<CoreMRAnswer>();
|
|
290
226
|
}
|
|
@@ -1,19 +1,30 @@
|
|
|
1
|
+
import { newGuid } from "@fable-org/fable-library-js/Guid.js";
|
|
2
|
+
import { tryFind as tryFind_1, FSharpMap, ofList, add } from "@fable-org/fable-library-js/Map.js";
|
|
3
|
+
import { Auto_generateBoxedEncoder_437914C6, toString, int64 } from "../../../../fable_modules/Thoth.Json.10.4.1/Encode.fs.js";
|
|
4
|
+
import { int64 as int64_1 } from "@fable-org/fable-library-js/BigInt.js";
|
|
5
|
+
import { int64 as int64_2 } from "../../../../fable_modules/Thoth.Json.10.4.1/Decode.fs.js";
|
|
6
|
+
import { FSharpResult$2_$union } from "@fable-org/fable-library-js/Result.js";
|
|
7
|
+
import { ExtraCoders, ErrorReason_$union } from "../../../../fable_modules/Thoth.Json.10.4.1/Types.fs.js";
|
|
8
|
+
import { empty } from "../../../../fable_modules/Thoth.Json.10.4.1/Extra.fs.js";
|
|
1
9
|
import { Record } from "@fable-org/fable-library-js/Types.js";
|
|
2
10
|
import { numberHash, comparePrimitives, IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
|
|
3
|
-
import { class_type, list_type, option_type, int32_type, record_type, bool_type, string_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
11
|
+
import { class_type, list_type, option_type, int64_type, int32_type, record_type, bool_type, string_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
4
12
|
import { getElementTypeInfo, ElementTypeInfo } from "./CorEMRElementTypeMap.js";
|
|
5
13
|
import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
6
14
|
import { map, value as value_2, defaultArg, Option } from "@fable-org/fable-library-js/Option.js";
|
|
7
15
|
import { Spec_FormStep$1, Spec_FormField$1, Spec_MultiChoiceInfo, Spec_SingleChoiceInfo, Shared_FieldOption, Spec_FormSpec$1_$reflection, Spec_FieldType_$reflection, Spec_FieldType_$union, Spec_FormSpec$1, Shared_FieldKey_$reflection, Shared_FieldKey, Shared_MatrixItemKey_$reflection, Shared_MatrixItemKey, Shared_FieldOptionKey_$reflection, Shared_FieldOptionKey } from "../../../FormSpec.js";
|
|
8
|
-
import { tryFind, choose, item as item_1, length, mapIndexed, sortBy, empty, FSharpList } from "@fable-org/fable-library-js/List.js";
|
|
16
|
+
import { tryFind, choose, item as item_1, length, mapIndexed, sortBy, empty as empty_1, FSharpList } from "@fable-org/fable-library-js/List.js";
|
|
9
17
|
import { CoreMRFormData, CoreMRItem, CoreMRChoice, CoreMRTag_$reflection, CoreMRTrigger_$reflection, CoreMRTag, CoreMRTrigger } from "../../CorEMR/CoreMRTypes.js";
|
|
10
|
-
import { tryFind as tryFind_1, FSharpMap, ofList } from "@fable-org/fable-library-js/Map.js";
|
|
11
18
|
import { List_groupBy } from "@fable-org/fable-library-js/Seq2.js";
|
|
12
19
|
import { detectHeadings, groupItemsByHeadings, Section, HeadingItem } from "./CorEMRSectioning.js";
|
|
13
20
|
import { convertToFormSpec } from "./CorEMRTemplateToFormSpec.js";
|
|
14
|
-
import { Auto_generateBoxedEncoder_437914C6, toString } from "../../../../fable_modules/Thoth.Json.10.4.1/Encode.fs.js";
|
|
15
21
|
import { IntegrationProvenance } from "../../../Provenance.js";
|
|
16
22
|
|
|
23
|
+
export const coreMRExtra: ExtraCoders = new ExtraCoders((() => {
|
|
24
|
+
let copyOfStruct: string = newGuid();
|
|
25
|
+
return copyOfStruct;
|
|
26
|
+
})(), add<string, [((arg0: any) => any), ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<any, [string, ErrorReason_$union]>))]>("System.Int64", [int64, int64_2] as [((arg0: any) => any), ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<any, [string, ErrorReason_$union]>))], empty.Coders));
|
|
27
|
+
|
|
17
28
|
export class ValueEncodingInfo extends Record implements IEquatable<ValueEncodingInfo>, IComparable<ValueEncodingInfo> {
|
|
18
29
|
readonly ValueEncoding: string;
|
|
19
30
|
readonly TextFieldRole: string;
|
|
@@ -46,16 +57,16 @@ export class CoreMRChoiceAnchor extends Record implements IEquatable<CoreMRChoic
|
|
|
46
57
|
readonly ChoiceId: int32;
|
|
47
58
|
readonly Sequence: int32;
|
|
48
59
|
readonly Text: string;
|
|
49
|
-
readonly Score:
|
|
60
|
+
readonly Score: int64_1;
|
|
50
61
|
readonly BitPosition: Option<int32>;
|
|
51
62
|
readonly Code: Option<string>;
|
|
52
63
|
readonly FieldOptionKey: Shared_FieldOptionKey;
|
|
53
|
-
constructor(ChoiceId: int32, Sequence: int32, Text$: string, Score:
|
|
64
|
+
constructor(ChoiceId: int32, Sequence: int32, Text$: string, Score: int64_1, BitPosition: Option<int32>, Code: Option<string>, FieldOptionKey: Shared_FieldOptionKey) {
|
|
54
65
|
super();
|
|
55
66
|
this.ChoiceId = (ChoiceId | 0);
|
|
56
67
|
this.Sequence = (Sequence | 0);
|
|
57
68
|
this.Text = Text$;
|
|
58
|
-
this.Score =
|
|
69
|
+
this.Score = Score;
|
|
59
70
|
this.BitPosition = BitPosition;
|
|
60
71
|
this.Code = Code;
|
|
61
72
|
this.FieldOptionKey = FieldOptionKey;
|
|
@@ -63,7 +74,7 @@ export class CoreMRChoiceAnchor extends Record implements IEquatable<CoreMRChoic
|
|
|
63
74
|
}
|
|
64
75
|
|
|
65
76
|
export function CoreMRChoiceAnchor_$reflection(): TypeInfo {
|
|
66
|
-
return record_type("FormSpec.Integrations.CorEMR.CoreMRSourceMap.CoreMRChoiceAnchor", [], CoreMRChoiceAnchor, () => [["ChoiceId", int32_type], ["Sequence", int32_type], ["Text", string_type], ["Score",
|
|
77
|
+
return record_type("FormSpec.Integrations.CorEMR.CoreMRSourceMap.CoreMRChoiceAnchor", [], CoreMRChoiceAnchor, () => [["ChoiceId", int32_type], ["Sequence", int32_type], ["Text", string_type], ["Score", int64_type], ["BitPosition", option_type(int32_type)], ["Code", option_type(string_type)], ["FieldOptionKey", Shared_FieldOptionKey_$reflection()]]);
|
|
67
78
|
}
|
|
68
79
|
|
|
69
80
|
export class CoreMRMatrixItemAnchor extends Record implements IEquatable<CoreMRMatrixItemAnchor>, IComparable<CoreMRMatrixItemAnchor> {
|
|
@@ -280,7 +291,7 @@ function getFieldOptions(field: Spec_FormField$1<Spec_FieldType_$union>): FSharp
|
|
|
280
291
|
case 2:
|
|
281
292
|
return info_2!.Options;
|
|
282
293
|
default:
|
|
283
|
-
return
|
|
294
|
+
return empty_1<Shared_FieldOption>();
|
|
284
295
|
}
|
|
285
296
|
}
|
|
286
297
|
|
|
@@ -293,7 +304,7 @@ export function buildFieldAnchor(item: CoreMRItem, choices: FSharpList<CoreMRCho
|
|
|
293
304
|
Compare: comparePrimitives,
|
|
294
305
|
});
|
|
295
306
|
const fieldOptions: FSharpList<Shared_FieldOption> = getFieldOptions(field);
|
|
296
|
-
return new CoreMRFieldAnchor(item.ItemId, item.ItemTypeId, item.Sequence, item.NestingLevel, item.Label, item.IsRequired, item.SequenceText, item.Code, item.Uuid, item.GenderRequired, encoding, mapIndexed<CoreMRChoice, CoreMRChoiceAnchor>((i: int32, choice: CoreMRChoice): CoreMRChoiceAnchor => (new CoreMRChoiceAnchor(choice.ChoiceId, choice.Sequence, choice.Text, choice.Score, choice.BitPosition, choice.Code, (i < length(fieldOptions)) ? item_1(i, fieldOptions).OptionKey : (new Shared_FieldOptionKey("00000000-0000-0000-0000-000000000000")))), sortedChoices), field.FieldKey,
|
|
307
|
+
return new CoreMRFieldAnchor(item.ItemId, item.ItemTypeId, item.Sequence, item.NestingLevel, item.Label, item.IsRequired, item.SequenceText, item.Code, item.Uuid, item.GenderRequired, encoding, mapIndexed<CoreMRChoice, CoreMRChoiceAnchor>((i: int32, choice: CoreMRChoice): CoreMRChoiceAnchor => (new CoreMRChoiceAnchor(choice.ChoiceId, choice.Sequence, choice.Text, choice.Score, choice.BitPosition, choice.Code, (i < length(fieldOptions)) ? item_1(i, fieldOptions).OptionKey : (new Shared_FieldOptionKey("00000000-0000-0000-0000-000000000000")))), sortedChoices), field.FieldKey, empty_1<CoreMRMatrixItemAnchor>());
|
|
297
308
|
}
|
|
298
309
|
|
|
299
310
|
export class ListMetadata extends Record implements IEquatable<ListMetadata>, IComparable<ListMetadata> {
|
|
@@ -336,7 +347,7 @@ export function buildSourceMap(formData: CoreMRFormData, formSpec: Spec_FormSpec
|
|
|
336
347
|
}
|
|
337
348
|
const fieldAnchors: FSharpList<CoreMRFieldAnchor> = mapIndexed<CoreMRItem, CoreMRFieldAnchor>((i: int32, item: CoreMRItem): CoreMRFieldAnchor => {
|
|
338
349
|
const field: Spec_FormField$1<Spec_FieldType_$union> = item_1(i, step.Fields);
|
|
339
|
-
return buildFieldAnchor(item, defaultArg(tryFind_1<int32, FSharpList<CoreMRChoice>>(item.ItemId, choicesByItem),
|
|
350
|
+
return buildFieldAnchor(item, defaultArg(tryFind_1<int32, FSharpList<CoreMRChoice>>(item.ItemId, choicesByItem), empty_1<CoreMRChoice>()), field);
|
|
340
351
|
}, section.Items);
|
|
341
352
|
const headingItemId: Option<int32> = map<HeadingItem, int32>((h: HeadingItem): int32 => h.ItemId, section.Heading);
|
|
342
353
|
return new CoreMRStepMap(stepOrder, new CoreMRStepAnchor(headingItemId, section.HeadingSequence, section.HeadingLabel), fieldAnchors);
|
|
@@ -345,8 +356,8 @@ export function buildSourceMap(formData: CoreMRFormData, formSpec: Spec_FormSpec
|
|
|
345
356
|
return undefined;
|
|
346
357
|
}
|
|
347
358
|
}, groupItemsByHeadings(detectHeadings(formData.Items), formData.Items));
|
|
348
|
-
const listMeta: ListMetadata = defaultArg<ListMetadata>(listMetadata, new ListMetadata(undefined, undefined,
|
|
349
|
-
return new CoreMRSourceMap(formData.Metadata.FormId, formData.Metadata.VersionId, formData.Metadata.VersionNumber, formData.Metadata.FormName, formCode, "name", formData.Metadata.Description, (matchValue = listMeta.IsIntake, (matchValue == null) ? formData.Metadata.IsIntake : value_2(matchValue)), formData.Metadata.RequiresSignature, listMeta.IsScored, listMeta.EncounterTypes, undefined, undefined, undefined, undefined, stepMaps,
|
|
359
|
+
const listMeta: ListMetadata = defaultArg<ListMetadata>(listMetadata, new ListMetadata(undefined, undefined, empty_1<string>()));
|
|
360
|
+
return new CoreMRSourceMap(formData.Metadata.FormId, formData.Metadata.VersionId, formData.Metadata.VersionNumber, formData.Metadata.FormName, formCode, "name", formData.Metadata.Description, (matchValue = listMeta.IsIntake, (matchValue == null) ? formData.Metadata.IsIntake : value_2(matchValue)), formData.Metadata.RequiresSignature, listMeta.IsScored, listMeta.EncounterTypes, undefined, undefined, undefined, undefined, stepMaps, empty_1<CoreMRAbsorbedItem>(), formData.Triggers, formData.Tags, formSpec.Id);
|
|
350
361
|
}
|
|
351
362
|
|
|
352
363
|
/**
|
|
@@ -365,7 +376,7 @@ export function convertWithMap(formData: CoreMRFormData, listMetadata: Option<Li
|
|
|
365
376
|
export function convertWithMapAndProvenance(formData: CoreMRFormData, listMetadata: Option<ListMetadata>): Spec_FormSpec$1<Spec_FieldType_$union> {
|
|
366
377
|
const result: CoreMRConversionResult = convertWithMap(formData, listMetadata);
|
|
367
378
|
const bind$0040: Spec_FormSpec$1<Spec_FieldType_$union> = result.FormSpec;
|
|
368
|
-
return new Spec_FormSpec$1(bind$0040.Id, bind$0040.Code, bind$0040.Title, bind$0040.Abstract, bind$0040.Version, bind$0040.FormSpecVersion, bind$0040.Steps, bind$0040.CategoryTags, bind$0040.Score, bind$0040.AssociatedCodes, bind$0040.RequiresReview, bind$0040.RequiresReviewAndApproval, bind$0040.ClinicalPathway, bind$0040.Lifecycle, bind$0040.FilledMeta, bind$0040.CustomData, new IntegrationProvenance("coremr", toString(0, Auto_generateBoxedEncoder_437914C6(CoreMRSourceMap_$reflection(), undefined,
|
|
379
|
+
return new Spec_FormSpec$1(bind$0040.Id, bind$0040.Code, bind$0040.Title, bind$0040.Abstract, bind$0040.Version, bind$0040.FormSpecVersion, bind$0040.Steps, bind$0040.CategoryTags, bind$0040.Score, bind$0040.AssociatedCodes, bind$0040.RequiresReview, bind$0040.RequiresReviewAndApproval, bind$0040.ClinicalPathway, bind$0040.Lifecycle, bind$0040.FilledMeta, bind$0040.CustomData, new IntegrationProvenance("coremr", toString(0, Auto_generateBoxedEncoder_437914C6(CoreMRSourceMap_$reflection(), undefined, coreMRExtra, undefined)(result.SourceMap))));
|
|
369
380
|
}
|
|
370
381
|
|
|
371
382
|
//# sourceMappingURL=CoreMRSourceMap.ts.map
|
|
@@ -3,7 +3,8 @@ import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
|
3
3
|
import { empty as empty_1, ofList, toList, isEmpty as isEmpty_1, tryFind as tryFind_1, FSharpMap } from "@fable-org/fable-library-js/Map.js";
|
|
4
4
|
import { Spec_FormSpec$1, Spec_FormStep$1, Spec_FormField$1, Shared_PluginDataProperty, Shared_MatrixAnswer, Shared_FieldValue, Shared_FieldValue_$union, Spec_FieldType_$union, Spec_MultiChoiceInfo, Spec_SingleChoiceInfo, Shared_FieldAnswer, Shared_FieldOption, Shared_FieldKey_$reflection, Shared_FieldKey } from "../../../FormSpec.js";
|
|
5
5
|
import { compare, uncurry2, uncurry3, IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
|
|
6
|
-
import { bool_type, list_type, option_type, record_type, class_type, string_type, int32_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
6
|
+
import { bool_type, list_type, option_type, int64_type, record_type, class_type, string_type, int32_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
7
|
+
import { fromInt32, toInt64, int64 } from "@fable-org/fable-library-js/BigInt.js";
|
|
7
8
|
import { defaultArg, toArray, value as value_6, map, bind, Option } from "@fable-org/fable-library-js/Option.js";
|
|
8
9
|
import { map as map_1, choose, mapIndexed, collect, head, tail, isEmpty, ofArray, empty, tryFind, FSharpList } from "@fable-org/fable-library-js/List.js";
|
|
9
10
|
import { Helpers_canonicalizeFieldKey } from "../../../Helpers.js";
|
|
@@ -33,18 +34,18 @@ export function CoreMRPublishMetadata_$reflection(): TypeInfo {
|
|
|
33
34
|
|
|
34
35
|
export class CoreMRAnswer extends Record implements IEquatable<CoreMRAnswer>, IComparable<CoreMRAnswer> {
|
|
35
36
|
readonly Sequence: int32;
|
|
36
|
-
readonly Value:
|
|
37
|
+
readonly Value: int64;
|
|
37
38
|
readonly Text: Option<string>;
|
|
38
|
-
constructor(Sequence: int32, Value:
|
|
39
|
+
constructor(Sequence: int32, Value: int64, Text$: Option<string>) {
|
|
39
40
|
super();
|
|
40
41
|
this.Sequence = (Sequence | 0);
|
|
41
|
-
this.Value =
|
|
42
|
+
this.Value = Value;
|
|
42
43
|
this.Text = Text$;
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
export function CoreMRAnswer_$reflection(): TypeInfo {
|
|
47
|
-
return record_type("FormSpec.Integrations.CorEMR.CoreMRAnswer", [], CoreMRAnswer, () => [["Sequence", int32_type], ["Value",
|
|
48
|
+
return record_type("FormSpec.Integrations.CorEMR.CoreMRAnswer", [], CoreMRAnswer, () => [["Sequence", int32_type], ["Value", int64_type], ["Text", option_type(string_type)]]);
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
export class CoreMRFormInsertRequest extends Record implements IEquatable<CoreMRFormInsertRequest>, IComparable<CoreMRFormInsertRequest> {
|
|
@@ -74,10 +75,10 @@ function FormSpecToCoreMRInsert_singleToAnswer(fieldKey: Shared_FieldKey, option
|
|
|
74
75
|
return map<int32, CoreMRAnswer>((seq: int32): CoreMRAnswer => {
|
|
75
76
|
const matchValue: Option<int32> = FormSpecToCoreMRInsert_getScoreFromOption(options, answer.Value);
|
|
76
77
|
if (matchValue == null) {
|
|
77
|
-
return new CoreMRAnswer(seq, 0, answer.Value);
|
|
78
|
+
return new CoreMRAnswer(seq, toInt64(fromInt32(0)), answer.Value);
|
|
78
79
|
}
|
|
79
80
|
else {
|
|
80
|
-
return new CoreMRAnswer(seq, value_6(matchValue), undefined);
|
|
81
|
+
return new CoreMRAnswer(seq, toInt64(fromInt32(value_6(matchValue))), undefined);
|
|
81
82
|
}
|
|
82
83
|
}, tryFind_1<Shared_FieldKey, int32>(fieldKey, seqMap));
|
|
83
84
|
}
|
|
@@ -171,7 +172,7 @@ function FormSpecToCoreMRInsert_fieldToAnswers(field: Spec_FormField$1<Spec_Fiel
|
|
|
171
172
|
}
|
|
172
173
|
switch (matchResult) {
|
|
173
174
|
case 0:
|
|
174
|
-
return ofArray(toArray<CoreMRAnswer>(map<int32, CoreMRAnswer>((seq: int32): CoreMRAnswer => (new CoreMRAnswer(seq, 0, p_1!.Value)), tryFind_1<Shared_FieldKey, int32>(field.FieldKey, seqMap))));
|
|
175
|
+
return ofArray(toArray<CoreMRAnswer>(map<int32, CoreMRAnswer>((seq: int32): CoreMRAnswer => (new CoreMRAnswer(seq, toInt64(fromInt32(0)), p_1!.Value)), tryFind_1<Shared_FieldKey, int32>(field.FieldKey, seqMap))));
|
|
175
176
|
default:
|
|
176
177
|
return empty<CoreMRAnswer>();
|
|
177
178
|
}
|
|
@@ -251,7 +252,7 @@ function FormSpecToCoreMRInsert_fieldToValueAndText(field: Spec_FormField$1<Spec
|
|
|
251
252
|
*/
|
|
252
253
|
export function FormSpecToCoreMRInsert_convertToCoreMRInsertPayload(filledFormSpec: Spec_FormSpec$1<Spec_FieldType_$union>, metadata: CoreMRPublishMetadata, scaffoldMode: boolean, dryRun: boolean): CoreMRFormInsertRequest {
|
|
253
254
|
let allFields: FSharpList<Spec_FormField$1<Spec_FieldType_$union>>, acc: FSharpList<CoreMRAnswer>;
|
|
254
|
-
return new CoreMRFormInsertRequest(metadata.FormId, metadata.FormName, scaffoldMode ? undefined : ((allFields = collect<Spec_FormStep$1<Spec_FieldType_$union>, Spec_FormField$1<Spec_FieldType_$union>>((step: Spec_FormStep$1<Spec_FieldType_$union>): FSharpList<Spec_FormField$1<Spec_FieldType_$union>> => step.Fields, filledFormSpec.Steps), (acc = (isEmpty_1<Shared_FieldKey, int32>(metadata.FieldKeyToSequence) ? mapIndexed<[int32, Option<string>], CoreMRAnswer>((i: int32, tupledArg: [int32, Option<string>]): CoreMRAnswer => (new CoreMRAnswer((2 * i) + 1, tupledArg[0], tupledArg[1])), choose<Spec_FormField$1<Spec_FieldType_$union>, [int32, Option<string>]>(FormSpecToCoreMRInsert_fieldToValueAndText, allFields)) : collect<Spec_FormField$1<Spec_FieldType_$union>, CoreMRAnswer>((f: Spec_FormField$1<Spec_FieldType_$union>): FSharpList<CoreMRAnswer> => FormSpecToCoreMRInsert_fieldToAnswers(f, metadata.FieldKeyToSequence), allFields)), isEmpty(acc) ? undefined : acc))), dryRun);
|
|
255
|
+
return new CoreMRFormInsertRequest(metadata.FormId, metadata.FormName, scaffoldMode ? undefined : ((allFields = collect<Spec_FormStep$1<Spec_FieldType_$union>, Spec_FormField$1<Spec_FieldType_$union>>((step: Spec_FormStep$1<Spec_FieldType_$union>): FSharpList<Spec_FormField$1<Spec_FieldType_$union>> => step.Fields, filledFormSpec.Steps), (acc = (isEmpty_1<Shared_FieldKey, int32>(metadata.FieldKeyToSequence) ? mapIndexed<[int32, Option<string>], CoreMRAnswer>((i: int32, tupledArg: [int32, Option<string>]): CoreMRAnswer => (new CoreMRAnswer((2 * i) + 1, toInt64(fromInt32(tupledArg[0])), tupledArg[1])), choose<Spec_FormField$1<Spec_FieldType_$union>, [int32, Option<string>]>(FormSpecToCoreMRInsert_fieldToValueAndText, allFields)) : collect<Spec_FormField$1<Spec_FieldType_$union>, CoreMRAnswer>((f: Spec_FormField$1<Spec_FieldType_$union>): FSharpList<CoreMRAnswer> => FormSpecToCoreMRInsert_fieldToAnswers(f, metadata.FieldKeyToSequence), allFields)), isEmpty(acc) ? undefined : acc))), dryRun);
|
|
255
256
|
}
|
|
256
257
|
|
|
257
258
|
const CoreMRPublishMetadataCustomData_key = "coremr_publish";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Union, Record } from "@fable-org/fable-library-js/Types.js";
|
|
2
2
|
import { IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
|
|
3
|
-
import { union_type, list_type, float64_type, obj_type, array_type, option_type, bool_type, anonRecord_type, class_type, int32_type, record_type, string_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
3
|
+
import { union_type, list_type, int64_type, float64_type, obj_type, array_type, option_type, bool_type, anonRecord_type, class_type, int32_type, record_type, string_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
4
4
|
import { float64, int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
5
5
|
import { FSharpMap } from "@fable-org/fable-library-js/Map.js";
|
|
6
6
|
import { Option } from "@fable-org/fable-library-js/Option.js";
|
|
7
|
+
import { int64 } from "@fable-org/fable-library-js/BigInt.js";
|
|
7
8
|
import { FSharpList } from "@fable-org/fable-library-js/List.js";
|
|
8
9
|
|
|
9
10
|
export class ElementType extends Record implements IEquatable<ElementType>, IComparable<ElementType> {
|
|
@@ -457,17 +458,17 @@ export class CoreMRChoice extends Record implements IEquatable<CoreMRChoice>, IC
|
|
|
457
458
|
readonly ItemId: int32;
|
|
458
459
|
readonly Sequence: int32;
|
|
459
460
|
readonly Text: string;
|
|
460
|
-
readonly Score:
|
|
461
|
+
readonly Score: int64;
|
|
461
462
|
readonly BitPosition: Option<int32>;
|
|
462
463
|
readonly Code: Option<string>;
|
|
463
464
|
readonly Highlight: Option<string>;
|
|
464
|
-
constructor(ChoiceId: int32, ItemId: int32, Sequence: int32, Text$: string, Score:
|
|
465
|
+
constructor(ChoiceId: int32, ItemId: int32, Sequence: int32, Text$: string, Score: int64, BitPosition: Option<int32>, Code: Option<string>, Highlight: Option<string>) {
|
|
465
466
|
super();
|
|
466
467
|
this.ChoiceId = (ChoiceId | 0);
|
|
467
468
|
this.ItemId = (ItemId | 0);
|
|
468
469
|
this.Sequence = (Sequence | 0);
|
|
469
470
|
this.Text = Text$;
|
|
470
|
-
this.Score =
|
|
471
|
+
this.Score = Score;
|
|
471
472
|
this.BitPosition = BitPosition;
|
|
472
473
|
this.Code = Code;
|
|
473
474
|
this.Highlight = Highlight;
|
|
@@ -475,7 +476,7 @@ export class CoreMRChoice extends Record implements IEquatable<CoreMRChoice>, IC
|
|
|
475
476
|
}
|
|
476
477
|
|
|
477
478
|
export function CoreMRChoice_$reflection(): TypeInfo {
|
|
478
|
-
return record_type("FormSpec.Integrations.CorEMR.CoreMRTypes.CoreMRChoice", [], CoreMRChoice, () => [["ChoiceId", int32_type], ["ItemId", int32_type], ["Sequence", int32_type], ["Text", string_type], ["Score",
|
|
479
|
+
return record_type("FormSpec.Integrations.CorEMR.CoreMRTypes.CoreMRChoice", [], CoreMRChoice, () => [["ChoiceId", int32_type], ["ItemId", int32_type], ["Sequence", int32_type], ["Text", string_type], ["Score", int64_type], ["BitPosition", option_type(int32_type)], ["Code", option_type(string_type)], ["Highlight", option_type(string_type)]]);
|
|
479
480
|
}
|
|
480
481
|
|
|
481
482
|
export class CoreMRTriggerCondition extends Record implements IEquatable<CoreMRTriggerCondition>, IComparable<CoreMRTriggerCondition> {
|