@f1studio/form-spec 5.0.0-alpha.121 → 5.0.0-alpha.124
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 +1 -1
- package/FormSpec.FS/BlueprintValidation.d.ts.map +1 -1
- package/FormSpec.FS/FormSpec.d.ts +41 -1
- package/FormSpec.FS/FormSpec.d.ts.map +1 -1
- package/FormSpec.FS/FormSpecHelpers.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.d.ts +6 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.d.ts +5 -0
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.d.ts +72 -0
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.d.ts.map +1 -0
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.d.ts.map +1 -1
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.d.ts +15 -9
- package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.d.ts.map +1 -1
- package/FormSpec.FS/Interop/FormSpec.Api.Helpers.d.ts +25 -23
- package/FormSpec.FS/Interop/FormSpec.Api.Helpers.d.ts.map +1 -1
- package/FormSpec.FS/Interop/FormSpec.Api.Option.d.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/BlueprintValidation.js +63 -46
- package/FormSpec.TS/FormSpec.FS/BlueprintValidation.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/BlueprintValidation.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Designer.js +1 -1
- package/FormSpec.TS/FormSpec.FS/Designer.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Designer.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/FormSpec.js +129 -1
- package/FormSpec.TS/FormSpec.FS/FormSpec.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/FormSpec.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.js +1 -1
- package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/FormSpecValues.js +2 -2
- package/FormSpec.TS/FormSpec.FS/FormSpecValues.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/FormSpecValues.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Helpers.js +11 -11
- package/FormSpec.TS/FormSpec.FS/Helpers.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Helpers.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.js +4 -4
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.js +9 -2
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.js +360 -0
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.js.map +1 -0
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.ts.map +1 -0
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js +119 -46
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js +40 -24
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js +105 -125
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.js +1 -1
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.js.map +1 -1
- package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.ts.map +1 -1
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.js.map +1 -1
- package/FormSpec.TS/fable_modules/Thoth.Json.10.4.1/Encode.fs.ts.map +1 -1
- package/FormSpec.TS/fable_modules/project_cracked.json +1 -1
- package/FormSpec.TS/plugins/bmi/src/BMIField.js +193 -275
- package/FormSpec.TS/plugins/bmi/src/BMIField.js.map +1 -1
- package/FormSpec.TS/plugins/bmi/src/BMIField.ts.map +1 -1
- package/FormSpec.TS/plugins/likert/src/LikertField.js +19 -138
- package/FormSpec.TS/plugins/likert/src/LikertField.js.map +1 -1
- package/FormSpec.TS/plugins/likert/src/LikertField.ts.map +1 -1
- package/README.md +20 -16
- package/package.json +1 -1
- package/plugins/bmi/src/BMIField.d.ts.map +1 -1
- package/plugins/likert/src/LikertField.d.ts.map +1 -1
- package/src/FormSpec.FS/BlueprintValidation.ts +62 -44
- package/src/FormSpec.FS/Designer.ts +1 -1
- package/src/FormSpec.FS/FormSpec.ts +92 -2
- package/src/FormSpec.FS/FormSpecHelpers.ts +2 -2
- package/src/FormSpec.FS/FormSpecValues.ts +2 -2
- package/src/FormSpec.FS/Helpers.ts +11 -11
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRAdapter.ts +8 -4
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.ts +11 -2
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.ts +222 -0
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts +2 -2
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts +123 -51
- package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts +44 -25
- package/src/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts +137 -136
- package/src/FormSpec.FS/Interop/FormSpec.Api.Option.ts +2 -2
- package/src/plugins/bmi/src/BMIField.ts +62 -82
- package/src/plugins/likert/src/LikertField.ts +20 -95
- package/FormSpec.FS/Interop/PluginPropertyKeyRegistry.d.ts +0 -16
- package/FormSpec.FS/Interop/PluginPropertyKeyRegistry.d.ts.map +0 -1
- package/FormSpec.FS/Validation/Validation.FilledForm.d.ts +0 -31
- package/FormSpec.FS/Validation/Validation.FilledForm.d.ts.map +0 -1
- package/FormSpec.FS/Validation/ValidationTypes.d.ts +0 -12
- package/FormSpec.FS/Validation/ValidationTypes.d.ts.map +0 -1
- package/FormSpec.TS/FormSpec.FS/Interop/PluginPropertyKeyRegistry.js +0 -121
- package/FormSpec.TS/FormSpec.FS/Interop/PluginPropertyKeyRegistry.js.map +0 -1
- package/FormSpec.TS/FormSpec.FS/Interop/PluginPropertyKeyRegistry.ts.map +0 -1
- package/FormSpec.TS/FormSpec.FS/Validation/Validation.FilledForm.js +0 -148
- package/FormSpec.TS/FormSpec.FS/Validation/Validation.FilledForm.js.map +0 -1
- package/FormSpec.TS/FormSpec.FS/Validation/Validation.FilledForm.ts.map +0 -1
- package/FormSpec.TS/FormSpec.FS/Validation/ValidationTypes.js +0 -51
- package/FormSpec.TS/FormSpec.FS/Validation/ValidationTypes.js.map +0 -1
- package/FormSpec.TS/FormSpec.FS/Validation/ValidationTypes.ts.map +0 -1
- package/fable_modules/Feliz.2.8.0/Colors.fs.d.ts +0 -9
- package/fable_modules/Feliz.2.8.0/Colors.fs.d.ts.map +0 -1
- package/src/FormSpec.FS/Interop/PluginPropertyKeyRegistry.ts +0 -96
- package/src/FormSpec.FS/Validation/Validation.FilledForm.ts +0 -158
- package/src/FormSpec.FS/Validation/ValidationTypes.ts +0 -23
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { tryPick, filter, mapIndexed as mapIndexed_1, isEmpty, map as map_3,
|
|
3
|
-
import { join,
|
|
1
|
+
import { value as value_11, map, unwrap, defaultArgWith as defaultArgWith_1, Option, defaultArg as defaultArg_1 } from "@fable-org/fable-library-js/Option.js";
|
|
2
|
+
import { tryPick, filter, mapIndexed as mapIndexed_1, isEmpty, singleton, map as map_3, empty, ofArray as ofArray_1, ofSeq, fold, collect, tryFind, FSharpList } from "@fable-org/fable-library-js/List.js";
|
|
3
|
+
import { join, printf, toConsole } from "@fable-org/fable-library-js/String.js";
|
|
4
4
|
import { Auto_generateBoxedEncoder_437914C6, toString } from "../../fable_modules/Thoth.Json.10.4.1/Encode.fs.js";
|
|
5
5
|
import { array_type, string_type, union_type, TypeInfo, obj_type } from "@fable-org/fable-library-js/Reflection.js";
|
|
6
6
|
import { Auto_generateBoxedDecoder_Z6670B51, fromString } from "../../fable_modules/Thoth.Json.10.4.1/Decode.fs.js";
|
|
7
|
-
import { equals, stringHash, compare,
|
|
8
|
-
import { ClinicalPathway_StateType_$union, ClinicalPathway_TaskPriority_$union, ClinicalPathway_AlertSeverity_$union, ClinicalPathway_ReferralUrgency_$union, ClinicalPathway_ActionInfo_$union, ClinicalPathway_NavigateToFormAction, ClinicalPathway_ProblemAction, ClinicalPathway_AlertAction, ClinicalPathway_EducationAction, ClinicalPathway_ProcedureAction, ClinicalPathway_TestAction, ClinicalPathway_DocumentationAction, ClinicalPathway_FieldValueSource_$union, ClinicalPathway_SetFieldValueAction, ClinicalPathway_PrescriptionAction, ClinicalPathway_MedicationAction, ClinicalPathway_ReferralAction, Shared_FieldValue, Shared_FieldValue_$union, ClinicalPathway_ClinicalPathwaySpec, ClinicalPathway_PathRequirement, ClinicalPathway_ConstraintDefinition, ClinicalPathway_PathwayExecutionMode_SinglePathway, ClinicalPathway_SinglePathwayConfig, ClinicalPathway_SelectionStrategy_HighestPriority, ClinicalPathway_TransitionDefinition, ClinicalPathway_TransitionCondition_FieldCondition, Shared_ConditionValue_Single, ClinicalPathway_FieldEvaluator_Equals, Shared_TransitionKey, ClinicalPathway_StateType_Terminal, ClinicalPathway_TerminalInfo, ClinicalPathway_StateDefinition, ClinicalPathway_StateType_Action, ClinicalPathway_ActionInfo_Task, ClinicalPathway_TaskAction, ClinicalPathway_DueDate_Today, ClinicalPathway_TaskPriority_Medium, ClinicalPathway_TaskPriority_Low, ClinicalPathway_TaskPriority_High, Shared_StateKey, Spec_FieldType_PluginField, Spec_PluginFieldConfig, Spec_FieldType_Matrix, Spec_MatrixInfo, Spec_FormLifecycle_Blueprint, Spec_FieldType_Text, Spec_TextInfo, Spec_FieldType_CheckboxList, Spec_MultiChoiceInfo, Shared_FieldOptionKey, Spec_FieldType_Checkbox, Spec_BooleanInfo, Shared_FieldKey, Shared_FieldOption, Shared_FieldValue_Single, Shared_FieldValue_PluginData, Shared_PluginDataProperty, Shared_PluginPropertyKey, Shared_FieldValue_Matrix, Shared_MatrixAnswer, Shared_MatrixItemKey, Shared_FieldValue_Multiple, Shared_FieldAnswer, Spec_FormStep$1, Spec_FormField$1, Spec_FieldType_$union, Spec_FormSpec$1, Spec_FormSpec$1_$reflection, Spec_FieldType_$reflection } from "../FormSpec.js";
|
|
7
|
+
import { equals, createObj, stringHash, compare, IDisposable, disposeSafe, IEnumerator, getEnumerator, IMap, isArrayLike, uncurry2 } from "@fable-org/fable-library-js/Util.js";
|
|
8
|
+
import { Spec_ClinicalInstrumentInfo, Spec_FormClassification_$union, ClinicalPathway_StateType_$union, ClinicalPathway_TaskPriority_$union, ClinicalPathway_AlertSeverity_$union, ClinicalPathway_ReferralUrgency_$union, ClinicalPathway_ActionInfo_$union, ClinicalPathway_NavigateToFormAction, ClinicalPathway_ProblemAction, ClinicalPathway_AlertAction, ClinicalPathway_EducationAction, ClinicalPathway_ProcedureAction, ClinicalPathway_TestAction, ClinicalPathway_DocumentationAction, ClinicalPathway_FieldValueSource_$union, ClinicalPathway_SetFieldValueAction, ClinicalPathway_PrescriptionAction, ClinicalPathway_MedicationAction, ClinicalPathway_ReferralAction, Shared_FieldValue, Shared_FieldValue_$union, ClinicalPathway_ClinicalPathwaySpec, ClinicalPathway_PathRequirement, ClinicalPathway_ConstraintDefinition, ClinicalPathway_PathwayExecutionMode_SinglePathway, ClinicalPathway_SinglePathwayConfig, ClinicalPathway_SelectionStrategy_HighestPriority, ClinicalPathway_TransitionDefinition, ClinicalPathway_TransitionCondition_FieldCondition, Shared_ConditionValue_Single, ClinicalPathway_FieldEvaluator_Equals, Shared_TransitionKey, ClinicalPathway_StateType_Terminal, ClinicalPathway_TerminalInfo, ClinicalPathway_StateDefinition, ClinicalPathway_StateType_Action, ClinicalPathway_ActionInfo_Task, ClinicalPathway_TaskAction, ClinicalPathway_DueDate_Today, ClinicalPathway_TaskPriority_Medium, ClinicalPathway_TaskPriority_Low, ClinicalPathway_TaskPriority_High, Shared_StateKey, Spec_FieldType_PluginField, Spec_PluginFieldConfig, Spec_FieldType_Matrix, Spec_MatrixInfo, Spec_FormClassification_General, Spec_FormLifecycle_Blueprint, Spec_FieldType_Text, Spec_TextInfo, Spec_FieldType_CheckboxList, Spec_MultiChoiceInfo, Shared_FieldOptionKey, Spec_FieldType_Checkbox, Spec_BooleanInfo, Shared_FieldKey, Shared_FieldOption, Shared_FieldValue_Single, Shared_FieldValue_PluginData, Shared_PluginDataProperty, Shared_PluginPropertyKey, Shared_FieldValue_Matrix, Shared_MatrixAnswer, Shared_MatrixItemKey, Shared_FieldValue_Multiple, Shared_FieldAnswer, Spec_FormStep$1, Spec_FormField$1, Spec_FieldType_$union, Spec_FormSpec$1, Spec_FormSpec$1_$reflection, Spec_FieldType_$reflection } from "../FormSpec.js";
|
|
9
9
|
import { FSharpResult$2_Ok, FSharpResult$2_Error, FSharpResult$2_$union } from "@fable-org/fable-library-js/Result.js";
|
|
10
10
|
import { newGuid, parse, tryParse } from "@fable-org/fable-library-js/Guid.js";
|
|
11
|
-
import {
|
|
11
|
+
import { Union, FSharpRef } from "@fable-org/fable-library-js/Types.js";
|
|
12
12
|
import { IOptionalGetter, array as array_4, IGetters, dict as dict_1, string, IRequiredGetter, object, fromString as fromString_1 } from "../../fable_modules/Thoth.Json.10.4.1/Decode.fs.js";
|
|
13
13
|
import { ErrorReason_$union } from "../../fable_modules/Thoth.Json.10.4.1/Types.fs.js";
|
|
14
|
-
import { count, ofSeq as ofSeq_1,
|
|
14
|
+
import { count, ofSeq as ofSeq_1, toList, FSharpMap } from "@fable-org/fable-library-js/Map.js";
|
|
15
15
|
import { addToDict } from "@fable-org/fable-library-js/MapUtil.js";
|
|
16
16
|
import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import { ValidationError } from "../Validation/ValidationTypes.js";
|
|
22
|
-
import { getFieldDetails as getFieldDetails_1, FieldDetails$1, updateField, findStepIndexForField, updateFieldDocumentation } from "../FormSpecValues.js";
|
|
23
|
-
import { toArray, ofArray as ofArray_1 } from "@fable-org/fable-library-js/Set.js";
|
|
17
|
+
import { getFieldDetails as getFieldDetails_1, FieldDetails$1, findStepIndexForField, updateField } from "../FormSpecValues.js";
|
|
18
|
+
import { singleton as singleton_1, empty as empty_1, collect as collect_1, delay, toList as toList_1, mapIndexed, map as map_2, choose } from "@fable-org/fable-library-js/Seq.js";
|
|
19
|
+
import { toArray, ofArray } from "@fable-org/fable-library-js/Set.js";
|
|
20
|
+
import { map as map_1 } from "@fable-org/fable-library-js/Array.js";
|
|
24
21
|
import { now } from "@fable-org/fable-library-js/DateOffset.js";
|
|
25
22
|
import { initializeExecution } from "../PathwayExecutor.js";
|
|
26
23
|
import { List_distinct, distinct } from "@fable-org/fable-library-js/Seq2.js";
|
|
@@ -65,20 +62,12 @@ export function listToArray<T>(list: FSharpList<T>): T[] {
|
|
|
65
62
|
return Array.from(list);
|
|
66
63
|
}
|
|
67
64
|
|
|
68
|
-
/**
|
|
69
|
-
* Serialize FormSpec to JSON. Uses PascalCase (Thoth default).
|
|
70
|
-
* Case conversion at API boundaries per COREMR_F1_CACHING_STRATEGY.md.
|
|
71
|
-
*/
|
|
72
65
|
export function serializeFormSpec(formSpec: any): string {
|
|
73
66
|
toConsole(printf("[API.Helpers] Serializing FormSpec!!"));
|
|
74
67
|
toConsole(`[API.Helpers] FormSpec: ${formSpec}`);
|
|
75
68
|
return toString(0, Auto_generateBoxedEncoder_437914C6(obj_type, undefined, undefined, undefined)(formSpec));
|
|
76
69
|
}
|
|
77
70
|
|
|
78
|
-
/**
|
|
79
|
-
* Deserialize FormSpec from JSON. Uses PascalCase (Thoth default).
|
|
80
|
-
* Case conversion at API boundaries per COREMR_F1_CACHING_STRATEGY.md.
|
|
81
|
-
*/
|
|
82
71
|
export function deserializeFormSpec(json: string): Option<Spec_FormSpec$1<Spec_FieldType_$union>> {
|
|
83
72
|
toConsole(printf("[API.Helpers] Deserializing FormSpec"));
|
|
84
73
|
const matchValue: FSharpResult$2_$union<Spec_FormSpec$1<Spec_FieldType_$union>, string> = fromString<Spec_FormSpec$1<Spec_FieldType_$union>>(uncurry2(Auto_generateBoxedDecoder_Z6670B51(Spec_FormSpec$1_$reflection(Spec_FieldType_$reflection()), undefined, undefined)), json);
|
|
@@ -381,109 +370,36 @@ export function createFormFieldData(fieldKey: string, objectValue: any): { field
|
|
|
381
370
|
};
|
|
382
371
|
}
|
|
383
372
|
|
|
384
|
-
function normalizePluginDataItem(item: any): any {
|
|
385
|
-
const name: string = toString_1((item["Name"] != null && item["Name"] !== undefined ? item["Name"] : (item["name"] != null && item["name"] !== undefined ? item["name"] : null)));
|
|
386
|
-
const value_2: string = toString_1((item["Value"] != null && item["Value"] !== undefined ? item["Value"] : (item["value"] != null && item["value"] !== undefined ? item["value"] : null)));
|
|
387
|
-
const dataType: string = toString_1((item["DataType"] != null && item["DataType"] !== undefined ? item["DataType"] : (item["dataType"] != null && item["dataType"] !== undefined ? item["dataType"] : null)));
|
|
388
|
-
const displayName: any = (item["DisplayName"] != null && item["DisplayName"] !== undefined ? item["DisplayName"] : (item["displayName"] != null && item["displayName"] !== undefined ? item["displayName"] : null));
|
|
389
|
-
const unitVal: any = (item["Unit"] != null && item["Unit"] !== undefined ? item["Unit"] : (item["unit"] != null && item["unit"] !== undefined ? item["unit"] : null));
|
|
390
|
-
const description: any = (item["Description"] != null && item["Description"] !== undefined ? item["Description"] : (item["description"] != null && item["description"] !== undefined ? item["description"] : null));
|
|
391
|
-
const pk: any = (item["PropertyKey"] != null && item["PropertyKey"] !== undefined ? item["PropertyKey"] : (item["propertyKey"] != null && item["propertyKey"] !== undefined ? item["propertyKey"] : null));
|
|
392
|
-
const withOpt = (k: string, v: any): FSharpList<[string, any]> => {
|
|
393
|
-
if (v == null) {
|
|
394
|
-
return empty<[string, any]>();
|
|
395
|
-
}
|
|
396
|
-
else {
|
|
397
|
-
return singleton([k, v] as [string, any]);
|
|
398
|
-
}
|
|
399
|
-
};
|
|
400
|
-
return createObj(append(ofArray([["propertyKey", resolvePropertyKey(name, (pk == null) ? undefined : extractPropertyKeyFromUnknown(pk))] as [string, any], ["name", name] as [string, any], ["dataType", isNullOrEmpty(dataType) ? "string" : dataType] as [string, any], ["value", value_2] as [string, any]]), append(withOpt("displayName", displayName), append(withOpt("unit", unitVal), withOpt("description", description)))));
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* Normalize filledFormData for platform API (fill_form, buildFormSpecWithValues).
|
|
405
|
-
* Converts PluginData arrays from PascalCase to camelCase, resolves propertyKey.
|
|
406
|
-
* Passes through non-PluginData values (e.g. fieldKey_doc) unchanged.
|
|
407
|
-
* TypeScript: import { normalizeFormValuesForPlatformApi } from '@f1studio/form-spec/Interop/FormSpec.Api.Helpers'
|
|
408
|
-
*/
|
|
409
|
-
export function normalizeFormValuesForPlatformApi(formValues: any): any {
|
|
410
|
-
if (formValues == null) {
|
|
411
|
-
throw new Error("normalizeFormValuesForPlatformApi: formValues is null");
|
|
412
|
-
}
|
|
413
|
-
const entries: [string, any][] = Object.entries(formValues);
|
|
414
|
-
return createObj(toList_1<[string, any]>(delay<[string, any]>((): Iterable<[string, any]> => collect_1<[string, any], Iterable<[string, any]>, [string, any]>((matchValue: [string, any]): Iterable<[string, any]> => {
|
|
415
|
-
const value: any = matchValue[1];
|
|
416
|
-
return singleton_1<[string, any]>([matchValue[0], (Array.isArray(value) && value.length > 0 && typeof value[0] === 'object' && value[0] !== null && ('Name' in value[0] || 'name' in value[0])) ? map<any, any>(normalizePluginDataItem, value as any[]) : value] as [string, any]);
|
|
417
|
-
}, entries))));
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
function jsObjectToFilledFormDataMap(o: any): FSharpMap<string, any> {
|
|
421
|
-
if (o == null) {
|
|
422
|
-
return empty_1<string, any>({
|
|
423
|
-
Compare: comparePrimitives,
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
else {
|
|
427
|
-
const entries: [string, any][] = Object.entries(o);
|
|
428
|
-
return fold<[string, any], FSharpMap<string, any>>((m: FSharpMap<string, any>, tupledArg: [string, any]): FSharpMap<string, any> => add<string, any>(tupledArg[0], tupledArg[1], m), empty_1<string, any>({
|
|
429
|
-
Compare: comparePrimitives,
|
|
430
|
-
}), entries);
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
/**
|
|
435
|
-
* Validate filled form data against FormSpec. Returns Ok () or Error with ValidationError list.
|
|
436
|
-
* plainValues: { [fieldKey]: value, [fieldKey_doc]: doc }. Converted at boundary to typed Map. Use before save/publish.
|
|
437
|
-
* TypeScript: import { validateFilledFormData } from '@f1studio/form-spec/Interop/FormSpec.Api.Helpers'
|
|
438
|
-
*/
|
|
439
|
-
export function validateFilledFormData(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, plainValues: any): FSharpResult$2_$union<void, FSharpList<ValidationError>> {
|
|
440
|
-
return FilledForm_validateFilledFormData(formSpec, jsObjectToFilledFormDataMap(plainValues));
|
|
441
|
-
}
|
|
442
|
-
|
|
443
373
|
/**
|
|
444
374
|
* Build FormSpec with field values applied. Primary API - pathway uses FormSpec directly.
|
|
445
375
|
* TypeScript: buildFormSpecWithValues(formSpec: FormSpec, fieldData: FieldInput[]) => FormSpec
|
|
446
376
|
*/
|
|
447
377
|
export function buildFormSpecWithValues(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, fieldData: { fieldKey: string, objectValue: any }[]): Spec_FormSpec$1<Spec_FieldType_$union> {
|
|
448
|
-
|
|
449
|
-
return fold_1<{ fieldKey: string, objectValue: any }, Spec_FormSpec$1<Spec_FieldType_$union>>((spec_1: Spec_FormSpec$1<Spec_FieldType_$union>, input_2: { fieldKey: string, objectValue: any }): Spec_FormSpec$1<Spec_FieldType_$union> => {
|
|
450
|
-
const baseKey: string = substring(input_2.fieldKey, 0, input_2.fieldKey.length - 4);
|
|
451
|
-
const matchValue_3: Option<Spec_FormField$1<Spec_FieldType_$union>> = findFieldByKey(spec_1, baseKey);
|
|
452
|
-
if (matchValue_3 == null) {
|
|
453
|
-
toConsole(`Warning: Documentation field ${input_2.fieldKey} - base field ${baseKey} not found in FormSpec`);
|
|
454
|
-
return spec_1;
|
|
455
|
-
}
|
|
456
|
-
else {
|
|
457
|
-
const field_2: Spec_FormField$1<Spec_FieldType_$union> = value_11(matchValue_3);
|
|
458
|
-
const docStr: string = decodeAsString(input_2.fieldKey, input_2.objectValue);
|
|
459
|
-
const docOpt: Option<string> = isNullOrEmpty(docStr) ? undefined : docStr;
|
|
460
|
-
return defaultArg_1(map_1<int32, Spec_FormSpec$1<Spec_FieldType_$union>>((stepIdx_1: int32): Spec_FormSpec$1<Spec_FieldType_$union> => updateFieldDocumentation<Spec_FieldType_$union>(spec_1, field_2.FieldKey, docOpt, stepIdx_1), findStepIndexForField<Spec_FieldType_$union>(spec_1, field_2.FieldKey)), spec_1);
|
|
461
|
-
}
|
|
462
|
-
}, fold_1<[Spec_FormField$1<Spec_FieldType_$union>, FieldDetails$1<Spec_FieldType_$union>], Spec_FormSpec$1<Spec_FieldType_$union>>((spec: Spec_FormSpec$1<Spec_FieldType_$union>, tupledArg: [Spec_FormField$1<Spec_FieldType_$union>, FieldDetails$1<Spec_FieldType_$union>]): Spec_FormSpec$1<Spec_FieldType_$union> => {
|
|
378
|
+
return fold<[Spec_FormField$1<Spec_FieldType_$union>, FieldDetails$1<Spec_FieldType_$union>], Spec_FormSpec$1<Spec_FieldType_$union>>((spec: Spec_FormSpec$1<Spec_FieldType_$union>, tupledArg: [Spec_FormField$1<Spec_FieldType_$union>, FieldDetails$1<Spec_FieldType_$union>]): Spec_FormSpec$1<Spec_FieldType_$union> => {
|
|
463
379
|
const field_1: Spec_FormField$1<Spec_FieldType_$union> = tupledArg[0];
|
|
464
|
-
return defaultArg_1(
|
|
465
|
-
}, formSpec, ofSeq<[Spec_FormField$1<Spec_FieldType_$union>, FieldDetails$1<Spec_FieldType_$union>]>(choose<{ fieldKey: string, objectValue: any }, [Spec_FormField$1<Spec_FieldType_$union>, FieldDetails$1<Spec_FieldType_$union>]>((
|
|
380
|
+
return defaultArg_1(map<int32, Spec_FormSpec$1<Spec_FieldType_$union>>((stepIdx: int32): Spec_FormSpec$1<Spec_FieldType_$union> => updateField<Spec_FieldType_$union>(spec, field_1.FieldKey, tupledArg[1].FieldValue, stepIdx), findStepIndexForField<Spec_FieldType_$union>(spec, field_1.FieldKey)), spec);
|
|
381
|
+
}, formSpec, ofSeq<[Spec_FormField$1<Spec_FieldType_$union>, FieldDetails$1<Spec_FieldType_$union>]>(choose<{ fieldKey: string, objectValue: any }, [Spec_FormField$1<Spec_FieldType_$union>, FieldDetails$1<Spec_FieldType_$union>]>((input: { fieldKey: string, objectValue: any }): Option<[Spec_FormField$1<Spec_FieldType_$union>, FieldDetails$1<Spec_FieldType_$union>]> => {
|
|
466
382
|
let matchValue_1: ExpectedFieldValueType_$union, matrixData: { description: string, values: IMap<string, string> }, matrixValues: FSharpMap<Shared_MatrixItemKey, string>, matrixAnswer: Shared_MatrixAnswer, arg_1: int32, matchValue_2: Spec_FieldType_$union;
|
|
467
|
-
const matchValue: Option<Spec_FormField$1<Spec_FieldType_$union>> = findFieldByKey(formSpec,
|
|
383
|
+
const matchValue: Option<Spec_FormField$1<Spec_FieldType_$union>> = findFieldByKey(formSpec, input.fieldKey);
|
|
468
384
|
if (matchValue == null) {
|
|
469
|
-
toConsole(`Warning: Field ${
|
|
385
|
+
toConsole(`Warning: Field ${input.fieldKey} not found in FormSpec`);
|
|
470
386
|
return undefined;
|
|
471
387
|
}
|
|
472
388
|
else {
|
|
473
389
|
const field: Spec_FormField$1<Spec_FieldType_$union> = value_11(matchValue);
|
|
474
390
|
try {
|
|
475
|
-
return [field, new FieldDetails$1(field.FieldOrder, field.FieldKey, field.Label, (matchValue_1 = getExpectedFieldValueType(field.FieldType), (matchValue_1.tag === /* MultipleValues */ 1) ? Shared_FieldValue_Multiple(
|
|
391
|
+
return [field, new FieldDetails$1(field.FieldOrder, field.FieldKey, field.Label, (matchValue_1 = getExpectedFieldValueType(field.FieldType), (matchValue_1.tag === /* MultipleValues */ 1) ? Shared_FieldValue_Multiple(ofArray<Shared_FieldAnswer>(map_1<string, Shared_FieldAnswer>((value: string): Shared_FieldAnswer => (new Shared_FieldAnswer(field.FieldKey, field.Label, value)), decodeAsStringArray(input.fieldKey, input.objectValue)), {
|
|
476
392
|
Compare: compare,
|
|
477
|
-
})) : ((matchValue_1.tag === /* MatrixValue */ 2) ? ((matrixData = decodeAsMatrixValue(
|
|
393
|
+
})) : ((matchValue_1.tag === /* MatrixValue */ 2) ? ((matrixData = decodeAsMatrixValue(input.fieldKey, input.objectValue), (matrixValues = ofSeq_1<Shared_MatrixItemKey, string>(map_2<[string, string], [Shared_MatrixItemKey, string]>((kvp: [string, string]): [Shared_MatrixItemKey, string] => ([new Shared_MatrixItemKey(parse(kvp[0])), kvp[1]] as [Shared_MatrixItemKey, string]), matrixData.values), {
|
|
478
394
|
Compare: compare,
|
|
479
|
-
}), (matrixAnswer = (new Shared_MatrixAnswer(field.FieldKey, matrixData.description, matrixValues)), ((arg_1 = (count<Shared_MatrixItemKey, string>(matrixValues) | 0), toConsole(printf("[DEBUGGING_FORMSPEC_RENDERER] buildFormSpecWithValues Matrix fieldKey=%s valuesCount=%d"))(
|
|
395
|
+
}), (matrixAnswer = (new Shared_MatrixAnswer(field.FieldKey, matrixData.description, matrixValues)), ((arg_1 = (count<Shared_MatrixItemKey, string>(matrixValues) | 0), toConsole(printf("[DEBUGGING_FORMSPEC_RENDERER] buildFormSpecWithValues Matrix fieldKey=%s valuesCount=%d"))(input.fieldKey)(arg_1)), Shared_FieldValue_Matrix(matrixAnswer)))))) : ((matchValue_1.tag === /* PluginDataValue */ 3) ? Shared_FieldValue_PluginData(ofArray_1<Shared_PluginDataProperty>(map_1<{ dataType: string, description?: string, displayName?: string, name: string, propertyKey: string, unit?: string, value: string }, Shared_PluginDataProperty>((prop: { dataType: string, description?: string, displayName?: string, name: string, propertyKey: string, unit?: string, value: string }): Shared_PluginDataProperty => (new Shared_PluginDataProperty(new Shared_PluginPropertyKey(parse(prop.propertyKey)), prop.name, prop.dataType, prop.value, prop.displayName, prop.unit, prop.description)), decodeAsPluginDataArray(input.fieldKey, input.objectValue)))) : Shared_FieldValue_Single(new Shared_FieldAnswer(field.FieldKey, field.Label, decodeAsString(input.fieldKey, input.objectValue)))))), field.FieldType, (matchValue_2 = field.FieldType, (matchValue_2.tag === /* Radio */ 12) ? matchValue_2.fields[0].Options : ((matchValue_2.tag === /* SingleChoice */ 13) ? matchValue_2.fields[0].Options : ((matchValue_2.tag === /* Dropdown */ 14) ? matchValue_2.fields[0].Options : ((matchValue_2.tag === /* MultiChoice */ 15) ? matchValue_2.fields[0].Options : ((matchValue_2.tag === /* CheckboxList */ 16) ? matchValue_2.fields[0].Options : ((matchValue_2.tag === /* TagList */ 17) ? matchValue_2.fields[0].Options : ((matchValue_2.tag === /* TextAutoComplete */ 18) ? matchValue_2.fields[0].Options : ((matchValue_2.tag === /* Matrix */ 19) ? matchValue_2.fields[0].Options : empty<Shared_FieldOption>())))))))))] as [Spec_FormField$1<Spec_FieldType_$union>, FieldDetails$1<Spec_FieldType_$union>];
|
|
480
396
|
}
|
|
481
397
|
catch (ex: any) {
|
|
482
|
-
toConsole(`Error processing field ${
|
|
398
|
+
toConsole(`Error processing field ${input.fieldKey}: ${ex.message}`);
|
|
483
399
|
return undefined;
|
|
484
400
|
}
|
|
485
401
|
}
|
|
486
|
-
},
|
|
402
|
+
}, fieldData)));
|
|
487
403
|
}
|
|
488
404
|
|
|
489
405
|
/**
|
|
@@ -524,7 +440,7 @@ export function createFormStep(stepOrder: int32, stepLabel: string, fields: Spec
|
|
|
524
440
|
* TypeScript: createFormSpec(id: string, title: string, steps: FormStep[])
|
|
525
441
|
*/
|
|
526
442
|
export function createFormSpec(idString: string, title: string, steps: Spec_FormStep$1<Spec_FieldType_$union>[]): Spec_FormSpec$1<Spec_FieldType_$union> {
|
|
527
|
-
return new Spec_FormSpec$1(parse(idString), "DYN", title, "Dynamically created FormSpec", "1.0.0", "2.0.5", ofSeq<Spec_FormStep$1<Spec_FieldType_$union>>(steps), empty<string>(), undefined, empty<string>(), false, false, undefined, Spec_FormLifecycle_Blueprint(), undefined, undefined, undefined);
|
|
443
|
+
return new Spec_FormSpec$1(parse(idString), "DYN", title, "Dynamically created FormSpec", "1.0.0", "2.0.5", ofSeq<Spec_FormStep$1<Spec_FieldType_$union>>(steps), empty<string>(), undefined, empty<string>(), false, false, undefined, Spec_FormLifecycle_Blueprint(), undefined, undefined, undefined, Spec_FormClassification_General());
|
|
528
444
|
}
|
|
529
445
|
|
|
530
446
|
/**
|
|
@@ -590,7 +506,7 @@ export function createClinicalPathway(name: string, states: ClinicalPathway_Stat
|
|
|
590
506
|
* TypeScript: addPathwayToFormSpec(formSpec: FormSpec, pathway: ClinicalPathwaySpec)
|
|
591
507
|
*/
|
|
592
508
|
export function addPathwayToFormSpec(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, pathway: ClinicalPathway_ClinicalPathwaySpec): Spec_FormSpec$1<Spec_FieldType_$union> {
|
|
593
|
-
return new Spec_FormSpec$1(formSpec.Id, formSpec.Code, formSpec.Title, formSpec.Abstract, formSpec.Version, formSpec.FormSpecVersion, formSpec.Steps, formSpec.CategoryTags, formSpec.Score, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, pathway, formSpec.Lifecycle, formSpec.FilledMeta, formSpec.CustomData, formSpec.Provenance);
|
|
509
|
+
return new Spec_FormSpec$1(formSpec.Id, formSpec.Code, formSpec.Title, formSpec.Abstract, formSpec.Version, formSpec.FormSpecVersion, formSpec.Steps, formSpec.CategoryTags, formSpec.Score, formSpec.AssociatedCodes, formSpec.RequiresReview, formSpec.RequiresReviewAndApproval, pathway, formSpec.Lifecycle, formSpec.FilledMeta, formSpec.CustomData, formSpec.Provenance, formSpec.Classification);
|
|
594
510
|
}
|
|
595
511
|
|
|
596
512
|
/**
|
|
@@ -598,7 +514,7 @@ export function addPathwayToFormSpec(formSpec: Spec_FormSpec$1<Spec_FieldType_$u
|
|
|
598
514
|
* TypeScript: getFieldDataFromFormSpec(formSpec: FormSpec, stepOrder: number, fieldKey: string)
|
|
599
515
|
*/
|
|
600
516
|
export function getFieldDataFromFormSpec(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, _stepOrder: int32, fieldKeyString: string): Option<any> {
|
|
601
|
-
return
|
|
517
|
+
return map<FieldDetails$1<Spec_FieldType_$union>, any>((fieldDetails: FieldDetails$1<Spec_FieldType_$union>): any => ({
|
|
602
518
|
FieldOrder: fieldDetails.FieldOrder,
|
|
603
519
|
FieldType: fieldDetails.FieldType,
|
|
604
520
|
FieldValue: fieldDetails.FieldValue,
|
|
@@ -621,7 +537,7 @@ export function getFormResultStepOrders(formSpec: Spec_FormSpec$1<Spec_FieldType
|
|
|
621
537
|
* TypeScript: getFormResultFieldKeys(formSpec: FormSpec, stepOrder: number)
|
|
622
538
|
*/
|
|
623
539
|
export function getFormResultFieldKeys(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, stepOrder: int32): string[] {
|
|
624
|
-
return defaultArgWith_1<string[]>(
|
|
540
|
+
return defaultArgWith_1<string[]>(map<Spec_FormStep$1<Spec_FieldType_$union>, string[]>((step_1: Spec_FormStep$1<Spec_FieldType_$union>): string[] => {
|
|
625
541
|
const collection: FSharpList<string> = map_3<Spec_FormField$1<Spec_FieldType_$union>, string>((f: Spec_FormField$1<Spec_FieldType_$union>): string => f.FieldKey.fields[0], step_1.Fields);
|
|
626
542
|
return Array.from(collection);
|
|
627
543
|
}, tryFind<Spec_FormStep$1<Spec_FieldType_$union>>((step: Spec_FormStep$1<Spec_FieldType_$union>): boolean => (step.StepOrder === stepOrder), formSpec.Steps)), (): string[] => []);
|
|
@@ -640,7 +556,7 @@ export function getResultSteps(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>)
|
|
|
640
556
|
* TypeScript: getFieldValue(formSpec: FormSpec, stepOrder: number, fieldKey: string)
|
|
641
557
|
*/
|
|
642
558
|
export function getFieldValue(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, _stepOrder: int32, fieldKeyString: string): Option<any> {
|
|
643
|
-
return
|
|
559
|
+
return map<FieldDetails$1<Spec_FieldType_$union>, any>((details: FieldDetails$1<Spec_FieldType_$union>): any => details.FieldValue, getFieldDetails_1(formSpec, new Shared_FieldKey(parse(fieldKeyString))));
|
|
644
560
|
}
|
|
645
561
|
|
|
646
562
|
/**
|
|
@@ -648,7 +564,7 @@ export function getFieldValue(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>,
|
|
|
648
564
|
* TypeScript: getFieldDetails(formSpec: FormSpec, stepOrder: number, fieldKey: string)
|
|
649
565
|
*/
|
|
650
566
|
export function getFieldDetails(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, _stepOrder: int32, fieldKeyString: string): Option<any> {
|
|
651
|
-
return
|
|
567
|
+
return map<FieldDetails$1<Spec_FieldType_$union>, any>((details: FieldDetails$1<Spec_FieldType_$union>): any => details, getFieldDetails_1(formSpec, new Shared_FieldKey(parse(fieldKeyString))));
|
|
652
568
|
}
|
|
653
569
|
|
|
654
570
|
/**
|
|
@@ -658,8 +574,8 @@ export function getFieldDetails(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>
|
|
|
658
574
|
export function createTestFormSpec(): Spec_FormSpec$1<Spec_FieldType_$union> {
|
|
659
575
|
const option1: Shared_FieldOption = new Shared_FieldOption("Option 1", "opt1", new Shared_FieldOptionKey(newGuid()), undefined);
|
|
660
576
|
const option2: Shared_FieldOption = new Shared_FieldOption("Option 2", "opt2", new Shared_FieldOptionKey(newGuid()), undefined);
|
|
661
|
-
const testStep: Spec_FormStep$1<Spec_FieldType_$union> = new Spec_FormStep$1(1, "Test Step",
|
|
662
|
-
return new Spec_FormSpec$1(newGuid(), "TEST-001", "Test Form", "Test form for buildDynamicFormResultData", "1.0.0", "5.0.0", singleton(testStep), empty<string>(), undefined, empty<string>(), false, false, undefined, Spec_FormLifecycle_Blueprint(), undefined, undefined, undefined);
|
|
577
|
+
const testStep: Spec_FormStep$1<Spec_FieldType_$union> = new Spec_FormStep$1(1, "Test Step", ofArray_1([new Spec_FormField$1(1, new Shared_FieldKey("11111111-1111-1111-1111-111111111111"), "Test Text Field", undefined, undefined, false, false, false, undefined, Spec_FieldType_Text(new Spec_TextInfo(undefined)), undefined), new Spec_FormField$1(2, new Shared_FieldKey("22222222-2222-2222-2222-222222222222"), "Test Checkbox List", undefined, undefined, false, false, false, undefined, Spec_FieldType_CheckboxList(new Spec_MultiChoiceInfo(ofArray_1([option1, option2]))), undefined), new Spec_FormField$1(3, new Shared_FieldKey("33333333-3333-3333-3333-333333333333"), "Test Matrix", undefined, undefined, false, false, false, undefined, Spec_FieldType_Matrix(new Spec_MatrixInfo(ofArray_1([option1, option2]), ofArray_1([new Shared_FieldOption("Scale 1", "1", new Shared_FieldOptionKey(newGuid()), 1), new Shared_FieldOption("Scale 2", "2", new Shared_FieldOptionKey(newGuid()), 2)]))), undefined), new Spec_FormField$1(4, new Shared_FieldKey("44444444-4444-4444-4444-444444444444"), "Test Plugin Field", undefined, undefined, false, false, false, undefined, Spec_FieldType_PluginField(new Spec_PluginFieldConfig("test.plugin", undefined, undefined)), undefined)]));
|
|
578
|
+
return new Spec_FormSpec$1(newGuid(), "TEST-001", "Test Form", "Test form for buildDynamicFormResultData", "1.0.0", "5.0.0", singleton(testStep), empty<string>(), undefined, empty<string>(), false, false, undefined, Spec_FormLifecycle_Blueprint(), undefined, undefined, undefined, Spec_FormClassification_General());
|
|
663
579
|
}
|
|
664
580
|
|
|
665
581
|
/**
|
|
@@ -703,14 +619,14 @@ export function getPluginFieldConfig(field: Spec_FormField$1<Spec_FieldType_$uni
|
|
|
703
619
|
if (matchValue.tag === /* PluginField */ 23) {
|
|
704
620
|
const config: Spec_PluginFieldConfig = matchValue.fields[0];
|
|
705
621
|
return {
|
|
706
|
-
items: unwrap(
|
|
622
|
+
items: unwrap(map<FSharpList<Shared_FieldOption>, { key: string, label: string }[]>((items: FSharpList<Shared_FieldOption>): { key: string, label: string }[] => {
|
|
707
623
|
const collection: FSharpList<{ key: string, label: string }> = map_3<Shared_FieldOption, { key: string, label: string }>((item: Shared_FieldOption): { key: string, label: string } => ({
|
|
708
624
|
key: item.OptionKey.fields[0],
|
|
709
625
|
label: item.Description,
|
|
710
626
|
}), items);
|
|
711
627
|
return Array.from(collection);
|
|
712
628
|
}, config.Items)),
|
|
713
|
-
options: unwrap(
|
|
629
|
+
options: unwrap(map<FSharpList<Shared_FieldOption>, { description: string, key: string, value: string }[]>((opts: FSharpList<Shared_FieldOption>): { description: string, key: string, value: string }[] => {
|
|
714
630
|
const collection_1: FSharpList<{ description: string, key: string, value: string }> = map_3<Shared_FieldOption, { description: string, key: string, value: string }>((opt: Shared_FieldOption): { description: string, key: string, value: string } => ({
|
|
715
631
|
description: opt.Description,
|
|
716
632
|
key: opt.OptionKey.fields[0],
|
|
@@ -941,27 +857,33 @@ export function getFieldKeyString(fieldKey: Shared_FieldKey): string {
|
|
|
941
857
|
*/
|
|
942
858
|
export function extractFormValuesFromFormSpec(spec: Spec_FormSpec$1<Spec_FieldType_$union>): any {
|
|
943
859
|
const pairs: FSharpList<[string, any]> = toList_1<[string, any]>(delay<[string, any]>((): Iterable<[string, any]> => collect_1<Spec_FormStep$1<Spec_FieldType_$union>, Iterable<[string, any]>, [string, any]>((step: Spec_FormStep$1<Spec_FieldType_$union>): Iterable<[string, any]> => collect_1<Spec_FormField$1<Spec_FieldType_$union>, Iterable<[string, any]>, [string, any]>((field: Spec_FormField$1<Spec_FieldType_$union>): Iterable<[string, any]> => {
|
|
944
|
-
let
|
|
945
|
-
const
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
860
|
+
let arr: string[], ma: Shared_MatrixAnswer, dict: IMap<string, string>, enumerator: IEnumerator<[Shared_MatrixItemKey, string]>, arr_1: FSharpList<any>;
|
|
861
|
+
const matchValue: Option<Shared_FieldValue_$union> = field.Value;
|
|
862
|
+
if (matchValue == null) {
|
|
863
|
+
return empty_1<[string, any]>();
|
|
864
|
+
}
|
|
865
|
+
else {
|
|
866
|
+
const fv: Shared_FieldValue_$union = value_11(matchValue);
|
|
867
|
+
return singleton_1<[string, any]>([getFieldKeyString(field.FieldKey), (fv.tag === /* Multiple */ 1) ? ((arr = map_1<Shared_FieldAnswer, string>((fa_1: Shared_FieldAnswer): string => fa_1.Value, toArray<Shared_FieldAnswer>(fv.fields[0])), Array.from(arr))) : ((fv.tag === /* Matrix */ 2) ? ((ma = fv.fields[0], (dict = (new Map<string, string>([])), ((enumerator = getEnumerator(ma.Values), (() => {
|
|
868
|
+
try {
|
|
869
|
+
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
870
|
+
const kvp: [Shared_MatrixItemKey, string] = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
871
|
+
addToDict(dict, kvp[0].fields[0], kvp[1]);
|
|
872
|
+
}
|
|
951
873
|
}
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
}
|
|
874
|
+
finally {
|
|
875
|
+
disposeSafe(enumerator as IDisposable);
|
|
876
|
+
}
|
|
877
|
+
})()), dict)))) : ((fv.tag === /* PluginData */ 3) ? ((arr_1 = map_3<Shared_PluginDataProperty, any>((p: Shared_PluginDataProperty): any => ({
|
|
878
|
+
dataType: p.DataType,
|
|
879
|
+
description: unwrap(p.Description),
|
|
880
|
+
displayName: unwrap(p.DisplayName),
|
|
881
|
+
name: p.Name,
|
|
882
|
+
propertyKey: p.PropertyKey.fields[0],
|
|
883
|
+
unit: unwrap(p.Unit),
|
|
884
|
+
value: p.Value,
|
|
885
|
+
}), fv.fields[0]), Array.from(arr_1))) : fv.fields[0].Value))] as [string, any]);
|
|
886
|
+
}
|
|
965
887
|
}, step.Fields), spec.Steps)));
|
|
966
888
|
if (isEmpty(pairs)) {
|
|
967
889
|
return {};
|
|
@@ -1073,7 +995,7 @@ export function convertActionInfo(action: ClinicalPathway_ActionInfo_$union): an
|
|
|
1073
995
|
case /* Problem */ 8: {
|
|
1074
996
|
const prob: ClinicalPathway_ProblemAction = action.fields[0];
|
|
1075
997
|
return {
|
|
1076
|
-
description: `${prob.ProblemName}${defaultArg_1(
|
|
998
|
+
description: `${prob.ProblemName}${defaultArg_1(map<string, string>((code: string): string => (` (ICD: ${code})`), prob.IcdCode), "")}`,
|
|
1077
999
|
icdCode: unwrap(prob.IcdCode),
|
|
1078
1000
|
problemName: prob.ProblemName,
|
|
1079
1001
|
type: "problem",
|
|
@@ -1131,4 +1053,83 @@ export function stateKeyForAction(pathway: ClinicalPathway_ClinicalPathwaySpec,
|
|
|
1131
1053
|
}, pathway.States);
|
|
1132
1054
|
}
|
|
1133
1055
|
|
|
1056
|
+
/**
|
|
1057
|
+
* Returns the tag string of a FormSpec's Classification discriminated union.
|
|
1058
|
+
* TypeScript: getFormClassificationTag(spec: FormSpec) => "ClinicalInstrument" | "Intake" | "Screening" | "General"
|
|
1059
|
+
*/
|
|
1060
|
+
export function getFormClassificationTag(spec: Spec_FormSpec$1<Spec_FieldType_$union>): string {
|
|
1061
|
+
const matchValue: Spec_FormClassification_$union = spec.Classification;
|
|
1062
|
+
switch (matchValue.tag) {
|
|
1063
|
+
case /* Intake */ 1:
|
|
1064
|
+
return "Intake";
|
|
1065
|
+
case /* Screening */ 2:
|
|
1066
|
+
return "Screening";
|
|
1067
|
+
case /* General */ 3:
|
|
1068
|
+
return "General";
|
|
1069
|
+
default:
|
|
1070
|
+
return "ClinicalInstrument";
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
/**
|
|
1075
|
+
* Returns true when the FormSpec is classified as a ClinicalInstrument.
|
|
1076
|
+
* TypeScript: isClinicalInstrument(spec: FormSpec) => boolean
|
|
1077
|
+
*/
|
|
1078
|
+
export function isClinicalInstrument(spec: Spec_FormSpec$1<Spec_FieldType_$union>): boolean {
|
|
1079
|
+
if (spec.Classification.tag === /* ClinicalInstrument */ 0) {
|
|
1080
|
+
return true;
|
|
1081
|
+
}
|
|
1082
|
+
else {
|
|
1083
|
+
return false;
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
/**
|
|
1088
|
+
* Returns the instrument type string when Classification is ClinicalInstrument, None otherwise.
|
|
1089
|
+
* TypeScript: getInstrumentType(spec: FormSpec) => string | null
|
|
1090
|
+
*/
|
|
1091
|
+
export function getInstrumentType(spec: Spec_FormSpec$1<Spec_FieldType_$union>): Option<string> {
|
|
1092
|
+
const matchValue: Spec_FormClassification_$union = spec.Classification;
|
|
1093
|
+
if (matchValue.tag === /* ClinicalInstrument */ 0) {
|
|
1094
|
+
return matchValue.fields[0].InstrumentType;
|
|
1095
|
+
}
|
|
1096
|
+
else {
|
|
1097
|
+
return undefined;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
/**
|
|
1102
|
+
* Returns the instrument max score when Classification is ClinicalInstrument, None otherwise.
|
|
1103
|
+
* TypeScript: getInstrumentMaxScore(spec: FormSpec) => number | null
|
|
1104
|
+
*/
|
|
1105
|
+
export function getInstrumentMaxScore(spec: Spec_FormSpec$1<Spec_FieldType_$union>): Option<int32> {
|
|
1106
|
+
const matchValue: Spec_FormClassification_$union = spec.Classification;
|
|
1107
|
+
if (matchValue.tag === /* ClinicalInstrument */ 0) {
|
|
1108
|
+
return matchValue.fields[0].MaxScore;
|
|
1109
|
+
}
|
|
1110
|
+
else {
|
|
1111
|
+
return undefined;
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* Returns "Exact" or "Inferred" when Classification is ClinicalInstrument, None otherwise.
|
|
1117
|
+
* TypeScript: getInstrumentConfidence(spec: FormSpec) => "Exact" | "Inferred" | null
|
|
1118
|
+
*/
|
|
1119
|
+
export function getInstrumentConfidence(spec: Spec_FormSpec$1<Spec_FieldType_$union>): Option<string> {
|
|
1120
|
+
const matchValue: Spec_FormClassification_$union = spec.Classification;
|
|
1121
|
+
if (matchValue.tag === /* ClinicalInstrument */ 0) {
|
|
1122
|
+
const info: Spec_ClinicalInstrumentInfo = matchValue.fields[0];
|
|
1123
|
+
if (info.Confidence.tag === /* Inferred */ 1) {
|
|
1124
|
+
return "Inferred";
|
|
1125
|
+
}
|
|
1126
|
+
else {
|
|
1127
|
+
return "Exact";
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
else {
|
|
1131
|
+
return undefined;
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1134
1135
|
//# sourceMappingURL=FormSpec.Api.Helpers.ts.map
|
|
@@ -3,7 +3,7 @@ import { uncurry2, IComparable, IEquatable } from "@fable-org/fable-library-js/U
|
|
|
3
3
|
import { obj_type, enum_type, int32_type, array_type, bool_type, option_type, record_type, string_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
|
|
4
4
|
import { map as map_2, value as value_2, Option } from "@fable-org/fable-library-js/Option.js";
|
|
5
5
|
import { int32 } from "@fable-org/fable-library-js/Int32.js";
|
|
6
|
-
import { Spec_FormSpec$1_$reflection, Spec_FieldType_$reflection, Spec_FormLifecycle_Blueprint, Spec_FormSpec$1, Spec_FilledMeta, Spec_FormLifecycle_$union, ClinicalPathway_ClinicalPathwaySpec, Spec_Score, Spec_ScoreRange, Spec_ScoreColor_Danger, Spec_ScoreColor_Warning, Spec_ScoreColor_Success, Spec_ScoreColor_Info, Spec_ScoreColor_Link, Spec_ScoreColor_Primary, Spec_ScoreColor_Unspecified, Spec_ScoreColor_$union, Spec_FormStep$1, Spec_FormField$1, Shared_FieldValue_$union, Spec_FieldType_PluginField, Spec_PluginFieldConfig, Spec_FieldType_Message, Spec_FieldType_Signature, Spec_SignatureInfo, Spec_FieldType_Matrix, Spec_FieldType_TextAutoComplete, Spec_FieldType_TagList, Spec_FieldType_CheckboxList, Spec_FieldType_MultiChoice, Spec_MultiChoiceInfo, Spec_FieldType_Dropdown, Spec_FieldType_SingleChoice, Spec_FieldType_Radio, Spec_SingleChoiceInfo, Spec_FieldType_Checkbox, Spec_FieldType_Time, Spec_FieldType_DateTimeLocal, Spec_FieldType_Date, Spec_FieldType_Tel, Spec_FieldType_Number, Spec_FieldType_Color, Spec_FieldType_Search, Spec_FieldType_Password, Spec_FieldType_Email, Spec_FieldType_TextArea, Spec_FieldType_Text, Spec_TextInfo, Spec_FieldType_$union, Spec_MessageInfo, Spec_MatrixInfo, Spec_BooleanInfo, Spec_MessageType_Danger, Spec_MessageType_Info, Spec_MessageType_Error, Spec_MessageType_Success, Spec_MessageType_Warning, Spec_MessageType_$union, Spec_DependsOn, Spec_Evaluator_Contains, Spec_Evaluator_IsEmpty, Spec_Evaluator_Exists, Spec_Evaluator_LessThanOrEquals, Spec_Evaluator_LessThan, Spec_Evaluator_GreaterThanOrEquals, Spec_Evaluator_GreaterThan, Spec_Evaluator_NotEquals, Spec_Evaluator_Equals, Spec_Evaluator_$union, Shared_FieldOption, Shared_FieldOptionKey, Shared_MatrixItemKey, Shared_TransitionKey, Shared_StateKey, Shared_FieldKey } from "../FormSpec.js";
|
|
6
|
+
import { Spec_FormSpec$1_$reflection, Spec_FieldType_$reflection, Spec_FormClassification_General, Spec_FormLifecycle_Blueprint, Spec_FormSpec$1, Spec_FilledMeta, Spec_FormLifecycle_$union, ClinicalPathway_ClinicalPathwaySpec, Spec_Score, Spec_ScoreRange, Spec_ScoreColor_Danger, Spec_ScoreColor_Warning, Spec_ScoreColor_Success, Spec_ScoreColor_Info, Spec_ScoreColor_Link, Spec_ScoreColor_Primary, Spec_ScoreColor_Unspecified, Spec_ScoreColor_$union, Spec_FormStep$1, Spec_FormField$1, Shared_FieldValue_$union, Spec_FieldType_PluginField, Spec_PluginFieldConfig, Spec_FieldType_Message, Spec_FieldType_Signature, Spec_SignatureInfo, Spec_FieldType_Matrix, Spec_FieldType_TextAutoComplete, Spec_FieldType_TagList, Spec_FieldType_CheckboxList, Spec_FieldType_MultiChoice, Spec_MultiChoiceInfo, Spec_FieldType_Dropdown, Spec_FieldType_SingleChoice, Spec_FieldType_Radio, Spec_SingleChoiceInfo, Spec_FieldType_Checkbox, Spec_FieldType_Time, Spec_FieldType_DateTimeLocal, Spec_FieldType_Date, Spec_FieldType_Tel, Spec_FieldType_Number, Spec_FieldType_Color, Spec_FieldType_Search, Spec_FieldType_Password, Spec_FieldType_Email, Spec_FieldType_TextArea, Spec_FieldType_Text, Spec_TextInfo, Spec_FieldType_$union, Spec_MessageInfo, Spec_MatrixInfo, Spec_BooleanInfo, Spec_MessageType_Danger, Spec_MessageType_Info, Spec_MessageType_Error, Spec_MessageType_Success, Spec_MessageType_Warning, Spec_MessageType_$union, Spec_DependsOn, Spec_Evaluator_Contains, Spec_Evaluator_IsEmpty, Spec_Evaluator_Exists, Spec_Evaluator_LessThanOrEquals, Spec_Evaluator_LessThan, Spec_Evaluator_GreaterThanOrEquals, Spec_Evaluator_GreaterThan, Spec_Evaluator_NotEquals, Spec_Evaluator_Equals, Spec_Evaluator_$union, Shared_FieldOption, Shared_FieldOptionKey, Shared_MatrixItemKey, Shared_TransitionKey, Shared_StateKey, Shared_FieldKey } from "../FormSpec.js";
|
|
7
7
|
import { tryParse } from "@fable-org/fable-library-js/Guid.js";
|
|
8
8
|
import { ofArray, reverse, empty, FSharpList, cons, map, toArray } from "@fable-org/fable-library-js/List.js";
|
|
9
9
|
import { sumBy, tryFind, collect, map as map_1, fold } from "@fable-org/fable-library-js/Array.js";
|
|
@@ -1457,7 +1457,7 @@ export function Converters_formSpecFromTS(spec: Types_FormSpecTS): Option<Spec_F
|
|
|
1457
1457
|
return undefined;
|
|
1458
1458
|
}
|
|
1459
1459
|
else {
|
|
1460
|
-
return new Spec_FormSpec$1(matchValue[1], spec.Code, spec.Title, spec.Abstract, spec.Version, spec.FormSpecVersion, reverse<Spec_FormStep$1<Spec_FieldType_$union>>(value_2(convertedSteps)), ofArray<string>(spec.CategoryTags), scoreResult, ofArray<string>(spec.AssociatedCodes), spec.RequiresReview, spec.RequiresReviewAndApproval, undefined, Spec_FormLifecycle_Blueprint(), undefined, undefined, undefined);
|
|
1460
|
+
return new Spec_FormSpec$1(matchValue[1], spec.Code, spec.Title, spec.Abstract, spec.Version, spec.FormSpecVersion, reverse<Spec_FormStep$1<Spec_FieldType_$union>>(value_2(convertedSteps)), ofArray<string>(spec.CategoryTags), scoreResult, ofArray<string>(spec.AssociatedCodes), spec.RequiresReview, spec.RequiresReviewAndApproval, undefined, Spec_FormLifecycle_Blueprint(), undefined, undefined, undefined, Spec_FormClassification_General());
|
|
1461
1461
|
}
|
|
1462
1462
|
}
|
|
1463
1463
|
else {
|