@f1studio/form-spec 5.0.0-alpha.124 → 5.0.0-alpha.125

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 (44) hide show
  1. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.d.ts.map +1 -1
  2. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.d.ts +8 -51
  3. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.d.ts.map +1 -1
  4. package/FormSpec.FS/Integrations/CorEMR/TemplateDecodeTypes.d.ts +73 -0
  5. package/FormSpec.FS/Integrations/CorEMR/TemplateDecodeTypes.d.ts.map +1 -0
  6. package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.d.ts +162 -0
  7. package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.d.ts.map +1 -0
  8. package/FormSpec.FS/Interop/FormSpec.Api.Helpers.d.ts +21 -0
  9. package/FormSpec.FS/Interop/FormSpec.Api.Helpers.d.ts.map +1 -1
  10. package/FormSpec.TS/FormSpec.FS/BitmaskHelpers.js +1 -1
  11. package/FormSpec.TS/FormSpec.FS/BitmaskHelpers.js.map +1 -1
  12. package/FormSpec.TS/FormSpec.FS/BitmaskHelpers.ts.map +1 -1
  13. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.js +1 -1
  14. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.js.map +1 -1
  15. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.ts.map +1 -1
  16. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.js +16 -220
  17. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.js.map +1 -1
  18. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.ts.map +1 -1
  19. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js.map +1 -1
  20. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts.map +1 -1
  21. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/TemplateDecodeTypes.js +387 -0
  22. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/TemplateDecodeTypes.js.map +1 -0
  23. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/TemplateDecodeTypes.ts.map +1 -0
  24. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.js +771 -0
  25. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.js.map +1 -0
  26. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.ts.map +1 -0
  27. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js +87 -0
  28. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js.map +1 -1
  29. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts.map +1 -1
  30. package/FormSpec.TS/fable_modules/project_cracked.json +1 -1
  31. package/README.md +7 -7
  32. package/package.json +1 -1
  33. package/src/FormSpec.FS/BitmaskHelpers.ts +1 -1
  34. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.ts +2 -2
  35. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.ts +32 -127
  36. package/src/FormSpec.FS/Integrations/CorEMR/TemplateDecodeTypes.ts +246 -0
  37. package/src/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.ts +431 -0
  38. package/src/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts +104 -2
  39. package/FormSpec.FS/Integrations/CorEMR/CorEmrTemplates.d.ts +0 -95
  40. package/FormSpec.FS/Integrations/CorEMR/CorEmrTemplates.d.ts.map +0 -1
  41. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/CorEmrTemplates.js +0 -258
  42. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/CorEmrTemplates.js.map +0 -1
  43. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/CorEmrTemplates.ts.map +0 -1
  44. package/src/FormSpec.FS/Integrations/CorEMR/CorEmrTemplates.ts +0 -15
