@f1studio/form-spec 5.0.0-alpha.117 → 5.0.0-alpha.123
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/FormSpec.d.ts +41 -1
- package/FormSpec.FS/FormSpec.d.ts.map +1 -1
- package/FormSpec.FS/FormSpecHelpers.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.d.ts +6 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.d.ts +5 -0
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.d.ts +72 -0
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.d.ts.map +1 -0
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.d.ts +15 -9
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.d.ts.map +1 -1
- package/FormSpec.FS/Interop/FormSpec.Api.Helpers.d.ts +0 -7
- package/FormSpec.FS/Interop/FormSpec.Api.Helpers.d.ts.map +1 -1
- package/FormSpec.FS/Interop/FormSpec.Api.Option.d.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/BlueprintValidation.js +1 -1
- package/FormSpec.TS/FormSpec.FS/BlueprintValidation.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/BlueprintValidation.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Designer.js +1 -1
- package/FormSpec.TS/FormSpec.FS/Designer.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Designer.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/FormSpec.js +129 -1
- package/FormSpec.TS/FormSpec.FS/FormSpec.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/FormSpec.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.js +1 -1
- package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/FormSpecValues.js +2 -2
- package/FormSpec.TS/FormSpec.FS/FormSpecValues.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/FormSpecValues.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Helpers.js +11 -11
- package/FormSpec.TS/FormSpec.FS/Helpers.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Helpers.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.js +4 -4
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.js +9 -2
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.js +360 -0
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.js.map +1 -0
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.ts.map +1 -0
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js +119 -46
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js +40 -24
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js +41 -106
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.js +1 -1
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.ts.map +1 -1
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.js.map +1 -1
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.ts.map +1 -1
- package/FormSpec.TS/fable_modules/project_cracked.json +1 -1
- package/FormSpec.TS/plugins/bmi/src/BMIField.js +193 -275
- package/FormSpec.TS/plugins/bmi/src/BMIField.js.map +1 -1
- package/FormSpec.TS/plugins/bmi/src/BMIField.ts.map +1 -1
- package/FormSpec.TS/plugins/likert/src/LikertField.js +19 -138
- package/FormSpec.TS/plugins/likert/src/LikertField.js.map +1 -1
- package/FormSpec.TS/plugins/likert/src/LikertField.ts.map +1 -1
- package/README.md +19 -13
- package/package.json +1 -1
- package/plugins/bmi/src/BMIField.d.ts.map +1 -1
- package/plugins/likert/src/LikertField.d.ts.map +1 -1
- package/src/FormSpec.FS/BlueprintValidation.ts +1 -1
- package/src/FormSpec.FS/Designer.ts +1 -1
- package/src/FormSpec.FS/FormSpec.ts +92 -2
- package/src/FormSpec.FS/FormSpecHelpers.ts +2 -2
- package/src/FormSpec.FS/FormSpecValues.ts +2 -2
- package/src/FormSpec.FS/Helpers.ts +11 -11
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.ts +8 -4
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.ts +11 -2
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.ts +222 -0
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts +2 -2
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts +123 -51
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts +44 -25
- package/src/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts +57 -102
- package/src/FormSpec.FS/Interop/FormSpec.Api.Option.ts +2 -2
- package/src/plugins/bmi/src/BMIField.ts +62 -82
- package/src/plugins/likert/src/LikertField.ts +20 -95
- package/FormSpec.FS/Interop/PluginPropertyKeyRegistry.d.ts +0 -16
- package/FormSpec.FS/Interop/PluginPropertyKeyRegistry.d.ts.map +0 -1
- package/FormSpec.TS/FormSpec.FS/Interop/PluginPropertyKeyRegistry.js +0 -121
- package/FormSpec.TS/FormSpec.FS/Interop/PluginPropertyKeyRegistry.js.map +0 -1
- package/FormSpec.TS/FormSpec.FS/Interop/PluginPropertyKeyRegistry.ts.map +0 -1
- package/fable_modules/Feliz.2.8.0/Colors.fs.d.ts +0 -9
- package/fable_modules/Feliz.2.8.0/Colors.fs.d.ts.map +0 -1
- package/src/FormSpec.FS/Interop/PluginPropertyKeyRegistry.ts +0 -96
|
@@ -1373,6 +1373,94 @@ export function Spec_FilledMeta_$reflection(): TypeInfo {
|
|
|
1373
1373
|
return record_type("F1.Studio.Spec.FilledMeta", [], Spec_FilledMeta, () => [["InstanceId", class_type("System.Guid")], ["SourceBlueprintId", class_type("System.Guid")], ["FilledBy", option_type(string_type)], ["FilledAt", option_type(class_type("System.DateTimeOffset"))], ["LastModifiedAt", option_type(class_type("System.DateTimeOffset"))], ["Signatures", list_type(Values_Signature_$reflection())], ["Notes", option_type(string_type)]]);
|
|
1374
1374
|
}
|
|
1375
1375
|
|
|
1376
|
+
export type Spec_InstrumentConfidence_$union =
|
|
1377
|
+
| Spec_InstrumentConfidence<0>
|
|
1378
|
+
| Spec_InstrumentConfidence<1>
|
|
1379
|
+
|
|
1380
|
+
export type Spec_InstrumentConfidence_$cases = {
|
|
1381
|
+
0: ["Exact", []],
|
|
1382
|
+
1: ["Inferred", []]
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
export function Spec_InstrumentConfidence_Exact() {
|
|
1386
|
+
return new Spec_InstrumentConfidence<0>(0, []);
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
export function Spec_InstrumentConfidence_Inferred() {
|
|
1390
|
+
return new Spec_InstrumentConfidence<1>(1, []);
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
export class Spec_InstrumentConfidence<Tag extends keyof Spec_InstrumentConfidence_$cases> extends Union<Tag, Spec_InstrumentConfidence_$cases[Tag][0]> {
|
|
1394
|
+
constructor(readonly tag: Tag, readonly fields: Spec_InstrumentConfidence_$cases[Tag][1]) {
|
|
1395
|
+
super();
|
|
1396
|
+
}
|
|
1397
|
+
cases() {
|
|
1398
|
+
return ["Exact", "Inferred"];
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1402
|
+
export function Spec_InstrumentConfidence_$reflection(): TypeInfo {
|
|
1403
|
+
return union_type("F1.Studio.Spec.InstrumentConfidence", [], Spec_InstrumentConfidence, () => [[], []]);
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
export class Spec_ClinicalInstrumentInfo extends Record implements IEquatable<Spec_ClinicalInstrumentInfo>, IComparable<Spec_ClinicalInstrumentInfo> {
|
|
1407
|
+
readonly InstrumentType: string;
|
|
1408
|
+
readonly Confidence: Spec_InstrumentConfidence_$union;
|
|
1409
|
+
readonly MaxScore: Option<int32>;
|
|
1410
|
+
constructor(InstrumentType: string, Confidence: Spec_InstrumentConfidence_$union, MaxScore: Option<int32>) {
|
|
1411
|
+
super();
|
|
1412
|
+
this.InstrumentType = InstrumentType;
|
|
1413
|
+
this.Confidence = Confidence;
|
|
1414
|
+
this.MaxScore = MaxScore;
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
export function Spec_ClinicalInstrumentInfo_$reflection(): TypeInfo {
|
|
1419
|
+
return record_type("F1.Studio.Spec.ClinicalInstrumentInfo", [], Spec_ClinicalInstrumentInfo, () => [["InstrumentType", string_type], ["Confidence", Spec_InstrumentConfidence_$reflection()], ["MaxScore", option_type(int32_type)]]);
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
export type Spec_FormClassification_$union =
|
|
1423
|
+
| Spec_FormClassification<0>
|
|
1424
|
+
| Spec_FormClassification<1>
|
|
1425
|
+
| Spec_FormClassification<2>
|
|
1426
|
+
| Spec_FormClassification<3>
|
|
1427
|
+
|
|
1428
|
+
export type Spec_FormClassification_$cases = {
|
|
1429
|
+
0: ["ClinicalInstrument", [Spec_ClinicalInstrumentInfo]],
|
|
1430
|
+
1: ["Intake", []],
|
|
1431
|
+
2: ["Screening", []],
|
|
1432
|
+
3: ["General", []]
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
export function Spec_FormClassification_ClinicalInstrument(Item: Spec_ClinicalInstrumentInfo) {
|
|
1436
|
+
return new Spec_FormClassification<0>(0, [Item]);
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
export function Spec_FormClassification_Intake() {
|
|
1440
|
+
return new Spec_FormClassification<1>(1, []);
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
export function Spec_FormClassification_Screening() {
|
|
1444
|
+
return new Spec_FormClassification<2>(2, []);
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
export function Spec_FormClassification_General() {
|
|
1448
|
+
return new Spec_FormClassification<3>(3, []);
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
export class Spec_FormClassification<Tag extends keyof Spec_FormClassification_$cases> extends Union<Tag, Spec_FormClassification_$cases[Tag][0]> {
|
|
1452
|
+
constructor(readonly tag: Tag, readonly fields: Spec_FormClassification_$cases[Tag][1]) {
|
|
1453
|
+
super();
|
|
1454
|
+
}
|
|
1455
|
+
cases() {
|
|
1456
|
+
return ["ClinicalInstrument", "Intake", "Screening", "General"];
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
export function Spec_FormClassification_$reflection(): TypeInfo {
|
|
1461
|
+
return union_type("F1.Studio.Spec.FormClassification", [], Spec_FormClassification, () => [[["Item", Spec_ClinicalInstrumentInfo_$reflection()]], [], [], []]);
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1376
1464
|
export class Spec_FormSpec$1<FieldType> extends Record implements IEquatable<Spec_FormSpec$1<FieldType>>, IComparable<Spec_FormSpec$1<FieldType>> {
|
|
1377
1465
|
readonly Id: string;
|
|
1378
1466
|
readonly Code: Option<string>;
|
|
@@ -1391,7 +1479,8 @@ export class Spec_FormSpec$1<FieldType> extends Record implements IEquatable<Spe
|
|
|
1391
1479
|
readonly FilledMeta: Option<Spec_FilledMeta>;
|
|
1392
1480
|
readonly CustomData: Option<FSharpMap<string, string>>;
|
|
1393
1481
|
readonly Provenance: Option<IntegrationProvenance>;
|
|
1394
|
-
|
|
1482
|
+
readonly Classification: Spec_FormClassification_$union;
|
|
1483
|
+
constructor(Id: string, Code: Option<string>, Title: string, Abstract: string, Version: string, FormSpecVersion: string, Steps: FSharpList<Spec_FormStep$1<FieldType>>, CategoryTags: FSharpList<string>, Score: Option<Spec_Score>, AssociatedCodes: FSharpList<string>, RequiresReview: boolean, RequiresReviewAndApproval: boolean, ClinicalPathway: Option<ClinicalPathway_ClinicalPathwaySpec>, Lifecycle: Spec_FormLifecycle_$union, FilledMeta: Option<Spec_FilledMeta>, CustomData: Option<FSharpMap<string, string>>, Provenance: Option<IntegrationProvenance>, Classification: Spec_FormClassification_$union) {
|
|
1395
1484
|
super();
|
|
1396
1485
|
this.Id = Id;
|
|
1397
1486
|
this.Code = Code;
|
|
@@ -1410,11 +1499,12 @@ export class Spec_FormSpec$1<FieldType> extends Record implements IEquatable<Spe
|
|
|
1410
1499
|
this.FilledMeta = FilledMeta;
|
|
1411
1500
|
this.CustomData = CustomData;
|
|
1412
1501
|
this.Provenance = Provenance;
|
|
1502
|
+
this.Classification = Classification;
|
|
1413
1503
|
}
|
|
1414
1504
|
}
|
|
1415
1505
|
|
|
1416
1506
|
export function Spec_FormSpec$1_$reflection(gen0: TypeInfo): TypeInfo {
|
|
1417
|
-
return record_type("F1.Studio.Spec.FormSpec`1", [gen0], Spec_FormSpec$1, () => [["Id", class_type("System.Guid")], ["Code", option_type(string_type)], ["Title", string_type], ["Abstract", string_type], ["Version", string_type], ["FormSpecVersion", string_type], ["Steps", list_type(Spec_FormStep$1_$reflection(gen0))], ["CategoryTags", list_type(string_type)], ["Score", option_type(Spec_Score_$reflection())], ["AssociatedCodes", list_type(string_type)], ["RequiresReview", bool_type], ["RequiresReviewAndApproval", bool_type], ["ClinicalPathway", option_type(ClinicalPathway_ClinicalPathwaySpec_$reflection())], ["Lifecycle", Spec_FormLifecycle_$reflection()], ["FilledMeta", option_type(Spec_FilledMeta_$reflection())], ["CustomData", option_type(class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, string_type]))], ["Provenance", option_type(IntegrationProvenance_$reflection())]]);
|
|
1507
|
+
return record_type("F1.Studio.Spec.FormSpec`1", [gen0], Spec_FormSpec$1, () => [["Id", class_type("System.Guid")], ["Code", option_type(string_type)], ["Title", string_type], ["Abstract", string_type], ["Version", string_type], ["FormSpecVersion", string_type], ["Steps", list_type(Spec_FormStep$1_$reflection(gen0))], ["CategoryTags", list_type(string_type)], ["Score", option_type(Spec_Score_$reflection())], ["AssociatedCodes", list_type(string_type)], ["RequiresReview", bool_type], ["RequiresReviewAndApproval", bool_type], ["ClinicalPathway", option_type(ClinicalPathway_ClinicalPathwaySpec_$reflection())], ["Lifecycle", Spec_FormLifecycle_$reflection()], ["FilledMeta", option_type(Spec_FilledMeta_$reflection())], ["CustomData", option_type(class_type("Microsoft.FSharp.Collections.FSharpMap`2", [string_type, string_type]))], ["Provenance", option_type(IntegrationProvenance_$reflection())], ["Classification", Spec_FormClassification_$reflection()]]);
|
|
1418
1508
|
}
|
|
1419
1509
|
|
|
1420
1510
|
export function Spec_Evaluator__get_Key(x: Spec_Evaluator_$union): string {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { singleton, head, isEmpty, ofSeq, iterate, forAll, exists, sumBy, collect, tryFind, FSharpList, empty, sortBy, mapIndexed, map } from "@fable-org/fable-library-js/List.js";
|
|
2
2
|
import { tryParse as tryParse_1, float64, int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
3
3
|
import { getFieldDetails, FormSpecMetadata, FieldDetails$1 } from "./FormSpecValues.js";
|
|
4
|
-
import { Shared_FieldValue_Single, Shared_FieldValue_PluginData, Shared_FieldValue_Matrix, Shared_FieldValue_Multiple, Shared_ConditionValue_Single, Shared_ConditionValue_PluginData, Shared_ConditionValue_Matrix, Shared_ConditionValue_Multiple, ClinicalPathway_ConstraintDefinition, ClinicalPathway_ConstraintType_$union, ClinicalPathway_TransitionDefinition, ClinicalPathway_ClinicalPathwaySpec, ClinicalPathway_TransitionCondition_$union, ClinicalPathway_LogicalOp_$union, Shared_MatrixAnswer, Shared_PluginPropertyKey, Shared_FieldOptionKey, Shared_ConditionValue_$union, ClinicalPathway_FieldEvaluator_$union, Shared_PluginDataProperty_$reflection, Shared_PluginDataProperty, Shared_MatrixItemKey, Shared_FieldAnswer, Shared_FieldValue_$union, Spec_FormSpec$1, Spec_FormLifecycle_Draft, Values_StepOrder, Spec_FormStep$1, Shared_FieldKey, Spec_FormField$1, Spec_FieldType_$union } from "./FormSpec.js";
|
|
4
|
+
import { Shared_FieldValue_Single, Shared_FieldValue_PluginData, Shared_FieldValue_Matrix, Shared_FieldValue_Multiple, Shared_ConditionValue_Single, Shared_ConditionValue_PluginData, Shared_ConditionValue_Matrix, Shared_ConditionValue_Multiple, ClinicalPathway_ConstraintDefinition, ClinicalPathway_ConstraintType_$union, ClinicalPathway_TransitionDefinition, ClinicalPathway_ClinicalPathwaySpec, ClinicalPathway_TransitionCondition_$union, ClinicalPathway_LogicalOp_$union, Shared_MatrixAnswer, Shared_PluginPropertyKey, Shared_FieldOptionKey, Shared_ConditionValue_$union, ClinicalPathway_FieldEvaluator_$union, Shared_PluginDataProperty_$reflection, Shared_PluginDataProperty, Shared_MatrixItemKey, Shared_FieldAnswer, Shared_FieldValue_$union, Spec_FormSpec$1, Spec_FormClassification_General, Spec_FormLifecycle_Draft, Values_StepOrder, Spec_FormStep$1, Shared_FieldKey, Spec_FormField$1, Spec_FieldType_$union } from "./FormSpec.js";
|
|
5
5
|
import { FSharpMap, toList } from "@fable-org/fable-library-js/Map.js";
|
|
6
6
|
import { compare, int32ToString, equals, comparePrimitives } from "@fable-org/fable-library-js/Util.js";
|
|
7
7
|
import { newGuid } from "@fable-org/fable-library-js/Guid.js";
|
|
@@ -30,7 +30,7 @@ export function buildFormSpecFromResultStepsMap(details: FormSpecMetadata, steps
|
|
|
30
30
|
})));
|
|
31
31
|
}, sortBy<[Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>], int32>((tupledArg: [Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>]): int32 => tupledArg[0].fields[0], toList<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>>(stepsMap), {
|
|
32
32
|
Compare: comparePrimitives,
|
|
33
|
-
})), empty<string>(), details.MaxScore, empty<string>(), false, false, undefined, Spec_FormLifecycle_Draft(newGuid()), undefined, undefined, undefined);
|
|
33
|
+
})), empty<string>(), details.MaxScore, empty<string>(), false, false, undefined, Spec_FormLifecycle_Draft(newGuid()), undefined, undefined, undefined, Spec_FormClassification_General());
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
@@ -123,7 +123,7 @@ export function updateField<FieldType>(spec: Spec_FormSpec$1<FieldType>, fieldKe
|
|
|
123
123
|
else {
|
|
124
124
|
return step;
|
|
125
125
|
}
|
|
126
|
-
}, spec.Steps), spec.CategoryTags, spec.Score, spec.AssociatedCodes, spec.RequiresReview, spec.RequiresReviewAndApproval, spec.ClinicalPathway, spec.Lifecycle, spec.FilledMeta, spec.CustomData, spec.Provenance);
|
|
126
|
+
}, spec.Steps), spec.CategoryTags, spec.Score, spec.AssociatedCodes, spec.RequiresReview, spec.RequiresReviewAndApproval, spec.ClinicalPathway, spec.Lifecycle, spec.FilledMeta, spec.CustomData, spec.Provenance, spec.Classification);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
/**
|
|
@@ -146,7 +146,7 @@ export function updateFieldDocumentation<FieldType>(spec: Spec_FormSpec$1<FieldT
|
|
|
146
146
|
else {
|
|
147
147
|
return step;
|
|
148
148
|
}
|
|
149
|
-
}, spec.Steps), spec.CategoryTags, spec.Score, spec.AssociatedCodes, spec.RequiresReview, spec.RequiresReviewAndApproval, spec.ClinicalPathway, spec.Lifecycle, spec.FilledMeta, spec.CustomData, spec.Provenance);
|
|
149
|
+
}, spec.Steps), spec.CategoryTags, spec.Score, spec.AssociatedCodes, spec.RequiresReview, spec.RequiresReviewAndApproval, spec.ClinicalPathway, spec.Lifecycle, spec.FilledMeta, spec.CustomData, spec.Provenance, spec.Classification);
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
/**
|
|
@@ -413,7 +413,7 @@ export function Helpers_FormSpecMutators_updateFormFieldInFormSpecStep<UserField
|
|
|
413
413
|
else {
|
|
414
414
|
return s;
|
|
415
415
|
}
|
|
416
|
-
}, formSpec.Steps), formSpec.CategoryTags, formSpec.Score, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, formSpec.ClinicalPathway, formSpec.Lifecycle, formSpec.FilledMeta, formSpec.CustomData, formSpec.Provenance);
|
|
416
|
+
}, formSpec.Steps), formSpec.CategoryTags, formSpec.Score, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, formSpec.ClinicalPathway, formSpec.Lifecycle, formSpec.FilledMeta, formSpec.CustomData, formSpec.Provenance, formSpec.Classification);
|
|
417
417
|
}
|
|
418
418
|
|
|
419
419
|
/**
|
|
@@ -427,7 +427,7 @@ export function Helpers_FormSpecMutators_updateFormStepInFormSpec<UserField>(for
|
|
|
427
427
|
else {
|
|
428
428
|
return s;
|
|
429
429
|
}
|
|
430
|
-
}, formSpec.Steps), formSpec.CategoryTags, formSpec.Score, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, formSpec.ClinicalPathway, formSpec.Lifecycle, formSpec.FilledMeta, formSpec.CustomData, formSpec.Provenance);
|
|
430
|
+
}, formSpec.Steps), formSpec.CategoryTags, formSpec.Score, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, formSpec.ClinicalPathway, formSpec.Lifecycle, formSpec.FilledMeta, formSpec.CustomData, formSpec.Provenance, formSpec.Classification);
|
|
431
431
|
}
|
|
432
432
|
|
|
433
433
|
/**
|
|
@@ -442,7 +442,7 @@ export function Helpers_FormSpecMutators_addFormFieldToStep<UserField>(formStep:
|
|
|
442
442
|
else {
|
|
443
443
|
return s;
|
|
444
444
|
}
|
|
445
|
-
}, formSpec.Steps), formSpec.CategoryTags, formSpec.Score, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, formSpec.ClinicalPathway, formSpec.Lifecycle, formSpec.FilledMeta, formSpec.CustomData, formSpec.Provenance);
|
|
445
|
+
}, formSpec.Steps), formSpec.CategoryTags, formSpec.Score, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, formSpec.ClinicalPathway, formSpec.Lifecycle, formSpec.FilledMeta, formSpec.CustomData, formSpec.Provenance, formSpec.Classification);
|
|
446
446
|
}
|
|
447
447
|
|
|
448
448
|
/**
|
|
@@ -456,7 +456,7 @@ export function Helpers_FormSpecMutators_removeFormFieldFromFormSpec<UserField>(
|
|
|
456
456
|
else {
|
|
457
457
|
return s;
|
|
458
458
|
}
|
|
459
|
-
}, formSpec.Steps), formSpec.CategoryTags, formSpec.Score, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, formSpec.ClinicalPathway, formSpec.Lifecycle, formSpec.FilledMeta, formSpec.CustomData, formSpec.Provenance);
|
|
459
|
+
}, formSpec.Steps), formSpec.CategoryTags, formSpec.Score, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, formSpec.ClinicalPathway, formSpec.Lifecycle, formSpec.FilledMeta, formSpec.CustomData, formSpec.Provenance, formSpec.Classification);
|
|
460
460
|
}
|
|
461
461
|
|
|
462
462
|
/**
|
|
@@ -489,7 +489,7 @@ export function Helpers_FormSpecMutators_moveFormFieldUpInFormSpec<UserField>(fo
|
|
|
489
489
|
else {
|
|
490
490
|
return s;
|
|
491
491
|
}
|
|
492
|
-
}, formSpec.Steps), formSpec.CategoryTags, formSpec.Score, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, formSpec.ClinicalPathway, formSpec.Lifecycle, formSpec.FilledMeta, formSpec.CustomData, formSpec.Provenance);
|
|
492
|
+
}, formSpec.Steps), formSpec.CategoryTags, formSpec.Score, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, formSpec.ClinicalPathway, formSpec.Lifecycle, formSpec.FilledMeta, formSpec.CustomData, formSpec.Provenance, formSpec.Classification);
|
|
493
493
|
}
|
|
494
494
|
|
|
495
495
|
/**
|
|
@@ -515,7 +515,7 @@ export function Helpers_FormSpecMutators_moveFormFieldDownInFormSpec<UserField>(
|
|
|
515
515
|
else {
|
|
516
516
|
return s;
|
|
517
517
|
}
|
|
518
|
-
}, formSpec.Steps), formSpec.CategoryTags, formSpec.Score, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, formSpec.ClinicalPathway, formSpec.Lifecycle, formSpec.FilledMeta, formSpec.CustomData, formSpec.Provenance);
|
|
518
|
+
}, formSpec.Steps), formSpec.CategoryTags, formSpec.Score, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, formSpec.ClinicalPathway, formSpec.Lifecycle, formSpec.FilledMeta, formSpec.CustomData, formSpec.Provenance, formSpec.Classification);
|
|
519
519
|
}
|
|
520
520
|
|
|
521
521
|
/**
|
|
@@ -535,7 +535,7 @@ export function Helpers_FormSpecMutators_moveFieldByKeyToPositionInFormStepSpec<
|
|
|
535
535
|
else {
|
|
536
536
|
return s;
|
|
537
537
|
}
|
|
538
|
-
}, formSpec.Steps), formSpec.CategoryTags, formSpec.Score, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, formSpec.ClinicalPathway, formSpec.Lifecycle, formSpec.FilledMeta, formSpec.CustomData, formSpec.Provenance);
|
|
538
|
+
}, formSpec.Steps), formSpec.CategoryTags, formSpec.Score, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, formSpec.ClinicalPathway, formSpec.Lifecycle, formSpec.FilledMeta, formSpec.CustomData, formSpec.Provenance, formSpec.Classification);
|
|
539
539
|
}
|
|
540
540
|
else {
|
|
541
541
|
return formSpec;
|
|
@@ -558,7 +558,7 @@ export function Helpers_FormSpecMutators_moveFormStepUpInFormSpec<UserField>(for
|
|
|
558
558
|
}
|
|
559
559
|
}, formSpec.Steps), {
|
|
560
560
|
Compare: comparePrimitives,
|
|
561
|
-
})), formSpec.CategoryTags, formSpec.Score, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, formSpec.ClinicalPathway, formSpec.Lifecycle, formSpec.FilledMeta, formSpec.CustomData, formSpec.Provenance);
|
|
561
|
+
})), formSpec.CategoryTags, formSpec.Score, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, formSpec.ClinicalPathway, formSpec.Lifecycle, formSpec.FilledMeta, formSpec.CustomData, formSpec.Provenance, formSpec.Classification);
|
|
562
562
|
}
|
|
563
563
|
|
|
564
564
|
/**
|
|
@@ -577,14 +577,14 @@ export function Helpers_FormSpecMutators_moveFormStepDownInFormSpec<UserField>(f
|
|
|
577
577
|
}
|
|
578
578
|
}, formSpec.Steps), {
|
|
579
579
|
Compare: comparePrimitives,
|
|
580
|
-
})), formSpec.CategoryTags, formSpec.Score, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, formSpec.ClinicalPathway, formSpec.Lifecycle, formSpec.FilledMeta, formSpec.CustomData, formSpec.Provenance);
|
|
580
|
+
})), formSpec.CategoryTags, formSpec.Score, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, formSpec.ClinicalPathway, formSpec.Lifecycle, formSpec.FilledMeta, formSpec.CustomData, formSpec.Provenance, formSpec.Classification);
|
|
581
581
|
}
|
|
582
582
|
|
|
583
583
|
/**
|
|
584
584
|
* Removes a form step from a FormSpec.
|
|
585
585
|
*/
|
|
586
586
|
export function Helpers_FormSpecMutators_removeFormStepFromFormSpec<UserField>(formStepOrder: int32, formSpec: Spec_FormSpec$1<UserField>): Spec_FormSpec$1<UserField> {
|
|
587
|
-
return new Spec_FormSpec$1(formSpec.Id, formSpec.Code, formSpec.Title, formSpec.Abstract, formSpec.Version, formSpec.FormSpecVersion, mapIndexed<Spec_FormStep$1<UserField>, Spec_FormStep$1<UserField>>((i: int32, s_1: Spec_FormStep$1<UserField>): Spec_FormStep$1<UserField> => (new Spec_FormStep$1(i + 1, s_1.StepLabel, s_1.Fields)), filter<Spec_FormStep$1<UserField>>((s: Spec_FormStep$1<UserField>): boolean => (s.StepOrder !== formStepOrder), formSpec.Steps)), formSpec.CategoryTags, formSpec.Score, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, formSpec.ClinicalPathway, formSpec.Lifecycle, formSpec.FilledMeta, formSpec.CustomData, formSpec.Provenance);
|
|
587
|
+
return new Spec_FormSpec$1(formSpec.Id, formSpec.Code, formSpec.Title, formSpec.Abstract, formSpec.Version, formSpec.FormSpecVersion, mapIndexed<Spec_FormStep$1<UserField>, Spec_FormStep$1<UserField>>((i: int32, s_1: Spec_FormStep$1<UserField>): Spec_FormStep$1<UserField> => (new Spec_FormStep$1(i + 1, s_1.StepLabel, s_1.Fields)), filter<Spec_FormStep$1<UserField>>((s: Spec_FormStep$1<UserField>): boolean => (s.StepOrder !== formStepOrder), formSpec.Steps)), formSpec.CategoryTags, formSpec.Score, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, formSpec.ClinicalPathway, formSpec.Lifecycle, formSpec.FilledMeta, formSpec.CustomData, formSpec.Provenance, formSpec.Classification);
|
|
588
588
|
}
|
|
589
589
|
|
|
590
590
|
/**
|
|
@@ -608,7 +608,7 @@ export function Helpers_FormSpecTransformers_flattenSpecSteps<UserField>(formSpe
|
|
|
608
608
|
break;
|
|
609
609
|
}
|
|
610
610
|
};
|
|
611
|
-
return new Spec_FormSpec$1(formSpec.Id, formSpec.Code, formSpec.Title, formSpec.Abstract, formSpec.Version, formSpec.FormSpecVersion, singleton(new Spec_FormStep$1(1, "Complete Form", flatten(formSpec.Steps, empty<Spec_FormField$1<UserField>>()))), formSpec.CategoryTags, formSpec.Score, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, formSpec.ClinicalPathway, formSpec.Lifecycle, formSpec.FilledMeta, formSpec.CustomData, formSpec.Provenance);
|
|
611
|
+
return new Spec_FormSpec$1(formSpec.Id, formSpec.Code, formSpec.Title, formSpec.Abstract, formSpec.Version, formSpec.FormSpecVersion, singleton(new Spec_FormStep$1(1, "Complete Form", flatten(formSpec.Steps, empty<Spec_FormField$1<UserField>>()))), formSpec.CategoryTags, formSpec.Score, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, formSpec.ClinicalPathway, formSpec.Lifecycle, formSpec.FilledMeta, formSpec.CustomData, formSpec.Provenance, formSpec.Classification);
|
|
612
612
|
}
|
|
613
613
|
|
|
614
614
|
/**
|
|
@@ -4,8 +4,11 @@ import { FSharpResult$2_$union, FSharpResult$2_Ok, FSharpResult$2_Error } from "
|
|
|
4
4
|
import { Spec_FieldType_$union, Spec_FormSpec$1 } from "../../../FormSpec.js";
|
|
5
5
|
import { ListMetadata, convertWithMapAndProvenance } from "./CoreMRSourceMap.js";
|
|
6
6
|
import { CoreMRChoice, CoreMRItem, CoreMRFormData } from "../../CorEMR/CoreMRTypes.js";
|
|
7
|
+
import { defaultArg, Option } from "@fable-org/fable-library-js/Option.js";
|
|
8
|
+
import { FSharpMap } from "@fable-org/fable-library-js/Map.js";
|
|
9
|
+
import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
10
|
+
import { ElementTypeInfo } from "./CorEMRElementTypeMap.js";
|
|
7
11
|
import { buildReport } from "./CorEMRSemanticReportBuilder.js";
|
|
8
|
-
import { defaultArg } from "@fable-org/fable-library-js/Option.js";
|
|
9
12
|
import { nonHeadingItems } from "./CorEMRSectioning.js";
|
|
10
13
|
import { fromInt32, toInt64, compare } from "@fable-org/fable-library-js/BigInt.js";
|
|
11
14
|
import { int32ToString } from "@fable-org/fable-library-js/Util.js";
|
|
@@ -14,11 +17,12 @@ import { FormSystemAdapter$1, FormSystemFeatures, FormMetadata } from "../FormSy
|
|
|
14
17
|
/**
|
|
15
18
|
* Convert with list metadata (IsScored, EncounterTypes) from FormListItem.
|
|
16
19
|
* Use when importing from fetch-coremr-forms where FormListItem is available.
|
|
20
|
+
* When elementTypes is Some (from bridge templates endpoint), use it for ValueEncoding; else fallback to CorEMRElementTypeMap.
|
|
17
21
|
*/
|
|
18
|
-
export function convertWithListMetadata(formData: CoreMRFormData, listMetadata: ListMetadata): FSharpResult$2_$union<Spec_FormSpec$1<Spec_FieldType_$union>, FSharpList<string>> {
|
|
22
|
+
export function convertWithListMetadata(formData: CoreMRFormData, listMetadata: ListMetadata, elementTypes: Option<FSharpMap<int32, ElementTypeInfo>>): FSharpResult$2_$union<Spec_FormSpec$1<Spec_FieldType_$union>, FSharpList<string>> {
|
|
19
23
|
let arg: string;
|
|
20
24
|
try {
|
|
21
|
-
return FSharpResult$2_Ok<Spec_FormSpec$1<Spec_FieldType_$union>, FSharpList<string>>(convertWithMapAndProvenance(formData, listMetadata));
|
|
25
|
+
return FSharpResult$2_Ok<Spec_FormSpec$1<Spec_FieldType_$union>, FSharpList<string>>(convertWithMapAndProvenance(formData, listMetadata, elementTypes));
|
|
22
26
|
}
|
|
23
27
|
catch (ex: any) {
|
|
24
28
|
return FSharpResult$2_Error<Spec_FormSpec$1<Spec_FieldType_$union>, FSharpList<string>>(cons((arg = ex.message, toText(printf("CorEMR conversion failed: %s"))(arg)), (ex.stack == null) ? empty<string>() : singleton(" Stack: " + ex.stack)));
|
|
@@ -28,7 +32,7 @@ export function convertWithListMetadata(formData: CoreMRFormData, listMetadata:
|
|
|
28
32
|
export const adapter: FormSystemAdapter$1<CoreMRFormData> = new FormSystemAdapter$1("coremr", (template: CoreMRFormData): FSharpResult$2_$union<Spec_FormSpec$1<Spec_FieldType_$union>, FSharpList<string>> => {
|
|
29
33
|
let arg: string;
|
|
30
34
|
try {
|
|
31
|
-
return FSharpResult$2_Ok<Spec_FormSpec$1<Spec_FieldType_$union>, FSharpList<string>>(convertWithMapAndProvenance(template, undefined));
|
|
35
|
+
return FSharpResult$2_Ok<Spec_FormSpec$1<Spec_FieldType_$union>, FSharpList<string>>(convertWithMapAndProvenance(template, undefined, undefined));
|
|
32
36
|
}
|
|
33
37
|
catch (ex: any) {
|
|
34
38
|
return FSharpResult$2_Error<Spec_FormSpec$1<Spec_FieldType_$union>, FSharpList<string>>(cons((arg = ex.message, toText(printf("CorEMR conversion failed: %s"))(arg)), (ex.stack == null) ? empty<string>() : singleton(" Stack: " + ex.stack)));
|
|
@@ -38,11 +38,11 @@ export function getElementTypeInfo(itemTypeId: int32): ElementTypeInfo {
|
|
|
38
38
|
case 21:
|
|
39
39
|
return new ElementTypeInfo("dropdown_notes", "choice_score", "optional_notes", true, false, false, true);
|
|
40
40
|
case 25:
|
|
41
|
-
return new ElementTypeInfo("dropdown_notes_ui", "choice_score", "ignored", false, false, false,
|
|
41
|
+
return new ElementTypeInfo("dropdown_notes_ui", "choice_score", "ignored", false, false, false, false);
|
|
42
42
|
case 26:
|
|
43
43
|
return new ElementTypeInfo("chips_notes", "choice_score", "optional_notes", true, false, false, true);
|
|
44
44
|
case 30:
|
|
45
|
-
return new ElementTypeInfo("yes_no_text", "1_yes_2_no", "optional_notes", false, false, false,
|
|
45
|
+
return new ElementTypeInfo("yes_no_text", "1_yes_2_no", "optional_notes", false, false, false, false);
|
|
46
46
|
case 31:
|
|
47
47
|
return new ElementTypeInfo("yes_no_notes", "1_yes_2_no", "optional_notes", true, false, false, true);
|
|
48
48
|
case 32:
|
|
@@ -100,4 +100,13 @@ export function hasTextHasDate(itemTypeId: int32): [boolean, boolean] {
|
|
|
100
100
|
return [(info.TextFieldRole === "content") ? true : (info.TextFieldRole === "optional_notes"), info.TextFieldRole === "iso_date"] as [boolean, boolean];
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Convert bridge format (code, valueEncoding, textField) to ElementTypeInfo.
|
|
105
|
+
* Used when elementTypes come from bridge templates endpoint (SSOT).
|
|
106
|
+
*/
|
|
107
|
+
export function fromBridgeFormat(code: string, valueEncoding: string, textField: string): ElementTypeInfo {
|
|
108
|
+
const isPlusNotes: boolean = (textField === "optional_notes") && ((valueEncoding === "choice_score") ? true : (valueEncoding === "1_yes_2_no"));
|
|
109
|
+
return new ElementTypeInfo(code, valueEncoding, textField, isPlusNotes, valueEncoding === "scaffold", (valueEncoding === "skip") ? true : (textField === "skip"), isPlusNotes);
|
|
110
|
+
}
|
|
111
|
+
|
|
103
112
|
//# sourceMappingURL=CorEMRElementTypeMap.ts.map
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { Record } from "@fable-org/fable-library-js/Types.js";
|
|
2
|
+
import { int32ToString, comparePrimitives, IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
|
|
3
|
+
import { list_type, bool_type, int64_type, option_type, int32_type, record_type, string_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
4
|
+
import { bind, orElse, map as map_1, orElseWith, defaultArg, value as value_13, Option } from "@fable-org/fable-library-js/Option.js";
|
|
5
|
+
import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
6
|
+
import { int64 } from "@fable-org/fable-library-js/BigInt.js";
|
|
7
|
+
import { empty, item as item_2, length, mapIndexed, sortBy, collect, isEmpty, map, FSharpList } from "@fable-org/fable-library-js/List.js";
|
|
8
|
+
import { FSharpSet__Contains, contains, FSharpSet, ofSeq } from "@fable-org/fable-library-js/Set.js";
|
|
9
|
+
import { Spec_FormClassification_$union, Spec_FormClassification_General, Spec_FormClassification_Screening, Spec_FormClassification_Intake, Spec_FormClassification_ClinicalInstrument, Spec_ClinicalInstrumentInfo, Spec_InstrumentConfidence_Inferred, Spec_InstrumentConfidence_Exact } from "../../../FormSpec.js";
|
|
10
|
+
import { CoreMRFormDetail, CoreMRTag, CoreMRTrigger, CoreMRChoice, CoreMRItem, CoreMRFormMetadata } from "../../CorEMR/CoreMRTypes.js";
|
|
11
|
+
import { FSharpMap, filter, keys, isEmpty as isEmpty_1, tryFind } from "@fable-org/fable-library-js/Map.js";
|
|
12
|
+
import { ElementTypeInfo, getElementTypeInfo } from "./CorEMRElementTypeMap.js";
|
|
13
|
+
import { normalizeChoiceScores } from "../../../BitmaskHelpers.js";
|
|
14
|
+
|
|
15
|
+
export class BridgeElementTypeInfo extends Record implements IEquatable<BridgeElementTypeInfo>, IComparable<BridgeElementTypeInfo> {
|
|
16
|
+
readonly Code: string;
|
|
17
|
+
readonly ValueEncoding: string;
|
|
18
|
+
readonly TextFieldRole: string;
|
|
19
|
+
constructor(Code: string, ValueEncoding: string, TextFieldRole: string) {
|
|
20
|
+
super();
|
|
21
|
+
this.Code = Code;
|
|
22
|
+
this.ValueEncoding = ValueEncoding;
|
|
23
|
+
this.TextFieldRole = TextFieldRole;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function BridgeElementTypeInfo_$reflection(): TypeInfo {
|
|
28
|
+
return record_type("FormSpec.Integrations.CorEMR.CorEMRTemplateMapper.BridgeElementTypeInfo", [], BridgeElementTypeInfo, () => [["Code", string_type], ["ValueEncoding", string_type], ["TextFieldRole", string_type]]);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export class BridgeTemplateChoice extends Record implements IEquatable<BridgeTemplateChoice>, IComparable<BridgeTemplateChoice> {
|
|
32
|
+
readonly ChoiceId: Option<int32>;
|
|
33
|
+
readonly Sequence: Option<int32>;
|
|
34
|
+
readonly Text: Option<string>;
|
|
35
|
+
readonly Score: Option<int64>;
|
|
36
|
+
readonly BitPosition: Option<int32>;
|
|
37
|
+
readonly Code: Option<string>;
|
|
38
|
+
readonly Highlight: Option<string>;
|
|
39
|
+
constructor(ChoiceId: Option<int32>, Sequence: Option<int32>, Text$: Option<string>, Score: Option<int64>, BitPosition: Option<int32>, Code: Option<string>, Highlight: Option<string>) {
|
|
40
|
+
super();
|
|
41
|
+
this.ChoiceId = ChoiceId;
|
|
42
|
+
this.Sequence = Sequence;
|
|
43
|
+
this.Text = Text$;
|
|
44
|
+
this.Score = Score;
|
|
45
|
+
this.BitPosition = BitPosition;
|
|
46
|
+
this.Code = Code;
|
|
47
|
+
this.Highlight = Highlight;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function BridgeTemplateChoice_$reflection(): TypeInfo {
|
|
52
|
+
return record_type("FormSpec.Integrations.CorEMR.CorEMRTemplateMapper.BridgeTemplateChoice", [], BridgeTemplateChoice, () => [["ChoiceId", option_type(int32_type)], ["Sequence", option_type(int32_type)], ["Text", option_type(string_type)], ["Score", option_type(int64_type)], ["BitPosition", option_type(int32_type)], ["Code", option_type(string_type)], ["Highlight", option_type(string_type)]]);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export class BridgeTemplateItem extends Record implements IEquatable<BridgeTemplateItem>, IComparable<BridgeTemplateItem> {
|
|
56
|
+
readonly ItemId: int32;
|
|
57
|
+
readonly Sequence: int32;
|
|
58
|
+
readonly Type: int32;
|
|
59
|
+
readonly NestingLevel: Option<int32>;
|
|
60
|
+
readonly IsRequired: boolean;
|
|
61
|
+
readonly Text: string;
|
|
62
|
+
readonly SequenceText: Option<string>;
|
|
63
|
+
readonly Code: Option<string>;
|
|
64
|
+
readonly Uuid: Option<string>;
|
|
65
|
+
readonly GenderRequired: Option<string>;
|
|
66
|
+
readonly Highlight: Option<int32>;
|
|
67
|
+
readonly Choices: FSharpList<BridgeTemplateChoice>;
|
|
68
|
+
constructor(ItemId: int32, Sequence: int32, Type: int32, NestingLevel: Option<int32>, IsRequired: boolean, Text$: string, SequenceText: Option<string>, Code: Option<string>, Uuid: Option<string>, GenderRequired: Option<string>, Highlight: Option<int32>, Choices: FSharpList<BridgeTemplateChoice>) {
|
|
69
|
+
super();
|
|
70
|
+
this.ItemId = (ItemId | 0);
|
|
71
|
+
this.Sequence = (Sequence | 0);
|
|
72
|
+
this.Type = (Type | 0);
|
|
73
|
+
this.NestingLevel = NestingLevel;
|
|
74
|
+
this.IsRequired = IsRequired;
|
|
75
|
+
this.Text = Text$;
|
|
76
|
+
this.SequenceText = SequenceText;
|
|
77
|
+
this.Code = Code;
|
|
78
|
+
this.Uuid = Uuid;
|
|
79
|
+
this.GenderRequired = GenderRequired;
|
|
80
|
+
this.Highlight = Highlight;
|
|
81
|
+
this.Choices = Choices;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function BridgeTemplateItem_$reflection(): TypeInfo {
|
|
86
|
+
return record_type("FormSpec.Integrations.CorEMR.CorEMRTemplateMapper.BridgeTemplateItem", [], BridgeTemplateItem, () => [["ItemId", int32_type], ["Sequence", int32_type], ["Type", int32_type], ["NestingLevel", option_type(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(BridgeTemplateChoice_$reflection())]]);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export class BridgeTemplateDetail extends Record implements IEquatable<BridgeTemplateDetail>, IComparable<BridgeTemplateDetail> {
|
|
90
|
+
readonly FormId: int32;
|
|
91
|
+
readonly Name: string;
|
|
92
|
+
readonly FormCode: Option<string>;
|
|
93
|
+
readonly Description: Option<string>;
|
|
94
|
+
readonly CurrentVersionId: Option<int32>;
|
|
95
|
+
readonly IsIntake: Option<boolean>;
|
|
96
|
+
readonly RequiresSignature: Option<boolean>;
|
|
97
|
+
readonly Items: FSharpList<BridgeTemplateItem>;
|
|
98
|
+
readonly FormCategory: Option<string>;
|
|
99
|
+
readonly InstrumentType: Option<string>;
|
|
100
|
+
readonly InstrumentConfidence: Option<string>;
|
|
101
|
+
readonly InstrumentMaxScore: Option<int32>;
|
|
102
|
+
constructor(FormId: int32, Name: string, FormCode: Option<string>, Description: Option<string>, CurrentVersionId: Option<int32>, IsIntake: Option<boolean>, RequiresSignature: Option<boolean>, Items: FSharpList<BridgeTemplateItem>, FormCategory: Option<string>, InstrumentType: Option<string>, InstrumentConfidence: Option<string>, InstrumentMaxScore: Option<int32>) {
|
|
103
|
+
super();
|
|
104
|
+
this.FormId = (FormId | 0);
|
|
105
|
+
this.Name = Name;
|
|
106
|
+
this.FormCode = FormCode;
|
|
107
|
+
this.Description = Description;
|
|
108
|
+
this.CurrentVersionId = CurrentVersionId;
|
|
109
|
+
this.IsIntake = IsIntake;
|
|
110
|
+
this.RequiresSignature = RequiresSignature;
|
|
111
|
+
this.Items = Items;
|
|
112
|
+
this.FormCategory = FormCategory;
|
|
113
|
+
this.InstrumentType = InstrumentType;
|
|
114
|
+
this.InstrumentConfidence = InstrumentConfidence;
|
|
115
|
+
this.InstrumentMaxScore = InstrumentMaxScore;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function BridgeTemplateDetail_$reflection(): TypeInfo {
|
|
120
|
+
return record_type("FormSpec.Integrations.CorEMR.CorEMRTemplateMapper.BridgeTemplateDetail", [], BridgeTemplateDetail, () => [["FormId", int32_type], ["Name", string_type], ["FormCode", option_type(string_type)], ["Description", option_type(string_type)], ["CurrentVersionId", option_type(int32_type)], ["IsIntake", option_type(bool_type)], ["RequiresSignature", option_type(bool_type)], ["Items", list_type(BridgeTemplateItem_$reflection())], ["FormCategory", option_type(string_type)], ["InstrumentType", option_type(string_type)], ["InstrumentConfidence", option_type(string_type)], ["InstrumentMaxScore", option_type(int32_type)]]);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const multiSelectCodes: FSharpSet<string> = ofSeq(["chips_notes", "checkbox", "checkbox_notes", "chips_ros"], {
|
|
124
|
+
Compare: comparePrimitives,
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
function hasTextHasDateFromBridge(textField: string): [boolean, boolean] {
|
|
128
|
+
return [(textField === "content") ? true : (textField === "optional_notes"), textField === "iso_date"] as [boolean, boolean];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Map bridge classification fields to FormClassification DU.
|
|
133
|
+
* ClinicalInstrument always carries instrument identity; General is the default.
|
|
134
|
+
*/
|
|
135
|
+
export function mapFormClassification(detail: BridgeTemplateDetail): Spec_FormClassification_$union {
|
|
136
|
+
let matchValue_3: Option<string>;
|
|
137
|
+
const matchValue: Option<string> = detail.FormCategory;
|
|
138
|
+
const matchValue_1: Option<string> = detail.InstrumentType;
|
|
139
|
+
let matchResult: int32, instType: string;
|
|
140
|
+
if (matchValue != null) {
|
|
141
|
+
switch (value_13(matchValue)) {
|
|
142
|
+
case "clinical_instrument": {
|
|
143
|
+
if (matchValue_1 != null) {
|
|
144
|
+
matchResult = 0;
|
|
145
|
+
instType = value_13(matchValue_1);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
matchResult = 3;
|
|
149
|
+
}
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
case "intake": {
|
|
153
|
+
matchResult = 1;
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
case "screening": {
|
|
157
|
+
matchResult = 2;
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
default:
|
|
161
|
+
matchResult = 3;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
matchResult = 3;
|
|
166
|
+
}
|
|
167
|
+
switch (matchResult) {
|
|
168
|
+
case 0:
|
|
169
|
+
return Spec_FormClassification_ClinicalInstrument(new Spec_ClinicalInstrumentInfo(instType!, (matchValue_3 = detail.InstrumentConfidence, (matchValue_3 != null) ? ((value_13(matchValue_3) === "exact") ? Spec_InstrumentConfidence_Exact() : Spec_InstrumentConfidence_Inferred()) : Spec_InstrumentConfidence_Inferred()), detail.InstrumentMaxScore));
|
|
170
|
+
case 1:
|
|
171
|
+
return Spec_FormClassification_Intake();
|
|
172
|
+
case 2:
|
|
173
|
+
return Spec_FormClassification_Screening();
|
|
174
|
+
default:
|
|
175
|
+
return Spec_FormClassification_General();
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Map bridge template to CoreMRFormDetail.
|
|
181
|
+
* When elementTypes is non-empty, use it for ItemTypeName, HasText, HasDate, and bitmask detection.
|
|
182
|
+
* When elementTypes is empty, fallback to CorEMRElementTypeMap.
|
|
183
|
+
*/
|
|
184
|
+
export function mapNewTemplateToCoreMRDetail(elementTypes: FSharpMap<int32, BridgeElementTypeInfo>, template: BridgeTemplateDetail): CoreMRFormDetail {
|
|
185
|
+
const metadata: CoreMRFormMetadata = new CoreMRFormMetadata(template.FormId, template.Name, template.Description, defaultArg(template.CurrentVersionId, 0), 1, undefined, defaultArg(template.RequiresSignature, false), defaultArg(template.IsIntake, false), defaultArg(template.FormCode, ""), "");
|
|
186
|
+
const items: FSharpList<CoreMRItem> = map<BridgeTemplateItem, CoreMRItem>((item: BridgeTemplateItem): CoreMRItem => {
|
|
187
|
+
let info_1: BridgeElementTypeInfo;
|
|
188
|
+
const itemTypeId: int32 = item.Type | 0;
|
|
189
|
+
const value: BridgeElementTypeInfo = new BridgeElementTypeInfo(`unknown_${itemTypeId}`, "unknown", "unknown");
|
|
190
|
+
info_1 = defaultArg(orElseWith<BridgeElementTypeInfo>(tryFind<int32, BridgeElementTypeInfo>(itemTypeId, elementTypes), (): Option<BridgeElementTypeInfo> => {
|
|
191
|
+
const info: ElementTypeInfo = getElementTypeInfo(itemTypeId);
|
|
192
|
+
return new BridgeElementTypeInfo(info.Code, info.ValueEncoding, info.TextFieldRole);
|
|
193
|
+
}), value);
|
|
194
|
+
const patternInput: [boolean, boolean] = hasTextHasDateFromBridge(info_1.TextFieldRole);
|
|
195
|
+
return new CoreMRItem(item.ItemId, item.Sequence, defaultArg(item.NestingLevel, 0), item.SequenceText, item.Type, info_1.Code, !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);
|
|
196
|
+
}, template.Items);
|
|
197
|
+
const multiSelectTypes: FSharpSet<int32> = isEmpty_1<int32, BridgeElementTypeInfo>(elementTypes) ? ofSeq([26, 40, 41, 143], {
|
|
198
|
+
Compare: comparePrimitives,
|
|
199
|
+
}) : ofSeq<int32>(keys<int32, BridgeElementTypeInfo>(filter<int32, BridgeElementTypeInfo>((_arg: int32, info_2: BridgeElementTypeInfo): boolean => contains<string>(info_2.Code, multiSelectCodes), elementTypes)), {
|
|
200
|
+
Compare: comparePrimitives,
|
|
201
|
+
});
|
|
202
|
+
return new CoreMRFormDetail(metadata, items, collect<BridgeTemplateItem, CoreMRChoice>((item_1: BridgeTemplateItem): FSharpList<CoreMRChoice> => {
|
|
203
|
+
const sortedChoices: FSharpList<BridgeTemplateChoice> = sortBy<BridgeTemplateChoice, int32>((c: BridgeTemplateChoice): int32 => defaultArg(c.Sequence, 0), item_1.Choices, {
|
|
204
|
+
Compare: comparePrimitives,
|
|
205
|
+
});
|
|
206
|
+
const patternInput_1: [FSharpList<int32>, boolean] = normalizeChoiceScores(map<BridgeTemplateChoice, int64>((c_1: BridgeTemplateChoice): int64 => defaultArg(c_1.Score, 0n), sortedChoices));
|
|
207
|
+
const bitPositions: Option<FSharpList<int32>> = (FSharpSet__Contains(multiSelectTypes, item_1.Type) && patternInput_1[1]) ? patternInput_1[0] : undefined;
|
|
208
|
+
return mapIndexed<BridgeTemplateChoice, CoreMRChoice>((index: int32, choice: BridgeTemplateChoice): CoreMRChoice => {
|
|
209
|
+
const bitPosition: Option<int32> = orElse(choice.BitPosition, bind<FSharpList<int32>, int32>((positions: FSharpList<int32>): Option<int32> => {
|
|
210
|
+
if (index < length(positions)) {
|
|
211
|
+
return item_2(index, positions);
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
return undefined;
|
|
215
|
+
}
|
|
216
|
+
}, bitPositions));
|
|
217
|
+
return new CoreMRChoice(defaultArg(choice.ChoiceId, ((item_1.ItemId * 1000) + index) + 1), item_1.ItemId, defaultArg(choice.Sequence, index + 1), defaultArg(choice.Text, ""), defaultArg(choice.Score, 0n), bitPosition, choice.Code, choice.Highlight);
|
|
218
|
+
}, sortedChoices);
|
|
219
|
+
}, template.Items), empty<CoreMRTrigger>(), empty<CoreMRTag>(), undefined);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
//# sourceMappingURL=CorEMRTemplateMapper.ts.map
|
|
@@ -5,7 +5,7 @@ import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
|
5
5
|
import { CoreMRFormData, CoreMRTag, CoreMRItem, CoreMRChoice } from "../../CorEMR/CoreMRTypes.js";
|
|
6
6
|
import { numberHash, comparePrimitives } from "@fable-org/fable-library-js/Util.js";
|
|
7
7
|
import { op_Addition, toInt64, int64, toInt32 } from "@fable-org/fable-library-js/BigInt.js";
|
|
8
|
-
import { Spec_FormSpec$1_$reflection, Spec_FieldType_$reflection, Spec_FormSpec$1, Spec_FormLifecycle_Blueprint, ClinicalPathway_ClinicalPathwaySpec, Spec_FormField$1, Shared_FieldKey, Spec_FieldType_$union, Spec_FormStep$1, Spec_Score, Spec_ScoreColor_Danger, Spec_ScoreColor_Warning, Spec_ScoreRange, Spec_ScoreColor_Success } from "../../../FormSpec.js";
|
|
8
|
+
import { Spec_FormSpec$1_$reflection, Spec_FieldType_$reflection, Spec_FormSpec$1, Spec_FormClassification_General, Spec_FormLifecycle_Blueprint, ClinicalPathway_ClinicalPathwaySpec, Spec_FormField$1, Shared_FieldKey, Spec_FieldType_$union, Spec_FormStep$1, Spec_Score, Spec_ScoreColor_Danger, Spec_ScoreColor_Warning, Spec_ScoreRange, Spec_ScoreColor_Success } from "../../../FormSpec.js";
|
|
9
9
|
import { defaultArg, Option } from "@fable-org/fable-library-js/Option.js";
|
|
10
10
|
import { toConsoleError, printf, toText, substring } from "@fable-org/fable-library-js/String.js";
|
|
11
11
|
import { createSteps } from "./CorEMRStepsBuilder.js";
|
|
@@ -103,7 +103,7 @@ export function convertToFormSpec(formData: CoreMRFormData): Spec_FormSpec$1<Spe
|
|
|
103
103
|
Compare: comparePrimitives,
|
|
104
104
|
});
|
|
105
105
|
const clinicalPathway: Option<ClinicalPathway_ClinicalPathwaySpec> = isEmpty(formData.Triggers) ? undefined : convertTriggersToSinglePathway(formData.Triggers, (itemId: int32): Shared_FieldKey => defaultArg(tryFind<int32, Shared_FieldKey>(itemId, itemIdToFieldKeyMap), new Shared_FieldKey(generateStableDeterministicGuid(`unknown_item_${itemId}`))), createChoiceIdToTextMap(formData.Choices), formData.Metadata, formData.Items);
|
|
106
|
-
return new Spec_FormSpec$1(generateStableDeterministicGuid(`form_${formData.Metadata.FormId}_${formData.Metadata.FormName}`), formCode, formData.Metadata.FormName, defaultArg(formData.Metadata.Description, ""), toText(printf("1.0.0-CoreEMRv%d"))(formData.Metadata.VersionNumber), "5.0.0", steps, map<CoreMRTag, string>((t: CoreMRTag): string => t.TagName, formData.Tags), score, empty<string>(), formData.Metadata.RequiresSignature, false, undefined, Spec_FormLifecycle_Blueprint(), undefined, undefined, undefined);
|
|
106
|
+
return new Spec_FormSpec$1(generateStableDeterministicGuid(`form_${formData.Metadata.FormId}_${formData.Metadata.FormName}`), formCode, formData.Metadata.FormName, defaultArg(formData.Metadata.Description, ""), toText(printf("1.0.0-CoreEMRv%d"))(formData.Metadata.VersionNumber), "5.0.0", steps, map<CoreMRTag, string>((t: CoreMRTag): string => t.TagName, formData.Tags), score, empty<string>(), formData.Metadata.RequiresSignature, false, undefined, Spec_FormLifecycle_Blueprint(), undefined, undefined, undefined, Spec_FormClassification_General());
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
/**
|