@f1studio/form-spec 5.0.0-alpha.168 → 5.0.0-alpha.169
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/BlueprintValidation.d.ts +6 -3
- package/FormSpec.FS/BlueprintValidation.d.ts.map +1 -1
- package/FormSpec.FS/BlueprintValidation.js +39 -15
- package/FormSpec.FS/BlueprintValidation.js.map +1 -1
- package/FormSpec.FS/Designer.d.ts.map +1 -1
- package/FormSpec.FS/Designer.js +1 -1
- package/FormSpec.FS/Designer.js.map +1 -1
- package/FormSpec.FS/FormSpec.d.ts +108 -58
- package/FormSpec.FS/FormSpec.d.ts.map +1 -1
- package/FormSpec.FS/FormSpec.js +319 -129
- package/FormSpec.FS/FormSpec.js.map +1 -1
- package/FormSpec.FS/FormSpecHelpers.d.ts.map +1 -1
- package/FormSpec.FS/FormSpecHelpers.js +1 -1
- package/FormSpec.FS/FormSpecHelpers.js.map +1 -1
- package/FormSpec.FS/FormSpecValues.d.ts.map +1 -1
- package/FormSpec.FS/FormSpecValues.js +5 -2
- package/FormSpec.FS/FormSpecValues.js.map +1 -1
- package/FormSpec.FS/Helpers.d.ts.map +1 -1
- package/FormSpec.FS/Helpers.js +14 -9
- package/FormSpec.FS/Helpers.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.js +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.d.ts +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.js +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.d.ts +3 -3
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.js +7 -5
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.js +11 -10
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.js +1 -9
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.d.ts +11 -4
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.js +30 -28
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.d.ts +3 -9
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js +4 -31
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js +2 -6
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImportPipeline.d.ts +45 -0
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImportPipeline.d.ts.map +1 -0
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImportPipeline.js +141 -0
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImportPipeline.js.map +1 -0
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImporterAnalysis.d.ts +326 -0
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImporterAnalysis.d.ts.map +1 -0
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImporterAnalysis.js +1743 -0
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImporterAnalysis.js.map +1 -0
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.d.ts +8 -8
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js +6 -6
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRTriggerEnrichment.d.ts +21 -15
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRTriggerEnrichment.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRTriggerEnrichment.js +83 -80
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRTriggerEnrichment.js.map +1 -1
- package/FormSpec.FS/Integrations/CorEMR/CoreMRPathwayMapper.d.ts +51 -0
- package/FormSpec.FS/Integrations/CorEMR/CoreMRPathwayMapper.d.ts.map +1 -0
- package/FormSpec.FS/Integrations/CorEMR/CoreMRPathwayMapper.js +939 -0
- package/FormSpec.FS/Integrations/CorEMR/CoreMRPathwayMapper.js.map +1 -0
- package/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.d.ts +2 -17
- package/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.js +1 -66
- package/FormSpec.FS/Integrations/CorEMR/{TemplateManifestDecoder.d.ts → FormTemplateDecoder.d.ts} +53 -45
- package/FormSpec.FS/Integrations/CorEMR/FormTemplateDecoder.d.ts.map +1 -0
- package/FormSpec.FS/Integrations/CorEMR/{TemplateManifestDecoder.js → FormTemplateDecoder.js} +544 -254
- package/FormSpec.FS/Integrations/CorEMR/FormTemplateDecoder.js.map +1 -0
- package/FormSpec.FS/Integrations/CorEMR/FormTemplateDomainDecoder.d.ts +7 -0
- package/FormSpec.FS/Integrations/CorEMR/FormTemplateDomainDecoder.d.ts.map +1 -0
- package/FormSpec.FS/Integrations/CorEMR/FormTemplateDomainDecoder.js +280 -0
- package/FormSpec.FS/Integrations/CorEMR/FormTemplateDomainDecoder.js.map +1 -0
- package/FormSpec.FS/Interop/FormSpec.Api.Helpers.d.ts +16 -4
- package/FormSpec.FS/Interop/FormSpec.Api.Helpers.d.ts.map +1 -1
- package/FormSpec.FS/Interop/FormSpec.Api.Helpers.js +63 -18
- package/FormSpec.FS/Interop/FormSpec.Api.Helpers.js.map +1 -1
- package/FormSpec.FS/Interop/FormSpec.Api.Option.d.ts +4 -4
- package/FormSpec.FS/Interop/FormSpec.Api.Option.d.ts.map +1 -1
- package/FormSpec.FS/Interop/FormSpec.Api.Option.js +2 -2
- package/FormSpec.FS/Interop/FormSpec.Api.Option.js.map +1 -1
- package/FormSpec.FS/PathwayDataExtractor.d.ts.map +1 -1
- package/FormSpec.FS/PathwayDataExtractor.js +39 -18
- package/FormSpec.FS/PathwayDataExtractor.js.map +1 -1
- package/FormSpec.FS/PathwayExecutor.d.ts +10 -10
- package/FormSpec.FS/PathwayExecutor.d.ts.map +1 -1
- package/FormSpec.FS/PathwayExecutor.js +14 -14
- package/FormSpec.FS/PathwayExecutor.js.map +1 -1
- package/FormSpec.FS/PathwayValidator.d.ts.map +1 -1
- package/FormSpec.FS/PathwayValidator.js +8 -5
- package/FormSpec.FS/PathwayValidator.js.map +1 -1
- package/FormSpec.FS/Renderers/FormSpecMarkdownRenderer.d.ts.map +1 -1
- package/FormSpec.FS/Renderers/FormSpecMarkdownRenderer.js +16 -7
- package/FormSpec.FS/Renderers/FormSpecMarkdownRenderer.js.map +1 -1
- package/FormSpec.FS/Renderers/MermaidRenderer.d.ts.map +1 -1
- package/FormSpec.FS/Renderers/MermaidRenderer.js +4 -8
- package/FormSpec.FS/Renderers/MermaidRenderer.js.map +1 -1
- package/FormSpec.FS/Renderers/PathwayRenderers.d.ts.map +1 -1
- package/FormSpec.FS/Renderers/PathwayRenderers.js +5 -4
- package/FormSpec.FS/Renderers/PathwayRenderers.js.map +1 -1
- package/FormSpec.FS/TriggerActionDto.d.ts +32 -21
- package/FormSpec.FS/TriggerActionDto.d.ts.map +1 -1
- package/FormSpec.FS/TriggerActionDto.js +247 -61
- package/FormSpec.FS/TriggerActionDto.js.map +1 -1
- package/README.md +7 -7
- package/Thoth.Json/packages/Thoth.Json/Encode.js.map +1 -1
- package/package.json +1 -1
- package/plugins/allergyfinder/src/AllergyFinderField.d.ts.map +1 -1
- package/plugins/allergyfinder/src/AllergyFinderField.js +2 -2
- package/plugins/allergyfinder/src/AllergyFinderField.js.map +1 -1
- package/plugins/bmi/src/BMIField.d.ts.map +1 -1
- package/plugins/bmi/src/BMIField.js +21 -15
- package/plugins/bmi/src/BMIField.js.map +1 -1
- package/plugins/demographics/src/DemographicsField.d.ts.map +1 -1
- package/plugins/demographics/src/DemographicsField.js +4 -4
- package/plugins/demographics/src/DemographicsField.js.map +1 -1
- package/plugins/likert/src/LikertField.d.ts.map +1 -1
- package/plugins/likert/src/LikertField.js +40 -35
- package/plugins/likert/src/LikertField.js.map +1 -1
- package/plugins/signature/src/SignatureField.d.ts.map +1 -1
- package/plugins/signature/src/SignatureField.js +4 -3
- package/plugins/signature/src/SignatureField.js.map +1 -1
- package/plugins/vitals/src/VitalsField.d.ts.map +1 -1
- package/plugins/vitals/src/VitalsField.js +4 -4
- package/plugins/vitals/src/VitalsField.js.map +1 -1
- package/src/FormSpec.FS/BlueprintValidation.ts +55 -24
- package/src/FormSpec.FS/Designer.ts +2 -2
- package/src/FormSpec.FS/FormSpec.ts +223 -100
- package/src/FormSpec.FS/FormSpecHelpers.ts +2 -2
- package/src/FormSpec.FS/FormSpecValues.ts +6 -3
- package/src/FormSpec.FS/Helpers.ts +16 -11
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.ts +2 -2
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.ts +3 -3
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.ts +10 -8
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.ts +6 -5
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.ts +1 -10
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.ts +35 -30
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts +7 -26
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts +2 -6
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImportPipeline.ts +115 -0
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImporterAnalysis.ts +1059 -0
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts +10 -10
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRTriggerEnrichment.ts +61 -88
- package/src/FormSpec.FS/Integrations/CorEMR/CoreMRPathwayMapper.ts +926 -0
- package/src/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.ts +3 -37
- package/src/FormSpec.FS/Integrations/CorEMR/FormTemplateDecoder.ts +1284 -0
- package/src/FormSpec.FS/Integrations/CorEMR/FormTemplateDomainDecoder.ts +287 -0
- package/src/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts +76 -25
- package/src/FormSpec.FS/Interop/FormSpec.Api.Option.ts +6 -6
- package/src/FormSpec.FS/PathwayDataExtractor.ts +40 -20
- package/src/FormSpec.FS/PathwayExecutor.ts +26 -26
- package/src/FormSpec.FS/PathwayValidator.ts +8 -5
- package/src/FormSpec.FS/Renderers/FormSpecMarkdownRenderer.ts +18 -8
- package/src/FormSpec.FS/Renderers/MermaidRenderer.ts +6 -10
- package/src/FormSpec.FS/Renderers/PathwayRenderers.ts +5 -5
- package/src/FormSpec.FS/TriggerActionDto.ts +247 -74
- package/src/plugins/allergyfinder/src/AllergyFinderField.ts +3 -3
- package/src/plugins/bmi/src/BMIField.ts +12 -5
- package/src/plugins/demographics/src/DemographicsField.ts +5 -5
- package/src/plugins/likert/src/LikertField.ts +16 -11
- package/src/plugins/signature/src/SignatureField.ts +4 -3
- package/src/plugins/vitals/src/VitalsField.ts +5 -5
- package/src/vye-os-contracts-fs/src/CoreMR/FormTemplate.ts +715 -0
- package/vye-os-contracts-fs/src/CoreMR/FormTemplate.d.ts +310 -0
- package/vye-os-contracts-fs/src/CoreMR/FormTemplate.d.ts.map +1 -0
- package/vye-os-contracts-fs/src/CoreMR/FormTemplate.js +1242 -0
- package/vye-os-contracts-fs/src/CoreMR/FormTemplate.js.map +1 -0
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.d.ts +0 -69
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.d.ts.map +0 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.js +0 -447
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.js.map +0 -1
- package/FormSpec.FS/Integrations/CorEMR/ItemTriggerConverter.d.ts +0 -19
- package/FormSpec.FS/Integrations/CorEMR/ItemTriggerConverter.d.ts.map +0 -1
- package/FormSpec.FS/Integrations/CorEMR/ItemTriggerConverter.js +0 -643
- package/FormSpec.FS/Integrations/CorEMR/ItemTriggerConverter.js.map +0 -1
- package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.d.ts.map +0 -1
- package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.js.map +0 -1
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.ts +0 -412
- package/src/FormSpec.FS/Integrations/CorEMR/ItemTriggerConverter.ts +0 -588
- package/src/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.ts +0 -1054
|
@@ -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_FormClassification_General, 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, Spec_Label_shown, 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";
|
|
@@ -424,7 +424,7 @@ export function validateFormSpecFieldKeys(formSpec: Spec_FormSpec$1<Spec_FieldTy
|
|
|
424
424
|
iterate<Spec_FormStep$1<Spec_FieldType_$union>>((step: Spec_FormStep$1<Spec_FieldType_$union>): void => {
|
|
425
425
|
iterate<Spec_FormField$1<Spec_FieldType_$union>>((field: Spec_FormField$1<Spec_FieldType_$union>): void => {
|
|
426
426
|
if (field.FieldKey.fields[0] === "00000000-0000-0000-0000-000000000000") {
|
|
427
|
-
void (errors.push(`Field '${field.Label}' has empty GUID field key`));
|
|
427
|
+
void (errors.push(`Field '${Spec_Label_shown(field.Label)}' has empty GUID field key`));
|
|
428
428
|
}
|
|
429
429
|
}, step.Fields);
|
|
430
430
|
}, formSpec.Steps);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Record } from "@fable-org/fable-library-js/Types.js";
|
|
2
2
|
import { map as map_1, value as value_1, defaultArg, bind, Option } from "@fable-org/fable-library-js/Option.js";
|
|
3
|
-
import { Values_StepOrder, Shared_FieldValue_Single, Shared_FieldAnswer, Spec_FormSpec$1, Spec_FormStep$1, Spec_FormField$1, Spec_FieldType_$union, Shared_FieldOption_$reflection, Shared_FieldValue_$reflection, Shared_FieldKey_$reflection, Shared_FieldOption, Shared_FieldValue_$union, Shared_FieldKey, Spec_Score_$reflection, Spec_Score } from "./FormSpec.js";
|
|
3
|
+
import { Values_StepOrder, Shared_FieldValue_Single, Shared_FieldAnswer, Spec_Label_shown, Spec_FormSpec$1, Spec_FormStep$1, Spec_FormField$1, Spec_FieldType_$union, Shared_FieldOption_$reflection, Shared_FieldValue_$reflection, Shared_FieldKey_$reflection, Shared_FieldOption, Shared_FieldValue_$union, Shared_FieldKey, Spec_Score_$reflection, Spec_Score } from "./FormSpec.js";
|
|
4
4
|
import { compare, equals, IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
|
|
5
5
|
import { list_type, int32_type, record_type, option_type, string_type, class_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
6
6
|
import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
@@ -131,8 +131,11 @@ export function updateField<FieldType>(spec: Spec_FormSpec$1<FieldType>, fieldKe
|
|
|
131
131
|
* Uses field.Value or creates empty default based on field type.
|
|
132
132
|
*/
|
|
133
133
|
export function fieldToDetails(field: Spec_FormField$1<Spec_FieldType_$union>): FieldDetails$1<Spec_FieldType_$union> {
|
|
134
|
-
let
|
|
135
|
-
|
|
134
|
+
let fieldValue: Shared_FieldValue_$union;
|
|
135
|
+
const matchValue: Option<Shared_FieldValue_$union> = field.Value;
|
|
136
|
+
fieldValue = ((matchValue == null) ? Shared_FieldValue_Single(new Shared_FieldAnswer(field.FieldKey, Spec_Label_shown(field.Label), "", undefined)) : value_1(matchValue));
|
|
137
|
+
const options: FSharpList<Shared_FieldOption> = optionsFromField(field);
|
|
138
|
+
return new FieldDetails$1(field.FieldOrder, field.FieldKey, Spec_Label_shown(field.Label), fieldValue, field.FieldType, options);
|
|
136
139
|
}
|
|
137
140
|
|
|
138
141
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Values_StepOrder, Shared_FieldValue_Multiple, Shared_FieldValue_Single, Shared_FieldAnswer, Shared_FieldValue_$union, Shared_FieldOption, Spec_PluginFieldConfig, Spec_FieldType_$union, Spec_FieldType, Spec_FormSpec$1, Spec_FormField$1, Spec_FormStep$1, Shared_FieldKey } from "./FormSpec.js";
|
|
1
|
+
import { Values_StepOrder, Shared_FieldValue_Multiple, Spec_Label_shown, Shared_FieldValue_Single, Shared_FieldAnswer, Shared_FieldValue_$union, Shared_FieldOption, Spec_PluginFieldConfig, Spec_FieldType_$union, Spec_FieldType, Spec_FormSpec$1, Spec_FormField$1, Spec_FormStep$1, Shared_FieldKey } from "./FormSpec.js";
|
|
2
2
|
import { arrayToGuid, parse } from "@fable-org/fable-library-js/Guid.js";
|
|
3
3
|
import { toConsole, isNullOrEmpty, trimEnd, trim, isNullOrWhiteSpace } from "@fable-org/fable-library-js/String.js";
|
|
4
4
|
import { replace } from "@fable-org/fable-library-js/RegExp.js";
|
|
@@ -6,9 +6,9 @@ import { uint8, int32, parse as parse_1 } from "@fable-org/fable-library-js/Int3
|
|
|
6
6
|
import sha256 from "crypto-js/sha256";
|
|
7
7
|
import { initialize } from "@fable-org/fable-library-js/Array.js";
|
|
8
8
|
import { value as value_1, Option, map, defaultArg } from "@fable-org/fable-library-js/Option.js";
|
|
9
|
-
import { splitAt, tryFindIndex, forAll, sortBy, find, insertAt, mapIndexed, singleton, append, head, tail, isEmpty, collect, empty, tryFind, FSharpList, filter, map as map_1 } from "@fable-org/fable-library-js/List.js";
|
|
10
|
-
import { Result_Map, FSharpResult$2_$union, FSharpResult$2_Error, FSharpResult$2_Ok } from "@fable-org/fable-library-js/Result.js";
|
|
9
|
+
import { splitAt, tryFindIndex, forAll, sortBy, find, insertAt, mapIndexed, singleton, append, choose, head, tail, isEmpty, collect, empty, tryFind, FSharpList, filter, map as map_1 } from "@fable-org/fable-library-js/List.js";
|
|
11
10
|
import { compare, safeHash, comparePrimitives, stringHash, equals } from "@fable-org/fable-library-js/Util.js";
|
|
11
|
+
import { Result_Map, FSharpResult$2_$union, FSharpResult$2_Error, FSharpResult$2_Ok } from "@fable-org/fable-library-js/Result.js";
|
|
12
12
|
import { List_distinct } from "@fable-org/fable-library-js/Seq2.js";
|
|
13
13
|
import { map as map_2, tryFind as tryFind_1 } from "@fable-org/fable-library-js/Seq.js";
|
|
14
14
|
import { FieldDetails$1 } from "./FormSpecValues.js";
|
|
@@ -70,14 +70,14 @@ export function Helpers_generateDeterministicGuid(fieldName: string): string {
|
|
|
70
70
|
* Finds a form field by its label string in a specific step.
|
|
71
71
|
*/
|
|
72
72
|
export function Helpers_FieldFinders_findFormFieldInStepByLabelString<FieldType>(label: string, stepNumber: int32, formSpec: Spec_FormSpec$1<FieldType>): FSharpList<[Spec_FormStep$1<FieldType>, Spec_FormField$1<FieldType>]> {
|
|
73
|
-
return defaultArg(map<Spec_FormStep$1<FieldType>, FSharpList<[Spec_FormStep$1<FieldType>, Spec_FormField$1<FieldType>]>>((step_1: Spec_FormStep$1<FieldType>): FSharpList<[Spec_FormStep$1<FieldType>, Spec_FormField$1<FieldType>]> => map_1<Spec_FormField$1<FieldType>, [Spec_FormStep$1<FieldType>, Spec_FormField$1<FieldType>]>((field_1: Spec_FormField$1<FieldType>): [Spec_FormStep$1<FieldType>, Spec_FormField$1<FieldType>] => ([step_1, field_1] as [Spec_FormStep$1<FieldType>, Spec_FormField$1<FieldType>]), filter<Spec_FormField$1<FieldType>>((field: Spec_FormField$1<FieldType>): boolean => (field.Label
|
|
73
|
+
return defaultArg(map<Spec_FormStep$1<FieldType>, FSharpList<[Spec_FormStep$1<FieldType>, Spec_FormField$1<FieldType>]>>((step_1: Spec_FormStep$1<FieldType>): FSharpList<[Spec_FormStep$1<FieldType>, Spec_FormField$1<FieldType>]> => map_1<Spec_FormField$1<FieldType>, [Spec_FormStep$1<FieldType>, Spec_FormField$1<FieldType>]>((field_1: Spec_FormField$1<FieldType>): [Spec_FormStep$1<FieldType>, Spec_FormField$1<FieldType>] => ([step_1, field_1] as [Spec_FormStep$1<FieldType>, Spec_FormField$1<FieldType>]), filter<Spec_FormField$1<FieldType>>((field: Spec_FormField$1<FieldType>): boolean => equals(field.Label, label), step_1.Fields)), tryFind<Spec_FormStep$1<FieldType>>((step: Spec_FormStep$1<FieldType>): boolean => (step.StepOrder === stepNumber), formSpec.Steps)), empty<[Spec_FormStep$1<FieldType>, Spec_FormField$1<FieldType>]>());
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
77
|
* Finds a form field by its label string across all steps in the form.
|
|
78
78
|
*/
|
|
79
79
|
export function Helpers_FieldFinders_findFormFieldInFormByLabelString<FieldType>(label: string, formSpec: Spec_FormSpec$1<FieldType>): FSharpList<[Spec_FormStep$1<FieldType>, Spec_FormField$1<FieldType>]> {
|
|
80
|
-
return collect<Spec_FormStep$1<FieldType>, [Spec_FormStep$1<FieldType>, Spec_FormField$1<FieldType>]>((step: Spec_FormStep$1<FieldType>): FSharpList<[Spec_FormStep$1<FieldType>, Spec_FormField$1<FieldType>]> => map_1<Spec_FormField$1<FieldType>, [Spec_FormStep$1<FieldType>, Spec_FormField$1<FieldType>]>((field_1: Spec_FormField$1<FieldType>): [Spec_FormStep$1<FieldType>, Spec_FormField$1<FieldType>] => ([step, field_1] as [Spec_FormStep$1<FieldType>, Spec_FormField$1<FieldType>]), filter<Spec_FormField$1<FieldType>>((field: Spec_FormField$1<FieldType>): boolean => (field.Label
|
|
80
|
+
return collect<Spec_FormStep$1<FieldType>, [Spec_FormStep$1<FieldType>, Spec_FormField$1<FieldType>]>((step: Spec_FormStep$1<FieldType>): FSharpList<[Spec_FormStep$1<FieldType>, Spec_FormField$1<FieldType>]> => map_1<Spec_FormField$1<FieldType>, [Spec_FormStep$1<FieldType>, Spec_FormField$1<FieldType>]>((field_1: Spec_FormField$1<FieldType>): [Spec_FormStep$1<FieldType>, Spec_FormField$1<FieldType>] => ([step, field_1] as [Spec_FormStep$1<FieldType>, Spec_FormField$1<FieldType>]), filter<Spec_FormField$1<FieldType>>((field: Spec_FormField$1<FieldType>): boolean => equals(field.Label, label), step.Fields)), formSpec.Steps);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
/**
|
|
@@ -155,7 +155,7 @@ export function Helpers_FieldFinders_tryFindFieldInSpec<UserField>(fieldNumber:
|
|
|
155
155
|
* Gets all unique field labels from a FormSpec.
|
|
156
156
|
*/
|
|
157
157
|
export function Helpers_FieldFinders_getAllFieldNames<UserField>(formSpec: Spec_FormSpec$1<UserField>): FSharpList<string> {
|
|
158
|
-
return List_distinct<string>(
|
|
158
|
+
return List_distinct<string>(choose<Spec_FormField$1<UserField>, string>((field: Spec_FormField$1<UserField>): Option<string> => field.Label, collect<Spec_FormStep$1<UserField>, Spec_FormField$1<UserField>>((step: Spec_FormStep$1<UserField>): FSharpList<Spec_FormField$1<UserField>> => step.Fields, formSpec.Steps)), {
|
|
159
159
|
Equals: (x: string, y: string): boolean => (x === y),
|
|
160
160
|
GetHashCode: stringHash,
|
|
161
161
|
});
|
|
@@ -711,7 +711,9 @@ export function Helpers_readManyValue<FieldType>(fieldKey: Shared_FieldKey, valu
|
|
|
711
711
|
export function Helpers_updateSingleFunc(formatter: ((arg0: string) => string), specField: Spec_FormField$1<Spec_FieldType_$union>, newValue: string, values: FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>): FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>> {
|
|
712
712
|
let Value: string, matchValue: Option<Shared_FieldOption>;
|
|
713
713
|
const fieldOptions: FSharpList<Shared_FieldOption> = Helpers_optionsFromSpecField(specField);
|
|
714
|
-
|
|
714
|
+
let newFieldDetails: FieldDetails$1<Spec_FieldType_$union>;
|
|
715
|
+
const FieldValue: Shared_FieldValue_$union = Shared_FieldValue_Single((Value = formatter(newValue), new Shared_FieldAnswer(specField.FieldKey, (matchValue = tryFind<Shared_FieldOption>((o: Shared_FieldOption): boolean => (o.Value === newValue), fieldOptions), (matchValue == null) ? newValue : value_1(matchValue).Description), Value, undefined)));
|
|
716
|
+
newFieldDetails = (new FieldDetails$1(specField.FieldOrder, specField.FieldKey, Spec_Label_shown(specField.Label), FieldValue, specField.FieldType, Helpers_specFieldOptionsToValueOptions(fieldOptions)));
|
|
715
717
|
const matchValue_1: Option<Shared_FieldKey> = tryFind_1<Shared_FieldKey>((k: Shared_FieldKey): boolean => equals(k, newFieldDetails.Key), map_2<[Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>], Shared_FieldKey>((tuple: [Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>]): Shared_FieldKey => tuple[0], toSeq<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>(values)));
|
|
716
718
|
if (matchValue_1 != null) {
|
|
717
719
|
const key: Shared_FieldKey = value_1(matchValue_1);
|
|
@@ -724,13 +726,15 @@ export function Helpers_updateSingleFunc(formatter: ((arg0: string) => string),
|
|
|
724
726
|
}
|
|
725
727
|
|
|
726
728
|
export function Helpers_updateManyFunc(formatter: ((arg0: string) => string), specField: Spec_FormField$1<Spec_FieldType_$union>, newValue: FSharpSet<string>, values: FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>): FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>> {
|
|
727
|
-
|
|
729
|
+
let newFieldDetails: FieldDetails$1<Spec_FieldType_$union>;
|
|
730
|
+
const FieldValue: Shared_FieldValue_$union = Shared_FieldValue_Multiple(map_3<string, Shared_FieldAnswer>((v: string): Shared_FieldAnswer => {
|
|
728
731
|
let matchValue: Option<Shared_FieldOption>;
|
|
729
732
|
const Value: string = formatter(v);
|
|
730
733
|
return new Shared_FieldAnswer(specField.FieldKey, (matchValue = tryFind<Shared_FieldOption>((o: Shared_FieldOption): boolean => (o.Value === v), Helpers_optionsFromSpecField(specField)), (matchValue == null) ? v : value_1(matchValue).Description), Value, undefined);
|
|
731
734
|
}, newValue, {
|
|
732
735
|
Compare: compare,
|
|
733
|
-
}))
|
|
736
|
+
}));
|
|
737
|
+
newFieldDetails = (new FieldDetails$1(specField.FieldOrder, specField.FieldKey, Spec_Label_shown(specField.Label), FieldValue, specField.FieldType, Helpers_specFieldOptionsToValueOptions(Helpers_optionsFromSpecField(specField))));
|
|
734
738
|
const matchValue_1: Option<Shared_FieldKey> = tryFind_1<Shared_FieldKey>((k: Shared_FieldKey): boolean => equals(k, newFieldDetails.Key), map_2<[Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>], Shared_FieldKey>((tuple: [Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>]): Shared_FieldKey => tuple[0], toSeq<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>(values)));
|
|
735
739
|
if (matchValue_1 != null) {
|
|
736
740
|
const key: Shared_FieldKey = value_1(matchValue_1);
|
|
@@ -746,9 +750,10 @@ export function Helpers_updateManyFunc(formatter: ((arg0: string) => string), sp
|
|
|
746
750
|
* Returns the updated ResultStepValues
|
|
747
751
|
*/
|
|
748
752
|
export function Helpers_updateFormFieldValue(field: Spec_FormField$1<Spec_FieldType_$union>, newValue: any, values: FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>): FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>> {
|
|
749
|
-
const
|
|
753
|
+
const fieldOptions: FSharpList<Shared_FieldOption> = Helpers_optionsFromSpecField(field);
|
|
754
|
+
const newFieldDetails: FieldDetails$1<Spec_FieldType_$union> = new FieldDetails$1(field.FieldOrder, field.FieldKey, Spec_Label_shown(field.Label), (() => {
|
|
750
755
|
throw new Error("updateFormFieldValue: Field type handling not implemented.");
|
|
751
|
-
})(), field.FieldType, Helpers_specFieldOptionsToValueOptions(
|
|
756
|
+
})(), field.FieldType, Helpers_specFieldOptionsToValueOptions(fieldOptions));
|
|
752
757
|
const matchValue_1: Option<Shared_FieldKey> = tryFind_1<Shared_FieldKey>((k: Shared_FieldKey): boolean => equals(k, newFieldDetails.Key), map_2<[Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>], Shared_FieldKey>((tuple: [Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>]): Shared_FieldKey => tuple[0], toSeq<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>(values)));
|
|
753
758
|
if (matchValue_1 != null) {
|
|
754
759
|
const key: Shared_FieldKey = value_1(matchValue_1);
|
|
@@ -2,7 +2,7 @@ import { isNullOrWhiteSpace } from "@fable-org/fable-library-js/String.js";
|
|
|
2
2
|
import { Helpers_generateDeterministicGuidRaw, Helpers_canonicalizeFieldKey } from "../../../Helpers.js";
|
|
3
3
|
import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
4
4
|
import { CoreMRChoice, CoreMRItem } from "../../CorEMR/CoreMRTypes.js";
|
|
5
|
-
import { Spec_FormField$1, Spec_FieldType_$union, Spec_FieldType_UnsupportedField, Spec_UnsupportedFieldInfo, Spec_FieldType_PluginField, Spec_PluginFieldConfig, Spec_FieldType_Message, Spec_MessageInfo, Spec_MessageType_Info, Spec_FieldType_Signature, Spec_SignatureInfo, Spec_FieldType_DateTimeLocal, Spec_FieldType_Date, Spec_FieldType_CheckboxList, Spec_MultiChoiceInfo, Spec_FieldType_Dropdown, Spec_FieldType_Radio, Spec_SingleChoiceInfo, Spec_FieldType_TextArea, Spec_FieldType_Text, Spec_TextInfo, Shared_FieldOption, Shared_FieldOptionKey, Shared_FieldKey } from "../../../FormSpec.js";
|
|
5
|
+
import { Spec_FormField$1, Spec_Label_ofStated, Spec_FieldType_$union, Spec_FieldType_UnsupportedField, Spec_UnsupportedFieldInfo, Spec_FieldType_PluginField, Spec_PluginFieldConfig, Spec_FieldType_Message, Spec_MessageInfo, Spec_MessageType_Info, Spec_FieldType_Signature, Spec_SignatureInfo, Spec_FieldType_DateTimeLocal, Spec_FieldType_Date, Spec_FieldType_CheckboxList, Spec_MultiChoiceInfo, Spec_FieldType_Dropdown, Spec_FieldType_Radio, Spec_SingleChoiceInfo, Spec_FieldType_TextArea, Spec_FieldType_Text, Spec_TextInfo, Shared_FieldOption, Shared_FieldOptionKey, Shared_FieldKey } from "../../../FormSpec.js";
|
|
6
6
|
import { isEmpty, ofArray, FSharpList, sortBy, map } from "@fable-org/fable-library-js/List.js";
|
|
7
7
|
import { comparePrimitives } from "@fable-org/fable-library-js/Util.js";
|
|
8
8
|
import { getElementTypeInfo } from "./CorEMRElementTypeMap.js";
|
|
@@ -108,7 +108,7 @@ export function mapToFormField(formCode: string, stepOrder: int32, item: CoreMRI
|
|
|
108
108
|
const fieldType: Spec_FieldType_$union = mapFieldType(item, choices);
|
|
109
109
|
const mainLabel: string = item.Label.trim();
|
|
110
110
|
const notesField: Option<string> = isPlusNotesType(item) ? "" : undefined;
|
|
111
|
-
return new Spec_FormField$1(item.Sequence, generateNamespacedFieldKey(formCode, stepOrder, item), mainLabel, notesField, undefined, !item.IsRequired, false, isNeedsDocumentationType(item), fieldType, undefined);
|
|
111
|
+
return new Spec_FormField$1(item.Sequence, generateNamespacedFieldKey(formCode, stepOrder, item), Spec_Label_ofStated(mainLabel), notesField, undefined, !item.IsRequired, false, isNeedsDocumentationType(item), fieldType, undefined);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
//# sourceMappingURL=CorEMRFieldTypeMapper.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { toString, Record, Union } from "@fable-org/fable-library-js/Types.js";
|
|
2
2
|
import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
3
|
-
import { defaultArg, value as value_3, map as map_1, Option } from "@fable-org/fable-library-js/Option.js";
|
|
3
|
+
import { bind, defaultArg, value as value_3, map as map_1, Option } from "@fable-org/fable-library-js/Option.js";
|
|
4
4
|
import { record_type, list_type, union_type, option_type, bool_type, string_type, int32_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
5
5
|
import { isEmpty, filter, singleton as singleton_1, empty as empty_1, ofSeq, choose, collect, sortBy, map, sumBy, length, FSharpList } from "@fable-org/fable-library-js/List.js";
|
|
6
6
|
import { IDisposable, disposeSafe, IEnumerator, getEnumerator, compare, int32ToString, comparePrimitives, numberHash, IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
|
|
@@ -12,7 +12,7 @@ import { List_groupBy } from "@fable-org/fable-library-js/Seq2.js";
|
|
|
12
12
|
import { join } from "@fable-org/fable-library-js/String.js";
|
|
13
13
|
import { empty, singleton, append, delay, toList } from "@fable-org/fable-library-js/Seq.js";
|
|
14
14
|
import { getElementTypeInfo } from "./CorEMRElementTypeMap.js";
|
|
15
|
-
import { FormScoring, ScoringLabel } from "../../CorEMR/
|
|
15
|
+
import { FormScoring, ScoringLabel } from "../../CorEMR/FormTemplateDecoder.js";
|
|
16
16
|
import { FSharpResult$2_$union, FSharpResult$2_Ok, FSharpResult$2_Error } from "@fable-org/fable-library-js/Result.js";
|
|
17
17
|
|
|
18
18
|
export type ValidationError_$union =
|
|
@@ -371,7 +371,7 @@ export function FormSpecValidator_validateRequiredFields(coreMR: CoreMRFormData,
|
|
|
371
371
|
try {
|
|
372
372
|
while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
|
|
373
373
|
const field: Spec_FormField$1<Spec_FieldType_$union> = enumerator_1["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
374
|
-
const matchValue: Option<CoreMRItem> = tryFind<string, CoreMRItem>(
|
|
374
|
+
const matchValue: Option<CoreMRItem> = bind<string, CoreMRItem>((label: string): Option<CoreMRItem> => tryFind<string, CoreMRItem>(label, itemsByLabel), field.Label);
|
|
375
375
|
if (matchValue == null) {
|
|
376
376
|
}
|
|
377
377
|
else {
|
|
@@ -5,6 +5,7 @@ import { list_type, option_type, record_type, string_type, int32_type, TypeInfo
|
|
|
5
5
|
import { Option } from "@fable-org/fable-library-js/Option.js";
|
|
6
6
|
import { item as item_3, length, mapIndexed, append, head, singleton, isEmpty, map, sortBy, filter, FSharpList } from "@fable-org/fable-library-js/List.js";
|
|
7
7
|
import { CoreMRItem_$reflection, CoreMRItem } from "../../CorEMR/CoreMRTypes.js";
|
|
8
|
+
import { Spec_Label_ofStated } from "../../../FormSpec.js";
|
|
8
9
|
|
|
9
10
|
export class HeadingItem extends Record implements IEquatable<HeadingItem>, IComparable<HeadingItem> {
|
|
10
11
|
readonly Sequence: int32;
|
|
@@ -25,9 +26,9 @@ export function HeadingItem_$reflection(): TypeInfo {
|
|
|
25
26
|
export class Section extends Record implements IEquatable<Section>, IComparable<Section> {
|
|
26
27
|
readonly Heading: Option<HeadingItem>;
|
|
27
28
|
readonly HeadingSequence: int32;
|
|
28
|
-
readonly HeadingLabel: string
|
|
29
|
+
readonly HeadingLabel: Option<string>;
|
|
29
30
|
readonly Items: FSharpList<CoreMRItem>;
|
|
30
|
-
constructor(Heading: Option<HeadingItem>, HeadingSequence: int32, HeadingLabel: string
|
|
31
|
+
constructor(Heading: Option<HeadingItem>, HeadingSequence: int32, HeadingLabel: Option<string>, Items: FSharpList<CoreMRItem>) {
|
|
31
32
|
super();
|
|
32
33
|
this.Heading = Heading;
|
|
33
34
|
this.HeadingSequence = (HeadingSequence | 0);
|
|
@@ -37,7 +38,7 @@ export class Section extends Record implements IEquatable<Section>, IComparable<
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
export function Section_$reflection(): TypeInfo {
|
|
40
|
-
return record_type("FormSpec.Integrations.CorEMR.CorEMRSectioning.Section", [], Section, () => [["Heading", option_type(HeadingItem_$reflection())], ["HeadingSequence", int32_type], ["HeadingLabel", string_type], ["Items", list_type(CoreMRItem_$reflection())]]);
|
|
41
|
+
return record_type("FormSpec.Integrations.CorEMR.CorEMRSectioning.Section", [], Section, () => [["Heading", option_type(HeadingItem_$reflection())], ["HeadingSequence", int32_type], ["HeadingLabel", option_type(string_type)], ["Items", list_type(CoreMRItem_$reflection())]]);
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
/**
|
|
@@ -58,7 +59,7 @@ export function detectHeadings(items: FSharpList<CoreMRItem>): FSharpList<Headin
|
|
|
58
59
|
|
|
59
60
|
/**
|
|
60
61
|
* Group items into sections based on heading positions.
|
|
61
|
-
* Preamble: items before first heading (HeadingLabel =
|
|
62
|
+
* Preamble: items before first heading (`HeadingLabel = None` — CoreMR states no heading there).
|
|
62
63
|
* Sections: one per heading, items between heading N and N+1.
|
|
63
64
|
*/
|
|
64
65
|
export function groupItemsByHeadings(headings: FSharpList<HeadingItem>, allItems: FSharpList<CoreMRItem>): FSharpList<Section> {
|
|
@@ -66,20 +67,21 @@ export function groupItemsByHeadings(headings: FSharpList<HeadingItem>, allItems
|
|
|
66
67
|
Compare: comparePrimitives,
|
|
67
68
|
});
|
|
68
69
|
if (isEmpty(headings)) {
|
|
69
|
-
return singleton(new Section(undefined, 0,
|
|
70
|
+
return singleton(new Section(undefined, 0, undefined, nonHeading));
|
|
70
71
|
}
|
|
71
72
|
else {
|
|
72
73
|
const firstHeading: HeadingItem = head(headings);
|
|
73
|
-
return append(singleton(new Section(undefined, 0,
|
|
74
|
+
return append(singleton(new Section(undefined, 0, undefined, filter<CoreMRItem>((item_1: CoreMRItem): boolean => (item_1.Sequence < firstHeading.Sequence), nonHeading))), mapIndexed<HeadingItem, Section>((index: int32, heading: HeadingItem): Section => {
|
|
74
75
|
const nextHeadingSeq: int32 = ((index < (length(headings) - 1)) ? item_3(index + 1, headings).Sequence : 2147483647) | 0;
|
|
75
|
-
|
|
76
|
+
const sectionItems: FSharpList<CoreMRItem> = filter<CoreMRItem>((item_2: CoreMRItem): boolean => {
|
|
76
77
|
if (item_2.Sequence > heading.Sequence) {
|
|
77
78
|
return item_2.Sequence < nextHeadingSeq;
|
|
78
79
|
}
|
|
79
80
|
else {
|
|
80
81
|
return false;
|
|
81
82
|
}
|
|
82
|
-
}, nonHeading)
|
|
83
|
+
}, nonHeading);
|
|
84
|
+
return new Section(heading, heading.Sequence, Spec_Label_ofStated(heading.Label), sectionItems);
|
|
83
85
|
}, headings));
|
|
84
86
|
}
|
|
85
87
|
}
|
|
@@ -4,7 +4,7 @@ import { float64, int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
|
4
4
|
import { value as value_129, map, defaultArg, Option } from "@fable-org/fable-library-js/Option.js";
|
|
5
5
|
import { stringHash, IDisposable, disposeSafe, IEnumerator, getEnumerator, compareArrays, comparePrimitives, IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
|
|
6
6
|
import { int64 } from "@fable-org/fable-library-js/BigInt.js";
|
|
7
|
-
import { reverse, length, sortByDescending, cons, sortBy,
|
|
7
|
+
import { reverse, length, sortByDescending, cons, sortBy, map as map_2, choose, collect, exists, empty as empty_1, tryFind, head, isEmpty, ofArray, FSharpList } from "@fable-org/fable-library-js/List.js";
|
|
8
8
|
import { FSharpMap__get_IsEmpty, tryFind as tryFind_1, FSharpMap__TryFind, ofList, FSharpMap__ContainsKey, FSharpMap } from "@fable-org/fable-library-js/Map.js";
|
|
9
9
|
import { CoreMRFormData, CoreMRChoice, CoreMRItem, CoreMRTrigger, CoreMRTriggerEvent } from "../../CorEMR/CoreMRTypes.js";
|
|
10
10
|
import { toString, utcNow } from "@fable-org/fable-library-js/Date.js";
|
|
@@ -499,7 +499,10 @@ export function extractFormReferences(itemId: int32, text: string): FSharpList<F
|
|
|
499
499
|
* Build field catalog from CoreMR items and FormSpec
|
|
500
500
|
*/
|
|
501
501
|
export function buildFieldCatalog<T>(items: FSharpList<CoreMRItem>, formSpec: Spec_FormSpec$1<T>): FSharpList<FieldCatalogEntry> {
|
|
502
|
-
const fieldDataMap: FSharpMap<string, [string, Option<string>]> = ofList<string, [string, Option<string>]>(collect<Spec_FormStep$1<T>, [string, [string, Option<string>]]>((step: Spec_FormStep$1<T>): FSharpList<[string, [string, Option<string>]]> =>
|
|
502
|
+
const fieldDataMap: FSharpMap<string, [string, Option<string>]> = ofList<string, [string, Option<string>]>(collect<Spec_FormStep$1<T>, [string, [string, Option<string>]]>((step: Spec_FormStep$1<T>): FSharpList<[string, [string, Option<string>]]> => choose<Spec_FormField$1<T>, [string, [string, Option<string>]]>((field: Spec_FormField$1<T>): Option<[string, [string, Option<string>]]> => {
|
|
503
|
+
const guid: string = field.FieldKey.fields[0];
|
|
504
|
+
return map<string, [string, [string, Option<string>]]>((label: string): [string, [string, Option<string>]] => ([label, [guid, field.Notes] as [string, Option<string>]] as [string, [string, Option<string>]]), field.Label);
|
|
505
|
+
}, step.Fields), formSpec.Steps), {
|
|
503
506
|
Compare: comparePrimitives,
|
|
504
507
|
});
|
|
505
508
|
return choose<CoreMRItem, FieldCatalogEntry>((item: CoreMRItem): Option<FieldCatalogEntry> => {
|
|
@@ -548,9 +551,7 @@ export function buildPathwayContext(pathway: Option<ClinicalPathway_ClinicalPath
|
|
|
548
551
|
const p: ClinicalPathway_ClinicalPathwaySpec = value_129(pathway);
|
|
549
552
|
return new PathwayContext(map_2<ClinicalPathway_StateDefinition, PathwayState>((state: ClinicalPathway_StateDefinition): PathwayState => {
|
|
550
553
|
let matchValue: ClinicalPathway_StateType_$union;
|
|
551
|
-
return new PathwayState(state.StateKey.fields[0], (matchValue = state.StateType, (matchValue.tag === /*
|
|
552
|
-
throw new Error("Match failure: F1.Studio.ClinicalPathway.StateType");
|
|
553
|
-
})()))))), state.StateLabel, state.StateOrder);
|
|
554
|
+
return new PathwayState(state.StateKey.fields[0], (matchValue = state.StateType, (matchValue.tag === /* Action */ 1) ? "Action" : ((matchValue.tag === /* Terminal */ 4) ? "Terminal" : ((matchValue.tag === /* CompoundAction */ 2) ? "CompoundAction" : ((matchValue.tag === /* ConditionalAction */ 3) ? "ConditionalAction" : "Evaluation")))), state.StateLabel, state.StateOrder);
|
|
554
555
|
}, p.States), map_2<ClinicalPathway_TransitionDefinition, PathwayTransition>((trans: ClinicalPathway_TransitionDefinition): PathwayTransition => {
|
|
555
556
|
let matchValue_2: ClinicalPathway_TransitionCondition_$union;
|
|
556
557
|
const transKey: string = trans.TransitionKey.fields[0];
|
|
@@ -5,22 +5,13 @@ import { FSharpMap, tryFind } from "@fable-org/fable-library-js/Map.js";
|
|
|
5
5
|
import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
6
6
|
import { CoreMRItem, CoreMRChoice } from "../../CorEMR/CoreMRTypes.js";
|
|
7
7
|
import { Spec_FormStep$1, Spec_FieldType_$union, Spec_FormField$1 } from "../../../FormSpec.js";
|
|
8
|
-
import { isNullOrWhiteSpace } from "@fable-org/fable-library-js/String.js";
|
|
9
8
|
import { detectHeadings, groupItemsByHeadings, Section } from "./CorEMRSectioning.js";
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Create FormSpec Steps from CoreMR items
|
|
13
12
|
*/
|
|
14
13
|
export function createSteps(formCode: string, items: FSharpList<CoreMRItem>, choicesByItem: FSharpMap<int32, FSharpList<CoreMRChoice>>): FSharpList<Spec_FormStep$1<Spec_FieldType_$union>> {
|
|
15
|
-
return mapIndexed<Section, Spec_FormStep$1<Spec_FieldType_$union>>((index: int32, section: Section): Spec_FormStep$1<Spec_FieldType_$union> => (new Spec_FormStep$1(index + 1, section.HeadingLabel, map<CoreMRItem, Spec_FormField$1<Spec_FieldType_$union>>((item: CoreMRItem): Spec_FormField$1<Spec_FieldType_$union> =>
|
|
16
|
-
const field: Spec_FormField$1<Spec_FieldType_$union> = mapToFormField(formCode, index + 1, item, defaultArg(tryFind<int32, FSharpList<CoreMRChoice>>(item.ItemId, choicesByItem), empty<CoreMRChoice>()));
|
|
17
|
-
if (isNullOrWhiteSpace(field.Label)) {
|
|
18
|
-
return new Spec_FormField$1(field.FieldOrder, field.FieldKey, "_(blank)_", field.Notes, field.DependsOn, field.IsOptional, field.IsDeprecated, field.NeedsDocumentation, field.FieldType, field.Value);
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
return field;
|
|
22
|
-
}
|
|
23
|
-
}, section.Items))), groupItemsByHeadings(detectHeadings(items), items));
|
|
14
|
+
return mapIndexed<Section, Spec_FormStep$1<Spec_FieldType_$union>>((index: int32, section: Section): Spec_FormStep$1<Spec_FieldType_$union> => (new Spec_FormStep$1(index + 1, section.HeadingLabel, map<CoreMRItem, Spec_FormField$1<Spec_FieldType_$union>>((item: CoreMRItem): Spec_FormField$1<Spec_FieldType_$union> => mapToFormField(formCode, index + 1, item, defaultArg(tryFind<int32, FSharpList<CoreMRChoice>>(item.ItemId, choicesByItem), empty<CoreMRChoice>())), section.Items))), groupItemsByHeadings(detectHeadings(items), items));
|
|
24
15
|
}
|
|
25
16
|
|
|
26
17
|
//# sourceMappingURL=CorEMRStepsBuilder.ts.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Spec_FormClassification_$union, Spec_FormClassification_General, Spec_FormClassification_Screening, Spec_FormClassification_Intake, Spec_FormClassification_ClinicalInstrument, Spec_ClinicalInstrumentInfo } from "../../../FormSpec.js";
|
|
2
2
|
import { tryParse, int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
3
|
-
import { bind, orElse, map as map_1, defaultArg, Option, value as
|
|
3
|
+
import { bind, orElse, map as map_1, defaultArg, Option, value as value_3 } from "@fable-org/fable-library-js/Option.js";
|
|
4
|
+
import { item as item_2, length, sortBy, FSharpList, empty, choose, isEmpty, map, mapIndexed, collect } from "@fable-org/fable-library-js/List.js";
|
|
5
|
+
import { FSharpRef } from "@fable-org/fable-library-js/Types.js";
|
|
6
|
+
import { CoreMRFormData, CoreMRFormDetail, CoreMRTag, CoreMRChoice, CoreMRItem, CoreMRFormMetadata, CoreMRTrigger, CoreMRTriggerEvent, CoreMRTriggerCondition } from "../../CorEMR/CoreMRTypes.js";
|
|
7
|
+
import { TemplateChoice, carriesTextOrDate, ElementTypeEntry, TemplateForm, ReleaseAvailability$1_$union, TemplateItem, ItemTrigger, TriggerAction, TriggerCondition } from "../../CorEMR/FormTemplateDecoder.js";
|
|
4
8
|
import { isNullOrEmpty } from "@fable-org/fable-library-js/String.js";
|
|
5
9
|
import { int64, toInt32 } from "@fable-org/fable-library-js/BigInt.js";
|
|
6
|
-
import { CoreMRFormData, CoreMRFormDetail, CoreMRTag, CoreMRTrigger, CoreMRTriggerEvent, CoreMRTriggerCondition, CoreMRChoice, CoreMRItem, CoreMRFormMetadata } from "../../CorEMR/CoreMRTypes.js";
|
|
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, ReleaseAvailability$1_$union, TemplateItem, carriesTextOrDate, ElementTypeEntry } from "../../CorEMR/TemplateManifestDecoder.js";
|
|
9
10
|
import { FSharpMap, tryFind } from "@fable-org/fable-library-js/Map.js";
|
|
10
11
|
import { comparePrimitives, int32ToString } from "@fable-org/fable-library-js/Util.js";
|
|
11
12
|
import { FSharpSet__Contains, FSharpSet, ofSeq } from "@fable-org/fable-library-js/Set.js";
|
|
12
13
|
import { normalizeChoiceScores } from "../../../BitmaskHelpers.js";
|
|
13
|
-
import { FSharpRef } from "@fable-org/fable-library-js/Types.js";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Map catalog classification fields to the FormClassification DU.
|
|
@@ -27,11 +27,11 @@ import { FSharpRef } from "@fable-org/fable-library-js/Types.js";
|
|
|
27
27
|
export function mapFormClassification(formCategory: Option<string>, instrumentType: Option<string>, instrumentMaxScore: Option<int32>): Spec_FormClassification_$union {
|
|
28
28
|
let matchResult: int32, instType: string;
|
|
29
29
|
if (formCategory != null) {
|
|
30
|
-
switch (
|
|
30
|
+
switch (value_3(formCategory)) {
|
|
31
31
|
case "clinical_instrument": {
|
|
32
32
|
if (instrumentType != null) {
|
|
33
33
|
matchResult = 0;
|
|
34
|
-
instType =
|
|
34
|
+
instType = value_3(instrumentType);
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
37
|
matchResult = 3;
|
|
@@ -65,10 +65,34 @@ export function mapFormClassification(formCategory: Option<string>, instrumentTy
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
/**
|
|
69
|
+
* The form's RAW trigger rows, reshaped for the record — PROVENANCE ONLY (see the file's teaching note).
|
|
70
|
+
* One `CoreMRTrigger` per item × trigger attachment, conditions and actions exactly as conduit served them.
|
|
71
|
+
* ⛔ Never a pathway input: `CoreMRPathwayMapper` reads the domain, and a test holds that it reads nothing here.
|
|
72
|
+
*/
|
|
73
|
+
export function provenanceTriggersOf(template: TemplateForm): FSharpList<CoreMRTrigger> {
|
|
74
|
+
return collect<TemplateItem, CoreMRTrigger>((item: TemplateItem): FSharpList<CoreMRTrigger> => {
|
|
75
|
+
let matchValue: ReleaseAvailability$1_$union<FSharpList<ItemTrigger>>;
|
|
76
|
+
return mapIndexed<ItemTrigger, CoreMRTrigger>((triggerOrder: int32, trigger: ItemTrigger): CoreMRTrigger => (new CoreMRTrigger(trigger.TriggerId, item.ItemId, trigger.EventName, triggerOrder + 1, trigger.ExclusiveTag, trigger.Enabled, map<TriggerCondition, CoreMRTriggerCondition>((cond: TriggerCondition): CoreMRTriggerCondition => (new CoreMRTriggerCondition(cond.ConditionId, trigger.TriggerId, undefined, cond.Source, cond.Operator, !isEmpty(cond.RawChoiceIds) ? cond.RawChoiceIds : choose<string, int32>((value: string): Option<int32> => {
|
|
77
|
+
let matchValue_1: [boolean, int32];
|
|
78
|
+
let outArg = 0;
|
|
79
|
+
matchValue_1 = ([tryParse(value, 511, false, 32, new FSharpRef<int32>((): int32 => outArg, (v: int32): void => {
|
|
80
|
+
outArg = (v | 0);
|
|
81
|
+
})), outArg] as [boolean, int32]);
|
|
82
|
+
if (matchValue_1[0]) {
|
|
83
|
+
return matchValue_1[1];
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
}, cond.Values))), trigger.Conditions), map<TriggerAction, CoreMRTriggerEvent>((action: TriggerAction): CoreMRTriggerEvent => (new CoreMRTriggerEvent(action.ActionId, trigger.TriggerId, action.ActionType, action.Params)), trigger.Actions))), (matchValue = item.Triggers, (matchValue.tag === /* NotInRelease */ 1) ? empty<ItemTrigger>() : ((matchValue.tag === /* NotReadYet */ 2) ? empty<ItemTrigger>() : matchValue.fields[0])));
|
|
89
|
+
}, template.Items);
|
|
90
|
+
}
|
|
91
|
+
|
|
68
92
|
/**
|
|
69
93
|
* Map bridge template (TemplateForm — SSOT) to CoreMRFormDetail.
|
|
70
94
|
* When elementTypes is non-empty, use it for ItemTypeName, HasText, HasDate, and bitmask detection.
|
|
71
|
-
*
|
|
95
|
+
* A kind `elementTypes` does not carry is NAMED unresolved (`unresolved_<code>`) — never guessed from a constant.
|
|
72
96
|
*/
|
|
73
97
|
export function mapNewTemplateToCoreMRDetail(elementTypes: FSharpMap<string, ElementTypeEntry>, template: TemplateForm): CoreMRFormDetail {
|
|
74
98
|
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, "");
|
|
@@ -92,39 +116,20 @@ export function mapNewTemplateToCoreMRDetail(elementTypes: FSharpMap<string, Ele
|
|
|
92
116
|
const bitPositions: Option<FSharpList<int32>> = (FSharpSet__Contains(multiSelectTypes, item_1.Type) && patternInput_1[1]) ? patternInput_1[0] : undefined;
|
|
93
117
|
return mapIndexed<TemplateChoice, CoreMRChoice>((index: int32, choice: TemplateChoice): CoreMRChoice => (new CoreMRChoice(choice.ChoiceId, item_1.ItemId, choice.Sequence, choice.Text, choice.Score, orElse(choice.BitPosition, bind<FSharpList<int32>, int32>((positions: FSharpList<int32>): Option<int32> => {
|
|
94
118
|
if (index < length(positions)) {
|
|
95
|
-
return
|
|
119
|
+
return item_2(index, positions);
|
|
96
120
|
}
|
|
97
121
|
else {
|
|
98
122
|
return undefined;
|
|
99
123
|
}
|
|
100
124
|
}, bitPositions)), choice.Code, map_1<int32, string>(int32ToString, choice.Highlight))), sortedChoices);
|
|
101
|
-
}, template.Items),
|
|
102
|
-
let matchValue_1: ReleaseAvailability$1_$union<FSharpList<ItemTrigger>>;
|
|
103
|
-
return mapIndexed<ItemTrigger, CoreMRTrigger>((triggerOrder: int32, trigger: ItemTrigger): CoreMRTrigger => {
|
|
104
|
-
const conditions: FSharpList<CoreMRTriggerCondition> = map<TriggerCondition, CoreMRTriggerCondition>((cond: TriggerCondition): CoreMRTriggerCondition => (new CoreMRTriggerCondition(cond.ConditionId, trigger.TriggerId, undefined, cond.Source, cond.Operator, !isEmpty(cond.RawChoiceIds) ? cond.RawChoiceIds : choose<string, int32>((value_3: string): Option<int32> => {
|
|
105
|
-
let matchValue_2: [boolean, int32];
|
|
106
|
-
let outArg = 0;
|
|
107
|
-
matchValue_2 = ([tryParse(value_3, 511, false, 32, new FSharpRef<int32>((): int32 => outArg, (v: int32): void => {
|
|
108
|
-
outArg = (v | 0);
|
|
109
|
-
})), outArg] as [boolean, int32]);
|
|
110
|
-
if (matchValue_2[0]) {
|
|
111
|
-
return matchValue_2[1];
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
return undefined;
|
|
115
|
-
}
|
|
116
|
-
}, cond.Values))), trigger.Conditions);
|
|
117
|
-
const events: FSharpList<CoreMRTriggerEvent> = map<TriggerAction, CoreMRTriggerEvent>((action: TriggerAction): CoreMRTriggerEvent => (new CoreMRTriggerEvent(action.ActionId, trigger.TriggerId, action.ActionType, action.Params)), trigger.Actions);
|
|
118
|
-
return new CoreMRTrigger(trigger.TriggerId, item_2.ItemId, trigger.EventName, triggerOrder + 1, defaultArg(trigger.ExclusiveTag, ""), trigger.Enabled, conditions, events);
|
|
119
|
-
}, (matchValue_1 = item_2.Triggers, (matchValue_1.tag === /* NotInRelease */ 1) ? empty<ItemTrigger>() : ((matchValue_1.tag === /* NotReadYet */ 2) ? empty<ItemTrigger>() : matchValue_1.fields[0])));
|
|
120
|
-
}, template.Items), empty<CoreMRTag>(), undefined);
|
|
125
|
+
}, template.Items), provenanceTriggersOf(template), empty<CoreMRTag>(), undefined);
|
|
121
126
|
}
|
|
122
127
|
|
|
123
128
|
/**
|
|
124
129
|
* ⭐ THE ONE `TemplateForm -> CoreMRFormData` PATH. A projection of the single builder above, so
|
|
125
130
|
* Studio and f1-api cannot drift: the same CoreMR form becomes the same record in both.
|
|
126
131
|
*
|
|
127
|
-
* ⚰️ It replaces `
|
|
132
|
+
* ⚰️ It replaces `FormTemplateDecoder.toCoreMRFormData`, a SECOND builder that stringified the
|
|
128
133
|
* item type code, hardcoded `HasText`/`HasDate`, dropped every trigger and tag, and never computed a
|
|
129
134
|
* choice's `BitPosition`. Studio used that one and f1-api used this one.
|
|
130
135
|
*/
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import { Helpers_generateDeterministicGuidRaw, Helpers_canonicalizeFieldKey } from "../../../Helpers.js";
|
|
2
|
-
import {
|
|
3
|
-
import { empty,
|
|
2
|
+
import { defaultArg, Option, bind } from "@fable-org/fable-library-js/Option.js";
|
|
3
|
+
import { empty, isEmpty, FSharpList, map, sortBy } from "@fable-org/fable-library-js/List.js";
|
|
4
|
+
import { Spec_FormSpec$1_$reflection, Spec_FieldType_$reflection, Spec_FormSpec$1, Spec_FormClassification_General, Spec_FormLifecycle_Blueprint, Spec_FieldType_$union, Spec_FormStep$1, Spec_VendorScore, Spec_VendorScoreBand } from "../../../FormSpec.js";
|
|
4
5
|
import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
5
|
-
import {
|
|
6
|
+
import { FormScoring, ScoringLabel } from "../../CorEMR/FormTemplateDecoder.js";
|
|
6
7
|
import { numberHash, comparePrimitives } from "@fable-org/fable-library-js/Util.js";
|
|
7
|
-
import { defaultArg, Option, bind } from "@fable-org/fable-library-js/Option.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_VendorScore, Spec_VendorScoreBand } from "../../../FormSpec.js";
|
|
9
|
-
import { FormScoring, ScoringLabel } from "../../CorEMR/TemplateManifestDecoder.js";
|
|
10
8
|
import { toConsoleError, printf, toText, substring } from "@fable-org/fable-library-js/String.js";
|
|
11
9
|
import { createSteps } from "./CorEMRStepsBuilder.js";
|
|
10
|
+
import { ofList } from "@fable-org/fable-library-js/Map.js";
|
|
12
11
|
import { List_groupBy } from "@fable-org/fable-library-js/Seq2.js";
|
|
13
|
-
import {
|
|
14
|
-
import { nonHeadingItems } from "./CorEMRSectioning.js";
|
|
15
|
-
import { convertTriggersToSinglePathway } from "./CorEMRTriggerConverter.js";
|
|
12
|
+
import { CoreMRFormData, CoreMRTag, CoreMRChoice } from "../../CorEMR/CoreMRTypes.js";
|
|
16
13
|
import { Auto_generateBoxedEncoder_437914C6, toString } from "../../../../Thoth.Json/packages/Thoth.Json/Encode.js";
|
|
17
14
|
import { FSharpResult$2_Ok, FSharpResult$2_$union, FSharpResult$2_Error } from "@fable-org/fable-library-js/Result.js";
|
|
18
15
|
import { FormSpecValidator_validateConversion, ValidationResult } from "./CorEMRFormSpecValidator.js";
|
|
@@ -32,15 +29,6 @@ export function generateStableDeterministicGuid(name: string): string {
|
|
|
32
29
|
return Helpers_generateDeterministicGuidRaw(`coremr:formspec:${name}`);
|
|
33
30
|
}
|
|
34
31
|
|
|
35
|
-
/**
|
|
36
|
-
* Create mapping from choice ID to actual text value
|
|
37
|
-
*/
|
|
38
|
-
export function createChoiceIdToTextMap(choices: FSharpList<CoreMRChoice>): FSharpMap<int32, string> {
|
|
39
|
-
return ofList<int32, string>(map<CoreMRChoice, [int32, string]>((c: CoreMRChoice): [int32, string] => ([c.ChoiceId, c.Text] as [int32, string]), choices), {
|
|
40
|
-
Compare: comparePrimitives,
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
32
|
/**
|
|
45
33
|
* ⚰️ `calculateScore` WAS HERE AND IS NOT COMING BACK. It summed every `item_choices.score`
|
|
46
34
|
* in the form — the BITMASK WEIGHT column, which `CoreMRTypes.CoreMRChoice.Score` documents as
|
|
@@ -121,14 +109,7 @@ export function convertToFormSpec(scoring: Option<FormScoring>, formData: CoreMR
|
|
|
121
109
|
Compare: comparePrimitives,
|
|
122
110
|
}));
|
|
123
111
|
const vendorScore: Option<Spec_VendorScore> = statedScale(scoring);
|
|
124
|
-
|
|
125
|
-
Compare: comparePrimitives,
|
|
126
|
-
});
|
|
127
|
-
const itemIdToFieldKeyMap: FSharpMap<int32, Shared_FieldKey> = ofList<int32, Shared_FieldKey>(map<CoreMRItem, [int32, Shared_FieldKey]>((item: CoreMRItem): [int32, Shared_FieldKey] => ([item.ItemId, defaultArg(tryFind<int32, Shared_FieldKey>(item.Sequence, fieldKeyBySequence), generateNamespacedFieldKey(formCode, 1, item))] as [int32, Shared_FieldKey]), nonHeadingItems(formData.Items)), {
|
|
128
|
-
Compare: comparePrimitives,
|
|
129
|
-
});
|
|
130
|
-
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);
|
|
131
|
-
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), undefined, vendorScore, empty<string>(), formData.Metadata.RequiresSignature, false, clinicalPathway, Spec_FormLifecycle_Blueprint(), undefined, undefined, undefined, Spec_FormClassification_General());
|
|
112
|
+
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), undefined, vendorScore, empty<string>(), formData.Metadata.RequiresSignature, false, undefined, Spec_FormLifecycle_Blueprint(), undefined, undefined, undefined, Spec_FormClassification_General());
|
|
132
113
|
}
|
|
133
114
|
|
|
134
115
|
/**
|
|
@@ -806,10 +806,9 @@ export function encodeToFormAnswersWithVitals(provenancePayload: string, filledF
|
|
|
806
806
|
const matchValue: FSharpResult$2_$union<CoreMRSourceMap, string> = tryDecodeSourceMap(provenancePayload);
|
|
807
807
|
if (matchValue.tag === /* Ok */ 0) {
|
|
808
808
|
const sourceMap: CoreMRSourceMap = matchValue.fields[0];
|
|
809
|
-
const formName: string = defaultArg(sourceMap.FormName, `CORE-${sourceMap.FormId}`);
|
|
810
809
|
const fieldMap: FSharpMap<string, Spec_FormField$1<Spec_FieldType_$union>> = buildFieldByKeyMap(filledFormSpec);
|
|
811
810
|
try {
|
|
812
|
-
return FSharpResult$2_Ok<CoreMRFormInsertRequest, string>(new CoreMRFormInsertRequest(sourceMap.FormId,
|
|
811
|
+
return FSharpResult$2_Ok<CoreMRFormInsertRequest, string>(new CoreMRFormInsertRequest(sourceMap.FormId, sourceMap.FormName, scaffoldMode ? undefined : ((acc = collect<CoreMRFieldAnchor, CoreMRAnswer>((anchor: CoreMRFieldAnchor): FSharpList<CoreMRAnswer> => anchorToAnswers(fieldMap, vitalsIdOpt, anchor), collect<CoreMRStepMap, CoreMRFieldAnchor>((step: CoreMRStepMap): FSharpList<CoreMRFieldAnchor> => step.FieldAnchors, sourceMap.Steps)), isEmpty(acc) ? undefined : acc)), dryRun, undefined));
|
|
813
812
|
}
|
|
814
813
|
catch (matchValue_1: any) {
|
|
815
814
|
const activePatternResult: Option<string> = Operators_FailurePattern(matchValue_1);
|
|
@@ -852,12 +851,9 @@ export function encodeToFormAnswers(provenancePayload: string, filledFormSpec: S
|
|
|
852
851
|
return FSharpResult$2_Error<CoreMRFormInsertRequest, string>(`FormSpecId mismatch: provenance is for form ${sourceMap.FormSpecId} but data is from form ${filledFormSpec.Id}. This could cause patient data mixing!`);
|
|
853
852
|
}
|
|
854
853
|
else {
|
|
855
|
-
let formName: string;
|
|
856
|
-
const value = `CORE-${sourceMap.FormId}`;
|
|
857
|
-
formName = defaultArg(orElse(sourceMap.FormName, isNullOrWhiteSpace(filledFormSpec.Title) ? undefined : filledFormSpec.Title), value);
|
|
858
854
|
const fieldMap: FSharpMap<string, Spec_FormField$1<Spec_FieldType_$union>> = buildFieldByKeyMap(filledFormSpec);
|
|
859
855
|
try {
|
|
860
|
-
return FSharpResult$2_Ok<CoreMRFormInsertRequest, string>(new CoreMRFormInsertRequest(sourceMap.FormId,
|
|
856
|
+
return FSharpResult$2_Ok<CoreMRFormInsertRequest, string>(new CoreMRFormInsertRequest(sourceMap.FormId, sourceMap.FormName, scaffoldMode ? undefined : ((acc = collect<CoreMRFieldAnchor, CoreMRAnswer>((anchor: CoreMRFieldAnchor): FSharpList<CoreMRAnswer> => anchorToAnswers(fieldMap, undefined, anchor), collect<CoreMRStepMap, CoreMRFieldAnchor>((step: CoreMRStepMap): FSharpList<CoreMRFieldAnchor> => step.FieldAnchors, sourceMap.Steps)), isEmpty(acc) ? undefined : acc)), dryRun, undefined));
|
|
861
857
|
}
|
|
862
858
|
catch (matchValue_1: any) {
|
|
863
859
|
const activePatternResult: Option<string> = Operators_FailurePattern(matchValue_1);
|