@f1studio/form-spec 5.0.0-alpha.165 → 5.0.0-alpha.166
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.d.ts +13 -13
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.js +14 -114
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js.map +1 -1
- package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.d.ts +2 -10
- package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.js +0 -18
- package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.js.map +1 -1
- package/FormSpec.FS/Interop/Facade/FormItemLookup.d.ts +95 -0
- package/FormSpec.FS/Interop/Facade/FormItemLookup.d.ts.map +1 -0
- package/FormSpec.FS/Interop/Facade/FormItemLookup.js +155 -0
- package/FormSpec.FS/Interop/Facade/FormItemLookup.js.map +1 -0
- package/README.md +7 -7
- package/Thoth.Json/packages/Thoth.Json/Encode.js.map +1 -1
- package/package.json +5 -1
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.ts +22 -87
- package/src/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.ts +14 -37
- package/src/FormSpec.FS/Interop/Facade/FormItemLookup.ts +179 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
2
|
+
import { Spec_FormSpec$1, Spec_FormField$1, Spec_FieldType_$union } from "../../FormSpec.js";
|
|
3
|
+
import { Option } from "@fable-org/fable-library-js/Option.js";
|
|
4
|
+
import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
5
|
+
export type ItemKindAuthority = "site" | "conduit" | "nobody";
|
|
6
|
+
export declare class ItemKindInfoTS {
|
|
7
|
+
readonly "label@65": string;
|
|
8
|
+
readonly "isResolved@65": boolean;
|
|
9
|
+
readonly "control@65": string;
|
|
10
|
+
readonly "authority@65": ItemKindAuthority;
|
|
11
|
+
constructor(control: string, label: string, authority: ItemKindAuthority, isResolved: boolean);
|
|
12
|
+
}
|
|
13
|
+
export declare function ItemKindInfoTS_$reflection(): TypeInfo;
|
|
14
|
+
export declare function ItemKindInfoTS_$ctor_Z4A082755(control: string, label: string, authority: ItemKindAuthority, isResolved: boolean): ItemKindInfoTS;
|
|
15
|
+
/**
|
|
16
|
+
* The control the vendor renders.
|
|
17
|
+
*/
|
|
18
|
+
export declare function ItemKindInfoTS__get_control(_: ItemKindInfoTS): string;
|
|
19
|
+
/**
|
|
20
|
+
* The source's own words for it, or conduit's where the release states none.
|
|
21
|
+
*/
|
|
22
|
+
export declare function ItemKindInfoTS__get_label(_: ItemKindInfoTS): string;
|
|
23
|
+
/**
|
|
24
|
+
* ⭐ WHOSE WORD THIS IS.
|
|
25
|
+
*/
|
|
26
|
+
export declare function ItemKindInfoTS__get_authority(_: ItemKindInfoTS): ItemKindAuthority;
|
|
27
|
+
/**
|
|
28
|
+
* ⛔ `false` when nothing states this kind. The item still exists and still has answers — what
|
|
29
|
+
* is missing is a MEANING, and a screen must say so rather than paint a plausible default.
|
|
30
|
+
*/
|
|
31
|
+
export declare function ItemKindInfoTS__get_isResolved(_: ItemKindInfoTS): boolean;
|
|
32
|
+
export declare class StatedOptionTS {
|
|
33
|
+
readonly "text@81": string;
|
|
34
|
+
readonly "optionKey@81": string;
|
|
35
|
+
constructor(optionKey: string, text: string);
|
|
36
|
+
}
|
|
37
|
+
export declare function StatedOptionTS_$reflection(): TypeInfo;
|
|
38
|
+
export declare function StatedOptionTS_$ctor_Z384F8060(optionKey: string, text: string): StatedOptionTS;
|
|
39
|
+
export declare function StatedOptionTS__get_optionKey(_: StatedOptionTS): string;
|
|
40
|
+
export declare function StatedOptionTS__get_text(_: StatedOptionTS): string;
|
|
41
|
+
/**
|
|
42
|
+
* What kind is this item, and whose word is that?
|
|
43
|
+
*
|
|
44
|
+
* ⭐ THE REPLACEMENT FOR `getFieldCoreMRAnchor` + `getBitmaskChoiceAnalysis` in a diagnostics
|
|
45
|
+
* panel: it answers "what is this field, and can we trust the answer" without naming an
|
|
46
|
+
* encoding, a bit or a vendor integer.
|
|
47
|
+
*
|
|
48
|
+
* ⛔ An unresolved kind is NAMED (`isResolved = false`), never defaulted. Conduit spells an
|
|
49
|
+
* unstated kind `unresolved_<code>`; this reads that and says so rather than passing it on as
|
|
50
|
+
* if it were a control.
|
|
51
|
+
*/
|
|
52
|
+
export declare function Lookup_getItemKindInfo(control: string, label: string, statedBy: string): ItemKindInfoTS;
|
|
53
|
+
/**
|
|
54
|
+
* The options a field states, as identity + the site's own text.
|
|
55
|
+
*
|
|
56
|
+
* ⭐ THE REPLACEMENT FOR `getFieldBitmaskChoiceTable`. That helper's table had `score` and
|
|
57
|
+
* `bitPosition` columns; neither is a fact about the option, both are CoreMR's encoding of it.
|
|
58
|
+
* ⛔ Whether one or several may be chosen is NOT answered here: it is a property of the item's
|
|
59
|
+
* own stated options, resolved in conduit, and a TypeScript panel has no business re-deciding it.
|
|
60
|
+
*/
|
|
61
|
+
export declare function Lookup_getStatedOptions(field: Spec_FormField$1<Spec_FieldType_$union>): StatedOptionTS[];
|
|
62
|
+
/**
|
|
63
|
+
* Does this field offer options at all?
|
|
64
|
+
*
|
|
65
|
+
* ⭐ STRUCTURAL, per field — never per item type. Measured at St Johns: 21 items of type 20
|
|
66
|
+
* state no options while 73 of 132 type-140 items DO, so any type-level answer is wrong for
|
|
67
|
+
* every one of them (conduit `audit/260923-1655`).
|
|
68
|
+
*/
|
|
69
|
+
export declare function Lookup_fieldStatesOptions(field: Spec_FormField$1<Spec_FieldType_$union>): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* The scale a SOURCE stated for this form, if it stated one.
|
|
72
|
+
*
|
|
73
|
+
* ⛔ `Score` is NOT consulted: that is the f1 designer's authored scale, a different fact with a
|
|
74
|
+
* different author. ⚠️ And there is no maximum here because nothing states one — CoreMR's
|
|
75
|
+
* `form_scores` is `id · name · form_name · labels · deleted`.
|
|
76
|
+
*/
|
|
77
|
+
export declare function Lookup_getVendorScaleName(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): Option<string>;
|
|
78
|
+
/**
|
|
79
|
+
* The bands a source stated, lowest first, as `[label, minimum]` pairs.
|
|
80
|
+
*
|
|
81
|
+
* ⭐ A band runs from its own minimum to the NEXT band's, and the last is unbounded — which is
|
|
82
|
+
* why no maximum is carried. Deriving the upper edge at the paint is correct; storing it is how
|
|
83
|
+
* bands acquire gaps and overlaps nobody stated.
|
|
84
|
+
*/
|
|
85
|
+
export declare function Lookup_getVendorScaleBands(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): [string, int32][];
|
|
86
|
+
/**
|
|
87
|
+
* Which stated band a total falls in, or `None` when no source stated a scale.
|
|
88
|
+
*
|
|
89
|
+
* ⛔ REFUSES to guess. If the form carries no stated scale there is no band, and a screen must
|
|
90
|
+
* show that rather than invent one. This function existing in F# is the whole point: until
|
|
91
|
+
* 2026-09-23 an importer invented Low/Medium/High at thirds and a CoreMR "Severe" rendered as
|
|
92
|
+
* "Low Risk" on five published instruments.
|
|
93
|
+
*/
|
|
94
|
+
export declare function Lookup_getVendorScaleBandFor(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, total: int32): Option<string>;
|
|
95
|
+
//# sourceMappingURL=FormItemLookup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormItemLookup.d.ts","sourceRoot":"","sources":["../../../../FormSpec.TS/FormSpec.FS/Interop/Facade/FormItemLookup.ts"],"names":[],"mappings":"AAAA,OAAO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IAAI,EAAE,MAAM;CAI9C;AAED,wBAAgB,0BAA0B,IAAI,QAAQ,CAErD;AAED,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,CAE9F;AAED,wBAAgB,6BAA6B,CAAC,CAAC,EAAE,cAAc,GAAG,MAAM,CAEvE;AAED,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,cAAc,GAAG,MAAM,CAElE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,cAAc,CAGvG;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,cAAc,EAAE,CAaxG;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,GAAG,OAAO,CAEjG;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,eAAe,CAAC,qBAAqB,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAE1G;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,eAAe,CAAC,qBAAqB,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAQ9G;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,eAAe,CAAC,qBAAqB,CAAC,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAE3H"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get ItemKindInfoTS () {
|
|
13
|
+
return ItemKindInfoTS;
|
|
14
|
+
},
|
|
15
|
+
get ItemKindInfoTS_$ctor_Z4A082755 () {
|
|
16
|
+
return ItemKindInfoTS_$ctor_Z4A082755;
|
|
17
|
+
},
|
|
18
|
+
get ItemKindInfoTS_$reflection () {
|
|
19
|
+
return ItemKindInfoTS_$reflection;
|
|
20
|
+
},
|
|
21
|
+
get ItemKindInfoTS__get_authority () {
|
|
22
|
+
return ItemKindInfoTS__get_authority;
|
|
23
|
+
},
|
|
24
|
+
get ItemKindInfoTS__get_control () {
|
|
25
|
+
return ItemKindInfoTS__get_control;
|
|
26
|
+
},
|
|
27
|
+
get ItemKindInfoTS__get_isResolved () {
|
|
28
|
+
return ItemKindInfoTS__get_isResolved;
|
|
29
|
+
},
|
|
30
|
+
get ItemKindInfoTS__get_label () {
|
|
31
|
+
return ItemKindInfoTS__get_label;
|
|
32
|
+
},
|
|
33
|
+
get Lookup_fieldStatesOptions () {
|
|
34
|
+
return Lookup_fieldStatesOptions;
|
|
35
|
+
},
|
|
36
|
+
get Lookup_getItemKindInfo () {
|
|
37
|
+
return Lookup_getItemKindInfo;
|
|
38
|
+
},
|
|
39
|
+
get Lookup_getStatedOptions () {
|
|
40
|
+
return Lookup_getStatedOptions;
|
|
41
|
+
},
|
|
42
|
+
get Lookup_getVendorScaleBandFor () {
|
|
43
|
+
return Lookup_getVendorScaleBandFor;
|
|
44
|
+
},
|
|
45
|
+
get Lookup_getVendorScaleBands () {
|
|
46
|
+
return Lookup_getVendorScaleBands;
|
|
47
|
+
},
|
|
48
|
+
get Lookup_getVendorScaleName () {
|
|
49
|
+
return Lookup_getVendorScaleName;
|
|
50
|
+
},
|
|
51
|
+
get StatedOptionTS () {
|
|
52
|
+
return StatedOptionTS;
|
|
53
|
+
},
|
|
54
|
+
get StatedOptionTS_$ctor_Z384F8060 () {
|
|
55
|
+
return StatedOptionTS_$ctor_Z384F8060;
|
|
56
|
+
},
|
|
57
|
+
get StatedOptionTS_$reflection () {
|
|
58
|
+
return StatedOptionTS_$reflection;
|
|
59
|
+
},
|
|
60
|
+
get StatedOptionTS__get_optionKey () {
|
|
61
|
+
return StatedOptionTS__get_optionKey;
|
|
62
|
+
},
|
|
63
|
+
get StatedOptionTS__get_text () {
|
|
64
|
+
return StatedOptionTS__get_text;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
const _Reflection = require("@fable-org/fable-library-js/Reflection.js");
|
|
68
|
+
const _String = require("@fable-org/fable-library-js/String.js");
|
|
69
|
+
const _Util = require("@fable-org/fable-library-js/Util.js");
|
|
70
|
+
const _List = require("@fable-org/fable-library-js/List.js");
|
|
71
|
+
const _Option = require("@fable-org/fable-library-js/Option.js");
|
|
72
|
+
class ItemKindInfoTS {
|
|
73
|
+
constructor(control, label, authority, isResolved){
|
|
74
|
+
this["control@65"] = control;
|
|
75
|
+
this["label@65"] = label;
|
|
76
|
+
this["authority@65"] = authority;
|
|
77
|
+
this["isResolved@65"] = isResolved;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function ItemKindInfoTS_$reflection() {
|
|
81
|
+
return (0, _Reflection.class_type)("F1.Studio.FormItemLookup.ItemKindInfoTS", undefined, ItemKindInfoTS);
|
|
82
|
+
}
|
|
83
|
+
function ItemKindInfoTS_$ctor_Z4A082755(control, label, authority, isResolved) {
|
|
84
|
+
return new ItemKindInfoTS(control, label, authority, isResolved);
|
|
85
|
+
}
|
|
86
|
+
function ItemKindInfoTS__get_control(_) {
|
|
87
|
+
return _["control@65"];
|
|
88
|
+
}
|
|
89
|
+
function ItemKindInfoTS__get_label(_) {
|
|
90
|
+
return _["label@65"];
|
|
91
|
+
}
|
|
92
|
+
function ItemKindInfoTS__get_authority(_) {
|
|
93
|
+
return _["authority@65"];
|
|
94
|
+
}
|
|
95
|
+
function ItemKindInfoTS__get_isResolved(_) {
|
|
96
|
+
return _["isResolved@65"];
|
|
97
|
+
}
|
|
98
|
+
class StatedOptionTS {
|
|
99
|
+
constructor(optionKey, text){
|
|
100
|
+
this["optionKey@81"] = optionKey;
|
|
101
|
+
this["text@81"] = text;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function StatedOptionTS_$reflection() {
|
|
105
|
+
return (0, _Reflection.class_type)("F1.Studio.FormItemLookup.StatedOptionTS", undefined, StatedOptionTS);
|
|
106
|
+
}
|
|
107
|
+
function StatedOptionTS_$ctor_Z384F8060(optionKey, text) {
|
|
108
|
+
return new StatedOptionTS(optionKey, text);
|
|
109
|
+
}
|
|
110
|
+
function StatedOptionTS__get_optionKey(_) {
|
|
111
|
+
return _["optionKey@81"];
|
|
112
|
+
}
|
|
113
|
+
function StatedOptionTS__get_text(_) {
|
|
114
|
+
return _["text@81"];
|
|
115
|
+
}
|
|
116
|
+
function Lookup_getItemKindInfo(control, label, statedBy) {
|
|
117
|
+
const authority = statedBy === "site" ? "site" : statedBy === "conduit" ? "conduit" : "nobody";
|
|
118
|
+
return ItemKindInfoTS_$ctor_Z4A082755(control, label, authority, !(0, _String.isNullOrWhiteSpace)(control) && !control.startsWith("unresolved_") && !(0, _Util.equals)(authority, "nobody"));
|
|
119
|
+
}
|
|
120
|
+
function Lookup_getStatedOptions(field) {
|
|
121
|
+
const ofOptions = (options)=>(0, _List.toArray)((0, _List.map)((o)=>StatedOptionTS_$ctor_Z384F8060(o.OptionKey.fields[0], o.Description), options));
|
|
122
|
+
const matchValue = field.FieldType;
|
|
123
|
+
switch(matchValue.tag){
|
|
124
|
+
case /* Radio */ 12:
|
|
125
|
+
return ofOptions(matchValue.fields[0].Options);
|
|
126
|
+
case /* Dropdown */ 14:
|
|
127
|
+
return ofOptions(matchValue.fields[0].Options);
|
|
128
|
+
case /* CheckboxList */ 16:
|
|
129
|
+
return ofOptions(matchValue.fields[0].Options);
|
|
130
|
+
default:
|
|
131
|
+
return [];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function Lookup_fieldStatesOptions(field) {
|
|
135
|
+
return Lookup_getStatedOptions(field).length > 0;
|
|
136
|
+
}
|
|
137
|
+
function Lookup_getVendorScaleName(formSpec) {
|
|
138
|
+
return (0, _Option.map)((v)=>v.ScaleName, formSpec.VendorScore);
|
|
139
|
+
}
|
|
140
|
+
function Lookup_getVendorScaleBands(formSpec) {
|
|
141
|
+
const matchValue = formSpec.VendorScore;
|
|
142
|
+
if (matchValue != null) {
|
|
143
|
+
return (0, _List.toArray)((0, _List.map)((b)=>[
|
|
144
|
+
b.Label,
|
|
145
|
+
b.Min
|
|
146
|
+
], (0, _Option.value)(matchValue).Bands));
|
|
147
|
+
} else {
|
|
148
|
+
return [];
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function Lookup_getVendorScaleBandFor(formSpec, total) {
|
|
152
|
+
return (0, _Option.map)((b_1)=>b_1.Label, (0, _Option.bind)((v)=>(0, _List.tryLast)((0, _List.filter)((b)=>total >= b.Min, v.Bands)), formSpec.VendorScore));
|
|
153
|
+
} //# sourceMappingURL=FormItemLookup.ts.map
|
|
154
|
+
|
|
155
|
+
//# sourceMappingURL=FormItemLookup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../FormSpec.TS/FormSpec.FS/Interop/Facade/FormItemLookup.ts"],"names":["control","label","authority","isResolved","_","optionKey","text","statedBy","``.ctor``","ofOptions","o","options","matchValue","field","getStatedOptions","v","formSpec","b","total"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAgEoB,IAAA,CAAA,aAAA,GAAAA;QAAiB,IAAA,CAAA,WAAA,GAAAC;QAAe,IAAA,CAAA,eAAA,GAAAC;QAA8B,IAAA,CAAA,gBAAA,GAAAC;;;;;;;;;;WAE3DC,CAAAA,CAA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YAAA,EAAA,CAAA,QAA0E,aAAA,MAAzC,YAAA,EAAA,CAAA,IAAsBC,SAASD,EAAAA,GAAAA,EAA1CF,EAAAA,KAAAA,IADzBC,SAAAA,WAAAA"}
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# FormSpec – Build & Publish
|
|
2
2
|
|
|
3
|
-
**Version: `5.0.0-alpha.
|
|
3
|
+
**Version: `5.0.0-alpha.166`**
|
|
4
4
|
|
|
5
5
|
TypeScript package generated from F# via Fable. Runtime uses external `@fable-org/fable-library-js`.
|
|
6
6
|
|
|
@@ -63,17 +63,17 @@ Notes:
|
|
|
63
63
|
### From Verdaccio (local testing)
|
|
64
64
|
|
|
65
65
|
```bash
|
|
66
|
-
npm install @f1studio/form-spec@5.0.0-alpha.
|
|
67
|
-
pnpm add @f1studio/form-spec@5.0.0-alpha.
|
|
68
|
-
bun add @f1studio/form-spec@5.0.0-alpha.
|
|
66
|
+
npm install @f1studio/form-spec@5.0.0-alpha.166 --registry http://localhost:4873
|
|
67
|
+
pnpm add @f1studio/form-spec@5.0.0-alpha.166 --registry http://localhost:4873
|
|
68
|
+
bun add @f1studio/form-spec@5.0.0-alpha.166 --registry http://localhost:4873
|
|
69
69
|
```
|
|
70
70
|
|
|
71
71
|
### From npm (public registry)
|
|
72
72
|
|
|
73
73
|
```bash
|
|
74
|
-
npm install @f1studio/form-spec@5.0.0-alpha.
|
|
75
|
-
pnpm add @f1studio/form-spec@5.0.0-alpha.
|
|
76
|
-
bun add @f1studio/form-spec@5.0.0-alpha.
|
|
74
|
+
npm install @f1studio/form-spec@5.0.0-alpha.166
|
|
75
|
+
pnpm add @f1studio/form-spec@5.0.0-alpha.166
|
|
76
|
+
bun add @f1studio/form-spec@5.0.0-alpha.166
|
|
77
77
|
```
|
|
78
78
|
|
|
79
79
|
Entry points:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../FormSpec.TS/Thoth.Json/packages/Thoth.Json/Encode.ts"],"names":["value","o","enumerator","values","forLoopVar","object","enc1","v1","enc2","v2","enc3","v3","enc4","v4","enc5","v5","enc6","v6","enc7","v7","enc8","v8","list","tuple2","keyEncoder","valueEncoder","tupledArg","space","encoder","nil","arg10","encoderRef","extra","matchValue","t","setters","targetKey","caseStrategy","fi","encode","autoEncoder","skipNullField","source","target","set","patternInput","info","fields","len","fieldTypes","i","fullname","seq","enumType","clo2","encoders","x","option","keyType","
|
|
1
|
+
{"version":3,"sources":["../../../../FormSpec.TS/Thoth.Json/packages/Thoth.Json/Encode.ts"],"names":["value","o","enumerator","values","forLoopVar","object","enc1","v1","enc2","v2","enc3","v3","enc4","v4","enc5","v5","enc6","v6","enc7","v7","enc8","v8","list","tuple2","keyEncoder","valueEncoder","tupledArg","space","encoder","nil","arg10","encoderRef","extra","matchValue","t","setters","targetKey","caseStrategy","fi","encode","autoEncoder","skipNullField","source","target","set","patternInput","info","fields","len","fieldTypes","i","fullname","seq","enumType","clo2","encoders","x","option","keyType","activePatternResult15293","_arg1","clo4","activePatternResult15337","_arg2","autoEncodeRecordsAndUnions","unit","int64","uint64","bigint","decimal","datetime","datetimeOffset","timespan","guid","v","y","e","makeExtra","toString"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAyCqDA;;;kCA4BNA;;gBAYlB,eAAA;;IA0BjBC,MAAAA,IAAAA,CAAAA;IAEgBC,MAAAA,iBAAA,mBAAA,EAAAC;IAApB,IAAA;QAAA,MAAoBD,UAAAA,CAAAA,0CAAAA,GAAAA;YAAfE,MAAAA,aAAeF,UAAAA,CAAAA,uDAAAA;YAChBD,CAAAA,CADCG,UAAAA,CAAAA,EAAAA,CAAAA,GAAAA,UAAAA,CAAAA,EAAAA;;;QAAL,IAAA,iBAAA,EAAoBF;;WAGhBD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BACDC;qBACC;2BACDC;qBACC;kCACDjB;;oBAEX,OAAAQ,2BAA2BhC,OAAMK,cAAaI,eAAcP;;;;QApK7DH,MAAAA,aAAAA,IAAAA,aAAAA,EAAcE;oBAASF,WAAAA,QAAAA,CAAoB2C;;;;IAuK5C,IAAA1C,SAAAA,MAAAA;QAEM,WAAA,QAAA,EAAA,CAAA,MAAA,YAA2B,IAAA,gBAAA,CAAXN,SAAAA,CAAAA,EAAAA,OAAoB,aAAA,EAApCM,OAAAA,MAAAA;;QADF,WAAA,UAAA,EAAA;;;;;;;;;;;;QAmBC2C,KADAA;IALHtC,MAAAA,qBAAe,kBAAA,EAAWA,cAAAA,IAAAA,+BAAAA;IAC1BI,MAAAA,sBAAgB,kBAAA,EAAWA,eAAc;IAW7C,WAAA,uCAAA,EAAA,2BAAA,GANOkC,OADAA,QADH,oBAAA,EAAAzC,QACQ,eAAA,EAAiBG,mBAAtBsC,OAII,kBAAA,MADA,WAAA,EAAA,CAAA,IAAqBC,EAAAA,IAAAA,EADxB5C,QAEuB,MAHxB2C,GAAAA,GAAAA,IASCnC,YAAaqC,UAAU7C,QAAOK,gBAAaI,iBAAcP;;;IA2B7DG,MAAAA,qBAAe,kBAAA,EAAWA,cAAAA,IAAAA,+BAAAA;IAC1BI,MAAAA,sBAAgB,kBAAA,EAAWA,eAAc;IAC7C,OAAAD,YAAaqC,UAAU7C,QAAOK,gBAAaI,iBAAcP;;;WAkEX4C,SAASnD,OAAM3B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@f1studio/form-spec",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.166",
|
|
4
4
|
"description": "F1 Core - Form specification and types",
|
|
5
5
|
"main": "./FormSpec.FS/Interop/FormSpec.Api.Option.js",
|
|
6
6
|
"types": "./FormSpec.FS/Interop/FormSpec.Api.Option.d.ts",
|
|
@@ -29,6 +29,10 @@
|
|
|
29
29
|
"types": "./FormSpec.FS/Interop/Facade/BlueprintFilledForm.d.ts",
|
|
30
30
|
"default": "./FormSpec.FS/Interop/Facade/BlueprintFilledForm.js"
|
|
31
31
|
},
|
|
32
|
+
"./Interop/Facade/FormItemLookup": {
|
|
33
|
+
"types": "./FormSpec.FS/Interop/Facade/FormItemLookup.d.ts",
|
|
34
|
+
"default": "./FormSpec.FS/Interop/Facade/FormItemLookup.js"
|
|
35
|
+
},
|
|
32
36
|
"./Interop/Facade/FormAnswersGate": {
|
|
33
37
|
"types": "./FormSpec.FS/Interop/Facade/FormAnswersGate.d.ts",
|
|
34
38
|
"default": "./FormSpec.FS/Interop/Facade/FormAnswersGate.js"
|
|
@@ -1,94 +1,16 @@
|
|
|
1
|
-
import { FSharpRef, Record } from "@fable-org/fable-library-js/Types.js";
|
|
2
|
-
import { comparePrimitives, int32ToString, IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
|
|
3
|
-
import { record_type, string_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
4
|
-
import { tryParse, int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
5
1
|
import { Spec_FormClassification_$union, Spec_FormClassification_General, Spec_FormClassification_Screening, Spec_FormClassification_Intake, Spec_FormClassification_ClinicalInstrument, Spec_ClinicalInstrumentInfo } from "../../../FormSpec.js";
|
|
2
|
+
import { tryParse, int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
6
3
|
import { bind, orElse, map as map_1, defaultArg, Option, value as value_5 } from "@fable-org/fable-library-js/Option.js";
|
|
7
4
|
import { isNullOrEmpty } from "@fable-org/fable-library-js/String.js";
|
|
8
5
|
import { int64, toInt32 } from "@fable-org/fable-library-js/BigInt.js";
|
|
9
|
-
import { CoreMRFormDetail, CoreMRTag, CoreMRTrigger, CoreMRTriggerEvent, CoreMRTriggerCondition, CoreMRChoice, CoreMRItem, CoreMRFormMetadata } from "../../CorEMR/CoreMRTypes.js";
|
|
6
|
+
import { CoreMRFormData, CoreMRFormDetail, CoreMRTag, CoreMRTrigger, CoreMRTriggerEvent, CoreMRTriggerCondition, CoreMRChoice, CoreMRItem, CoreMRFormMetadata } from "../../CorEMR/CoreMRTypes.js";
|
|
10
7
|
import { empty, choose, item as item_3, length, mapIndexed, sortBy, collect, FSharpList, isEmpty, map } from "@fable-org/fable-library-js/List.js";
|
|
8
|
+
import { TemplateForm, ItemTrigger, TriggerAction, TriggerCondition, TemplateChoice, TemplateItem, carriesTextOrDate, ElementTypeEntry } from "../../CorEMR/TemplateManifestDecoder.js";
|
|
11
9
|
import { FSharpMap, tryFind } from "@fable-org/fable-library-js/Map.js";
|
|
12
|
-
import {
|
|
10
|
+
import { comparePrimitives, int32ToString } from "@fable-org/fable-library-js/Util.js";
|
|
13
11
|
import { FSharpSet__Contains, FSharpSet, ofSeq } from "@fable-org/fable-library-js/Set.js";
|
|
14
12
|
import { normalizeChoiceScores } from "../../../BitmaskHelpers.js";
|
|
15
|
-
|
|
16
|
-
export class BridgeElementTypeInfo extends Record implements IEquatable<BridgeElementTypeInfo>, IComparable<BridgeElementTypeInfo> {
|
|
17
|
-
readonly Label: string;
|
|
18
|
-
readonly Control: string;
|
|
19
|
-
constructor(Label: string, Control: string) {
|
|
20
|
-
super();
|
|
21
|
-
this.Label = Label;
|
|
22
|
-
this.Control = Control;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function BridgeElementTypeInfo_$reflection(): TypeInfo {
|
|
27
|
-
return record_type("FormSpec.Integrations.CorEMR.CorEMRTemplateMapper.BridgeElementTypeInfo", [], BridgeElementTypeInfo, () => [["Label", string_type], ["Control", string_type]]);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function carriesTextOrDate(control: string): [boolean, boolean] {
|
|
31
|
-
let matchResult: int32, c_3: string;
|
|
32
|
-
switch (control) {
|
|
33
|
-
case "DateField":
|
|
34
|
-
case "DateFieldWithTime": {
|
|
35
|
-
matchResult = 0;
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
case "SignatureAndDate":
|
|
39
|
-
case "SignatureAndDateWithTime": {
|
|
40
|
-
matchResult = 1;
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
case "ShortAnswer":
|
|
44
|
-
case "NoteEssay": {
|
|
45
|
-
matchResult = 2;
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
case "PatientVitals": {
|
|
49
|
-
if (control.endsWith("PlusNotes")) {
|
|
50
|
-
matchResult = 3;
|
|
51
|
-
c_3 = control;
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
matchResult = 4;
|
|
55
|
-
}
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
case "AllergyFinder": {
|
|
59
|
-
if (control.endsWith("PlusNotes")) {
|
|
60
|
-
matchResult = 3;
|
|
61
|
-
c_3 = control;
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
matchResult = 4;
|
|
65
|
-
}
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
default:
|
|
69
|
-
if (control.endsWith("PlusNotes")) {
|
|
70
|
-
matchResult = 3;
|
|
71
|
-
c_3 = control;
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
matchResult = 5;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
switch (matchResult) {
|
|
78
|
-
case 0:
|
|
79
|
-
return [true, true] as [boolean, boolean];
|
|
80
|
-
case 1:
|
|
81
|
-
return [true, true] as [boolean, boolean];
|
|
82
|
-
case 2:
|
|
83
|
-
return [true, false] as [boolean, boolean];
|
|
84
|
-
case 3:
|
|
85
|
-
return [true, false] as [boolean, boolean];
|
|
86
|
-
case 4:
|
|
87
|
-
return [true, false] as [boolean, boolean];
|
|
88
|
-
default:
|
|
89
|
-
return [false, false] as [boolean, boolean];
|
|
90
|
-
}
|
|
91
|
-
}
|
|
13
|
+
import { FSharpRef } from "@fable-org/fable-library-js/Types.js";
|
|
92
14
|
|
|
93
15
|
/**
|
|
94
16
|
* Map catalog classification fields to the FormClassification DU.
|
|
@@ -148,13 +70,13 @@ export function mapFormClassification(formCategory: Option<string>, instrumentTy
|
|
|
148
70
|
* When elementTypes is non-empty, use it for ItemTypeName, HasText, HasDate, and bitmask detection.
|
|
149
71
|
* When elementTypes is empty, fallback to CorEMRElementTypeMap.
|
|
150
72
|
*/
|
|
151
|
-
export function mapNewTemplateToCoreMRDetail(elementTypes: FSharpMap<
|
|
73
|
+
export function mapNewTemplateToCoreMRDetail(elementTypes: FSharpMap<string, ElementTypeEntry>, template: TemplateForm): CoreMRFormDetail {
|
|
152
74
|
const metadata: CoreMRFormMetadata = new CoreMRFormMetadata(template.FormId, template.Name, isNullOrEmpty(template.Description) ? undefined : template.Description, ~~toInt32(template.CurrentVersionId), 1, undefined, template.RequiresSignature, template.IsIntake, template.FormCode, "");
|
|
153
75
|
const items: FSharpList<CoreMRItem> = map<TemplateItem, CoreMRItem>((item: TemplateItem): CoreMRItem => {
|
|
154
|
-
let info:
|
|
76
|
+
let info: ElementTypeEntry;
|
|
155
77
|
const itemTypeId: int32 = item.Type | 0;
|
|
156
|
-
const value:
|
|
157
|
-
info = defaultArg(tryFind<
|
|
78
|
+
const value: ElementTypeEntry = new ElementTypeEntry(`unresolved item kind ${itemTypeId}`, `unresolved_${itemTypeId}`);
|
|
79
|
+
info = defaultArg(tryFind<string, ElementTypeEntry>(int32ToString(itemTypeId), elementTypes), value);
|
|
158
80
|
const patternInput: [boolean, boolean] = carriesTextOrDate(info.Control);
|
|
159
81
|
return new CoreMRItem(item.ItemId, item.Sequence, item.NestingLevel, item.SequenceText, item.Type, info.Control, !isEmpty(item.Choices), patternInput[0], patternInput[1], item.Text, item.IsRequired, item.GenderRequired, map_1<int32, string>(int32ToString, item.Highlight), item.Code, item.Uuid, undefined, undefined, 0, 0, undefined);
|
|
160
82
|
}, template.Items);
|
|
@@ -194,4 +116,17 @@ export function mapNewTemplateToCoreMRDetail(elementTypes: FSharpMap<int32, Brid
|
|
|
194
116
|
}, item_2.Triggers), template.Items), empty<CoreMRTag>(), undefined);
|
|
195
117
|
}
|
|
196
118
|
|
|
119
|
+
/**
|
|
120
|
+
* ⭐ THE ONE `TemplateForm -> CoreMRFormData` PATH. A projection of the single builder above, so
|
|
121
|
+
* Studio and f1-api cannot drift: the same CoreMR form becomes the same record in both.
|
|
122
|
+
*
|
|
123
|
+
* ⚰️ It replaces `TemplateManifestDecoder.toCoreMRFormData`, a SECOND builder that stringified the
|
|
124
|
+
* item type code, hardcoded `HasText`/`HasDate`, dropped every trigger and tag, and never computed a
|
|
125
|
+
* choice's `BitPosition`. Studio used that one and f1-api used this one.
|
|
126
|
+
*/
|
|
127
|
+
export function toCoreMRFormData(elementTypes: FSharpMap<string, ElementTypeEntry>, template: TemplateForm): CoreMRFormData {
|
|
128
|
+
const detail: CoreMRFormDetail = mapNewTemplateToCoreMRDetail(elementTypes, template);
|
|
129
|
+
return new CoreMRFormData(detail.Metadata, detail.Items, detail.Choices, detail.Triggers, detail.Tags);
|
|
130
|
+
}
|
|
131
|
+
|
|
197
132
|
//# sourceMappingURL=CorEMRTemplateMapper.ts.map
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { Union, Record } from "@fable-org/fable-library-js/Types.js";
|
|
2
2
|
import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { int64 } from "@fable-org/fable-library-js/BigInt.js";
|
|
4
|
+
import { defaultArg, Option } from "@fable-org/fable-library-js/Option.js";
|
|
5
|
+
import { uncurry2, comparePrimitives, IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
|
|
6
6
|
import { union_type, bool_type, class_type, list_type, record_type, option_type, string_type, int64_type, int32_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { empty, FSharpList } from "@fable-org/fable-library-js/List.js";
|
|
8
|
+
import { empty as empty_1, ofList, FSharpMap } from "@fable-org/fable-library-js/Map.js";
|
|
9
9
|
import { Auto_generateBoxedDecoder_Z6670B51 } from "../../../Thoth.Json/packages/Thoth.Json/Decode.js";
|
|
10
10
|
import { FSharpResult$2_$union } from "@fable-org/fable-library-js/Result.js";
|
|
11
11
|
import { ErrorReason_$union } from "../../../Thoth.Json/packages/Thoth.Json/Types.js";
|
|
12
|
-
import { fromString, bool, list
|
|
13
|
-
import {
|
|
14
|
-
import { CoreMRFormData, CoreMRTag, CoreMRTrigger, CoreMRFormMetadata, CoreMRItem, CoreMRChoice } from "./CoreMRTypes.js";
|
|
12
|
+
import { fromString, bool, list, IOptionalGetter, IGetters, string, int, IRequiredGetter, object, map, keyValuePairs } from "../../../Thoth.Json/packages/Thoth.Json/Decode.js";
|
|
13
|
+
import { printf, toFail } from "@fable-org/fable-library-js/String.js";
|
|
15
14
|
|
|
16
15
|
export class TemplateChoice extends Record implements IEquatable<TemplateChoice>, IComparable<TemplateChoice> {
|
|
17
16
|
readonly ChoiceId: int32;
|
|
@@ -452,7 +451,7 @@ const choiceDecoder = (path_2: string): ((arg0: any) => FSharpResult$2_$union<Te
|
|
|
452
451
|
|
|
453
452
|
const triggerConditionDecoder = (path_6: string): ((arg0: any) => FSharpResult$2_$union<TriggerCondition, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<TriggerCondition, [string, ErrorReason_$union]> => object<TriggerCondition>((get$: IGetters): TriggerCondition => {
|
|
454
453
|
let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter, objectArg_2: IRequiredGetter, objectArg_3: IRequiredGetter, objectArg_4: IOptionalGetter, objectArg_5: IOptionalGetter, objectArg_6: IOptionalGetter;
|
|
455
|
-
return new TriggerCondition((objectArg = get$.Required, objectArg.Field<int32>("conditionId", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<int32>("sourceFieldId", uncurry2(int))), (objectArg_2 = get$.Required, objectArg_2.Field<string>("source", string)), (objectArg_3 = get$.Required, objectArg_3.Field<string>("operator", string)), defaultArg((objectArg_4 = get$.Optional, objectArg_4.Field<FSharpList<string>>("values", (path_3: string, value_3: any): FSharpResult$2_$union<FSharpList<string>, [string, ErrorReason_$union]> =>
|
|
454
|
+
return new TriggerCondition((objectArg = get$.Required, objectArg.Field<int32>("conditionId", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<int32>("sourceFieldId", uncurry2(int))), (objectArg_2 = get$.Required, objectArg_2.Field<string>("source", string)), (objectArg_3 = get$.Required, objectArg_3.Field<string>("operator", string)), defaultArg((objectArg_4 = get$.Optional, objectArg_4.Field<FSharpList<string>>("values", (path_3: string, value_3: any): FSharpResult$2_$union<FSharpList<string>, [string, ErrorReason_$union]> => list<string>(string, path_3, value_3))), empty<string>()), defaultArg((objectArg_5 = get$.Optional, objectArg_5.Field<FSharpList<int32>>("rawChoiceIds", (path_4: string, value_5: any): FSharpResult$2_$union<FSharpList<int32>, [string, ErrorReason_$union]> => list<int32>(uncurry2(int), path_4, value_5))), empty<int32>()), defaultArg((objectArg_6 = get$.Optional, objectArg_6.Field<string>("booleanOperator", string)), "&&"));
|
|
456
455
|
}, path_6, v));
|
|
457
456
|
|
|
458
457
|
const triggerActionDecoder = (path_2: string): ((arg0: any) => FSharpResult$2_$union<TriggerAction, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<TriggerAction, [string, ErrorReason_$union]> => object<TriggerAction>((get$: IGetters): TriggerAction => {
|
|
@@ -464,12 +463,12 @@ const triggerActionDecoder = (path_2: string): ((arg0: any) => FSharpResult$2_$u
|
|
|
464
463
|
|
|
465
464
|
const itemTriggerDecoder = (path_5: string): ((arg0: any) => FSharpResult$2_$union<ItemTrigger, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<ItemTrigger, [string, ErrorReason_$union]> => object<ItemTrigger>((get$: IGetters): ItemTrigger => {
|
|
466
465
|
let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter, objectArg_2: IOptionalGetter, objectArg_3: IOptionalGetter, objectArg_4: IOptionalGetter, objectArg_5: IOptionalGetter;
|
|
467
|
-
return new ItemTrigger((objectArg = get$.Required, objectArg.Field<int32>("triggerId", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<string>("eventName", string)), defaultArg((objectArg_2 = get$.Optional, objectArg_2.Field<boolean>("enabled", bool)), true), (objectArg_3 = get$.Optional, objectArg_3.Field<string>("exclusiveTag", string)), defaultArg((objectArg_4 = get$.Optional, objectArg_4.Field<FSharpList<TriggerCondition>>("conditions", (path_3: string, value_4: any): FSharpResult$2_$union<FSharpList<TriggerCondition>, [string, ErrorReason_$union]> =>
|
|
466
|
+
return new ItemTrigger((objectArg = get$.Required, objectArg.Field<int32>("triggerId", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<string>("eventName", string)), defaultArg((objectArg_2 = get$.Optional, objectArg_2.Field<boolean>("enabled", bool)), true), (objectArg_3 = get$.Optional, objectArg_3.Field<string>("exclusiveTag", string)), defaultArg((objectArg_4 = get$.Optional, objectArg_4.Field<FSharpList<TriggerCondition>>("conditions", (path_3: string, value_4: any): FSharpResult$2_$union<FSharpList<TriggerCondition>, [string, ErrorReason_$union]> => list<TriggerCondition>(uncurry2(triggerConditionDecoder), path_3, value_4))), empty<TriggerCondition>()), defaultArg((objectArg_5 = get$.Optional, objectArg_5.Field<FSharpList<TriggerAction>>("actions", (path_4: string, value_6: any): FSharpResult$2_$union<FSharpList<TriggerAction>, [string, ErrorReason_$union]> => list<TriggerAction>(uncurry2(triggerActionDecoder), path_4, value_6))), empty<TriggerAction>()));
|
|
468
467
|
}, path_5, v));
|
|
469
468
|
|
|
470
469
|
const itemDecoder = (path_8: string): ((arg0: any) => FSharpResult$2_$union<TemplateItem, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<TemplateItem, [string, ErrorReason_$union]> => object<TemplateItem>((get$: IGetters): TemplateItem => {
|
|
471
470
|
let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter, objectArg_2: IRequiredGetter, objectArg_3: IRequiredGetter, objectArg_4: IRequiredGetter, objectArg_5: IRequiredGetter, objectArg_6: IOptionalGetter, objectArg_7: IOptionalGetter, objectArg_8: IOptionalGetter, objectArg_9: IOptionalGetter, objectArg_10: IOptionalGetter, objectArg_11: IRequiredGetter, objectArg_12: IOptionalGetter;
|
|
472
|
-
return new TemplateItem((objectArg = get$.Required, objectArg.Field<int32>("itemId", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<int32>("sequence", uncurry2(int))), (objectArg_2 = get$.Required, objectArg_2.Field<int32>("type", uncurry2(int))), (objectArg_3 = get$.Required, objectArg_3.Field<int32>("nestingLevel", uncurry2(int))), (objectArg_4 = get$.Required, objectArg_4.Field<boolean>("isRequired", bool)), (objectArg_5 = get$.Required, objectArg_5.Field<string>("text", string)), (objectArg_6 = get$.Optional, objectArg_6.Field<string>("sequenceText", string)), (objectArg_7 = get$.Optional, objectArg_7.Field<string>("code", string)), (objectArg_8 = get$.Optional, objectArg_8.Field<string>("uuid", string)), (objectArg_9 = get$.Optional, objectArg_9.Field<string>("genderRequired", string)), (objectArg_10 = get$.Optional, objectArg_10.Field<int32>("highlight", uncurry2(int))), (objectArg_11 = get$.Required, objectArg_11.Field<FSharpList<TemplateChoice>>("choices", (path_6: string, value_6: any): FSharpResult$2_$union<FSharpList<TemplateChoice>, [string, ErrorReason_$union]> =>
|
|
471
|
+
return new TemplateItem((objectArg = get$.Required, objectArg.Field<int32>("itemId", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<int32>("sequence", uncurry2(int))), (objectArg_2 = get$.Required, objectArg_2.Field<int32>("type", uncurry2(int))), (objectArg_3 = get$.Required, objectArg_3.Field<int32>("nestingLevel", uncurry2(int))), (objectArg_4 = get$.Required, objectArg_4.Field<boolean>("isRequired", bool)), (objectArg_5 = get$.Required, objectArg_5.Field<string>("text", string)), (objectArg_6 = get$.Optional, objectArg_6.Field<string>("sequenceText", string)), (objectArg_7 = get$.Optional, objectArg_7.Field<string>("code", string)), (objectArg_8 = get$.Optional, objectArg_8.Field<string>("uuid", string)), (objectArg_9 = get$.Optional, objectArg_9.Field<string>("genderRequired", string)), (objectArg_10 = get$.Optional, objectArg_10.Field<int32>("highlight", uncurry2(int))), (objectArg_11 = get$.Required, objectArg_11.Field<FSharpList<TemplateChoice>>("choices", (path_6: string, value_6: any): FSharpResult$2_$union<FSharpList<TemplateChoice>, [string, ErrorReason_$union]> => list<TemplateChoice>(uncurry2(choiceDecoder), path_6, value_6))), defaultArg((objectArg_12 = get$.Optional, objectArg_12.Field<FSharpList<ItemTrigger>>("triggers", (path_7: string, value_7: any): FSharpResult$2_$union<FSharpList<ItemTrigger>, [string, ErrorReason_$union]> => list<ItemTrigger>(uncurry2(itemTriggerDecoder), path_7, value_7))), empty<ItemTrigger>()));
|
|
473
472
|
}, path_8, v));
|
|
474
473
|
|
|
475
474
|
const encounterTypesDecoder = (path_4: string): ((arg0: any) => FSharpResult$2_$union<EncounterTypes, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<EncounterTypes, [string, ErrorReason_$union]> => object<EncounterTypes>((get$: IGetters): EncounterTypes => {
|
|
@@ -484,12 +483,12 @@ const scoringLabelDecoder = (path_1: string): ((arg0: any) => FSharpResult$2_$un
|
|
|
484
483
|
|
|
485
484
|
const formScoringDecoder = (path_2: string): ((arg0: any) => FSharpResult$2_$union<FormScoring, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<FormScoring, [string, ErrorReason_$union]> => object<FormScoring>((get$: IGetters): FormScoring => {
|
|
486
485
|
let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter, objectArg_2: IRequiredGetter, arg_7: ((arg0: string) => ((arg0: any) => FSharpResult$2_$union<FSharpMap<string, int32>, [string, ErrorReason_$union]>)), objectArg_3: IRequiredGetter;
|
|
487
|
-
return new FormScoring((objectArg = get$.Required, objectArg.Field<int32>("scoreId", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<string>("scoreName", string)), (objectArg_2 = get$.Required, objectArg_2.Field<FSharpList<ScoringLabel>>("labels", (path_1: string, value_1: any): FSharpResult$2_$union<FSharpList<ScoringLabel>, [string, ErrorReason_$union]> =>
|
|
486
|
+
return new FormScoring((objectArg = get$.Required, objectArg.Field<int32>("scoreId", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<string>("scoreName", string)), (objectArg_2 = get$.Required, objectArg_2.Field<FSharpList<ScoringLabel>>("labels", (path_1: string, value_1: any): FSharpResult$2_$union<FSharpList<ScoringLabel>, [string, ErrorReason_$union]> => list<ScoringLabel>(uncurry2(scoringLabelDecoder), path_1, value_1))), (arg_7 = dictDecoder<int32>(uncurry2(int)), (objectArg_3 = get$.Required, objectArg_3.Field<FSharpMap<string, int32>>("choiceScores", uncurry2(arg_7)))));
|
|
488
487
|
}, path_2, v));
|
|
489
488
|
|
|
490
489
|
const formDecoder = (path_13: string): ((arg0: any) => FSharpResult$2_$union<TemplateForm, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<TemplateForm, [string, ErrorReason_$union]> => object<TemplateForm>((get$: IGetters): TemplateForm => {
|
|
491
490
|
let objectArg: IRequiredGetter, objectArg_1: IRequiredGetter, objectArg_2: IRequiredGetter, objectArg_3: IRequiredGetter, objectArg_4: IRequiredGetter, objectArg_5: IRequiredGetter, objectArg_6: IRequiredGetter, objectArg_7: IRequiredGetter, objectArg_8: IRequiredGetter, objectArg_9: IRequiredGetter, objectArg_10: IRequiredGetter, objectArg_11: IRequiredGetter, objectArg_12: IRequiredGetter, objectArg_13: IRequiredGetter, objectArg_14: IRequiredGetter, objectArg_15: IRequiredGetter, objectArg_16: IOptionalGetter;
|
|
492
|
-
return new TemplateForm((objectArg = get$.Required, objectArg.Field<int32>("formId", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<string>("name", string)), (objectArg_2 = get$.Required, objectArg_2.Field<string>("formCode", string)), (objectArg_3 = get$.Required, objectArg_3.Field<string>("formCodeSource", string)), (objectArg_4 = get$.Required, objectArg_4.Field<string>("description", string)), (objectArg_5 = get$.Required, objectArg_5.Field<int64>("currentVersionId", uncurry2(liberatedInt64Decoder))), (objectArg_6 = get$.Required, objectArg_6.Field<boolean>("isIntake", bool)), (objectArg_7 = get$.Required, objectArg_7.Field<string>("usage", string)), (objectArg_8 = get$.Required, objectArg_8.Field<boolean>("requiresSignature", bool)), (objectArg_9 = get$.Required, objectArg_9.Field<EncounterTypes>("encounterTypes", uncurry2(encounterTypesDecoder))), (objectArg_10 = get$.Required, objectArg_10.Field<boolean>("onceAYear", bool)), (objectArg_11 = get$.Required, objectArg_11.Field<string>("structureHash", string)), (objectArg_12 = get$.Required, objectArg_12.Field<string>("clinicalHash", string)), (objectArg_13 = get$.Required, objectArg_13.Field<string>("cosmeticHash", string)), (objectArg_14 = get$.Required, objectArg_14.Field<string>("hash", string)), (objectArg_15 = get$.Required, objectArg_15.Field<FSharpList<TemplateItem>>("items", (path_12: string, value_12: any): FSharpResult$2_$union<FSharpList<TemplateItem>, [string, ErrorReason_$union]> =>
|
|
491
|
+
return new TemplateForm((objectArg = get$.Required, objectArg.Field<int32>("formId", uncurry2(int))), (objectArg_1 = get$.Required, objectArg_1.Field<string>("name", string)), (objectArg_2 = get$.Required, objectArg_2.Field<string>("formCode", string)), (objectArg_3 = get$.Required, objectArg_3.Field<string>("formCodeSource", string)), (objectArg_4 = get$.Required, objectArg_4.Field<string>("description", string)), (objectArg_5 = get$.Required, objectArg_5.Field<int64>("currentVersionId", uncurry2(liberatedInt64Decoder))), (objectArg_6 = get$.Required, objectArg_6.Field<boolean>("isIntake", bool)), (objectArg_7 = get$.Required, objectArg_7.Field<string>("usage", string)), (objectArg_8 = get$.Required, objectArg_8.Field<boolean>("requiresSignature", bool)), (objectArg_9 = get$.Required, objectArg_9.Field<EncounterTypes>("encounterTypes", uncurry2(encounterTypesDecoder))), (objectArg_10 = get$.Required, objectArg_10.Field<boolean>("onceAYear", bool)), (objectArg_11 = get$.Required, objectArg_11.Field<string>("structureHash", string)), (objectArg_12 = get$.Required, objectArg_12.Field<string>("clinicalHash", string)), (objectArg_13 = get$.Required, objectArg_13.Field<string>("cosmeticHash", string)), (objectArg_14 = get$.Required, objectArg_14.Field<string>("hash", string)), (objectArg_15 = get$.Required, objectArg_15.Field<FSharpList<TemplateItem>>("items", (path_12: string, value_12: any): FSharpResult$2_$union<FSharpList<TemplateItem>, [string, ErrorReason_$union]> => list<TemplateItem>(uncurry2(itemDecoder), path_12, value_12))), (objectArg_16 = get$.Optional, objectArg_16.Field<FormScoring>("scoring", uncurry2(formScoringDecoder))));
|
|
493
492
|
}, path_13, v));
|
|
494
493
|
|
|
495
494
|
const elementTypeDecoder = (path_2: string): ((arg0: any) => FSharpResult$2_$union<ElementTypeEntry, [string, ErrorReason_$union]>) => ((v: any): FSharpResult$2_$union<ElementTypeEntry, [string, ErrorReason_$union]> => object<ElementTypeEntry>((get$: IGetters): ElementTypeEntry => {
|
|
@@ -551,11 +550,9 @@ const manifestDecoder = (path_3: string): ((arg0: any) => FSharpResult$2_$union<
|
|
|
551
550
|
return new TemplateManifest((objectArg = get$.Optional, objectArg.Field<string>("$schema", string)), (objectArg_1 = get$.Required, objectArg_1.Field<int32>("version", uncurry2(int))), (objectArg_2 = get$.Required, objectArg_2.Field<string>("generatedAt", string)), (objectArg_3 = get$.Required, objectArg_3.Field<string>("generatedFrom", string)), (objectArg_4 = get$.Required, objectArg_4.Field<CoreEmrInfo>("coreEmr", uncurry2(coreEmrDecoder))), (objectArg_5 = get$.Required, objectArg_5.Field<TemplateStats>("stats", uncurry2(statsDecoder))), (arg_13 = dictDecoder<ElementTypeEntry>(uncurry2(elementTypeDecoder)), (objectArg_6 = get$.Optional, objectArg_6.Field<FSharpMap<string, ElementTypeEntry>>("elementTypes", uncurry2(arg_13)))), defaultArg((objectArg_7 = get$.Optional, objectArg_7.Field<ElementTypesFrom_$union>("elementTypesFrom", uncurry2(elementTypesFromDecoder))), ElementTypesFrom_NotInRelease("the manifest carried no `elementTypesFrom`, so no provenance for the item-type vocabulary was stated")), (arg_17 = dictDecoder<TemplateForm>(uncurry2(formDecoder)), (objectArg_8 = get$.Required, objectArg_8.Field<FSharpMap<string, TemplateForm>>("forms", uncurry2(arg_17)))), (arg_19 = dictDecoder<InstrumentMapEntry>(uncurry2(instrumentMapEntryDecoder)), (objectArg_9 = get$.Required, objectArg_9.Field<FSharpMap<string, InstrumentMapEntry>>("instrumentMap", uncurry2(arg_19)))), (objectArg_10 = get$.Required, objectArg_10.Field<InstrumentMapStats>("instrumentMapStats", uncurry2(instrumentMapStatsDecoder))));
|
|
552
551
|
}, path_3, v));
|
|
553
552
|
|
|
554
|
-
function toCoreMRChoice(itemId: int32, c: TemplateChoice): CoreMRChoice {
|
|
555
|
-
return new CoreMRChoice(c.ChoiceId, itemId, c.Sequence, c.Text, c.Score, c.BitPosition, c.Code, map_1<int32, string>(int32ToString, c.Highlight));
|
|
556
|
-
}
|
|
557
|
-
|
|
558
553
|
/**
|
|
554
|
+
* Convert a TemplateChoice to CoreMRChoice (FormSpec type).
|
|
555
|
+
* Score stays int64 — raw scores can reach 2^31 for bitmask forms.
|
|
559
556
|
* Does this control carry free text, and does it carry a date?
|
|
560
557
|
*
|
|
561
558
|
* ⭐ THE ONE IMPLEMENTATION. It lives here because this file compiles before every adapter that needs
|
|
@@ -628,26 +625,6 @@ export function carriesTextOrDate(control: string): [boolean, boolean] {
|
|
|
628
625
|
}
|
|
629
626
|
}
|
|
630
627
|
|
|
631
|
-
function toCoreMRItem(kinds: FSharpMap<string, ElementTypeEntry>, item: TemplateItem): CoreMRItem {
|
|
632
|
-
let control: string;
|
|
633
|
-
const value = `unresolved_${item.Type}`;
|
|
634
|
-
control = defaultArg(map_1<ElementTypeEntry, string>((k: ElementTypeEntry): string => k.Control, tryFind<string, ElementTypeEntry>(int32ToString(item.Type), kinds)), value);
|
|
635
|
-
const patternInput: [boolean, boolean] = carriesTextOrDate(control);
|
|
636
|
-
return new CoreMRItem(item.ItemId, item.Sequence, item.NestingLevel, item.SequenceText, item.Type, control, !isEmpty(item.Choices), patternInput[0], patternInput[1], item.Text, item.IsRequired, item.GenderRequired, map_1<int32, string>(int32ToString, item.Highlight), item.Code, item.Uuid, undefined, undefined, 0, 0, undefined);
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
/**
|
|
640
|
-
* Convert a TemplateForm to CoreMRFormData — the universal pipeline input.
|
|
641
|
-
* ⭐ `kinds` IS REQUIRED — the manifest's item vocabulary, stated by the site or declared by conduit.
|
|
642
|
-
* ⛔ It is not optional and it does not default: the whole point of FLIP-9 is that a form's fields are
|
|
643
|
-
* typed by what the SITE says an item kind is, and a caller that has no kinds is a caller whose items
|
|
644
|
-
* cannot be resolved. Passing `Map.empty` is a legitimate statement ("nothing states them"), and every
|
|
645
|
-
* field then arrives NAMED as unresolved rather than silently guessed.
|
|
646
|
-
*/
|
|
647
|
-
export function toCoreMRFormData(kinds: FSharpMap<string, ElementTypeEntry>, form: TemplateForm): CoreMRFormData {
|
|
648
|
-
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>((item: TemplateItem): CoreMRItem => toCoreMRItem(kinds, item), 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<CoreMRTrigger>(), empty<CoreMRTag>());
|
|
649
|
-
}
|
|
650
|
-
|
|
651
628
|
/**
|
|
652
629
|
* Decode templates.json manifest. Strict (all-or-nothing).
|
|
653
630
|
*/
|