@f1studio/form-spec 5.0.0-alpha.135 → 5.0.0-alpha.137

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.
Files changed (88) hide show
  1. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.d.ts +47 -1
  2. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.d.ts.map +1 -1
  3. package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.d.ts +1 -1
  4. package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.d.ts.map +1 -1
  5. package/FormSpec.TS/FormSpec.FS/BlueprintValidation.js +1 -1
  6. package/FormSpec.TS/FormSpec.FS/BlueprintValidation.js.map +1 -1
  7. package/FormSpec.TS/FormSpec.FS/BlueprintValidation.ts.map +1 -1
  8. package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.js +1 -1
  9. package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.js.map +1 -1
  10. package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.ts.map +1 -1
  11. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js +1 -1
  12. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js.map +1 -1
  13. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts.map +1 -1
  14. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js +358 -55
  15. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js.map +1 -1
  16. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts.map +1 -1
  17. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js +1 -1
  18. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js.map +1 -1
  19. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts.map +1 -1
  20. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.js +2 -2
  21. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.js +1 -1
  22. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.ts.map +1 -1
  23. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js +2 -2
  24. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js.map +1 -1
  25. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts.map +1 -1
  26. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.js +2 -2
  27. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.js.map +1 -1
  28. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.ts.map +1 -1
  29. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Values.Api.Option.js +2 -2
  30. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Values.Api.Option.js.map +1 -1
  31. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Values.Api.Option.ts.map +1 -1
  32. package/FormSpec.TS/FormSpec.FS/Migrator.js +1 -1
  33. package/FormSpec.TS/FormSpec.FS/Migrator.js.map +1 -1
  34. package/FormSpec.TS/FormSpec.FS/Migrator.ts.map +1 -1
  35. package/FormSpec.TS/FormSpec.FS/PathwayExecutor.js +1 -1
  36. package/FormSpec.TS/FormSpec.FS/PathwayExecutor.js.map +1 -1
  37. package/FormSpec.TS/FormSpec.FS/PathwayExecutor.ts.map +1 -1
  38. package/FormSpec.TS/fable_modules/project_cracked.json +1 -1
  39. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Decode.js.map +1 -0
  40. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Decode.ts.map +1 -0
  41. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Encode.js.map +1 -0
  42. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Encode.ts.map +1 -0
  43. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Extra.js.map +1 -0
  44. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Extra.ts.map +1 -0
  45. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Types.js.map +1 -0
  46. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Types.ts.map +1 -0
  47. package/README.md +7 -7
  48. package/libs/Thoth.Json/packages/Thoth.Json/Decode.d.ts.map +1 -0
  49. package/libs/Thoth.Json/packages/Thoth.Json/Encode.d.ts.map +1 -0
  50. package/libs/Thoth.Json/packages/Thoth.Json/Extra.d.ts.map +1 -0
  51. package/libs/Thoth.Json/packages/Thoth.Json/Types.d.ts.map +1 -0
  52. package/package.json +1 -1
  53. package/src/FormSpec.FS/BlueprintValidation.ts +1 -1
  54. package/src/FormSpec.FS/FormSpecHelpers.ts +1 -1
  55. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts +1 -1
  56. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts +342 -62
  57. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts +1 -1
  58. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.ts +3 -3
  59. package/src/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.ts +3 -3
  60. package/src/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts +4 -4
  61. package/src/FormSpec.FS/Interop/FormSpec.Api.Option.ts +2 -2
  62. package/src/FormSpec.FS/Interop/FormSpec.Values.Api.Option.ts +2 -2
  63. package/src/FormSpec.FS/Migrator.ts +1 -1
  64. package/src/FormSpec.FS/PathwayExecutor.ts +1 -1
  65. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Decode.js.map +0 -1
  66. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Decode.ts.map +0 -1
  67. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Encode.js.map +0 -1
  68. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Encode.ts.map +0 -1
  69. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Extra.js.map +0 -1
  70. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Extra.ts.map +0 -1
  71. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Types.js.map +0 -1
  72. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Types.ts.map +0 -1
  73. package/Thoth.Json/packages/Thoth.Json/Decode.d.ts.map +0 -1
  74. package/Thoth.Json/packages/Thoth.Json/Encode.d.ts.map +0 -1
  75. package/Thoth.Json/packages/Thoth.Json/Extra.d.ts.map +0 -1
  76. package/Thoth.Json/packages/Thoth.Json/Types.d.ts.map +0 -1
  77. /package/FormSpec.TS/{Thoth.Json → libs/Thoth.Json}/packages/Thoth.Json/Decode.js +0 -0
  78. /package/FormSpec.TS/{Thoth.Json → libs/Thoth.Json}/packages/Thoth.Json/Encode.js +0 -0
  79. /package/FormSpec.TS/{Thoth.Json → libs/Thoth.Json}/packages/Thoth.Json/Extra.js +0 -0
  80. /package/FormSpec.TS/{Thoth.Json → libs/Thoth.Json}/packages/Thoth.Json/Types.js +0 -0
  81. /package/{Thoth.Json → libs/Thoth.Json}/packages/Thoth.Json/Decode.d.ts +0 -0
  82. /package/{Thoth.Json → libs/Thoth.Json}/packages/Thoth.Json/Encode.d.ts +0 -0
  83. /package/{Thoth.Json → libs/Thoth.Json}/packages/Thoth.Json/Extra.d.ts +0 -0
  84. /package/{Thoth.Json → libs/Thoth.Json}/packages/Thoth.Json/Types.d.ts +0 -0
  85. /package/src/{Thoth.Json → libs/Thoth.Json}/packages/Thoth.Json/Decode.ts +0 -0
  86. /package/src/{Thoth.Json → libs/Thoth.Json}/packages/Thoth.Json/Encode.ts +0 -0
  87. /package/src/{Thoth.Json → libs/Thoth.Json}/packages/Thoth.Json/Extra.ts +0 -0
  88. /package/src/{Thoth.Json → libs/Thoth.Json}/packages/Thoth.Json/Types.ts +0 -0
