@f1studio/form-spec 5.0.0-alpha.167 → 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/Provenance.d.ts +15 -7
- package/FormSpec.FS/Provenance.d.ts.map +1 -1
- package/FormSpec.FS/Provenance.js +11 -11
- package/FormSpec.FS/Provenance.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/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/Provenance.ts +23 -15
- 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/Core/Ids.ts +8 -8
- package/src/vye-os-contracts-fs/src/CoreMR/FormTemplate.ts +715 -0
- package/vye-os-contracts-fs/src/Core/Ids.d.ts +4 -4
- package/vye-os-contracts-fs/src/Core/Ids.d.ts.map +1 -1
- package/vye-os-contracts-fs/src/Core/Ids.js +18 -18
- 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,4 +1,4 @@
|
|
|
1
|
-
import { ClinicalPathway_PathRequirement, Shared_StateKey, ClinicalPathway_ConstraintType_$union, ClinicalPathway_ConstraintDefinition, ClinicalPathway_ClinicalPathwaySpec, ClinicalPathway_TransitionCondition_$union, ClinicalPathway_LogicalOp_$union, Shared_FieldOption, Shared_FieldOptionKey, Shared_PluginPropertyKey, Shared_MatrixItemKey, Shared_ConditionValue_$union, ClinicalPathway_FieldEvaluator_$union, Spec_FormSpec$1, Spec_FormStep$1, Spec_FieldType_$union, Spec_FormField$1, Shared_FieldKey, ClinicalPathway_StateDefinition, ClinicalPathway_TransitionDefinition } from "../FormSpec.js";
|
|
1
|
+
import { ClinicalPathway_PathRequirement, Shared_StateKey, ClinicalPathway_ConstraintType_$union, ClinicalPathway_ConstraintDefinition, ClinicalPathway_ClinicalPathwaySpec, ClinicalPathway_TransitionCondition_$union, ClinicalPathway_LogicalOp_$union, Shared_FieldOption, Shared_FieldOptionKey, Shared_PluginPropertyKey, Shared_MatrixItemKey, Shared_ConditionValue_$union, ClinicalPathway_FieldEvaluator_$union, Spec_FormSpec$1, Spec_FormStep$1, Spec_FieldType_$union, Spec_FormField$1, Spec_Label_shown, Shared_FieldKey, ClinicalPathway_StateDefinition, ClinicalPathway_TransitionDefinition } from "../FormSpec.js";
|
|
2
2
|
import { int32, float64 } from "@fable-org/fable-library-js/Int32.js";
|
|
3
3
|
import { unwrap, value as value_2, defaultArgWith, Option, map, bind, defaultArg } from "@fable-org/fable-library-js/Option.js";
|
|
4
4
|
import { contains, exists, iterate, length, empty, map as map_1, FSharpList, collect, tryFind } from "@fable-org/fable-library-js/List.js";
|
|
@@ -41,13 +41,13 @@ export function getTransitionLabel(condition: ClinicalPathway_TransitionConditio
|
|
|
41
41
|
const minScore_1: int32 = condition.fields[1] | 0;
|
|
42
42
|
const maxScore_1: int32 = condition.fields[2] | 0;
|
|
43
43
|
const fieldKey: Shared_FieldKey = condition.fields[0];
|
|
44
|
-
return `${defaultArg(bind<Spec_FormSpec$1<Spec_FieldType_$union>, string>((spec: Spec_FormSpec$1<Spec_FieldType_$union>): Option<string> => map<Spec_FormField$1<Spec_FieldType_$union>, string>((field_1: Spec_FormField$1<Spec_FieldType_$union>): string => field_1.Label, tryFind<Spec_FormField$1<Spec_FieldType_$union>>((field: Spec_FormField$1<Spec_FieldType_$union>): boolean => equals(field.FieldKey, fieldKey), collect<Spec_FormStep$1<Spec_FieldType_$union>, Spec_FormField$1<Spec_FieldType_$union>>((step: Spec_FormStep$1<Spec_FieldType_$union>): FSharpList<Spec_FormField$1<Spec_FieldType_$union>> => step.Fields, spec.Steps))), formSpec), "Field")} Score: ${minScore_1}-${maxScore_1}`;
|
|
44
|
+
return `${defaultArg(bind<Spec_FormSpec$1<Spec_FieldType_$union>, string>((spec: Spec_FormSpec$1<Spec_FieldType_$union>): Option<string> => map<Spec_FormField$1<Spec_FieldType_$union>, string>((field_1: Spec_FormField$1<Spec_FieldType_$union>): string => Spec_Label_shown(field_1.Label), tryFind<Spec_FormField$1<Spec_FieldType_$union>>((field: Spec_FormField$1<Spec_FieldType_$union>): boolean => equals(field.FieldKey, fieldKey), collect<Spec_FormStep$1<Spec_FieldType_$union>, Spec_FormField$1<Spec_FieldType_$union>>((step: Spec_FormStep$1<Spec_FieldType_$union>): FSharpList<Spec_FormField$1<Spec_FieldType_$union>> => step.Fields, spec.Steps))), formSpec), "Field")} Score: ${minScore_1}-${maxScore_1}`;
|
|
45
45
|
}
|
|
46
46
|
case /* FieldCondition */ 0: {
|
|
47
47
|
const op: ClinicalPathway_FieldEvaluator_$union = condition.fields[1];
|
|
48
48
|
const fieldPath: Shared_FieldKey = condition.fields[0];
|
|
49
49
|
const conditionValue: Shared_ConditionValue_$union = condition.fields[2];
|
|
50
|
-
const fieldName_1: string = defaultArgWith<string>(bind<Spec_FormSpec$1<Spec_FieldType_$union>, string>((spec_1: Spec_FormSpec$1<Spec_FieldType_$union>): Option<string> => map<Spec_FormField$1<Spec_FieldType_$union>, string>((field_3: Spec_FormField$1<Spec_FieldType_$union>): string => replace(field_3.Label, ":", "").trim(), tryFind<Spec_FormField$1<Spec_FieldType_$union>>((field_2: Spec_FormField$1<Spec_FieldType_$union>): boolean => equals(field_2.FieldKey, fieldPath), collect<Spec_FormStep$1<Spec_FieldType_$union>, Spec_FormField$1<Spec_FieldType_$union>>((step_1: Spec_FormStep$1<Spec_FieldType_$union>): FSharpList<Spec_FormField$1<Spec_FieldType_$union>> => step_1.Fields, spec_1.Steps))), formSpec), (): string => (`Field-${substring(fieldPath.fields[0], 0, 8)}`));
|
|
50
|
+
const fieldName_1: string = defaultArgWith<string>(bind<Spec_FormSpec$1<Spec_FieldType_$union>, string>((spec_1: Spec_FormSpec$1<Spec_FieldType_$union>): Option<string> => map<Spec_FormField$1<Spec_FieldType_$union>, string>((field_3: Spec_FormField$1<Spec_FieldType_$union>): string => replace(Spec_Label_shown(field_3.Label), ":", "").trim(), tryFind<Spec_FormField$1<Spec_FieldType_$union>>((field_2: Spec_FormField$1<Spec_FieldType_$union>): boolean => equals(field_2.FieldKey, fieldPath), collect<Spec_FormStep$1<Spec_FieldType_$union>, Spec_FormField$1<Spec_FieldType_$union>>((step_1: Spec_FormStep$1<Spec_FieldType_$union>): FSharpList<Spec_FormField$1<Spec_FieldType_$union>> => step_1.Fields, spec_1.Steps))), formSpec), (): string => (`Field-${substring(fieldPath.fields[0], 0, 8)}`));
|
|
51
51
|
const valueStr: string = (conditionValue.tag === /* Multiple */ 1) ? join(", ", toList<string>(conditionValue.fields[0])) : ((conditionValue.tag === /* Matrix */ 2) ? join(", ", map_1<[Shared_MatrixItemKey, string], string>((tupledArg: [Shared_MatrixItemKey, string]): string => tupledArg[1], toList_1<Shared_MatrixItemKey, string>(conditionValue.fields[0]))) : ((conditionValue.tag === /* PluginData */ 3) ? conditionValue.fields[0].Value : conditionValue.fields[0]));
|
|
52
52
|
switch (op.tag) {
|
|
53
53
|
case /* InRange */ 13: {
|
|
@@ -83,7 +83,7 @@ export function getTransitionLabel(condition: ClinicalPathway_TransitionConditio
|
|
|
83
83
|
const op_1: ClinicalPathway_FieldEvaluator_$union = condition.fields[2];
|
|
84
84
|
const fieldKey_1: Shared_FieldKey = condition.fields[0];
|
|
85
85
|
const conditionValue_1: Shared_ConditionValue_$union = condition.fields[3];
|
|
86
|
-
const fieldName_2: string = defaultArgWith<string>(bind<Spec_FormSpec$1<Spec_FieldType_$union>, string>((spec_2: Spec_FormSpec$1<Spec_FieldType_$union>): Option<string> => map<Spec_FormField$1<Spec_FieldType_$union>, string>((field_5: Spec_FormField$1<Spec_FieldType_$union>): string => replace(field_5.Label, ":", "").trim(), tryFind<Spec_FormField$1<Spec_FieldType_$union>>((field_4: Spec_FormField$1<Spec_FieldType_$union>): boolean => equals(field_4.FieldKey, fieldKey_1), collect<Spec_FormStep$1<Spec_FieldType_$union>, Spec_FormField$1<Spec_FieldType_$union>>((step_2: Spec_FormStep$1<Spec_FieldType_$union>): FSharpList<Spec_FormField$1<Spec_FieldType_$union>> => step_2.Fields, spec_2.Steps))), formSpec), (): string => (`Field-${substring(fieldKey_1.fields[0], 0, 8)}`));
|
|
86
|
+
const fieldName_2: string = defaultArgWith<string>(bind<Spec_FormSpec$1<Spec_FieldType_$union>, string>((spec_2: Spec_FormSpec$1<Spec_FieldType_$union>): Option<string> => map<Spec_FormField$1<Spec_FieldType_$union>, string>((field_5: Spec_FormField$1<Spec_FieldType_$union>): string => replace(Spec_Label_shown(field_5.Label), ":", "").trim(), tryFind<Spec_FormField$1<Spec_FieldType_$union>>((field_4: Spec_FormField$1<Spec_FieldType_$union>): boolean => equals(field_4.FieldKey, fieldKey_1), collect<Spec_FormStep$1<Spec_FieldType_$union>, Spec_FormField$1<Spec_FieldType_$union>>((step_2: Spec_FormStep$1<Spec_FieldType_$union>): FSharpList<Spec_FormField$1<Spec_FieldType_$union>> => step_2.Fields, spec_2.Steps))), formSpec), (): string => (`Field-${substring(fieldKey_1.fields[0], 0, 8)}`));
|
|
87
87
|
const valueStr_1: string = (conditionValue_1.tag === /* Multiple */ 1) ? join(", ", toList<string>(conditionValue_1.fields[0])) : ((conditionValue_1.tag === /* Matrix */ 2) ? join(", ", map_1<[Shared_MatrixItemKey, string], string>((tupledArg_1: [Shared_MatrixItemKey, string]): string => tupledArg_1[1], toList_1<Shared_MatrixItemKey, string>(conditionValue_1.fields[0]))) : ((conditionValue_1.tag === /* PluginData */ 3) ? conditionValue_1.fields[0].Value : conditionValue_1.fields[0]));
|
|
88
88
|
return `${fieldName_2}.${"Property"} ${(op_1.tag === /* Equals */ 0) ? "=" : ((op_1.tag === /* NotEquals */ 1) ? "≠" : ((op_1.tag === /* GreaterThan */ 5) ? ">" : ((op_1.tag === /* GreaterOrEqual */ 6) ? "≥" : ((op_1.tag === /* LessThan */ 7) ? "<" : ((op_1.tag === /* LessOrEqual */ 8) ? "≤" : "?")))))} ${valueStr_1}`;
|
|
89
89
|
}
|
|
@@ -93,7 +93,7 @@ export function getTransitionLabel(condition: ClinicalPathway_TransitionConditio
|
|
|
93
93
|
const fieldKey_2: Shared_FieldKey = condition.fields[0];
|
|
94
94
|
const fieldItemKey: Option<Shared_MatrixItemKey> = condition.fields[1];
|
|
95
95
|
const conditionValue_2: Shared_ConditionValue_$union = condition.fields[4];
|
|
96
|
-
const baseFieldLabel: string = defaultArgWith<string>(bind<Spec_FormSpec$1<Spec_FieldType_$union>, string>((spec_3: Spec_FormSpec$1<Spec_FieldType_$union>): Option<string> => map<Spec_FormField$1<Spec_FieldType_$union>, string>((field_7: Spec_FormField$1<Spec_FieldType_$union>): string => replace(field_7.Label, ":", "").trim(), tryFind<Spec_FormField$1<Spec_FieldType_$union>>((field_6: Spec_FormField$1<Spec_FieldType_$union>): boolean => equals(field_6.FieldKey, fieldKey_2), collect<Spec_FormStep$1<Spec_FieldType_$union>, Spec_FormField$1<Spec_FieldType_$union>>((step_3: Spec_FormStep$1<Spec_FieldType_$union>): FSharpList<Spec_FormField$1<Spec_FieldType_$union>> => step_3.Fields, spec_3.Steps))), formSpec), (): string => (`Field-${substring(fieldKey_2.fields[0], 0, 8)}`));
|
|
96
|
+
const baseFieldLabel: string = defaultArgWith<string>(bind<Spec_FormSpec$1<Spec_FieldType_$union>, string>((spec_3: Spec_FormSpec$1<Spec_FieldType_$union>): Option<string> => map<Spec_FormField$1<Spec_FieldType_$union>, string>((field_7: Spec_FormField$1<Spec_FieldType_$union>): string => replace(Spec_Label_shown(field_7.Label), ":", "").trim(), tryFind<Spec_FormField$1<Spec_FieldType_$union>>((field_6: Spec_FormField$1<Spec_FieldType_$union>): boolean => equals(field_6.FieldKey, fieldKey_2), collect<Spec_FormStep$1<Spec_FieldType_$union>, Spec_FormField$1<Spec_FieldType_$union>>((step_3: Spec_FormStep$1<Spec_FieldType_$union>): FSharpList<Spec_FormField$1<Spec_FieldType_$union>> => step_3.Fields, spec_3.Steps))), formSpec), (): string => (`Field-${substring(fieldKey_2.fields[0], 0, 8)}`));
|
|
97
97
|
const fieldName_3: string = (fieldItemKey == null) ? baseFieldLabel : (`${baseFieldLabel} [${substring(value_2(fieldItemKey).fields[0], 0, 8)}]`);
|
|
98
98
|
const optionLabel: string = defaultArgWith<string>(bind<Spec_FormSpec$1<Spec_FieldType_$union>, string>((spec_4: Spec_FormSpec$1<Spec_FieldType_$union>): Option<string> => bind<Spec_FormField$1<Spec_FieldType_$union>, string>((field_9: Spec_FormField$1<Spec_FieldType_$union>): Option<string> => {
|
|
99
99
|
let matchValue: Spec_FieldType_$union;
|
|
@@ -1,12 +1,37 @@
|
|
|
1
|
-
import { ClinicalPathway_ActionInfo_$union, ClinicalPathway_MedsetAction, ClinicalPathway_TreatmentAction, ClinicalPathway_ProblemAction, ClinicalPathway_AlertAction, ClinicalPathway_RecurrencePattern, ClinicalPathway_RecurrenceEnd_$union, ClinicalPathway_TaskAction, ClinicalPathway_DueDate_$union, ClinicalPathway_TaskPriority_$union } from "./FormSpec.js";
|
|
2
|
-
import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
3
1
|
import { fromDateTimeOffset, today, addDays, toString } from "@fable-org/fable-library-js/Date.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { Result_Map, FSharpResult$2_$union, FSharpResult$2_Error, FSharpResult$2_Ok } from "@fable-org/fable-library-js/Result.js";
|
|
3
|
+
import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
4
|
+
import { ClinicalPathway_ActionInfo_$union, ClinicalPathway_TaskAction, ClinicalPathway_MedsetAction, ClinicalPathway_TreatmentAction, ClinicalPathway_ProblemAction, ClinicalPathway_AlertAction, ClinicalPathway_StandingSchedule, ClinicalPathway_Cadence_$union, ClinicalPathway_TaskPriority_$union, ClinicalPathway_DueDate_$union } from "./FormSpec.js";
|
|
5
|
+
import { bind, map, defaultArg, Option, value } from "@fable-org/fable-library-js/Option.js";
|
|
6
|
+
import { Union } from "@fable-org/fable-library-js/Types.js";
|
|
7
|
+
import { TriggerAction_$reflection, TriggerAction } from "../vye-os-contracts-fs/src/Clinical/TriggerAction.js";
|
|
8
|
+
import { union_type, string_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
|
-
* Convert ClinicalPathway.
|
|
11
|
+
* Convert ClinicalPathway.DueDate DU → date-only string (yyyy-MM-dd), or the reason it cannot be dated.
|
|
12
|
+
* Date-only format avoids timezone offset issues — the conduit computes date_end as end-of-day from the date portion.
|
|
13
|
+
* ⛔ `AsStated` is the source's own expression ("+2 months", "+1 hours next monday"); f1 cannot date it exactly, so
|
|
14
|
+
* it is NOT WRITTEN rather than guessed (CTA-033).
|
|
15
|
+
*/
|
|
16
|
+
export function convertDueDate(dueDate: ClinicalPathway_DueDate_$union): FSharpResult$2_$union<string, string> {
|
|
17
|
+
switch (dueDate.tag) {
|
|
18
|
+
case /* Tomorrow */ 1:
|
|
19
|
+
return FSharpResult$2_Ok<string, string>(toString(addDays(today(), 1), "yyyy-MM-dd"));
|
|
20
|
+
case /* DaysFromNow */ 2: {
|
|
21
|
+
const days: int32 = dueDate.fields[0] | 0;
|
|
22
|
+
return FSharpResult$2_Ok<string, string>(toString(addDays(today(), days), "yyyy-MM-dd"));
|
|
23
|
+
}
|
|
24
|
+
case /* SpecificDate */ 3:
|
|
25
|
+
return FSharpResult$2_Ok<string, string>(toString(fromDateTimeOffset(dueDate.fields[0], 0), "yyyy-MM-dd"));
|
|
26
|
+
case /* AsStated */ 4:
|
|
27
|
+
return FSharpResult$2_Error<string, string>(`due "${dueDate.fields[0]}" is the source's own expression and cannot be dated by f1`);
|
|
28
|
+
default:
|
|
29
|
+
return FSharpResult$2_Ok<string, string>(toString(today(), "yyyy-MM-dd"));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Convert ClinicalPathway.TaskPriority DU → CoreMR int (1=High, 2=Medium, 3=Low; a stated band verbatim).
|
|
10
35
|
*/
|
|
11
36
|
export function convertPriority(priority: ClinicalPathway_TaskPriority_$union): int32 {
|
|
12
37
|
switch (priority.tag) {
|
|
@@ -14,99 +39,247 @@ export function convertPriority(priority: ClinicalPathway_TaskPriority_$union):
|
|
|
14
39
|
return 2;
|
|
15
40
|
case /* Low */ 2:
|
|
16
41
|
return 3;
|
|
42
|
+
case /* Stated */ 3:
|
|
43
|
+
return priority.fields[0] | 0;
|
|
17
44
|
default:
|
|
18
45
|
return 1;
|
|
19
46
|
}
|
|
20
47
|
}
|
|
21
48
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return toString(addDays(today(), days), "yyyy-MM-dd");
|
|
34
|
-
}
|
|
35
|
-
case /* SpecificDate */ 3:
|
|
36
|
-
return toString(fromDateTimeOffset(dueDate.fields[0], 0), "yyyy-MM-dd");
|
|
37
|
-
default:
|
|
38
|
-
return toString(today(), "yyyy-MM-dd");
|
|
49
|
+
function requireCategoryId(categoryName: string, categoryIdOpt: Option<int32>): FSharpResult$2_$union<int32, string> {
|
|
50
|
+
if (categoryIdOpt == null) {
|
|
51
|
+
return FSharpResult$2_Error<int32, string>(`it states no categoryId (category '${categoryName}'), and CoreMR records every action under one`);
|
|
52
|
+
}
|
|
53
|
+
else if (value(categoryIdOpt) > 0) {
|
|
54
|
+
const id_1: int32 = value(categoryIdOpt) | 0;
|
|
55
|
+
return FSharpResult$2_Ok<int32, string>(id_1);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
const id_2: int32 = value(categoryIdOpt) | 0;
|
|
59
|
+
return FSharpResult$2_Error<int32, string>(`its categoryId ${id_2} (category '${categoryName}') is not a CoreMR id — it must be > 0`);
|
|
39
60
|
}
|
|
40
61
|
}
|
|
41
62
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
63
|
+
export type ActionWrite_$union =
|
|
64
|
+
| ActionWrite<0>
|
|
65
|
+
| ActionWrite<1>
|
|
66
|
+
|
|
67
|
+
export type ActionWrite_$cases = {
|
|
68
|
+
0: ["Written", [TriggerAction]],
|
|
69
|
+
1: ["NotWritten", [string, string]]
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function ActionWrite_Written(Item: TriggerAction) {
|
|
73
|
+
return new ActionWrite<0>(0, [Item]);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function ActionWrite_NotWritten(action: string, reason: string) {
|
|
77
|
+
return new ActionWrite<1>(1, [action, reason]);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export class ActionWrite<Tag extends keyof ActionWrite_$cases> extends Union<Tag, ActionWrite_$cases[Tag][0]> {
|
|
81
|
+
constructor(readonly tag: Tag, readonly fields: ActionWrite_$cases[Tag][1]) {
|
|
82
|
+
super();
|
|
83
|
+
}
|
|
84
|
+
cases() {
|
|
85
|
+
return ["Written", "NotWritten"];
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function ActionWrite_$reflection(): TypeInfo {
|
|
90
|
+
return union_type("F1.Studio.TriggerActions.ActionWrite", [], ActionWrite, () => [[["Item", TriggerAction_$reflection()]], [["action", string_type], ["reason", string_type]]]);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const blank: TriggerAction = new TriggerAction("", 0, 0, 0, "", undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
|
|
94
|
+
|
|
95
|
+
function optionalDate(d: Option<ClinicalPathway_DueDate_$union>): FSharpResult$2_$union<Option<string>, string> {
|
|
96
|
+
if (d != null) {
|
|
97
|
+
return Result_Map<string, Option<string>, string>((Value: string): Option<string> => Value, convertDueDate(value(d)));
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
return FSharpResult$2_Ok<Option<string>, string>(undefined);
|
|
45
101
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function scheduleIdOf(s: ClinicalPathway_StandingSchedule): Option<int32> {
|
|
105
|
+
const matchValue: ClinicalPathway_Cadence_$union = s.Cadence;
|
|
106
|
+
if (matchValue.tag === /* Every */ 1) {
|
|
107
|
+
return undefined;
|
|
49
108
|
}
|
|
50
109
|
else {
|
|
51
|
-
|
|
52
|
-
throw new Error(`TriggerActionDto.convert: invalid categoryId=${id_2} for actionType='${actionType}' category='${categoryName}'. categoryId must be > 0.`);
|
|
110
|
+
return matchValue.fields[0];
|
|
53
111
|
}
|
|
54
112
|
}
|
|
55
113
|
|
|
56
114
|
/**
|
|
57
|
-
* BASE conversion: ClinicalPathway ActionInfo →
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* For CoreMR publishing, use CoreMRTriggerEnrichment.convertActionsForCoreMR instead —
|
|
64
|
-
* it calls this function internally, then adds treatment/medset DTOs and enriches
|
|
65
|
-
* with trigger IDs from provenance.
|
|
66
|
-
*
|
|
67
|
-
* Direct callers: unit tests (testing base conversion logic in isolation).
|
|
68
|
-
* Production callers: NONE (production always goes through convertActionsForCoreMR).
|
|
115
|
+
* BASE conversion: ONE ClinicalPathway ActionInfo → its `ActionWrite`. Vendor-free: it sets no trigger identity —
|
|
116
|
+
* `CoreMRTriggerEnrichment.convertActionsForCoreMR` calls this per action and adds the identity the action's ORIGIN
|
|
117
|
+
* states (or names an `Authored` action NOT WRITTEN).
|
|
118
|
+
* ⛔ NOTHING IS SKIPPED SILENTLY: an action the CoreMR write path has no home for (a group change, a medication, a
|
|
119
|
+
* referral, …) or whose date f1 cannot compute (`AsStated`) is `NotWritten` with its reason.
|
|
120
|
+
* Callers: `convertActionsForCoreMR` (production) and unit tests.
|
|
69
121
|
*/
|
|
70
|
-
export function
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
122
|
+
export function convertActionToBaseDto(action: ClinicalPathway_ActionInfo_$union): ActionWrite_$union {
|
|
123
|
+
const notWritten = ActionWrite_NotWritten;
|
|
124
|
+
switch (action.tag) {
|
|
125
|
+
case /* Alert */ 9: {
|
|
126
|
+
const alertAction: ClinicalPathway_AlertAction = action.fields[0];
|
|
127
|
+
const matchValue_4: FSharpResult$2_$union<int32, string> = requireCategoryId(alertAction.Category, alertAction.CategoryId);
|
|
128
|
+
if (matchValue_4.tag === /* Ok */ 0) {
|
|
129
|
+
return ActionWrite_Written(new TriggerAction("alert", blank.TriggerId, blank.TriggerActionId, matchValue_4.fields[0], alertAction.Category, blank.Priority, blank.Description, blank.DateStart, blank.AllDay, blank.ScheduleEnd, blank.ProblemListId, blank.FormItemId, blank.TreatmentId, blank.ScheduleId, blank.ProviderId, blank.Signature, blank.SourceRelatedId, blank.RelatedType, blank.Chronic, blank.Severity, blank.Inflammation, blank.MedsetId, blank.PharmacyId));
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
return notWritten("alert", matchValue_4.fields[0]);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
case /* Problem */ 10: {
|
|
136
|
+
const problemAction: ClinicalPathway_ProblemAction = action.fields[0];
|
|
137
|
+
const name: string = defaultArg<string>(problemAction.ProblemName, "");
|
|
138
|
+
const matchValue_5: FSharpResult$2_$union<int32, string> = requireCategoryId(name, problemAction.CategoryId);
|
|
139
|
+
if (matchValue_5.tag === /* Ok */ 0) {
|
|
140
|
+
return ActionWrite_Written(new TriggerAction("problem", blank.TriggerId, blank.TriggerActionId, matchValue_5.fields[0], name, blank.Priority, blank.Description, blank.DateStart, blank.AllDay, blank.ScheduleEnd, blank.ProblemListId, blank.FormItemId, blank.TreatmentId, blank.ScheduleId, blank.ProviderId, blank.Signature, blank.SourceRelatedId, blank.RelatedType, problemAction.Chronic, problemAction.Severity, problemAction.Inflammation, blank.MedsetId, blank.PharmacyId));
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
return notWritten("problem", matchValue_5.fields[0]);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
case /* Treatment */ 1: {
|
|
147
|
+
const t: ClinicalPathway_TreatmentAction = action.fields[0];
|
|
148
|
+
const matchValue_6: FSharpResult$2_$union<string, string> = convertDueDate(t.DateStart);
|
|
149
|
+
const matchValue_7: FSharpResult$2_$union<Option<string>, string> = optionalDate(t.Standing.Ends);
|
|
150
|
+
let matchResult: int32, reason_5: string, ends_1: Option<string>, start_1: string;
|
|
151
|
+
const copyOfStruct_2: FSharpResult$2_$union<string, string> = matchValue_6;
|
|
152
|
+
if (copyOfStruct_2.tag === /* Ok */ 0) {
|
|
153
|
+
const copyOfStruct_3: FSharpResult$2_$union<Option<string>, string> = matchValue_7;
|
|
154
|
+
if (copyOfStruct_3.tag === /* Ok */ 0) {
|
|
155
|
+
matchResult = 1;
|
|
156
|
+
ends_1 = copyOfStruct_3.fields[0];
|
|
157
|
+
start_1 = copyOfStruct_2.fields[0];
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
matchResult = 0;
|
|
161
|
+
reason_5 = copyOfStruct_3.fields[0];
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
matchResult = 0;
|
|
166
|
+
reason_5 = copyOfStruct_2.fields[0];
|
|
167
|
+
}
|
|
168
|
+
switch (matchResult) {
|
|
169
|
+
case 0:
|
|
170
|
+
return notWritten("treatment", reason_5!);
|
|
171
|
+
default: {
|
|
172
|
+
const matchValue_9: Option<int32> = t.TreatmentId;
|
|
173
|
+
let matchResult_1: int32, treatmentId: int32;
|
|
174
|
+
if (matchValue_9 != null) {
|
|
175
|
+
if (value(matchValue_9) === 0) {
|
|
176
|
+
matchResult_1 = 0;
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
matchResult_1 = 1;
|
|
180
|
+
treatmentId = value(matchValue_9);
|
|
82
181
|
}
|
|
83
|
-
|
|
84
|
-
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
matchResult_1 = 0;
|
|
185
|
+
}
|
|
186
|
+
switch (matchResult_1) {
|
|
187
|
+
case 0:
|
|
188
|
+
return notWritten("treatment", "it states no treatment id, and CoreMR orders a treatment by its id");
|
|
85
189
|
default:
|
|
86
|
-
return
|
|
190
|
+
return ActionWrite_Written(new TriggerAction("treatment", blank.TriggerId, blank.TriggerActionId, treatmentId!, defaultArg<string>(t.Name, ""), map<ClinicalPathway_TaskPriority_$union, int32>(convertPriority, t.Priority), t.Description, start_1, blank.AllDay, ends_1, blank.ProblemListId, blank.FormItemId, treatmentId!, scheduleIdOf(t.Standing), t.ProviderId, t.Signature, t.SourceRelatedId, 3, blank.Chronic, blank.Severity, blank.Inflammation, blank.MedsetId, blank.PharmacyId));
|
|
87
191
|
}
|
|
88
|
-
}
|
|
192
|
+
}
|
|
89
193
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
194
|
+
}
|
|
195
|
+
case /* Medset */ 2: {
|
|
196
|
+
const m: ClinicalPathway_MedsetAction = action.fields[0];
|
|
197
|
+
const matchValue_10: FSharpResult$2_$union<string, string> = convertDueDate(m.DateStart);
|
|
198
|
+
if (matchValue_10.tag === /* Ok */ 0) {
|
|
199
|
+
const start_2: string = matchValue_10.fields[0];
|
|
200
|
+
const matchValue_11: Option<int32> = m.MedsetId;
|
|
201
|
+
let matchResult_2: int32, medsetId: int32;
|
|
202
|
+
if (matchValue_11 != null) {
|
|
203
|
+
if (value(matchValue_11) === 0) {
|
|
204
|
+
matchResult_2 = 0;
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
matchResult_2 = 1;
|
|
208
|
+
medsetId = value(matchValue_11);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
matchResult_2 = 0;
|
|
213
|
+
}
|
|
214
|
+
switch (matchResult_2) {
|
|
215
|
+
case 0:
|
|
216
|
+
return notWritten("medset", "it states no medset id, and CoreMR orders a medset by its id");
|
|
217
|
+
default:
|
|
218
|
+
return ActionWrite_Written(new TriggerAction("medset", blank.TriggerId, blank.TriggerActionId, medsetId!, m.Name, blank.Priority, blank.Description, start_2, blank.AllDay, blank.ScheduleEnd, blank.ProblemListId, blank.FormItemId, blank.TreatmentId, blank.ScheduleId, m.ProviderId, blank.Signature, blank.SourceRelatedId, blank.RelatedType, blank.Chronic, blank.Severity, blank.Inflammation, medsetId!, m.PharmacyId));
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
return notWritten("medset", matchValue_10.fields[0]);
|
|
93
223
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
224
|
+
}
|
|
225
|
+
case /* ChangeGroups */ 14:
|
|
226
|
+
return notWritten("groups", "a patient-group change: conduit has no write for patient groups");
|
|
227
|
+
case /* Medication */ 0:
|
|
228
|
+
return notWritten("medication", "the CoreMR write path has no medication action");
|
|
229
|
+
case /* Test */ 3:
|
|
230
|
+
return notWritten("test", "the CoreMR write path has no test action");
|
|
231
|
+
case /* Referral */ 4:
|
|
232
|
+
return notWritten("referral", "the CoreMR write path has no referral action");
|
|
233
|
+
case /* Education */ 5:
|
|
234
|
+
return notWritten("education", "the CoreMR write path has no education action");
|
|
235
|
+
case /* Procedure */ 6:
|
|
236
|
+
return notWritten("procedure", "the CoreMR write path has no procedure action");
|
|
237
|
+
case /* Documentation */ 7:
|
|
238
|
+
return notWritten("documentation", "the CoreMR write path has no documentation action");
|
|
239
|
+
case /* Prescription */ 11:
|
|
240
|
+
return notWritten("prescription", "the CoreMR write path has no prescription action");
|
|
241
|
+
case /* SetFieldValue */ 12:
|
|
242
|
+
return notWritten("setFieldValue", "a form-local field change, not a CoreMR record");
|
|
243
|
+
case /* NavigateToForm */ 13:
|
|
244
|
+
return notWritten("navigateToForm", "a navigation, not a CoreMR record");
|
|
245
|
+
default: {
|
|
246
|
+
const taskAction: ClinicalPathway_TaskAction = action.fields[0];
|
|
247
|
+
const actionType: string = (taskAction.Standing != null) ? "recurring_task" : "task";
|
|
248
|
+
const matchValue: FSharpResult$2_$union<string, string> = convertDueDate(taskAction.DueDate);
|
|
249
|
+
const matchValue_1: FSharpResult$2_$union<Option<string>, string> = optionalDate(bind<ClinicalPathway_StandingSchedule, ClinicalPathway_DueDate_$union>((s: ClinicalPathway_StandingSchedule): Option<ClinicalPathway_DueDate_$union> => s.Ends, taskAction.Standing));
|
|
250
|
+
let matchResult_3: int32, reason_1: string, ends: Option<string>, start: string;
|
|
251
|
+
const copyOfStruct: FSharpResult$2_$union<string, string> = matchValue;
|
|
252
|
+
if (copyOfStruct.tag === /* Ok */ 0) {
|
|
253
|
+
const copyOfStruct_1: FSharpResult$2_$union<Option<string>, string> = matchValue_1;
|
|
254
|
+
if (copyOfStruct_1.tag === /* Ok */ 0) {
|
|
255
|
+
matchResult_3 = 1;
|
|
256
|
+
ends = copyOfStruct_1.fields[0];
|
|
257
|
+
start = copyOfStruct.fields[0];
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
matchResult_3 = 0;
|
|
261
|
+
reason_1 = copyOfStruct_1.fields[0];
|
|
262
|
+
}
|
|
97
263
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
264
|
+
else {
|
|
265
|
+
matchResult_3 = 0;
|
|
266
|
+
reason_1 = copyOfStruct.fields[0];
|
|
101
267
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
268
|
+
switch (matchResult_3) {
|
|
269
|
+
case 0:
|
|
270
|
+
return notWritten(actionType, reason_1!);
|
|
271
|
+
default: {
|
|
272
|
+
const matchValue_3: FSharpResult$2_$union<int32, string> = requireCategoryId(taskAction.Category, taskAction.CategoryId);
|
|
273
|
+
if (matchValue_3.tag === /* Ok */ 0) {
|
|
274
|
+
return ActionWrite_Written(new TriggerAction(actionType, blank.TriggerId, blank.TriggerActionId, matchValue_3.fields[0], taskAction.Category, convertPriority(taskAction.Priority), taskAction.Description, start!, true, ends!, blank.ProblemListId, blank.FormItemId, blank.TreatmentId, bind<ClinicalPathway_StandingSchedule, int32>(scheduleIdOf, taskAction.Standing), blank.ProviderId, blank.Signature, blank.SourceRelatedId, blank.RelatedType, blank.Chronic, blank.Severity, blank.Inflammation, blank.MedsetId, blank.PharmacyId));
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
return notWritten(actionType, matchValue_3.fields[0]);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
105
280
|
}
|
|
106
|
-
default:
|
|
107
|
-
return undefined;
|
|
108
281
|
}
|
|
109
|
-
}
|
|
282
|
+
}
|
|
110
283
|
}
|
|
111
284
|
|
|
112
285
|
//# sourceMappingURL=TriggerActionDto.ts.map
|
|
@@ -23,7 +23,7 @@ import { collect, empty as empty_1, map as map_1, singleton, append, delay, toLi
|
|
|
23
23
|
import { tryParse, float64, int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
24
24
|
import { IReactProperty } from "../../../fable_modules/Feliz.2.8.0/Types.fs.js";
|
|
25
25
|
import { IStandardField$3_$reflection, IStandardField$3, IField$1, StandardRenderFieldConfig$2 } from "../../../fable_modules/Fable.Form.Simple.Bulma.5.0.1/Types.fs.js";
|
|
26
|
-
import { Spec_FormField$1, Spec_FieldType_$union, Shared_FieldAnswer, Shared_FieldOption, Shared_FieldValue_$union, Shared_FieldKey, Shared_FieldValue_PluginData, Shared_PluginDataProperty, Shared_PluginPropertyKey, Spec_PluginFieldConfig } from "../../../FormSpec.FS/FormSpec.js";
|
|
26
|
+
import { Spec_FormField$1, Spec_Label_shown, Spec_FieldType_$union, Shared_FieldAnswer, Shared_FieldOption, Shared_FieldValue_$union, Shared_FieldKey, Shared_FieldValue_PluginData, Shared_PluginDataProperty, Shared_PluginPropertyKey, Spec_PluginFieldConfig } from "../../../FormSpec.FS/FormSpec.js";
|
|
27
27
|
import { IPluginValueConverter } from "../../../FormSpec.FS/PluginInterface.js";
|
|
28
28
|
import { Helpers_combineClasses } from "../../../fable_modules/Feliz.Bulma.3.0.0/ElementBuilders.fs.js";
|
|
29
29
|
import { RenderPreviewProps$1 } from "../../../FormSpec.FS/Interfaces.js";
|
|
@@ -1315,10 +1315,10 @@ export function Form_markdownRenderer(field: Spec_FormField$1<Spec_FieldType_$un
|
|
|
1315
1315
|
let matchValue: Shared_FieldValue_$union;
|
|
1316
1316
|
const allergies: FSharpList<AllergyFinderField_AllergyEntry> = AllergyFinderField_parseAllergies((matchValue = fieldDetails.FieldValue, (matchValue.tag === /* Single */ 0) ? matchValue.fields[0].Value : ((matchValue.tag === /* PluginData */ 3) ? defaultArg(map_2<Shared_PluginDataProperty, string>((p_1: Shared_PluginDataProperty): string => p_1.Value, tryFind<Shared_PluginDataProperty>((p: Shared_PluginDataProperty): boolean => (p.Name === "allergies_json"), matchValue.fields[0])), "[]") : "[]")));
|
|
1317
1317
|
if (isEmpty_1(allergies)) {
|
|
1318
|
-
return `**${field.Label}:** *[No allergies recorded]*`;
|
|
1318
|
+
return `**${Spec_Label_shown(field.Label)}:** *[No allergies recorded]*`;
|
|
1319
1319
|
}
|
|
1320
1320
|
else {
|
|
1321
|
-
let rows: FSharpList<string> = ofArray([`**${field.Label}**`, "", "| Allergen | Severity | Category | Reactions | Remedy |", "|----------|----------|----------|-----------|--------|"]);
|
|
1321
|
+
let rows: FSharpList<string> = ofArray([`**${Spec_Label_shown(field.Label)}**`, "", "| Allergen | Severity | Category | Reactions | Remedy |", "|----------|----------|----------|-----------|--------|"]);
|
|
1322
1322
|
const enumerator: IEnumerator<AllergyFinderField_AllergyEntry> = getEnumerator(allergies);
|
|
1323
1323
|
try {
|
|
1324
1324
|
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
@@ -16,7 +16,7 @@ import { empty, singleton, append, delay, toList } from "@fable-org/fable-librar
|
|
|
16
16
|
import { empty as empty_1, tryFind, FSharpList, ofArray } from "@fable-org/fable-library-js/List.js";
|
|
17
17
|
import { ReactElement } from "../../../fable_modules/Fable.React.Types.18.3.0/Fable.React.fs.js";
|
|
18
18
|
import { IStandardField$3_$reflection, IStandardField$3, IField$1, StandardRenderFieldConfig$2 } from "../../../fable_modules/Fable.Form.Simple.Bulma.5.0.1/Types.fs.js";
|
|
19
|
-
import { Spec_FormField$1, Spec_FieldType_$union, Shared_FieldOption, Shared_FieldValue_$union, Shared_FieldKey, Shared_FieldValue_PluginData, Shared_PluginDataProperty, Shared_PluginPropertyKey, Spec_PluginFieldConfig } from "../../../FormSpec.FS/FormSpec.js";
|
|
19
|
+
import { Spec_FormField$1, Spec_Label_shown, Spec_FieldType_$union, Shared_FieldOption, Shared_FieldValue_$union, Shared_FieldKey, Shared_FieldValue_PluginData, Shared_PluginDataProperty, Shared_PluginPropertyKey, Spec_PluginFieldConfig } from "../../../FormSpec.FS/FormSpec.js";
|
|
20
20
|
import { FSharpResult$2_$union, FSharpResult$2_Error, FSharpResult$2_Ok } from "@fable-org/fable-library-js/Result.js";
|
|
21
21
|
import { IPluginValueConverter } from "../../../FormSpec.FS/PluginInterface.js";
|
|
22
22
|
import { RenderPreviewProps$1 } from "../../../FormSpec.FS/Interfaces.js";
|
|
@@ -453,20 +453,27 @@ export function Form_designerPreview(props: RenderPreviewProps$1<Spec_FieldType_
|
|
|
453
453
|
}
|
|
454
454
|
|
|
455
455
|
export function Form_markdownRenderer(field: Spec_FormField$1<Spec_FieldType_$union>, fieldDetails: FieldDetails): string {
|
|
456
|
-
let matchValue_1: string;
|
|
457
456
|
let value: string;
|
|
458
457
|
const matchValue: Shared_FieldValue_$union = fieldDetails.FieldValue;
|
|
459
458
|
value = ((matchValue.tag === /* Single */ 0) ? matchValue.fields[0].Value : "");
|
|
460
459
|
if (isNullOrWhiteSpace(value)) {
|
|
461
|
-
return `**${field.Label}:** *[No data entered]*`;
|
|
460
|
+
return `**${Spec_Label_shown(field.Label)}:** *[No data entered]*`;
|
|
462
461
|
}
|
|
463
462
|
else {
|
|
464
463
|
try {
|
|
465
464
|
const bmiData: BMIField_BMIData = BMIField_parseBMIData(value);
|
|
466
|
-
|
|
465
|
+
if ((((bmiData.Height > 0) && (bmiData.Weight > 0)) && (bmiData.BMI != null)) && (bmiData.Category != null)) {
|
|
466
|
+
let emoji: string;
|
|
467
|
+
const matchValue_1: string = value_90(bmiData.Category);
|
|
468
|
+
emoji = ((matchValue_1 === "Underweight") ? "⚖️" : ((matchValue_1 === "Normal weight") ? "✅" : ((matchValue_1 === "Overweight") ? "⚠️" : ((matchValue_1 === "Obese") ? "🚨" : "📊"))));
|
|
469
|
+
return join("\n", [`**${Spec_Label_shown(field.Label)}** ${emoji}`, "", "| Metric | Value |", "|--------|-------|", `| **Height** | %P(F1) cm |`, `| **Weight** | %P(F1) kg |`, `| **BMI** | **%P(F1)** |`, `| **Category** | **${value_90(bmiData.Category)}** |`, "", "> 💡 *BMI is calculated as weight (kg) divided by height (m) squared*"]);
|
|
470
|
+
}
|
|
471
|
+
else {
|
|
472
|
+
return `**${Spec_Label_shown(field.Label)}:** *[Incomplete data: Height=%P(F1)cm, Weight=%P(F1)kg]*`;
|
|
473
|
+
}
|
|
467
474
|
}
|
|
468
475
|
catch (ex: any) {
|
|
469
|
-
return `**${field.Label}:** *[Error processing data: ${ex.message}]*`;
|
|
476
|
+
return `**${Spec_Label_shown(field.Label)}:** *[Error processing data: ${ex.message}]*`;
|
|
470
477
|
}
|
|
471
478
|
}
|
|
472
479
|
}
|
|
@@ -6,7 +6,7 @@ import { mapValues, Field$3, IAttributes } from "../../../fable_modules/Fable.Fo
|
|
|
6
6
|
import { Form$3, FieldConfig$4, field as field_1 } from "../../../fable_modules/Fable.Form.3.0.0/Base.fs.js";
|
|
7
7
|
import { join, split, isNullOrWhiteSpace, isNullOrEmpty } from "@fable-org/fable-library-js/String.js";
|
|
8
8
|
import { newGuid } from "@fable-org/fable-library-js/Guid.js";
|
|
9
|
-
import { Spec_FormField$1, Spec_FieldType_$union, Shared_FieldValue_$union, Shared_FieldKey, Shared_FieldValue_PluginData, Shared_PluginDataProperty, Shared_PluginPropertyKey, Spec_PluginFieldConfig, Shared_FieldOption, Shared_FieldOptionKey } from "../../../FormSpec.FS/FormSpec.js";
|
|
9
|
+
import { Spec_FormField$1, Spec_Label_shown, Spec_FieldType_$union, Shared_FieldValue_$union, Shared_FieldKey, Shared_FieldValue_PluginData, Shared_PluginDataProperty, Shared_PluginPropertyKey, Spec_PluginFieldConfig, Shared_FieldOption, Shared_FieldOptionKey } from "../../../FormSpec.FS/FormSpec.js";
|
|
10
10
|
import { empty as empty_1, tryFind, FSharpList, ofArray } from "@fable-org/fable-library-js/List.js";
|
|
11
11
|
import { item } from "@fable-org/fable-library-js/Array.js";
|
|
12
12
|
import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
@@ -464,7 +464,7 @@ export function Form_markdownRenderer(field: Spec_FormField$1<Spec_FieldType_$un
|
|
|
464
464
|
const matchValue: Shared_FieldValue_$union = fieldDetails.FieldValue;
|
|
465
465
|
value = ((matchValue.tag === /* Single */ 0) ? matchValue.fields[0].Value : "");
|
|
466
466
|
if (isNullOrWhiteSpace(value)) {
|
|
467
|
-
return `**${field.Label}:** *[No demographics recorded]*`;
|
|
467
|
+
return `**${Spec_Label_shown(field.Label)}:** *[No demographics recorded]*`;
|
|
468
468
|
}
|
|
469
469
|
else {
|
|
470
470
|
try {
|
|
@@ -489,12 +489,12 @@ export function Form_markdownRenderer(field: Spec_FormField$1<Spec_FieldType_$un
|
|
|
489
489
|
if (data.MRN != null) {
|
|
490
490
|
void (parts.push(`MRN: ${value_40(data.MRN)}`));
|
|
491
491
|
}
|
|
492
|
-
return (parts.length > 0) ? ((`**${field.Label}**
|
|
492
|
+
return (parts.length > 0) ? ((`**${Spec_Label_shown(field.Label)}**
|
|
493
493
|
|
|
494
|
-
`) + join("\n", map_1<string, string>((p: string): string => ("- " + p), parts))) : (`**${field.Label}:** *[No demographics recorded]*`);
|
|
494
|
+
`) + join("\n", map_1<string, string>((p: string): string => ("- " + p), parts))) : (`**${Spec_Label_shown(field.Label)}:** *[No demographics recorded]*`);
|
|
495
495
|
}
|
|
496
496
|
catch (ex: any) {
|
|
497
|
-
return `**${field.Label}:** *[Error: ${ex.message}]*`;
|
|
497
|
+
return `**${Spec_Label_shown(field.Label)}:** *[Error: ${ex.message}]*`;
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
500
|
}
|
|
@@ -14,7 +14,7 @@ import { map as map_2, defaultArg, some, value as value_47, Option } from "@fabl
|
|
|
14
14
|
import { reactApi } from "../../../fable_modules/Feliz.2.8.0/Interop.fs.js";
|
|
15
15
|
import { tryParse, int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
16
16
|
import { IStandardField$3_$reflection, IStandardField$3, IField$1, StandardRenderFieldConfig$2 } from "../../../fable_modules/Fable.Form.Simple.Bulma.5.0.1/Types.fs.js";
|
|
17
|
-
import { Spec_FormField$1, Shared_FieldAnswer, Spec_FieldType_$union, Shared_MatrixAnswer, Shared_FieldOption, Shared_MatrixItemKey, Shared_FieldValue_$union, Shared_FieldKey, Shared_FieldValue_PluginData, Shared_PluginDataProperty, Shared_PluginPropertyKey, Spec_PluginFieldConfig } from "../../../FormSpec.FS/FormSpec.js";
|
|
17
|
+
import { Spec_FormField$1, Spec_Label_shown, Shared_FieldAnswer, Spec_FieldType_$union, Shared_MatrixAnswer, Shared_FieldOption, Shared_MatrixItemKey, Shared_FieldValue_$union, Shared_FieldKey, Shared_FieldValue_PluginData, Shared_PluginDataProperty, Shared_PluginPropertyKey, Spec_PluginFieldConfig } from "../../../FormSpec.FS/FormSpec.js";
|
|
18
18
|
import { tryParse as tryParse_1 } from "@fable-org/fable-library-js/Guid.js";
|
|
19
19
|
import { FSharpResult$2_$union, FSharpResult$2_Ok } from "@fable-org/fable-library-js/Result.js";
|
|
20
20
|
import { IPluginValueConverter } from "../../../FormSpec.FS/PluginInterface.js";
|
|
@@ -396,10 +396,10 @@ export function Form_markdownRenderer(field: Spec_FormField$1<Spec_FieldType_$un
|
|
|
396
396
|
const pairs: FSharpList<[string, string]> = Form_parseLikertSerialized(answer.Value);
|
|
397
397
|
if (isEmpty_2(pairs)) {
|
|
398
398
|
if (isNullOrWhiteSpace(answer.Value)) {
|
|
399
|
-
return `**${field.Label}:** *No responses provided*`;
|
|
399
|
+
return `**${Spec_Label_shown(field.Label)}:** *No responses provided*`;
|
|
400
400
|
}
|
|
401
401
|
else {
|
|
402
|
-
return `**${field.Label}:** ${answer.Value}`;
|
|
402
|
+
return `**${Spec_Label_shown(field.Label)}:** ${answer.Value}`;
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
405
|
else {
|
|
@@ -422,28 +422,32 @@ export function Form_markdownRenderer(field: Spec_FormField$1<Spec_FieldType_$un
|
|
|
422
422
|
const optionScoreMap: FSharpMap<string, int32> = ofList<string, int32>(choose_1<Shared_FieldOption, [string, int32]>((o_2: Shared_FieldOption): Option<[string, int32]> => map_2<int32, [string, int32]>((sc: int32): [string, int32] => ([o_2.Value, sc] as [string, int32]), o_2.Score), options), {
|
|
423
423
|
Compare: comparePrimitives,
|
|
424
424
|
});
|
|
425
|
-
|
|
425
|
+
const valueRows_1: FSharpList<string> = map_1<[string, string], string>((tupledArg_2: [string, string]): string => {
|
|
426
426
|
const itemKey_1: string = tupledArg_2[0];
|
|
427
427
|
const optValue: string = tupledArg_2[1];
|
|
428
428
|
return `| ${defaultArg(tryFind<string, string>(itemKey_1, itemLabelMap), itemKey_1)} | **${defaultArg(tryFind<string, string>(optValue, optionLabelMap), optValue)}** |`;
|
|
429
|
-
}, pairs)
|
|
429
|
+
}, pairs);
|
|
430
|
+
const totalScore_1: int32 = sum<int32>(choose_1<[string, string], int32>((tupledArg_3: [string, string]): Option<int32> => tryFind<string, int32>(tupledArg_3[1], optionScoreMap), pairs), {
|
|
430
431
|
GetZero: (): int32 => 0,
|
|
431
432
|
Add: (x_4: int32, y_4: int32): int32 => (x_4 + y_4),
|
|
432
|
-
})
|
|
433
|
+
}) | 0;
|
|
434
|
+
const itemCount_1: int32 = length<[string, string]>(pairs) | 0;
|
|
435
|
+
return join("\n", append_1(ofArray([`**${Spec_Label_shown(field.Label)}** 📊`, "", "| Item | Rating |", "|------|--------|"]), append_1(valueRows_1, ofArray(["", `> **Total Score:** ${totalScore_1} (${itemCount_1} items rated)`]))));
|
|
433
436
|
}
|
|
434
437
|
}
|
|
435
438
|
case /* Multiple */ 1:
|
|
436
|
-
return `**${field.Label}:** *Multiple values (unexpected format)*`;
|
|
439
|
+
return `**${Spec_Label_shown(field.Label)}:** *Multiple values (unexpected format)*`;
|
|
437
440
|
case /* PluginData */ 3:
|
|
438
|
-
return `**${field.Label}:** *Plugin data (use plugin-specific export)*`;
|
|
441
|
+
return `**${Spec_Label_shown(field.Label)}:** *Plugin data (use plugin-specific export)*`;
|
|
439
442
|
default: {
|
|
440
443
|
const matrixAnswer: Shared_MatrixAnswer = matchValue.fields[0];
|
|
441
444
|
const itemCount: int32 = FSharpMap__get_Count(matrixAnswer.Values) | 0;
|
|
442
445
|
if (itemCount === 0) {
|
|
443
|
-
return `**${field.Label}:** *No responses provided*`;
|
|
446
|
+
return `**${Spec_Label_shown(field.Label)}:** *No responses provided*`;
|
|
444
447
|
}
|
|
445
448
|
else {
|
|
446
|
-
|
|
449
|
+
const valueRows: FSharpList<string> = map_1<[Shared_MatrixItemKey, string], string>((tupledArg: [Shared_MatrixItemKey, string]): string => (`| ${substring(tupledArg[0].fields[0], 0, 8)} | **${tupledArg[1]}** |`), toList_1<Shared_MatrixItemKey, string>(matrixAnswer.Values));
|
|
450
|
+
const totalScore: int32 = sum<int32>(choose_1<[Shared_MatrixItemKey, string], int32>((tupledArg_1: [Shared_MatrixItemKey, string]): Option<int32> => {
|
|
447
451
|
let matchValue_1: [boolean, int32];
|
|
448
452
|
let outArg = 0;
|
|
449
453
|
matchValue_1 = ([tryParse(tupledArg_1[1], 511, false, 32, new FSharpRef<int32>((): int32 => outArg, (v_1: int32): void => {
|
|
@@ -458,7 +462,8 @@ export function Form_markdownRenderer(field: Spec_FormField$1<Spec_FieldType_$un
|
|
|
458
462
|
}, toList_1<Shared_MatrixItemKey, string>(matrixAnswer.Values)), {
|
|
459
463
|
GetZero: (): int32 => 0,
|
|
460
464
|
Add: (x: int32, y: int32): int32 => (x + y),
|
|
461
|
-
})
|
|
465
|
+
}) | 0;
|
|
466
|
+
return join("\n", append_1(ofArray([`**${Spec_Label_shown(field.Label)}** 📊`, "", "| Item | Rating |", "|------|--------|"]), append_1(valueRows, ofArray(["", `> **Total Score:** ${totalScore} (${itemCount} items rated)`]))));
|
|
462
467
|
}
|
|
463
468
|
}
|
|
464
469
|
}
|