@@ -0,0 +1,431 @@
1
+ import { Record } from "@fable-org/fable-library-js/Types.js";
2
+ import { int32 } from "@fable-org/fable-library-js/Int32.js";
3
+ import { toInt32, int64 } from "@fable-org/fable-library-js/BigInt.js";
4
+ import { map as map_1, defaultArg, Option } from "@fable-org/fable-library-js/Option.js";
5
+ import { int32ToString, uncurry2, comparePrimitives, IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
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
+ import { empty as empty_1, collect, map as map_2, isEmpty, FSharpList } from "@fable-org/fable-library-js/List.js";
8
+ import { ofList, add, FSharpMap } from "@fable-org/fable-library-js/Map.js";
9
+ import { newGuid } from "@fable-org/fable-library-js/Guid.js";
10
+ import { int64 as int64_1 } from "../../../fable_modules/Thoth.Json.10.4.1/Encode.fs.js";
11
+ import { Auto_generateBoxedDecoder_Z6670B51, int64 as int64_2 } from "../../../fable_modules/Thoth.Json.10.4.1/Decode.fs.js";
12
+ import { FSharpResult$2_$union } from "@fable-org/fable-library-js/Result.js";
13
+ import { ExtraCoders, ErrorReason_$union } from "../../../fable_modules/Thoth.Json.10.4.1/Types.fs.js";
14
+ import { empty } from "../../../fable_modules/Thoth.Json.10.4.1/Extra.fs.js";
15
+ import { fromString, list as list_3, bool, IOptionalGetter, IRequiredGetter, IGetters, string, int, object, map, keyValuePairs } from "../../../fable_modules/Thoth.Json.10.4.1/Decode.fs.js";
16
+ import { CoreMRFormData, CoreMRTag, CoreMRTrigger, CoreMRFormMetadata, CoreMRItem, CoreMRChoice } from "./CoreMRTypes.js";
17
+ import { isNullOrEmpty } from "@fable-org/fable-library-js/String.js";
18
+
19
+ export class TemplateChoice extends Record implements IEquatable<TemplateChoice>, IComparable<TemplateChoice> {
20
+ readonly ChoiceId: int32;
21
+ readonly Sequence: int32;
22
+ readonly Score: int64;
23
+ readonly Text: string;
24
+ readonly BitPosition: Option<int32>;
25
+ readonly Code: Option<string>;
26
+ readonly Highlight: Option<int32>;
27
+ constructor(ChoiceId: int32, Sequence: int32, Score: int64, Text$: string, BitPosition: Option<int32>, Code: Option<string>, Highlight: Option<int32>) {
28
+ super();
29
+ this.ChoiceId = (ChoiceId | 0);
30
+ this.Sequence = (Sequence | 0);
31
+ this.Score = Score;
32
+ this.Text = Text$;
33
+ this.BitPosition = BitPosition;
34
+ this.Code = Code;
35
+ this.Highlight = Highlight;
36
+ }
37
+ }
38
+
39
+ export function TemplateChoice_$reflection(): TypeInfo {
40
+ return record_type("FormSpec.Integrations.CorEMR.TemplateManifestDecoder.TemplateChoice", [], TemplateChoice, () => [["ChoiceId", int32_type], ["Sequence", int32_type], ["Score", int64_type], ["Text", string_type], ["BitPosition", option_type(int32_type)], ["Code", option_type(string_type)], ["Highlight", option_type(int32_type)]]);
41
+ }
42
+
43
+ export class TemplateItem extends Record implements IEquatable<TemplateItem>, IComparable<TemplateItem> {
44
+ readonly ItemId: int32;
45
+ readonly Sequence: int32;
46
+ readonly Type: int32;
47
+ readonly NestingLevel: int32;
48
+ readonly IsRequired: boolean;
49
+ readonly Text: string;
50
+ readonly SequenceText: Option<string>;
51
+ readonly Code: Option<string>;
52
+ readonly Uuid: Option<string>;
53
+ readonly GenderRequired: Option<string>;
54
+ readonly Highlight: Option<int32>;
55
+ readonly Choices: FSharpList<TemplateChoice>;
56
+ constructor(ItemId: int32, Sequence: int32, Type: int32, NestingLevel: int32, IsRequired: boolean, Text$: string, SequenceText: Option<string>, Code: Option<string>, Uuid: Option<string>, GenderRequired: Option<string>, Highlight: Option<int32>, Choices: FSharpList<TemplateChoice>) {
57
+ super();
58
+ this.ItemId = (ItemId | 0);
59
+ this.Sequence = (Sequence | 0);
60
+ this.Type = (Type | 0);
61
+ this.NestingLevel = (NestingLevel | 0);
62
+ this.IsRequired = IsRequired;
63
+ this.Text = Text$;
64
+ this.SequenceText = SequenceText;
65
+ this.Code = Code;
66
+ this.Uuid = Uuid;
67
+ this.GenderRequired = GenderRequired;
68
+ this.Highlight = Highlight;
69
+ this.Choices = Choices;
70
+ }
71
+ }
72
+
73
+ export function TemplateItem_$reflection(): TypeInfo {
74
+ return record_type("FormSpec.Integrations.CorEMR.TemplateManifestDecoder.TemplateItem", [], TemplateItem, () => [["ItemId", int32_type], ["Sequence", int32_type], ["Type", int32_type], ["NestingLevel", int32_type], ["IsRequired", bool_type], ["Text", string_type], ["SequenceText", option_type(string_type)], ["Code", option_type(string_type)], ["Uuid", option_type(string_type)], ["GenderRequired", option_type(string_type)], ["Highlight", option_type(int32_type)], ["Choices", list_type(TemplateChoice_$reflection())]]);
75
+ }
76
+
77
+ export class EncounterTypes extends Record implements IEquatable<EncounterTypes>, IComparable<EncounterTypes> {
78
+ readonly Medical: boolean;
79
+ readonly Mental: boolean;
80
+ readonly Dental: boolean;
81
+ readonly Other: boolean;
82
+ constructor(Medical: boolean, Mental: boolean, Dental: boolean, Other: boolean) {
83
+ super();
84
+ this.Medical = Medical;
85
+ this.Mental = Mental;
86
+ this.Dental = Dental;
87
+ this.Other = Other;
88
+ }
89
+ }
90
+
91
+ export function EncounterTypes_$reflection(): TypeInfo {
92
+ return record_type("FormSpec.Integrations.CorEMR.TemplateManifestDecoder.EncounterTypes", [], EncounterTypes, () => [["Medical", bool_type], ["Mental", bool_type], ["Dental", bool_type], ["Other", bool_type]]);
93
+ }
94
+
95
+ export class ScoringLabel extends Record implements IEquatable<ScoringLabel>, IComparable<ScoringLabel> {
96
+ readonly Name: string;
97
+ readonly Min: int32;
98
+ constructor(Name: string, Min: int32) {
99
+ super();
100
+ this.Name = Name;
101
+ this.Min = (Min | 0);
102
+ }
103
+ }
104
+
105
+ export function ScoringLabel_$reflection(): TypeInfo {
106
+ return record_type("FormSpec.Integrations.CorEMR.TemplateManifestDecoder.ScoringLabel", [], ScoringLabel, () => [["Name", string_type], ["Min", int32_type]]);
107
+ }
108
+
109
+ export class FormScoring extends Record implements IEquatable<FormScoring>, IComparable<FormScoring> {
110
+ readonly ScoreId: int32;
111
+ readonly ScoreName: string;
112
+ readonly Labels: FSharpList<ScoringLabel>;
113
+ readonly ChoiceScores: FSharpMap<string, int32>;
114
+ constructor(ScoreId: int32, ScoreName: string, Labels: FSharpList<ScoringLabel>, ChoiceScores: FSharpMap<string, int32>) {
115
+ super();
116
+ this.ScoreId = (ScoreId | 0);
117
+ this.ScoreName = ScoreName;
118
+ this.Labels = Labels;
119
+ this.ChoiceScores = ChoiceScores;
120
+ }
121
+ }
122
+
123
+ export function FormScoring_$reflection(): TypeInfo {
124
+ return record_type("FormSpec.Integrations.CorEMR.TemplateManifestDecoder.FormScoring", [], FormScoring, () => [["ScoreId", int32_type], ["ScoreName", string_type], ["Labels", list_type(ScoringLabel_$reflection())], ["ChoiceScores", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, int32_type])]]);
125
+ }
126
+
127
+ export class TemplateForm extends Record implements IEquatable<TemplateForm>, IComparable<TemplateForm> {
128
+ readonly FormId: int32;
129
+ readonly Name: string;
130
+ readonly FormCode: string;
131
+ readonly FormCodeSource: string;
132
+ readonly Description: string;
133
+ readonly CurrentVersionId: int64;
134
+ readonly IsIntake: boolean;
135
+ readonly Usage: string;
136
+ readonly RequiresSignature: boolean;
137
+ readonly EncounterTypes: EncounterTypes;
138
+ readonly OnceAYear: boolean;
139
+ readonly StructureHash: string;
140
+ readonly ClinicalHash: string;
141
+ readonly CosmeticHash: string;
142
+ readonly Hash: string;
143
+ readonly Items: FSharpList<TemplateItem>;
144
+ readonly Scoring: Option<FormScoring>;
145
+ constructor(FormId: int32, Name: string, FormCode: string, FormCodeSource: string, Description: string, CurrentVersionId: int64, IsIntake: boolean, Usage: string, RequiresSignature: boolean, EncounterTypes: EncounterTypes, OnceAYear: boolean, StructureHash: string, ClinicalHash: string, CosmeticHash: string, Hash: string, Items: FSharpList<TemplateItem>, Scoring: Option<FormScoring>) {
146
+ super();
147
+ this.FormId = (FormId | 0);
148
+ this.Name = Name;
149
+ this.FormCode = FormCode;
150
+ this.FormCodeSource = FormCodeSource;
151
+ this.Description = Description;
152
+ this.CurrentVersionId = CurrentVersionId;
153
+ this.IsIntake = IsIntake;
154
+ this.Usage = Usage;
155
+ this.RequiresSignature = RequiresSignature;
156
+ this.EncounterTypes = EncounterTypes;
157
+ this.OnceAYear = OnceAYear;
158
+ this.StructureHash = StructureHash;
159
+ this.ClinicalHash = ClinicalHash;
160
+ this.CosmeticHash = CosmeticHash;
161
+ this.Hash = Hash;
162
+ this.Items = Items;
163
+ this.Scoring = Scoring;
164
+ }
165
+ }
166
+
167
+ export function TemplateForm_$reflection(): TypeInfo {
168
+ return record_type("FormSpec.Integrations.CorEMR.TemplateManifestDecoder.TemplateForm", [], TemplateForm, () => [["FormId", int32_type], ["Name", string_type], ["FormCode", string_type], ["FormCodeSource", string_type], ["Description", string_type], ["CurrentVersionId", int64_type], ["IsIntake", bool_type], ["Usage", string_type], ["RequiresSignature", bool_type], ["EncounterTypes", EncounterTypes_$reflection()], ["OnceAYear", bool_type], ["StructureHash", string_type], ["ClinicalHash", string_type], ["CosmeticHash", string_type], ["Hash", string_type], ["Items", list_type(TemplateItem_$reflection())], ["Scoring", option_type(FormScoring_$reflection())]]);
169
+ }
170
+
171
+ export class ElementTypeEntry extends Record implements IEquatable<ElementTypeEntry>, IComparable<ElementTypeEntry> {
172
+ readonly Code: string;
173
+ readonly ValueEncoding: string;
174
+ readonly TextField: string;
175
+ constructor(Code: string, ValueEncoding: string, TextField: string) {
176
+ super();
177
+ this.Code = Code;
178
+ this.ValueEncoding = ValueEncoding;
179
+ this.TextField = TextField;
180
+ }
181
+ }
182
+
183
+ export function ElementTypeEntry_$reflection(): TypeInfo {
184
+ return record_type("FormSpec.Integrations.CorEMR.TemplateManifestDecoder.ElementTypeEntry", [], ElementTypeEntry, () => [["Code", string_type], ["ValueEncoding", string_type], ["TextField", string_type]]);
185
+ }
186
+
187
+ export class InstrumentMapEntry extends Record implements IEquatable<InstrumentMapEntry>, IComparable<InstrumentMapEntry> {
188
+ readonly InstrumentType: string;
189
+ readonly FormCode: string;
190
+ readonly MaxScore: Option<int32>;
191
+ readonly Source: string;
192
+ readonly Archived: boolean;
193
+ readonly FormName: string;
194
+ constructor(InstrumentType: string, FormCode: string, MaxScore: Option<int32>, Source: string, Archived: boolean, FormName: string) {
195
+ super();
196
+ this.InstrumentType = InstrumentType;
197
+ this.FormCode = FormCode;
198
+ this.MaxScore = MaxScore;
199
+ this.Source = Source;
200
+ this.Archived = Archived;
201
+ this.FormName = FormName;
202
+ }
203
+ }
204
+
205
+ export function InstrumentMapEntry_$reflection(): TypeInfo {
206
+ return record_type("FormSpec.Integrations.CorEMR.TemplateManifestDecoder.InstrumentMapEntry", [], InstrumentMapEntry, () => [["InstrumentType", string_type], ["FormCode", string_type], ["MaxScore", option_type(int32_type)], ["Source", string_type], ["Archived", bool_type], ["FormName", string_type]]);
207
+ }
208
+
209
+ export class CodeExtractionStats extends Record implements IEquatable<CodeExtractionStats>, IComparable<CodeExtractionStats> {
210
+ readonly Extracted: int32;
211
+ readonly Generated: int32;
212
+ readonly BySource: FSharpMap<string, int32>;
213
+ readonly Regex: string;
214
+ constructor(Extracted: int32, Generated: int32, BySource: FSharpMap<string, int32>, Regex: string) {
215
+ super();
216
+ this.Extracted = (Extracted | 0);
217
+ this.Generated = (Generated | 0);
218
+ this.BySource = BySource;
219
+ this.Regex = Regex;
220
+ }
221
+ }
222
+
223
+ export function CodeExtractionStats_$reflection(): TypeInfo {
224
+ return record_type("FormSpec.Integrations.CorEMR.TemplateManifestDecoder.CodeExtractionStats", [], CodeExtractionStats, () => [["Extracted", int32_type], ["Generated", int32_type], ["BySource", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, int32_type])], ["Regex", string_type]]);
225
+ }
226
+
227
+ export class TemplateStats extends Record implements IEquatable<TemplateStats>, IComparable<TemplateStats> {
228
+ readonly TotalForms: int32;
229
+ readonly WithCodes: int32;
230
+ readonly WithSyntheticCodes: int32;
231
+ readonly WithScoring: int32;
232
+ readonly WithSignature: int32;
233
+ readonly ByUsage: FSharpMap<string, int32>;
234
+ readonly ByElementType: FSharpMap<string, int32>;
235
+ readonly CodeExtraction: CodeExtractionStats;
236
+ constructor(TotalForms: int32, WithCodes: int32, WithSyntheticCodes: int32, WithScoring: int32, WithSignature: int32, ByUsage: FSharpMap<string, int32>, ByElementType: FSharpMap<string, int32>, CodeExtraction: CodeExtractionStats) {
237
+ super();
238
+ this.TotalForms = (TotalForms | 0);
239
+ this.WithCodes = (WithCodes | 0);
240
+ this.WithSyntheticCodes = (WithSyntheticCodes | 0);
241
+ this.WithScoring = (WithScoring | 0);
242
+ this.WithSignature = (WithSignature | 0);
243
+ this.ByUsage = ByUsage;
244
+ this.ByElementType = ByElementType;
245
+ this.CodeExtraction = CodeExtraction;
246
+ }
247
+ }
248
+
249
+ export function TemplateStats_$reflection(): TypeInfo {
250
+ return record_type("FormSpec.Integrations.CorEMR.TemplateManifestDecoder.TemplateStats", [], TemplateStats, () => [["TotalForms", int32_type], ["WithCodes", int32_type], ["WithSyntheticCodes", int32_type], ["WithScoring", int32_type], ["WithSignature", int32_type], ["ByUsage", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, int32_type])], ["ByElementType", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, int32_type])], ["CodeExtraction", CodeExtractionStats_$reflection()]]);
251
+ }
252
+
253
+ export class CoreEmrInfo extends Record implements IEquatable<CoreEmrInfo>, IComparable<CoreEmrInfo> {
254
+ readonly AppVersion: string;
255
+ readonly SchemaVersion: string;
256
+ readonly SchemaRevision: int32;
257
+ constructor(AppVersion: string, SchemaVersion: string, SchemaRevision: int32) {
258
+ super();
259
+ this.AppVersion = AppVersion;
260
+ this.SchemaVersion = SchemaVersion;
261
+ this.SchemaRevision = (SchemaRevision | 0);
262
+ }
263
+ }
264
+
265
+ export function CoreEmrInfo_$reflection(): TypeInfo {
266
+ return record_type("FormSpec.Integrations.CorEMR.TemplateManifestDecoder.CoreEmrInfo", [], CoreEmrInfo, () => [["AppVersion", string_type], ["SchemaVersion", string_type], ["SchemaRevision", int32_type]]);
267
+ }
268
+
269
+ export class InstrumentMapStats extends Record implements IEquatable<InstrumentMapStats>, IComparable<InstrumentMapStats> {
270
+ readonly Total: int32;
271
+ readonly Current: int32;
272
+ readonly Archived: int32;
273
+ readonly BySource: FSharpMap<string, int32>;
274
+ readonly ByType: FSharpMap<string, int32>;
275
+ constructor(Total: int32, Current: int32, Archived: int32, BySource: FSharpMap<string, int32>, ByType: FSharpMap<string, int32>) {
276
+ super();
277
+ this.Total = (Total | 0);
278
+ this.Current = (Current | 0);
279
+ this.Archived = (Archived | 0);
280
+ this.BySource = BySource;
281
+ this.ByType = ByType;
282
+ }
283
+ }
284
+
285
+ export function InstrumentMapStats_$reflection(): TypeInfo {
286
+ return record_type("FormSpec.Integrations.CorEMR.TemplateManifestDecoder.InstrumentMapStats", [], InstrumentMapStats, () => [["Total", int32_type], ["Current", int32_type], ["Archived", int32_type], ["BySource", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, int32_type])], ["ByType", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, int32_type])]]);
287
+ }
288
+
289
+ export class TemplateManifest extends Record implements IEquatable<TemplateManifest>, IComparable<TemplateManifest> {
290
+ readonly Schema: Option<string>;
291
+ readonly Version: int32;
292
+ readonly GeneratedAt: string;
293
+ readonly GeneratedFrom: string;
294
+ readonly CoreEmr: CoreEmrInfo;
295
+ readonly Stats: TemplateStats;
296
+ readonly ElementTypes: FSharpMap<string, ElementTypeEntry>;
297
+ readonly Forms: FSharpMap<string, TemplateForm>;
298
+ readonly InstrumentMap: FSharpMap<string, InstrumentMapEntry>;
299
+ readonly InstrumentMapStats: InstrumentMapStats;
300
+ constructor(Schema: Option<string>, Version: int32, GeneratedAt: string, GeneratedFrom: string, CoreEmr: CoreEmrInfo, Stats: TemplateStats, ElementTypes: FSharpMap<string, ElementTypeEntry>, Forms: FSharpMap<string, TemplateForm>, InstrumentMap: FSharpMap<string, InstrumentMapEntry>, InstrumentMapStats: InstrumentMapStats) {
301
+ super();
302
+ this.Schema = Schema;
303
+ this.Version = (Version | 0);
304
+ this.GeneratedAt = GeneratedAt;
305
+ this.GeneratedFrom = GeneratedFrom;
306
+ this.CoreEmr = CoreEmr;
307
+ this.Stats = Stats;
308
+ this.ElementTypes = ElementTypes;
309
+ this.Forms = Forms;
310
+ this.InstrumentMap = InstrumentMap;
311
+ this.InstrumentMapStats = InstrumentMapStats;
312
+ }
313
+ }
314
+
315
+ export function TemplateManifest_$reflection(): TypeInfo {
316
+ return record_type("FormSpec.Integrations.CorEMR.TemplateManifestDecoder.TemplateManifest", [], TemplateManifest, () => [["Schema", option_type(string_type)], ["Version", int32_type], ["GeneratedAt", string_type], ["GeneratedFrom", string_type], ["CoreEmr", CoreEmrInfo_$reflection()], ["Stats", TemplateStats_$reflection()], ["ElementTypes", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, ElementTypeEntry_$reflection()])], ["Forms", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, TemplateForm_$reflection()])], ["InstrumentMap", class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, InstrumentMapEntry_$reflection()])], ["InstrumentMapStats", InstrumentMapStats_$reflection()]]);
317
+ }
318
+
319
+ const extraWithInt64: ExtraCoders = new ExtraCoders((() => {
320
+ let copyOfStruct: string = newGuid();
321
+ return copyOfStruct;
322
+ })(), add<string, [((arg0: any) => any), ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<any, [string, ErrorReason_$union]>))]>("System.Int64", [int64_1, int64_2] as [((arg0: any) => any), ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<any, [string, ErrorReason_$union]>))], empty.Coders));
323
+
324
+ const int64Decoder: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<int64, [string, ErrorReason_$union]>)) = Auto_generateBoxedDecoder_Z6670B51(int64_type, undefined, extraWithInt64);
325
+
326
+ function dictDecoder<T>(decoder: ((arg0: string, arg1: any) => FSharpResult$2_$union<T, [string, ErrorReason_$union]>)): ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<FSharpMap<string, T>, [string, ErrorReason_$union]>)) {
327
+ let d: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<FSharpList<[string, T]>, [string, ErrorReason_$union]>));
328
+ const decoder_1: ((arg0: string, arg1: any) => FSharpResult$2_$union<T, [string, ErrorReason_$union]>) = decoder;
329
+ d = ((path: string): ((arg0: any) => FSharpResult$2_$union<FSharpList<[string, T]>, [string, ErrorReason_$union]>) => ((value: any): FSharpResult$2_$union<FSharpList<[string, T]>, [string, ErrorReason_$union]> => keyValuePairs<T>(decoder_1, path, value)));
330
+ return (path_1: string): ((arg0: any) => FSharpResult$2_$union<FSharpMap<string, T>, [string, ErrorReason_$union]>) => ((value_1: any): FSharpResult$2_$union<FSharpMap<string, T>, [string, ErrorReason_$union]> => map<FSharpList<[string, T]>, FSharpMap<string, T>>((elements: FSharpList<[string, T]>): FSharpMap<string, T> => ofList<string, T>(elements, {
331
+ Compare: comparePrimitives,
332
+ }), uncurry2(d), path_1, value_1));
333
+ }
334
+
335
+ const choiceDecoder = (path_2: string): ((arg0: any) => FSharpResult$2_$union<TemplateChoice, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<TemplateChoice, [string, ErrorReason_$union]> => object<TemplateChoice>((get$: IGetters): TemplateChoice => {
336
+ let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter, objectArg_2: IRequiredGetter, objectArg_3: IOptionalGetter, objectArg_4: IOptionalGetter, objectArg_5: IOptionalGetter;
337
+ return new TemplateChoice((objectArg = get$.Required, objectArg.Field<int32>("choiceId", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<int32>("sequence", uncurry2(int))), 0n, (objectArg_2 = get$.Required, objectArg_2.Field<string>("text", string)), (objectArg_3 = get$.Optional, objectArg_3.Field<int32>("bitPosition", uncurry2(int))), (objectArg_4 = get$.Optional, objectArg_4.Field<string>("code", string)), (objectArg_5 = get$.Optional, objectArg_5.Field<int32>("highlight", uncurry2(int))));
338
+ }, path_2, v));
339
+
340
+ const itemDecoder = (path_7: string): ((arg0: any) => FSharpResult$2_$union<TemplateItem, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<TemplateItem, [string, ErrorReason_$union]> => object<TemplateItem>((get$: IGetters): TemplateItem => {
341
+ let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter, objectArg_2: IRequiredGetter, objectArg_3: IRequiredGetter, objectArg_4: IRequiredGetter, objectArg_5: IRequiredGetter, objectArg_6: IOptionalGetter, objectArg_7: IOptionalGetter, objectArg_8: IOptionalGetter, objectArg_9: IOptionalGetter, objectArg_10: IOptionalGetter, objectArg_11: IRequiredGetter;
342
+ return new TemplateItem((objectArg = get$.Required, objectArg.Field<int32>("itemId", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<int32>("sequence", uncurry2(int))), (objectArg_2 = get$.Required, objectArg_2.Field<int32>("type", uncurry2(int))), (objectArg_3 = get$.Required, objectArg_3.Field<int32>("nestingLevel", uncurry2(int))), (objectArg_4 = get$.Required, objectArg_4.Field<boolean>("isRequired", bool)), (objectArg_5 = get$.Required, objectArg_5.Field<string>("text", string)), (objectArg_6 = get$.Optional, objectArg_6.Field<string>("sequenceText", string)), (objectArg_7 = get$.Optional, objectArg_7.Field<string>("code", string)), (objectArg_8 = get$.Optional, objectArg_8.Field<string>("uuid", string)), (objectArg_9 = get$.Optional, objectArg_9.Field<string>("genderRequired", string)), (objectArg_10 = get$.Optional, objectArg_10.Field<int32>("highlight", uncurry2(int))), (objectArg_11 = get$.Required, objectArg_11.Field<FSharpList<TemplateChoice>>("choices", (path_6: string, value_6: any): FSharpResult$2_$union<FSharpList<TemplateChoice>, [string, ErrorReason_$union]> => list_3<TemplateChoice>(uncurry2(choiceDecoder), path_6, value_6))));
343
+ }, path_7, v));
344
+
345
+ const encounterTypesDecoder = (path_4: string): ((arg0: any) => FSharpResult$2_$union<EncounterTypes, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<EncounterTypes, [string, ErrorReason_$union]> => object<EncounterTypes>((get$: IGetters): EncounterTypes => {
346
+ let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter, objectArg_2: IRequiredGetter, objectArg_3: IRequiredGetter;
347
+ return new EncounterTypes((objectArg = get$.Required, objectArg.Field<boolean>("medical", bool)), (objectArg_1 = get$.Required, objectArg_1.Field<boolean>("mental", bool)), (objectArg_2 = get$.Required, objectArg_2.Field<boolean>("dental", bool)), (objectArg_3 = get$.Required, objectArg_3.Field<boolean>("other", bool)));
348
+ }, path_4, v));
349
+
350
+ const scoringLabelDecoder = (path_1: string): ((arg0: any) => FSharpResult$2_$union<ScoringLabel, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<ScoringLabel, [string, ErrorReason_$union]> => object<ScoringLabel>((get$: IGetters): ScoringLabel => {
351
+ let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter;
352
+ return new ScoringLabel((objectArg = get$.Required, objectArg.Field<string>("name", string)), (objectArg_1 = get$.Required, objectArg_1.Field<int32>("min", uncurry2(int))));
353
+ }, path_1, v));
354
+
355
+ const formScoringDecoder = (path_2: string): ((arg0: any) => FSharpResult$2_$union<FormScoring, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<FormScoring, [string, ErrorReason_$union]> => object<FormScoring>((get$: IGetters): FormScoring => {
356
+ let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter, objectArg_2: IRequiredGetter, arg_7: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<FSharpMap<string, int32>, [string, ErrorReason_$union]>)), objectArg_3: IRequiredGetter;
357
+ return new FormScoring((objectArg = get$.Required, objectArg.Field<int32>("scoreId", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<string>("scoreName", string)), (objectArg_2 = get$.Required, objectArg_2.Field<FSharpList<ScoringLabel>>("labels", (path_1: string, value_1: any): FSharpResult$2_$union<FSharpList<ScoringLabel>, [string, ErrorReason_$union]> => list_3<ScoringLabel>(uncurry2(scoringLabelDecoder), path_1, value_1))), (arg_7 = dictDecoder<int32>(uncurry2(int)), (objectArg_3 = get$.Required, objectArg_3.Field<FSharpMap<string, int32>>("choiceScores", uncurry2(arg_7)))));
358
+ }, path_2, v));
359
+
360
+ const formDecoder = (path_13: string): ((arg0: any) => FSharpResult$2_$union<TemplateForm, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<TemplateForm, [string, ErrorReason_$union]> => object<TemplateForm>((get$: IGetters): TemplateForm => {
361
+ let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter, objectArg_2: IRequiredGetter, objectArg_3: IRequiredGetter, objectArg_4: IRequiredGetter, objectArg_5: IRequiredGetter, objectArg_6: IRequiredGetter, objectArg_7: IRequiredGetter, objectArg_8: IRequiredGetter, objectArg_9: IRequiredGetter, objectArg_10: IRequiredGetter, objectArg_11: IRequiredGetter, objectArg_12: IRequiredGetter, objectArg_13: IRequiredGetter, objectArg_14: IRequiredGetter, objectArg_15: IRequiredGetter, objectArg_16: IOptionalGetter;
362
+ return new TemplateForm((objectArg = get$.Required, objectArg.Field<int32>("formId", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<string>("name", string)), (objectArg_2 = get$.Required, objectArg_2.Field<string>("formCode", string)), (objectArg_3 = get$.Required, objectArg_3.Field<string>("formCodeSource", string)), (objectArg_4 = get$.Required, objectArg_4.Field<string>("description", string)), (objectArg_5 = get$.Required, objectArg_5.Field<int64>("currentVersionId", uncurry2(int64Decoder))), (objectArg_6 = get$.Required, objectArg_6.Field<boolean>("isIntake", bool)), (objectArg_7 = get$.Required, objectArg_7.Field<string>("usage", string)), (objectArg_8 = get$.Required, objectArg_8.Field<boolean>("requiresSignature", bool)), (objectArg_9 = get$.Required, objectArg_9.Field<EncounterTypes>("encounterTypes", uncurry2(encounterTypesDecoder))), (objectArg_10 = get$.Required, objectArg_10.Field<boolean>("onceAYear", bool)), (objectArg_11 = get$.Required, objectArg_11.Field<string>("structureHash", string)), (objectArg_12 = get$.Required, objectArg_12.Field<string>("clinicalHash", string)), (objectArg_13 = get$.Required, objectArg_13.Field<string>("cosmeticHash", string)), (objectArg_14 = get$.Required, objectArg_14.Field<string>("hash", string)), (objectArg_15 = get$.Required, objectArg_15.Field<FSharpList<TemplateItem>>("items", (path_12: string, value_12: any): FSharpResult$2_$union<FSharpList<TemplateItem>, [string, ErrorReason_$union]> => list_3<TemplateItem>(uncurry2(itemDecoder), path_12, value_12))), (objectArg_16 = get$.Optional, objectArg_16.Field<FormScoring>("scoring", uncurry2(formScoringDecoder))));
363
+ }, path_13, v));
364
+
365
+ const elementTypeDecoder = (path_3: string): ((arg0: any) => FSharpResult$2_$union<ElementTypeEntry, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<ElementTypeEntry, [string, ErrorReason_$union]> => object<ElementTypeEntry>((get$: IGetters): ElementTypeEntry => {
366
+ let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter, objectArg_2: IRequiredGetter;
367
+ return new ElementTypeEntry((objectArg = get$.Required, objectArg.Field<string>("code", string)), (objectArg_1 = get$.Required, objectArg_1.Field<string>("valueEncoding", string)), (objectArg_2 = get$.Required, objectArg_2.Field<string>("textField", string)));
368
+ }, path_3, v));
369
+
370
+ const instrumentMapEntryDecoder = (path_5: string): ((arg0: any) => FSharpResult$2_$union<InstrumentMapEntry, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<InstrumentMapEntry, [string, ErrorReason_$union]> => object<InstrumentMapEntry>((get$: IGetters): InstrumentMapEntry => {
371
+ let objectArg: IRequiredGetter, objectArg_1: IOptionalGetter, objectArg_2: IOptionalGetter, objectArg_3: IRequiredGetter, objectArg_4: IRequiredGetter, objectArg_5: IRequiredGetter;
372
+ return new InstrumentMapEntry((objectArg = get$.Required, objectArg.Field<string>("instrumentType", string)), defaultArg((objectArg_1 = get$.Optional, objectArg_1.Field<string>("formCode", string)), ""), (objectArg_2 = get$.Optional, objectArg_2.Field<int32>("maxScore", uncurry2(int))), (objectArg_3 = get$.Required, objectArg_3.Field<string>("source", string)), (objectArg_4 = get$.Required, objectArg_4.Field<boolean>("archived", bool)), (objectArg_5 = get$.Required, objectArg_5.Field<string>("formName", string)));
373
+ }, path_5, v));
374
+
375
+ const codeExtractionStatsDecoder = (path_1: string): ((arg0: any) => FSharpResult$2_$union<CodeExtractionStats, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<CodeExtractionStats, [string, ErrorReason_$union]> => object<CodeExtractionStats>((get$: IGetters): CodeExtractionStats => {
376
+ let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter, arg_5: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<FSharpMap<string, int32>, [string, ErrorReason_$union]>)), objectArg_2: IRequiredGetter, objectArg_3: IRequiredGetter;
377
+ return new CodeExtractionStats((objectArg = get$.Required, objectArg.Field<int32>("extracted", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<int32>("generated", uncurry2(int))), (arg_5 = dictDecoder<int32>(uncurry2(int)), (objectArg_2 = get$.Required, objectArg_2.Field<FSharpMap<string, int32>>("bySource", uncurry2(arg_5)))), (objectArg_3 = get$.Required, objectArg_3.Field<string>("regex", string)));
378
+ }, path_1, v));
379
+
380
+ const statsDecoder = (path: string): ((arg0: any) => FSharpResult$2_$union<TemplateStats, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<TemplateStats, [string, ErrorReason_$union]> => object<TemplateStats>((get$: IGetters): TemplateStats => {
381
+ let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter, objectArg_2: IRequiredGetter, objectArg_3: IRequiredGetter, objectArg_4: IRequiredGetter, arg_11: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<FSharpMap<string, int32>, [string, ErrorReason_$union]>)), objectArg_5: IRequiredGetter, arg_13: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<FSharpMap<string, int32>, [string, ErrorReason_$union]>)), objectArg_6: IRequiredGetter, objectArg_7: IRequiredGetter;
382
+ return new TemplateStats((objectArg = get$.Required, objectArg.Field<int32>("totalForms", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<int32>("withCodes", uncurry2(int))), (objectArg_2 = get$.Required, objectArg_2.Field<int32>("withSyntheticCodes", uncurry2(int))), (objectArg_3 = get$.Required, objectArg_3.Field<int32>("withScoring", uncurry2(int))), (objectArg_4 = get$.Required, objectArg_4.Field<int32>("withSignature", uncurry2(int))), (arg_11 = dictDecoder<int32>(uncurry2(int)), (objectArg_5 = get$.Required, objectArg_5.Field<FSharpMap<string, int32>>("byUsage", uncurry2(arg_11)))), (arg_13 = dictDecoder<int32>(uncurry2(int)), (objectArg_6 = get$.Required, objectArg_6.Field<FSharpMap<string, int32>>("byElementType", uncurry2(arg_13)))), (objectArg_7 = get$.Required, objectArg_7.Field<CodeExtractionStats>("codeExtraction", uncurry2(codeExtractionStatsDecoder))));
383
+ }, path, v));
384
+
385
+ const coreEmrDecoder = (path_2: string): ((arg0: any) => FSharpResult$2_$union<CoreEmrInfo, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<CoreEmrInfo, [string, ErrorReason_$union]> => object<CoreEmrInfo>((get$: IGetters): CoreEmrInfo => {
386
+ let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter, objectArg_2: IRequiredGetter;
387
+ return new CoreEmrInfo((objectArg = get$.Required, objectArg.Field<string>("appVersion", string)), (objectArg_1 = get$.Required, objectArg_1.Field<string>("schemaVersion", string)), (objectArg_2 = get$.Required, objectArg_2.Field<int32>("schemaRevision", uncurry2(int))));
388
+ }, path_2, v));
389
+
390
+ const instrumentMapStatsDecoder = (path: string): ((arg0: any) => FSharpResult$2_$union<InstrumentMapStats, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<InstrumentMapStats, [string, ErrorReason_$union]> => object<InstrumentMapStats>((get$: IGetters): InstrumentMapStats => {
391
+ let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter, objectArg_2: IRequiredGetter, arg_7: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<FSharpMap<string, int32>, [string, ErrorReason_$union]>)), objectArg_3: IRequiredGetter, arg_9: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<FSharpMap<string, int32>, [string, ErrorReason_$union]>)), objectArg_4: IRequiredGetter;
392
+ return new InstrumentMapStats((objectArg = get$.Required, objectArg.Field<int32>("total", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<int32>("current", uncurry2(int))), (objectArg_2 = get$.Required, objectArg_2.Field<int32>("archived", uncurry2(int))), (arg_7 = dictDecoder<int32>(uncurry2(int)), (objectArg_3 = get$.Required, objectArg_3.Field<FSharpMap<string, int32>>("bySource", uncurry2(arg_7)))), (arg_9 = dictDecoder<int32>(uncurry2(int)), (objectArg_4 = get$.Required, objectArg_4.Field<FSharpMap<string, int32>>("byType", uncurry2(arg_9)))));
393
+ }, path, v));
394
+
395
+ const manifestDecoder = (path_3: string): ((arg0: any) => FSharpResult$2_$union<TemplateManifest, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<TemplateManifest, [string, ErrorReason_$union]> => object<TemplateManifest>((get$: IGetters): TemplateManifest => {
396
+ let objectArg: IOptionalGetter, objectArg_1: IRequiredGetter, objectArg_2: IRequiredGetter, objectArg_3: IRequiredGetter, objectArg_4: IRequiredGetter, objectArg_5: IRequiredGetter, arg_13: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<FSharpMap<string, ElementTypeEntry>, [string, ErrorReason_$union]>)), objectArg_6: IRequiredGetter, arg_15: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<FSharpMap<string, TemplateForm>, [string, ErrorReason_$union]>)), objectArg_7: IRequiredGetter, arg_17: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<FSharpMap<string, InstrumentMapEntry>, [string, ErrorReason_$union]>)), objectArg_8: IRequiredGetter, objectArg_9: IRequiredGetter;
397
+ return new TemplateManifest((objectArg = get$.Optional, objectArg.Field<string>("$schema", string)), (objectArg_1 = get$.Required, objectArg_1.Field<int32>("version", uncurry2(int))), (objectArg_2 = get$.Required, objectArg_2.Field<string>("generatedAt", string)), (objectArg_3 = get$.Required, objectArg_3.Field<string>("generatedFrom", string)), (objectArg_4 = get$.Required, objectArg_4.Field<CoreEmrInfo>("coreEmr", uncurry2(coreEmrDecoder))), (objectArg_5 = get$.Required, objectArg_5.Field<TemplateStats>("stats", uncurry2(statsDecoder))), (arg_13 = dictDecoder<ElementTypeEntry>(uncurry2(elementTypeDecoder)), (objectArg_6 = get$.Required, objectArg_6.Field<FSharpMap<string, ElementTypeEntry>>("elementTypes", uncurry2(arg_13)))), (arg_15 = dictDecoder<TemplateForm>(uncurry2(formDecoder)), (objectArg_7 = get$.Required, objectArg_7.Field<FSharpMap<string, TemplateForm>>("forms", uncurry2(arg_15)))), (arg_17 = dictDecoder<InstrumentMapEntry>(uncurry2(instrumentMapEntryDecoder)), (objectArg_8 = get$.Required, objectArg_8.Field<FSharpMap<string, InstrumentMapEntry>>("instrumentMap", uncurry2(arg_17)))), (objectArg_9 = get$.Required, objectArg_9.Field<InstrumentMapStats>("instrumentMapStats", uncurry2(instrumentMapStatsDecoder))));
398
+ }, path_3, v));
399
+
400
+ function toCoreMRChoice(itemId: int32, c: TemplateChoice): CoreMRChoice {
401
+ return new CoreMRChoice(c.ChoiceId, itemId, c.Sequence, c.Text, c.Score, c.BitPosition, c.Code, map_1<int32, string>(int32ToString, c.Highlight));
402
+ }
403
+
404
+ function toCoreMRItem(item: TemplateItem): CoreMRItem {
405
+ return new CoreMRItem(item.ItemId, item.Sequence, item.NestingLevel, item.SequenceText, item.Type, int32ToString(item.Type), !isEmpty(item.Choices), true, false, item.Text, item.IsRequired, item.GenderRequired, map_1<int32, string>(int32ToString, item.Highlight), item.Code, item.Uuid, undefined, undefined, 0, 0, undefined);
406
+ }
407
+
408
+ /**
409
+ * Convert a TemplateForm to CoreMRFormData — the universal pipeline input.
410
+ */
411
+ export function toCoreMRFormData(form: TemplateForm): CoreMRFormData {
412
+ return new CoreMRFormData(new CoreMRFormMetadata(form.FormId, form.Name, isNullOrEmpty(form.Description) ? undefined : form.Description, ~~toInt32(form.CurrentVersionId), 1, undefined, form.RequiresSignature, form.IsIntake, "", ""), map_2<TemplateItem, CoreMRItem>(toCoreMRItem, form.Items), collect<TemplateItem, CoreMRChoice>((item_1: TemplateItem): FSharpList<CoreMRChoice> => map_2<TemplateChoice, CoreMRChoice>((c: TemplateChoice): CoreMRChoice => toCoreMRChoice(item_1.ItemId, c), item_1.Choices), form.Items), empty_1<CoreMRTrigger>(), empty_1<CoreMRTag>());
413
+ }
414
+
415
+ /**
416
+ * Decode templates.json manifest. Strict (all-or-nothing).
417
+ */
418
+ export function decodeManifest(json: string): FSharpResult$2_$union<TemplateManifest, string> {
419
+ return fromString<TemplateManifest>(uncurry2(manifestDecoder), json);
420
+ }
421
+
422
+ /**
423
+ * Decode a single TemplateForm from JSON (bridge API single-form response).
424
+ */
425
+ export function decodeTemplateForm(json: string): FSharpResult$2_$union<TemplateForm, string> {
426
+ return fromString<TemplateForm>(uncurry2(formDecoder), json);
427
+ }
428
+
429
+ export const templateFormDecoder: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<TemplateForm, [string, ErrorReason_$union]>)) = formDecoder;
430
+
431
+ //# sourceMappingURL=TemplateManifestDecoder.ts.map
@@ -4,7 +4,7 @@ import { join, printf, toConsole } from "@fable-org/fable-library-js/String.js";
4
4
  import { Auto_generateBoxedEncoder_437914C6, toString } from "../../fable_modules/Thoth.Json.10.4.1/Encode.fs.js";