@@ -1,24 +1,174 @@
1
- import { Auto_generateBoxedDecoder_Z6670B51, fromString } from "../../../../Thoth.Json/packages/Thoth.Json/Decode.js";
2
- import { comparePrimitives, uncurry2 } from "@fable-org/fable-library-js/Util.js";
1
+ import { FSharpRef, Record } from "@fable-org/fable-library-js/Types.js";
2
+ import { orElse, defaultArg, map, value as value_3, bind, unwrap, Option } from "@fable-org/fable-library-js/Option.js";
3
+ import { int32, float64 } from "@fable-org/fable-library-js/Int32.js";
4
+ import { comparePrimitives, stringHash, uncurry2, IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
5
+ import { record_type, option_type, float64_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
6
+ import { fold, contains, exists, tail, choose, map as map_1, singleton, empty, tryFind, head, isEmpty, FSharpList, collect, filter } from "@fable-org/fable-library-js/List.js";
7
+ import { Shared_MatrixItemKey, Shared_MatrixAnswer, Spec_MultiChoiceInfo, Spec_SingleChoiceInfo, Shared_FieldOption, Shared_FieldOptionKey, Shared_FieldKey, Spec_FormSpec$1, Shared_FieldValue, Shared_FieldAnswer, Shared_PluginDataProperty, Shared_FieldValue_$union, Spec_FormStep$1, Spec_FormField$1, Spec_PluginFieldConfig, Spec_FieldType_$union } from "../../../FormSpec.js";
8
+ import { split, isNullOrWhiteSpace } from "@fable-org/fable-library-js/String.js";
9
+ import { tryParse } from "@fable-org/fable-library-js/Double.js";
10
+ import { item } from "@fable-org/fable-library-js/Array.js";
11
+ import { Auto_generateBoxedDecoder_Z6670B51, fromString } from "../../../../libs/Thoth.Json/packages/Thoth.Json/Decode.js";
3
12
  import { CoreMRStepMap, CoreMRMatrixItemAnchor, CoreMRChoiceAnchor, CoreMRFieldAnchor, CoreMRSourceMap, CoreMRSourceMap_$reflection } from "./CoreMRSourceMap.js";
4
13
  import { FSharpResult$2_Ok, FSharpResult$2_Error, FSharpResult$2_$union } from "@fable-org/fable-library-js/Result.js";
5
- import { Auto_generateBoxedEncoder_437914C6, toString } from "../../../../Thoth.Json/packages/Thoth.Json/Encode.js";
14
+ import { Auto_generateBoxedEncoder_437914C6, toString } from "../../../../libs/Thoth.Json/packages/Thoth.Json/Encode.js";
6
15
  import { CoreMRAnswer, CoreMRFormInsertRequest, CoreMRFormInsertRequest_$reflection } from "./FormSpecToCoreMRInsert.js";
7
- import { CaseStrategy_CamelCase } from "../../../../Thoth.Json/packages/Thoth.Json/Types.js";
8
- import { isNullOrWhiteSpace } from "@fable-org/fable-library-js/String.js";
9
- 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 } from "../../../FormSpec.js";
16
+ import { CaseStrategy_CamelCase } from "../../../../libs/Thoth.Json/packages/Thoth.Json/Types.js";
10
17
  import { Helpers_canonicalizeFieldKey } from "../../../Helpers.js";
11
- import { orElse, defaultArg, value as value_2, Option, map, bind } from "@fable-org/fable-library-js/Option.js";
12
- import { int64, fromInt32, toInt64 } from "@fable-org/fable-library-js/BigInt.js";
13
- import { int32 } from "@fable-org/fable-library-js/Int32.js";
14
- import { collect, exists, head, tail, choose, isEmpty, map as map_1, singleton, empty, FSharpList, tryFind } from "@fable-org/fable-library-js/List.js";
18
+ import { op_LeftShift, op_BitwiseOr, int64, fromInt32, toInt64 } from "@fable-org/fable-library-js/BigInt.js";
15
19
  import { toList, FSharpSet } from "@fable-org/fable-library-js/Set.js";
16
20
  import { computeBitmask } from "../../../BitmaskHelpers.js";
17
21
  import { FSharpMap, ofList, tryFind as tryFind_1 } from "@fable-org/fable-library-js/Map.js";
22
+ import { Operators_FailurePattern } from "@fable-org/fable-library-js/FSharp.Core.js";
23
+
24
+ export class ExtractedVitals extends Record implements IEquatable<ExtractedVitals>, IComparable<ExtractedVitals> {
25
+ readonly Temperature: Option<float64>;
26
+ readonly SystolicBp: Option<float64>;
27
+ readonly DiastolicBp: Option<float64>;
28
+ readonly HeartRate: Option<float64>;
29
+ readonly RespiratoryRate: Option<float64>;
30
+ readonly Spo2: Option<float64>;
31
+ readonly PainScale: Option<float64>;
32
+ constructor(Temperature: Option<float64>, SystolicBp: Option<float64>, DiastolicBp: Option<float64>, HeartRate: Option<float64>, RespiratoryRate: Option<float64>, Spo2: Option<float64>, PainScale: Option<float64>) {
33
+ super();
34
+ this.Temperature = Temperature;
35
+ this.SystolicBp = SystolicBp;
36
+ this.DiastolicBp = DiastolicBp;
37
+ this.HeartRate = HeartRate;
38
+ this.RespiratoryRate = RespiratoryRate;
39
+ this.Spo2 = Spo2;
40
+ this.PainScale = PainScale;
41
+ }
42
+ }
43
+
44
+ export function ExtractedVitals_$reflection(): TypeInfo {
45
+ return record_type("FormSpec.Integrations.CorEMR.CoreMREncoder.ExtractedVitals", [], ExtractedVitals, () => [["Temperature", option_type(float64_type)], ["SystolicBp", option_type(float64_type)], ["DiastolicBp", option_type(float64_type)], ["HeartRate", option_type(float64_type)], ["RespiratoryRate", option_type(float64_type)], ["Spo2", option_type(float64_type)], ["PainScale", option_type(float64_type)]]);
46
+ }
18
47
 
19
48
  /**
20
49
  * 🚀 BIGINT LIBERATION: Native BigInt support via Fable 4.28.0+ & Liberation Fork
21
50
  * No Extra.* needed - using native Thoth.Json auto generation only
51
+ * 🩺 Convert extracted vitals to CoreMR bridge API format (camelCase)
52
+ */
53
+ export function vitalsTobridge(vitals: ExtractedVitals): { diastolicBp?: float64, heartRate?: float64, respiratoryRate?: float64, spo2?: float64, systolicBp?: float64, temperature?: float64 } {
54
+ return {
55
+ diastolicBp: unwrap(vitals.DiastolicBp),
56
+ heartRate: unwrap(vitals.HeartRate),
57
+ respiratoryRate: unwrap(vitals.RespiratoryRate),
58
+ spo2: unwrap(vitals.Spo2),
59
+ systolicBp: unwrap(vitals.SystolicBp),
60
+ temperature: unwrap(vitals.Temperature),
61
+ };
62
+ }
63
+
64
+ /**
65
+ * 🩺 Extract vitals data from FormSpec for separate bridge submission
66
+ * Finds Type 130 vitals fields and converts PluginData to bridge format
67
+ */
68
+ export function extractVitalsFromFormSpec(spec: Spec_FormSpec$1<Spec_FieldType_$union>): Option<ExtractedVitals> {
69
+ try {
70
+ const vitalsFields: FSharpList<Spec_FormField$1<Spec_FieldType_$union>> = filter<Spec_FormField$1<Spec_FieldType_$union>>((field: Spec_FormField$1<Spec_FieldType_$union>): boolean => {
71
+ const matchValue: Spec_FieldType_$union = field.FieldType;
72
+ let matchResult: int32, pf_1: Spec_PluginFieldConfig;
73
+ if (matchValue.tag === /* PluginField */ 23) {
74
+ if (matchValue.fields[0].PluginId === "Fable.Form.Simple.Bulma.Fields.VitalsField") {
75
+ matchResult = 0;
76
+ pf_1 = matchValue.fields[0];
77
+ }
78
+ else {
79
+ matchResult = 1;
80
+ }
81
+ }
82
+ else {
83
+ matchResult = 1;
84
+ }
85
+ switch (matchResult) {
86
+ case 0:
87
+ return true;
88
+ default:
89
+ return false;
90
+ }
91
+ }, 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, spec.Steps));
92
+ if (!isEmpty(vitalsFields)) {
93
+ const matchValue_1: Option<Shared_FieldValue_$union> = head(vitalsFields).Value;
94
+ let matchResult_1: int32, props: FSharpList<Shared_PluginDataProperty>, answer: Shared_FieldAnswer;
95
+ if (matchValue_1 != null) {
96
+ switch (value_3(matchValue_1).tag) {
97
+ case /* PluginData */ 3: {
98
+ matchResult_1 = 0;
99
+ props = (value_3(matchValue_1) as Shared_FieldValue<3>).fields[0];
100
+ break;
101
+ }
102
+ case /* Single */ 0: {
103
+ matchResult_1 = 1;
104
+ answer = (value_3(matchValue_1) as Shared_FieldValue<0>).fields[0];
105
+ break;
106
+ }
107
+ default:
108
+ matchResult_1 = 2;
109
+ }
110
+ }
111
+ else {
112
+ matchResult_1 = 2;
113
+ }
114
+ switch (matchResult_1) {
115
+ case 0: {
116
+ const getVitalValue = (propertyName: string): Option<float64> => bind<Shared_PluginDataProperty, float64>((p_1: Shared_PluginDataProperty): Option<float64> => {
117
+ if (isNullOrWhiteSpace(p_1.Value)) {
118
+ return undefined;
119
+ }
120
+ else {
121
+ let matchValue_2: [boolean, float64];
122
+ let outArg = 0;
123
+ matchValue_2 = ([tryParse(p_1.Value, new FSharpRef<float64>((): float64 => outArg, (v: float64): void => {
124
+ outArg = v;
125
+ })), outArg] as [boolean, float64]);
126
+ if (matchValue_2[0]) {
127
+ return matchValue_2[1];
128
+ }
129
+ else {
130
+ return undefined;
131
+ }
132
+ }
133
+ }, tryFind<Shared_PluginDataProperty>((p: Shared_PluginDataProperty): boolean => (p.Name === propertyName), props!));
134
+ return new ExtractedVitals(getVitalValue("temperature"), getVitalValue("systolic_bp"), getVitalValue("diastolic_bp"), getVitalValue("pulse"), getVitalValue("respiration"), getVitalValue("oxygen_saturation"), getVitalValue("pain_scale"));
135
+ }
136
+ case 1: {
137
+ const parts: string[] = split(answer!.Value, ["|"], undefined, 0);
138
+ const parseAt = (index: int32): Option<float64> => {
139
+ if ((index < parts.length) && !isNullOrWhiteSpace(item(index, parts))) {
140
+ let matchValue_3: [boolean, float64];
141
+ let outArg_1 = 0;
142
+ matchValue_3 = ([tryParse(item(index, parts), new FSharpRef<float64>((): float64 => outArg_1, (v_2: float64): void => {
143
+ outArg_1 = v_2;
144
+ })), outArg_1] as [boolean, float64]);
145
+ if (matchValue_3[0]) {
146
+ return matchValue_3[1];
147
+ }
148
+ else {
149
+ return undefined;
150
+ }
151
+ }
152
+ else {
153
+ return undefined;
154
+ }
155
+ };
156
+ return new ExtractedVitals(parseAt(0), parseAt(1), parseAt(2), parseAt(3), parseAt(4), parseAt(5), parseAt(6));
157
+ }
158
+ default:
159
+ return undefined;
160
+ }
161
+ }
162
+ else {
163
+ return undefined;
164
+ }
165
+ }
166
+ catch (ex: any) {
167
+ return undefined;
168
+ }
169
+ }
170
+
171
+ /**
22
172
  * Decode provenance payload using Thoth Auto — same type that was encoded by
23
173
  * CoreMRSourceMap.convertWithMapAndProvenance (Encode.Auto.toString).
24
174
  * Native Thoth.Json auto generation with full int64 support.
@@ -124,8 +274,7 @@ function getOptionsFromFieldType(ft: Spec_FieldType_$union): FSharpList<Shared_F
124
274
  }
125
275
  }
126
276
 
127
- function fieldToAnswers(field: Spec_FormField$1<Spec_FieldType_$union>, anchor: CoreMRFieldAnchor): FSharpList<CoreMRAnswer> {
128
- let canonicalAnswer: string;
277
+ function fieldToAnswers(field: Spec_FormField$1<Spec_FieldType_$union>, vitalsIdOpt: Option<int64>, anchor: CoreMRFieldAnchor): FSharpList<CoreMRAnswer> {
129
278
  if (anchor.Encoding.IsSkip) {
130
279
  return empty<CoreMRAnswer>();
131
280
  }
@@ -135,38 +284,43 @@ function fieldToAnswers(field: Spec_FormField$1<Spec_FieldType_$union>, anchor:
135
284
  else {
136
285
  const matchValue: Option<Shared_FieldValue_$union> = field.Value;
137
286
  if (matchValue != null) {
138
- switch (value_2(matchValue).tag) {
287
+ switch (value_3(matchValue).tag) {
139
288
  case /* Multiple */ 1: {
140
- const answers: FSharpSet<Shared_FieldAnswer> = (value_2(matchValue) as Shared_FieldValue<1>).fields[0];
141
- if (anchor.Encoding.ValueEncoding !== "choice_score") {
142
- return empty<CoreMRAnswer>();
143
- }
144
- else {
145
- const options_1: FSharpList<Shared_FieldOption> = getOptionsFromFieldType(field.FieldType);
146
- const choicesWithBitPos: FSharpList<[string, int32]> = map_1<CoreMRChoiceAnchor, [string, int32]>((c_2: CoreMRChoiceAnchor): [string, int32] => {
147
- const bit: int32 = defaultArg(c_2.BitPosition, c_2.Sequence - 1) | 0;
148
- return [getFieldOptionKeyGuid(c_2.FieldOptionKey), bit] as [string, int32];
149
- }, anchor.Choices);
150
- if (isEmpty(choicesWithBitPos)) {
151
- return empty<CoreMRAnswer>();
152
- }
153
- else {
154
- return 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 => (Helpers_canonicalizeFieldKey(opt_1.Value) === Helpers_canonicalizeFieldKey(valStr_1)), options_1)), map_1<Shared_FieldAnswer, string>((a: Shared_FieldAnswer): string => a.Value, toList<Shared_FieldAnswer>(answers))))), undefined));
289
+ const answers: FSharpSet<Shared_FieldAnswer> = (value_3(matchValue) as Shared_FieldValue<1>).fields[0];
290
+ const matchValue_3: int32 = anchor.ItemTypeId | 0;
291
+ switch (matchValue_3) {
292
+ case 26:
293
+ case 40:
294
+ case 41:
295
+ case 143: {
296
+ const options_1: FSharpList<Shared_FieldOption> = getOptionsFromFieldType(field.FieldType);
297
+ const choicesWithBitPos_1: FSharpList<[string, int32]> = map_1<CoreMRChoiceAnchor, [string, int32]>((c_3: CoreMRChoiceAnchor): [string, int32] => {
298
+ const bit_2: int32 = defaultArg(c_3.BitPosition, c_3.Sequence - 1) | 0;
299
+ return [getFieldOptionKeyGuid(c_3.FieldOptionKey), bit_2] as [string, int32];
300
+ }, anchor.Choices);
301
+ if (isEmpty(choicesWithBitPos_1)) {
302
+ throw new Error(`🚨 ItemTypeId ${anchor.ItemTypeId} multiple choice field ${anchor.FieldKey} has no choices`);
303
+ }
304
+ else {
305
+ return 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_1: [string, int32]): boolean => (tupledArg_1[0] === key), choicesWithBitPos_1)), choose<string, string>((valStr_1: string): Option<string> => map<Shared_FieldOption, string>((opt_4: Shared_FieldOption): string => getFieldOptionKeyGuid(opt_4.OptionKey), tryFind<Shared_FieldOption>((opt_3: Shared_FieldOption): boolean => (Helpers_canonicalizeFieldKey(opt_3.Value) === Helpers_canonicalizeFieldKey(valStr_1)), options_1)), map_1<Shared_FieldAnswer, string>((a: Shared_FieldAnswer): string => a.Value, toList<Shared_FieldAnswer>(answers))))), undefined));
306
+ }
155
307
  }
308
+ default:
309
+ throw new Error(`🚨 Multiple answers not supported for CoreMR ItemTypeId ${anchor.ItemTypeId} field ${anchor.FieldKey} - only bitmask types (26,40,41,143) support multiple selection!`);
156
310
  }
157
311
  }
158
312
  case /* Matrix */ 2: {
159
- const matrixAnswer: Shared_MatrixAnswer = (value_2(matchValue) as Shared_FieldValue<2>).fields[0];
313
+ const matrixAnswer: Shared_MatrixAnswer = (value_3(matchValue) as Shared_FieldValue<2>).fields[0];
160
314
  if (isEmpty(anchor.MatrixItemAnchors)) {
161
315
  return empty<CoreMRAnswer>();
162
316
  }
163
317
  else {
164
318
  const options_2: FSharpList<Shared_FieldOption> = getOptionsFromFieldType(field.FieldType);
165
- return 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);
319
+ return choose<CoreMRMatrixItemAnchor, CoreMRAnswer>((rowAnchor: CoreMRMatrixItemAnchor): Option<CoreMRAnswer> => map<string, CoreMRAnswer>((selectedValue_1: string): CoreMRAnswer => (new CoreMRAnswer(rowAnchor.Sequence, defaultArg(getScoreFromOption(options_2, selectedValue_1), 0n), undefined)), tryFind_1<Shared_MatrixItemKey, string>(rowAnchor.MatrixItemKey, matrixAnswer.Values)), anchor.MatrixItemAnchors);
166
320
  }