5
5
  import { array_type, string_type, union_type, TypeInfo, obj_type } from "@fable-org/fable-library-js/Reflection.js";
6
6
  import { Auto_generateBoxedDecoder_Z6670B51, fromString } from "../../fable_modules/Thoth.Json.10.4.1/Decode.fs.js";
7
- import { equals, createObj, stringHash, compare, IDisposable, disposeSafe, IEnumerator, getEnumerator, IMap, isArrayLike, uncurry2 } from "@fable-org/fable-library-js/Util.js";
7
+ import { defaultOf, equals, createObj, stringHash, compare, IDisposable, disposeSafe, IEnumerator, getEnumerator, IMap, isArrayLike, uncurry2 } from "@fable-org/fable-library-js/Util.js";
8
8
  import { 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";
9
9
  import { FSharpResult$2_Ok, FSharpResult$2_Error, FSharpResult$2_$union } from "@fable-org/fable-library-js/Result.js";
10
10
  import { newGuid, parse, tryParse } from "@fable-org/fable-library-js/Guid.js";
@@ -15,12 +15,14 @@ import { count, ofSeq as ofSeq_1, toList, FSharpMap } from "@fable-org/fable-lib
15
15
  import { addToDict } from "@fable-org/fable-library-js/MapUtil.js";
16
16
  import { int32 } from "@fable-org/fable-library-js/Int32.js";
17
17
  import { getFieldDetails as getFieldDetails_1, FieldDetails$1, findStepIndexForField, updateField } from "../FormSpecValues.js";
18
- import { singleton as singleton_1, empty as empty_1, collect as collect_1, delay, toList as toList_1, mapIndexed, map as map_2, choose } from "@fable-org/fable-library-js/Seq.js";
18
+ import { length, singleton as singleton_1, empty as empty_1, collect as collect_1, delay, toList as toList_1, mapIndexed, map as map_2, choose } from "@fable-org/fable-library-js/Seq.js";
19
19
  import { toArray, ofArray } from "@fable-org/fable-library-js/Set.js";
20
20
  import { map as map_1 } from "@fable-org/fable-library-js/Array.js";
21
21
  import { now } from "@fable-org/fable-library-js/DateOffset.js";
22
22
  import { initializeExecution } from "../PathwayExecutor.js";
23
23
  import { List_distinct, distinct } from "@fable-org/fable-library-js/Seq2.js";
24
+ import { tryDecodeSourceMap as tryDecodeSourceMap_1 } from "../Integrations/Adapters/CorEMR/CoreMREncoder.js";
25
+ import { CoreMRSourceMap } from "../Integrations/Adapters/CorEMR/CoreMRSourceMap.js";
24
26
 
25
27
  /**
26
28
  * Get value from Option or return default (SAFE - recommended)
@@ -62,6 +64,15 @@ export function listToArray<T>(list: FSharpList<T>): T[] {
62
64
  return Array.from(list);
63
65
  }
64
66
 
67
+ /**
68
+ * Normalize form values for platform API (f1-api fill_form, etc.).
69
+ * Ensures field keys and value shapes are in the format expected by the API.
70
+ * TypeScript: normalizeFormValuesForPlatformApi(formValues: Record<string, unknown>) => Record<string, unknown>
71
+ */
72
+ export function normalizeFormValuesForPlatformApi(formValues: any): any {
73
+ return formValues;
74
+ }
75
+
65
76
  export function serializeFormSpec(formSpec: any): string {
66
77
  toConsole(printf("[API.Helpers] Serializing FormSpec!!"));
67
78
  toConsole(`[API.Helpers] FormSpec: ${formSpec}`);
@@ -1132,4 +1143,95 @@ export function getInstrumentConfidence(spec: Spec_FormSpec$1<Spec_FieldType_$un
1132
1143
  }
1133
1144
  }
1134
1145
 
1146
+ /**
1147
+ * Decode CoreMR provenance source map from JSON payload.
1148
+ * TypeScript: tryDecodeSourceMap(payloadJson: string) => {success: boolean; sourceMap?: CoreMRSourceMap; error?: string}
1149
+ * NO Result type - returns simple object for compatibility.
1150
+ */
1151
+ export function tryDecodeSourceMap(payloadJson: string): any {
1152
+ const matchValue: FSharpResult$2_$union<CoreMRSourceMap, string> = tryDecodeSourceMap_1(payloadJson);
1153
+ if (matchValue.tag === /* Error */ 1) {
1154
+ return {
1155
+ error: matchValue.fields[0],
1156
+ sourceMap: defaultOf(),
1157
+ success: false,
1158
+ };
1159
+ }
1160
+ else {
1161
+ const sourceMap: CoreMRSourceMap = matchValue.fields[0];
1162
+ return {
1163
+ error: defaultOf(),
1164
+ sourceMap: sourceMap,
1165
+ success: true,
1166
+ };
1167
+ }
1168
+ }
1169
+
1170
+ /**
1171
+ * Validate and build FormSpec with values, collecting ALL validation errors.
1172
+ * TypeScript: validateAndBuildFormSpec(formSpec: FormSpec, fieldData: any[]) => {isValid: boolean; formSpec?: FormSpec; errors: ValidationError[]}
1173
+ * NO Result type - returns detailed telemetry for client-side validation.
1174
+ */
1175
+ export function validateAndBuildFormSpec(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, fieldData: { fieldKey: string, objectValue: any }[]): any {
1176
+ let formSpec_1: any, totalFields_1: int32;
1177
+ let errors: any[] = [];
1178
+ let validFieldCount = 0;
1179
+ let enumerator: any = getEnumerator(fieldData);
1180
+ try {
1181
+ while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
1182
+ const input: { fieldKey: string, objectValue: any } = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
1183
+ const matchValue: Option<Spec_FormField$1<Spec_FieldType_$union>> = findFieldByKey(formSpec, input.fieldKey);
1184
+ if (matchValue == null) {
1185
+ void (errors.push({
1186
+ errorType: "field_not_found",
1187
+ fieldKey: input.fieldKey,
1188
+ layer: "helper",
1189
+ message: `Field ${input.fieldKey} not found in FormSpec`,
1190
+ }));
1191
+ }
1192
+ else {
1193
+ const field: Spec_FormField$1<Spec_FieldType_$union> = value_11(matchValue);
1194
+ try {
1195
+ validFieldCount = ((validFieldCount + 1) | 0);
1196
+ }
1197
+ catch (ex: any) {
1198
+ void (errors.push({
1199
+ errorType: "validation_error",
1200
+ fieldKey: input.fieldKey,
1201
+ layer: "helper",
1202
+ message: ex.message,
1203
+ }));
1204
+ }
1205
+ }
1206
+ }
1207
+ }
1208
+ finally {
1209
+ disposeSafe(enumerator);
1210
+ }
1211
+ if (errors.length === 0) {
1212
+ return {
1213
+ errors: [],
1214
+ formSpec: buildFormSpecWithValues(formSpec, fieldData),
1215
+ isValid: true,
1216
+ stats: {
1217
+ errorFields: 0,
1218
+ totalFields: length<{ fieldKey: string, objectValue: any }>(fieldData),
1219
+ validFields: validFieldCount,
1220
+ },
1221
+ };
1222
+ }
1223
+ else {
1224
+ return (formSpec_1 = defaultOf(), {
1225
+ errors: errors,
1226
+ formSpec: formSpec_1,
1227
+ isValid: false,
1228
+ stats: (totalFields_1 = (length<{ fieldKey: string, objectValue: any }>(fieldData) | 0), {
1229
+ errorFields: errors.length,
1230
+ totalFields: totalFields_1,
1231
+ validFields: validFieldCount,
1232
+ }),
1233
+ });
1234
+ }
1235
+ }
1236
+
1135
1237
  //# sourceMappingURL=FormSpec.Api.Helpers.ts.map