167
321
  }
168
322
  case /* PluginData */ 3: {
169
- const props: FSharpList<Shared_PluginDataProperty> = (value_2(matchValue) as Shared_FieldValue<3>).fields[0];
323
+ const props: FSharpList<Shared_PluginDataProperty> = (value_3(matchValue) as Shared_FieldValue<3>).fields[0];
170
324
  let matchResult: int32, p_1: Shared_PluginDataProperty;
171
325
  if (!isEmpty(props)) {
172
326
  if (isEmpty(tail(props))) {
@@ -193,56 +347,134 @@ function fieldToAnswers(field: Spec_FormField$1<Spec_FieldType_$union>, anchor:
193
347
  }
194
348
  }
195
349
  default: {
196
- const answer: Shared_FieldAnswer = (value_2(matchValue) as Shared_FieldValue<0>).fields[0];
350
+ const answer: Shared_FieldAnswer = (value_3(matchValue) as Shared_FieldValue<0>).fields[0];
197
351
  const options: FSharpList<Shared_FieldOption> = getOptionsFromFieldType(field.FieldType);
198
- const matchValue_2: string = anchor.Encoding.ValueEncoding;
352
+ const matchValue_2: int32 = anchor.ItemTypeId | 0;
199
353
  switch (matchValue_2) {
200
- case "choice_score": {
201
- const matchValue_3: Option<int64> = orElse(getScoreFromOption(options, answer.Value), (canonicalAnswer = Helpers_canonicalizeFieldKey(answer.Value), map<CoreMRChoiceAnchor, int64>((c_1: CoreMRChoiceAnchor): int64 => c_1.Score, tryFind<CoreMRChoiceAnchor>((c: CoreMRChoiceAnchor): boolean => exists<Shared_FieldOption>((opt: Shared_FieldOption): boolean => {
354
+ case 1:
355
+ case 2:
356
+ return singleton(new CoreMRAnswer(anchor.Sequence, 0n, supportsTextContent(anchor) ? answer.Value : undefined));
357
+ case 20:
358
+ case 21:
359
+ case 25:
360
+ case 32: {
361
+ const canonicalAnswer: string = Helpers_canonicalizeFieldKey(answer.Value);
362
+ const scoreOpt: Option<int64> = map<CoreMRChoiceAnchor, int64>((c_1: CoreMRChoiceAnchor): int64 => c_1.Score, tryFind<CoreMRChoiceAnchor>((c: CoreMRChoiceAnchor): boolean => exists<Shared_FieldOption>((opt: Shared_FieldOption): boolean => {
202
363
  if (getFieldOptionKeyGuid(opt.OptionKey) === getFieldOptionKeyGuid(c.FieldOptionKey)) {
203
364
  return Helpers_canonicalizeFieldKey(opt.Value) === canonicalAnswer;
204
365
  }
205
366
  else {
206
367
  return false;
207
368
  }
208
- }, options), anchor.Choices))));
209
- if (matchValue_3 == null) {
210
- return singleton(new CoreMRAnswer(anchor.Sequence, 0n, undefined));
369
+ }, options), anchor.Choices));
370
+ if (scoreOpt == null) {
371
+ throw new Error(`🚨 No matching choice found for ItemTypeId ${anchor.ItemTypeId} field ${anchor.FieldKey} answer '${answer.Value}'`);
211
372
  }
212
373
  else {
213
- return singleton(new CoreMRAnswer(anchor.Sequence, value_2(matchValue_3), undefined));
374
+ return singleton(new CoreMRAnswer(anchor.Sequence, value_3(scoreOpt), undefined));
214
375
  }
215
376
  }
216
- case "1_yes_2_no": {
377
+ case 26:
378
+ case 40:
379
+ case 41:
380
+ case 143: {
381
+ const choicesWithBitPos: FSharpList<[string, int32]> = map_1<CoreMRChoiceAnchor, [string, int32]>((c_2: CoreMRChoiceAnchor): [string, int32] => {
382
+ const bit: int32 = defaultArg(c_2.BitPosition, c_2.Sequence - 1) | 0;
383
+ return [getFieldOptionKeyGuid(c_2.FieldOptionKey), bit] as [string, int32];
384
+ }, anchor.Choices);
385
+ if (isEmpty(choicesWithBitPos)) {
386
+ throw new Error(`🚨 ItemTypeId ${anchor.ItemTypeId} bitmask field ${anchor.FieldKey} has no choices`);
387
+ }
388
+ else {
389
+ const selectedKeys: FSharpList<string> = choose<string, string>((selectedValue: string): Option<string> => {
390
+ const canonicalSelected: string = Helpers_canonicalizeFieldKey(selectedValue);
391
+ return map<Shared_FieldOption, string>((opt_2: Shared_FieldOption): string => getFieldOptionKeyGuid(opt_2.OptionKey), tryFind<Shared_FieldOption>((opt_1: Shared_FieldOption): boolean => (Helpers_canonicalizeFieldKey(opt_1.Value) === canonicalSelected), options));
392
+ }, singleton(answer.Value));
393
+ const bitPositions: FSharpList<int32> = choose<[string, int32], int32>((tupledArg: [string, int32]): Option<int32> => {
394
+ if (contains<string>(tupledArg[0], selectedKeys, {
395
+ Equals: (x: string, y: string): boolean => (x === y),
396
+ GetHashCode: stringHash,
397
+ })) {
398
+ return tupledArg[1];
399
+ }
400
+ else {
401
+ return undefined;
402
+ }
403
+ }, choicesWithBitPos);
404
+ if (isEmpty(bitPositions)) {
405
+ throw new Error(`🚨 No matching bitmask choice found for ItemTypeId ${anchor.ItemTypeId} field ${anchor.FieldKey} answer '${answer.Value}'`);
406
+ }
407
+ return singleton(new CoreMRAnswer(anchor.Sequence, fold<int32, int64>((acc: int64, bit_1: int32): int64 => toInt64(op_BitwiseOr(acc, toInt64(op_LeftShift(1n, bit_1)))), 0n, bitPositions), undefined));
408
+ }
409
+ }
410
+ case 30:
411
+ case 31: {
217
412
  const valStr: string = canonicalizeForYesNo(answer.Value);
218
- return singleton(new CoreMRAnswer(anchor.Sequence, (((valStr === "yes") ? true : (valStr === "true")) ? true : (valStr === "1")) ? (1n) : (2n), undefined));
413
+ return singleton(new CoreMRAnswer(anchor.Sequence, (((valStr === "yes") ? true : (valStr === "true")) ? true : (valStr === "1")) ? (1n) : (2n), supportsTextContent(anchor) ? answer.Value : undefined));
219
414
  }
220
- case "zero":
221
- case "scaffold":
222
- case "unknown":
415
+ case 50:
416
+ case 51:
417
+ case 60:
223
418
  return singleton(new CoreMRAnswer(anchor.Sequence, 0n, supportsTextContent(anchor) ? answer.Value : undefined));
419
+ case 61:
420
+ return empty<CoreMRAnswer>();
421
+ case 110:
422
+ case 120:
423
+ case 121:
424
+ case 130:
425
+ case 131:
426
+ case 132:
427
+ case 133:
428
+ case 134:
429
+ case 135:
430
+ case 138:
431
+ case 140:
432
+ return empty<CoreMRAnswer>();
224
433
  default:
225
- return singleton(new CoreMRAnswer(anchor.Sequence, 0n, supportsTextContent(anchor) ? answer.Value : undefined));
434
+ throw new Error(`🚨 UNKNOWN CoreMR ItemTypeId ${anchor.ItemTypeId} for field ${anchor.FieldKey} - cannot encode Single answer. Add support for this type in CoreMREncoder.fs!`);
226
435
  }
227
436
  }
228
437
  }
229
438
  }
230
439
  else {
231
- const matchValue_1: string = anchor.Encoding.ValueEncoding;
440
+ const matchValue_1: int32 = anchor.ItemTypeId | 0;
232
441
  switch (matchValue_1) {
233
- case "1_yes_2_no":
442
+ case 1:
443
+ case 2:
444
+ return empty<CoreMRAnswer>();
445
+ case 20:
446
+ case 21:
447
+ case 25:
448
+ case 32:
449
+ return empty<CoreMRAnswer>();
450
+ case 26:
451
+ case 40:
452
+ case 41:
453
+ case 143:
454
+ return empty<CoreMRAnswer>();
455
+ case 30:
456
+ case 31:
234
457
  return singleton(new CoreMRAnswer(anchor.Sequence, 2n, undefined));
235
- case "choice_score":
236
- if (isEmpty(anchor.Choices)) {
237
- return empty<CoreMRAnswer>();
238
- }
239
- else {
240
- return singleton(new CoreMRAnswer(anchor.Sequence, 0n, undefined));
241
- }
242
- case "zero":
243
- return singleton(new CoreMRAnswer(anchor.Sequence, 0n, undefined));
244
- default:
458
+ case 50:
459
+ case 51:
460
+ case 60:
245
461
  return empty<CoreMRAnswer>();
462
+ case 61:
463
+ return empty<CoreMRAnswer>();
464
+ case 110:
465
+ case 120:
466
+ case 121:
467
+ case 130:
468
+ case 131:
469
+ case 132:
470
+ case 133:
471
+ case 134:
472
+ case 135:
473
+ case 138:
474
+ case 140:
475
+ return empty<CoreMRAnswer>();
476
+ default:
477
+ throw new Error(`🚨 UNKNOWN CoreMR ItemTypeId ${anchor.ItemTypeId} for field ${anchor.FieldKey} - cannot encode without user selection. Add support for this type in CoreMREncoder.fs!`);
246
478
  }
247
479
  }
248
480
  }
@@ -254,16 +486,16 @@ function buildFieldByKeyMap(spec: Spec_FormSpec$1<Spec_FieldType_$union>): FShar
254
486
  });
255
487
  }
256
488
 
257
- function anchorToAnswers(fieldMap: FSharpMap<string, Spec_FormField$1<Spec_FieldType_$union>>, anchor: CoreMRFieldAnchor): FSharpList<CoreMRAnswer> {
489
+ function anchorToAnswers(fieldMap: FSharpMap<string, Spec_FormField$1<Spec_FieldType_$union>>, vitalsIdOpt: Option<int64>, anchor: CoreMRFieldAnchor): FSharpList<CoreMRAnswer> {
258
490
  const field: Option<Spec_FormField$1<Spec_FieldType_$union>> = tryFind_1<string, Spec_FormField$1<Spec_FieldType_$union>>(getFieldKeyGuid(anchor.FieldKey), fieldMap);
259
491
  if (anchor.Encoding.IsSkip) {
260
492
  return empty<CoreMRAnswer>();
261
493
  }
262
494
  else if (anchor.Encoding.IsScaffold) {
263
- return singleton(new CoreMRAnswer(anchor.Sequence, 2n, undefined));
495
+ return empty<CoreMRAnswer>();
264
496
  }
265
497
  else if (field != null) {
266
- return fieldToAnswers(value_2(field), anchor);
498
+ return fieldToAnswers(value_3(field), vitalsIdOpt, anchor);
267
499
  }
268
500
  else {
269
501
  const matchValue: string = anchor.Encoding.ValueEncoding;
@@ -285,13 +517,55 @@ function anchorToAnswers(fieldMap: FSharpMap<string, Spec_FormField$1<Spec_Field
285
517
  }
286
518
  }
287
519
 
520
+ /**
521
+ * 🩺 Encode filled FormSpec to CoreMR form-insert payload WITH VITALS COORDINATION.
522
+ * Uses provided flow_vitals.id for Type 130 vitals fields.
523
+ * This is the NEW smart coordination function that handles vitals references.
524
+ */
525
+ export function encodeToFormAnswersWithVitals(provenancePayload: string, filledFormSpec: Spec_FormSpec$1<Spec_FieldType_$union>, vitalsIdOpt: Option<int64>, scaffoldMode: boolean, dryRun: boolean): FSharpResult$2_$union<CoreMRFormInsertRequest, string> {
526
+ let msg: string, acc: FSharpList<CoreMRAnswer>;
527
+ const matchValue: FSharpResult$2_$union<CoreMRSourceMap, string> = tryDecodeSourceMap(provenancePayload);
528
+ if (matchValue.tag === /* Ok */ 0) {
529
+ const sourceMap: CoreMRSourceMap = matchValue.fields[0];
530
+ const formName: string = defaultArg(sourceMap.FormName, `CORE-${sourceMap.FormId}`);
531
+ const fieldMap: FSharpMap<string, Spec_FormField$1<Spec_FieldType_$union>> = buildFieldByKeyMap(filledFormSpec);
532
+ try {
533
+ return FSharpResult$2_Ok<CoreMRFormInsertRequest, string>(new CoreMRFormInsertRequest(sourceMap.FormId, formName, scaffoldMode ? undefined : ((acc = collect<CoreMRFieldAnchor, CoreMRAnswer>((anchor: CoreMRFieldAnchor): FSharpList<CoreMRAnswer> => anchorToAnswers(fieldMap, vitalsIdOpt, anchor), collect<CoreMRStepMap, CoreMRFieldAnchor>((step: CoreMRStepMap): FSharpList<CoreMRFieldAnchor> => step.FieldAnchors, sourceMap.Steps)), isEmpty(acc) ? undefined : acc)), dryRun));
534
+ }
535
+ catch (matchValue_1: any) {
536
+ const activePatternResult: Option<string> = Operators_FailurePattern(matchValue_1);
537
+ return (activePatternResult != null) ? ((msg = value_3(activePatternResult), FSharpResult$2_Error<CoreMRFormInsertRequest, string>(`CoreMR encoding failed: ${msg}`))) : FSharpResult$2_Error<CoreMRFormInsertRequest, string>(`Unexpected error during CoreMR encoding: ${matchValue_1.message}`);
538
+ }
539
+ }
540
+ else {
541
+ return FSharpResult$2_Error<CoreMRFormInsertRequest, string>(`Invalid provenance payload: ${matchValue.fields[0]}`);
542
+ }
543
+ }
544
+
545
+ /**
546
+ * 🚀 SMART COORDINATION: Extract vitals and form data for two-phase bridge submission
547
+ * Returns (vitalsOpt, formRequest) where vitalsOpt should be sent to /vitals endpoint first
548
+ * and formRequest should be sent to /forms endpoint with vitalsId reference
549
+ */
550
+ export function extractVitalsAndFormData(provenancePayload: string, filledFormSpec: Spec_FormSpec$1<Spec_FieldType_$union>, scaffoldMode: boolean, dryRun: boolean): FSharpResult$2_$union<[Option<ExtractedVitals>, CoreMRFormInsertRequest], string> {
551
+ const vitalsOpt: Option<ExtractedVitals> = extractVitalsFromFormSpec(filledFormSpec);
552
+ const matchValue: FSharpResult$2_$union<CoreMRFormInsertRequest, string> = encodeToFormAnswersWithVitals(provenancePayload, filledFormSpec, undefined, scaffoldMode, dryRun);
553
+ if (matchValue.tag === /* Ok */ 0) {
554
+ return FSharpResult$2_Ok<[Option<ExtractedVitals>, CoreMRFormInsertRequest], string>([vitalsOpt, matchValue.fields[0]] as [Option<ExtractedVitals>, CoreMRFormInsertRequest]);
555
+ }
556
+ else {
557
+ return FSharpResult$2_Error<[Option<ExtractedVitals>, CoreMRFormInsertRequest], string>(matchValue.fields[0]);
558
+ }
559
+ }
560
+
288
561
  /**
289
562
  * Encode filled FormSpec to CoreMR form-insert payload.
290
563
  * scaffoldMode: when true, omit answers (scaffold mode — all items get value=2).
291
564
  * Iterates over provenance anchors (source of truth) so we never omit required items.
565
+ * LEGACY: Use extractVitalsAndFormData for new smart coordination.
292
566
  */
293
567
  export function encodeToFormAnswers(provenancePayload: string, filledFormSpec: Spec_FormSpec$1<Spec_FieldType_$union>, scaffoldMode: boolean, dryRun: boolean): FSharpResult$2_$union<CoreMRFormInsertRequest, string> {
294
- let acc: FSharpList<CoreMRAnswer>;
568
+ let msg: string, acc: FSharpList<CoreMRAnswer>;
295
569
  const matchValue: FSharpResult$2_$union<CoreMRSourceMap, string> = tryDecodeSourceMap(provenancePayload);
296
570
  if (matchValue.tag === /* Ok */ 0) {
297
571
  const sourceMap: CoreMRSourceMap = matchValue.fields[0];
@@ -303,7 +577,13 @@ export function encodeToFormAnswers(provenancePayload: string, filledFormSpec: S
303
577
  const value = `CORE-${sourceMap.FormId}`;
304
578
  formName = defaultArg(orElse(sourceMap.FormName, isNullOrWhiteSpace(filledFormSpec.Title) ? undefined : filledFormSpec.Title), value);
305
579
  const fieldMap: FSharpMap<string, Spec_FormField$1<Spec_FieldType_$union>> = buildFieldByKeyMap(filledFormSpec);
306
- return FSharpResult$2_Ok<CoreMRFormInsertRequest, string>(new CoreMRFormInsertRequest(sourceMap.FormId, formName, scaffoldMode ? undefined : ((acc = collect<CoreMRFieldAnchor, CoreMRAnswer>((anchor: CoreMRFieldAnchor): FSharpList<CoreMRAnswer> => anchorToAnswers(fieldMap, anchor), collect<CoreMRStepMap, CoreMRFieldAnchor>((step: CoreMRStepMap): FSharpList<CoreMRFieldAnchor> => step.FieldAnchors, sourceMap.Steps)), isEmpty(acc) ? undefined : acc)), dryRun));
580
+ try {
581
+ return FSharpResult$2_Ok<CoreMRFormInsertRequest, string>(new CoreMRFormInsertRequest(sourceMap.FormId, formName, scaffoldMode ? undefined : ((acc = collect<CoreMRFieldAnchor, CoreMRAnswer>((anchor: CoreMRFieldAnchor): FSharpList<CoreMRAnswer> => anchorToAnswers(fieldMap, undefined, anchor), collect<CoreMRStepMap, CoreMRFieldAnchor>((step: CoreMRStepMap): FSharpList<CoreMRFieldAnchor> => step.FieldAnchors, sourceMap.Steps)), isEmpty(acc) ? undefined : acc)), dryRun));
582
+ }
583
+ catch (matchValue_1: any) {
584
+ const activePatternResult: Option<string> = Operators_FailurePattern(matchValue_1);
585
+ return (activePatternResult != null) ? ((msg = value_3(activePatternResult), FSharpResult$2_Error<CoreMRFormInsertRequest, string>(`CoreMR encoding failed: ${msg}`))) : FSharpResult$2_Error<CoreMRFormInsertRequest, string>(`Unexpected error during CoreMR encoding: ${matchValue_1.message}`);
586
+ }
307
587
  }
308
588
  }
309
589
  else {
@@ -12,7 +12,7 @@ import { CoreMRFormData, CoreMRItem, CoreMRChoice, CoreMRTag_$reflection, CoreMR
12
12
  import { List_groupBy } from "@fable-org/fable-library-js/Seq2.js";
13
13
  import { detectHeadings, groupItemsByHeadings, Section, HeadingItem } from "./CorEMRSectioning.js";
14
14
  import { convertToFormSpec } from "./CorEMRTemplateToFormSpec.js";
15
- import { Auto_generateBoxedEncoder_437914C6, toString } from "../../../../Thoth.Json/packages/Thoth.Json/Encode.js";
15
+ import { Auto_generateBoxedEncoder_437914C6, toString } from "../../../../libs/Thoth.Json/packages/Thoth.Json/Encode.js";
16
16
  import { IntegrationProvenance } from "../../../Provenance.js";
17
17
 
18
18
  export class ValueEncodingInfo extends Record implements IEquatable<ValueEncodingInfo>, IComparable<ValueEncodingInfo> {
@@ -9,10 +9,10 @@ import { defaultArg, toArray, value as value_6, map, bind, Option } from "@fable
9
9
  import { map as map_1, choose, mapIndexed, collect, head, tail, isEmpty, ofArray, empty, tryFind, FSharpList } from "@fable-org/fable-library-js/List.js";
10
10
  import { Helpers_canonicalizeFieldKey } from "../../../Helpers.js";
11
11
  import { isNullOrWhiteSpace } from "@fable-org/fable-library-js/String.js";
12
- import { object, toString } from "../../../../Thoth.Json/packages/Thoth.Json/Encode.js";
13
- import { keyValuePairs, map as map_2, fromString, IOptionalGetter, list as list_4, IRequiredGetter, IGetters, int, object as object_1, string, fail, succeed, andThen, guid, index, field as field_1, oneOf } from "../../../../Thoth.Json/packages/Thoth.Json/Decode.js";
12
+ import { object, toString } from "../../../../libs/Thoth.Json/packages/Thoth.Json/Encode.js";
13
+ import { keyValuePairs, map as map_2, fromString, IOptionalGetter, list as list_4, IRequiredGetter, IGetters, int, object as object_1, string, fail, succeed, andThen, guid, index, field as field_1, oneOf } from "../../../../libs/Thoth.Json/packages/Thoth.Json/Decode.js";
14
14
  import { FSharpResult$2_$union } from "@fable-org/fable-library-js/Result.js";
15
- import { ErrorReason_$union } from "../../../../Thoth.Json/packages/Thoth.Json/Types.js";
15
+ import { ErrorReason_$union } from "../../../../libs/Thoth.Json/packages/Thoth.Json/Types.js";
16
16
  import { tryParse } from "@fable-org/fable-library-js/Guid.js";
17
17
  import { IntegrationProvenance } from "../../../Provenance.js";
18
18
 
@@ -6,11 +6,11 @@ import { int32ToString, uncurry2, comparePrimitives, IComparable, IEquatable } f
6
6
  import { class_type, list_type, bool_type, record_type, option_type, string_type, int64_type, int32_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
7
7
  import { filter, length, sumBy as sumBy_1, empty, collect, map as map_2, isEmpty, FSharpList } from "@fable-org/fable-library-js/List.js";
8
8
  import { toSeq, ofList, FSharpMap } from "@fable-org/fable-library-js/Map.js";
9
- import { Auto_generateBoxedDecoder_Z6670B51 } from "../../../Thoth.Json/packages/Thoth.Json/Decode.js";
9
+ import { Auto_generateBoxedDecoder_Z6670B51 } from "../../../libs/Thoth.Json/packages/Thoth.Json/Decode.js";
10
10
  import { FSharpResult$2_$union } from "@fable-org/fable-library-js/Result.js";
11
- import { ErrorReason_$union } from "../../../Thoth.Json/packages/Thoth.Json/Types.js";
11
+ import { ErrorReason_$union } from "../../../libs/Thoth.Json/packages/Thoth.Json/Types.js";
12
12
  import { isNullOrEmpty, toConsole, printf, toText } from "@fable-org/fable-library-js/String.js";
13
- import { fromString, list as list_5, bool, IOptionalGetter, IGetters, string, int, IRequiredGetter, object, map, keyValuePairs } from "../../../Thoth.Json/packages/Thoth.Json/Decode.js";
13
+ import { fromString, list as list_5, bool, IOptionalGetter, IGetters, string, int, IRequiredGetter, object, map, keyValuePairs } from "../../../libs/Thoth.Json/packages/Thoth.Json/Decode.js";
14
14
  import { CoreMRFormData, CoreMRTag, CoreMRTrigger, CoreMRFormMetadata, CoreMRItem, CoreMRChoice } from "./CoreMRTypes.js";
15
15
  import { sumBy } from "@fable-org/fable-library-js/Seq.js";
16
16
 
@@ -1,16 +1,16 @@
1
1
  import { map, unwrap, value as value_19, orElseWith, orElse, defaultArgWith as defaultArgWith_1, Option, defaultArg as defaultArg_1 } from "@fable-org/fable-library-js/Option.js";
2
2
  import { exists, sortBy, toArray as toArray_1, length as length_1, tryPick, filter, mapIndexed as mapIndexed_1, isEmpty, map as map_3, empty, ofArray as ofArray_1, ofSeq, fold, singleton, collect, tryFind, FSharpList } from "@fable-org/fable-library-js/List.js";
3
3
  import { isNullOrEmpty, toText, join, isNullOrWhiteSpace, printf, toConsole } from "@fable-org/fable-library-js/String.js";
4
- import { Auto_generateBoxedEncoder_437914C6, toString } from "../../Thoth.Json/packages/Thoth.Json/Encode.js";
4
+ import { Auto_generateBoxedEncoder_437914C6, toString } from "../../libs/Thoth.Json/packages/Thoth.Json/Encode.js";
5
5
  import { Spec_SingleChoiceInfo, Spec_ClinicalInstrumentInfo, Spec_FormClassification_$union, ClinicalPathway_StateType_$union, ClinicalPathway_TaskPriority_$union, ClinicalPathway_AlertSeverity_$union, ClinicalPathway_ReferralUrgency_$union, ClinicalPathway_ActionInfo_$union, ClinicalPathway_NavigateToFormAction, ClinicalPathway_ProblemAction, ClinicalPathway_AlertAction, ClinicalPathway_EducationAction, ClinicalPathway_ProcedureAction, ClinicalPathway_TestAction, ClinicalPathway_DocumentationAction, ClinicalPathway_FieldValueSource_$union, ClinicalPathway_SetFieldValueAction, ClinicalPathway_PrescriptionAction, ClinicalPathway_MedicationAction, ClinicalPathway_ReferralAction, Shared_FieldValue, Shared_FieldValue_$union, ClinicalPathway_ClinicalPathwaySpec, ClinicalPathway_PathRequirement, ClinicalPathway_ConstraintDefinition, ClinicalPathway_PathwayExecutionMode_SinglePathway, ClinicalPathway_SinglePathwayConfig, ClinicalPathway_SelectionStrategy_HighestPriority, ClinicalPathway_TransitionDefinition, ClinicalPathway_TransitionCondition_FieldCondition, Shared_ConditionValue_Single, ClinicalPathway_FieldEvaluator_Equals, Shared_TransitionKey, ClinicalPathway_StateType_Terminal, ClinicalPathway_TerminalInfo, ClinicalPathway_StateDefinition, ClinicalPathway_StateType_Action, ClinicalPathway_ActionInfo_Task, ClinicalPathway_TaskAction, ClinicalPathway_DueDate_Today, ClinicalPathway_TaskPriority_Medium, ClinicalPathway_TaskPriority_Low, ClinicalPathway_TaskPriority_High, Shared_StateKey, Spec_FieldType_PluginField, Spec_PluginFieldConfig, Spec_FieldType_Matrix, Spec_MatrixInfo, Spec_FormClassification_General, Spec_FormLifecycle_Blueprint, Spec_FieldType_Text, Spec_TextInfo, Spec_FieldType_CheckboxList, Spec_MultiChoiceInfo, Shared_FieldOptionKey, Spec_FieldType_Checkbox, Spec_BooleanInfo, Shared_FieldKey, Shared_FieldOption, Shared_FieldValue_Single, Shared_FieldValue_PluginData, Shared_PluginDataProperty, Shared_PluginPropertyKey, Shared_FieldValue_Matrix, Shared_MatrixAnswer, Shared_MatrixItemKey, Shared_FieldValue_Multiple, Shared_FieldAnswer, Spec_FormStep$1, Spec_FormField$1, Spec_FieldType_$union, Spec_FormSpec$1, Spec_FormSpec$1_$reflection, Spec_FieldType_$reflection } from "../FormSpec.js";
6
- import { Auto_generateBoxedDecoder_Z6670B51, fromString } from "../../Thoth.Json/packages/Thoth.Json/Decode.js";
6
+ import { Auto_generateBoxedDecoder_Z6670B51, fromString } from "../../libs/Thoth.Json/packages/Thoth.Json/Decode.js";
7
7
  import { comparePrimitives, int32ToString, int64ToString, defaultOf, equals, createObj, stringHash, compare, IDisposable, disposeSafe, IEnumerator, getEnumerator, IMap, isArrayLike, uncurry2 } from "@fable-org/fable-library-js/Util.js";
8
8
  import { FSharpResult$2_Ok, FSharpResult$2_Error, FSharpResult$2_$union } from "@fable-org/fable-library-js/Result.js";
9
9
  import { newGuid, parse, tryParse } from "@fable-org/fable-library-js/Guid.js";
10
10
  import { Union, FSharpRef } from "@fable-org/fable-library-js/Types.js";
11
11
  import { array_type, string_type, obj_type, union_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
12
- import { array as array_7, at, IOptionalGetter, IGetters, dict as dict_1, string, IRequiredGetter, object, fromString as fromString_1 } from "../../Thoth.Json/packages/Thoth.Json/Decode.js";
13
- import { ErrorReason_$union } from "../../Thoth.Json/packages/Thoth.Json/Types.js";
12
+ import { array as array_7, at, IOptionalGetter, IGetters, dict as dict_1, string, IRequiredGetter, object, fromString as fromString_1 } from "../../libs/Thoth.Json/packages/Thoth.Json/Decode.js";
13
+ import { ErrorReason_$union } from "../../libs/Thoth.Json/packages/Thoth.Json/Types.js";
14
14
  import { tryFind as tryFind_1, empty as empty_2, count, ofSeq as ofSeq_1, toList, FSharpMap } from "@fable-org/fable-library-js/Map.js";
15
15
  import { addToDict } from "@fable-org/fable-library-js/MapUtil.js";
16
16
  import { int32 } from "@fable-org/fable-library-js/Int32.js";
@@ -7,9 +7,9 @@ import { Spec_FormSpec$1_$reflection, Spec_FieldType_$reflection, Spec_FormClass
7
7
  import { tryParse } from "@fable-org/fable-library-js/Guid.js";
8
8
  import { ofArray, reverse, empty, FSharpList, cons, map, toArray } from "@fable-org/fable-library-js/List.js";
9
9
  import { sumBy, tryFind, collect, map as map_1, fold } from "@fable-org/fable-library-js/Array.js";
10
- import { Auto_generateBoxedEncoder_437914C6, toString } from "../../Thoth.Json/packages/Thoth.Json/Encode.js";
10
+ import { Auto_generateBoxedEncoder_437914C6, toString } from "../../libs/Thoth.Json/packages/Thoth.Json/Encode.js";
11
11
  import { FSharpResult$2_$union, Result_ToOption } from "@fable-org/fable-library-js/Result.js";
12
- import { Auto_generateBoxedDecoder_Z6670B51, fromString } from "../../Thoth.Json/packages/Thoth.Json/Decode.js";
12
+ import { Auto_generateBoxedDecoder_Z6670B51, fromString } from "../../libs/Thoth.Json/packages/Thoth.Json/Decode.js";
13
13
  import { printf, toConsole } from "@fable-org/fable-library-js/String.js";
14
14
 
15
15
  export class Types_FieldKeyTS extends Record implements IEquatable<Types_FieldKeyTS>, IComparable<Types_FieldKeyTS> {
@@ -13,9 +13,9 @@ import { ofArray, empty as empty_1, add as add_1, FSharpSet, toList as toList_1
13
13
  import { resultStepsMapToFormSpec, formSpecToResultStepsMap, formSpecToMetadata, FormSpecMetadata, FieldDetails$1 } from "../FormSpecValues.js";
14
14
  import { tryParse as tryParse_1, minValue, toString } from "@fable-org/fable-library-js/Date.js";
15
15
  import { buildFormSpecFromResultStepsMap } from "../FormSpecHelpers.js";
16
- import { Auto_generateBoxedEncoder_437914C6, toString as toString_1 } from "../../Thoth.Json/packages/Thoth.Json/Encode.js";
16
+ import { Auto_generateBoxedEncoder_437914C6, toString as toString_1 } from "../../libs/Thoth.Json/packages/Thoth.Json/Encode.js";
17
17
  import { FSharpResult$2_$union, Result_ToOption } from "@fable-org/fable-library-js/Result.js";
18
- import { Auto_generateBoxedDecoder_Z6670B51, fromString } from "../../Thoth.Json/packages/Thoth.Json/Decode.js";
18
+ import { Auto_generateBoxedDecoder_Z6670B51, fromString } from "../../libs/Thoth.Json/packages/Thoth.Json/Decode.js";
19
19
 
20
20
  export class ValuesTypes_FieldAnswerTS extends Record implements IEquatable<ValuesTypes_FieldAnswerTS>, IComparable<ValuesTypes_FieldAnswerTS> {
21
21
  readonly FieldKey: Types_FieldKeyTS;
@@ -1,7 +1,7 @@
1
1
  import { Union } from "@fable-org/fable-library-js/Types.js";
2
2
  import { string_type, union_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
3
3
  import { Spec_FieldType_$union, Spec_FieldType_$reflection, Spec_FormSpec$1_$reflection, Spec_FormSpec$1 } from "./FormSpec.js";
4
- import { Auto_generateBoxedDecoder_Z6670B51, fromString } from "../Thoth.Json/packages/Thoth.Json/Decode.js";
4
+ import { Auto_generateBoxedDecoder_Z6670B51, fromString } from "../libs/Thoth.Json/packages/Thoth.Json/Decode.js";
5
5
  import { uncurry2 } from "@fable-org/fable-library-js/Util.js";
6
6
  import { FSharpResult$2_$union } from "@fable-org/fable-library-js/Result.js";
7
7