@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.
Files changed (194) hide show
  1. package/FormSpec.FS/BlueprintValidation.d.ts +6 -3
  2. package/FormSpec.FS/BlueprintValidation.d.ts.map +1 -1
  3. package/FormSpec.FS/BlueprintValidation.js +39 -15
  4. package/FormSpec.FS/BlueprintValidation.js.map +1 -1
  5. package/FormSpec.FS/Designer.d.ts.map +1 -1
  6. package/FormSpec.FS/Designer.js +1 -1
  7. package/FormSpec.FS/Designer.js.map +1 -1
  8. package/FormSpec.FS/FormSpec.d.ts +108 -58
  9. package/FormSpec.FS/FormSpec.d.ts.map +1 -1
  10. package/FormSpec.FS/FormSpec.js +319 -129
  11. package/FormSpec.FS/FormSpec.js.map +1 -1
  12. package/FormSpec.FS/FormSpecHelpers.d.ts.map +1 -1
  13. package/FormSpec.FS/FormSpecHelpers.js +1 -1
  14. package/FormSpec.FS/FormSpecHelpers.js.map +1 -1
  15. package/FormSpec.FS/FormSpecValues.d.ts.map +1 -1
  16. package/FormSpec.FS/FormSpecValues.js +5 -2
  17. package/FormSpec.FS/FormSpecValues.js.map +1 -1
  18. package/FormSpec.FS/Helpers.d.ts.map +1 -1
  19. package/FormSpec.FS/Helpers.js +14 -9
  20. package/FormSpec.FS/Helpers.js.map +1 -1
  21. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.d.ts.map +1 -1
  22. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.js +1 -1
  23. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.js.map +1 -1
  24. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.d.ts +1 -1
  25. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.d.ts.map +1 -1
  26. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.js +1 -1
  27. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.js.map +1 -1
  28. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.d.ts +3 -3
  29. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.d.ts.map +1 -1
  30. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.js +7 -5
  31. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.js.map +1 -1
  32. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.d.ts.map +1 -1
  33. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.js +11 -10
  34. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.js.map +1 -1
  35. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.d.ts.map +1 -1
  36. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.js +1 -9
  37. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.js.map +1 -1
  38. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.d.ts +11 -4
  39. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.d.ts.map +1 -1
  40. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.js +30 -28
  41. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.js.map +1 -1
  42. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.d.ts +3 -9
  43. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.d.ts.map +1 -1
  44. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js +4 -31
  45. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js.map +1 -1
  46. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.d.ts.map +1 -1
  47. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js +2 -6
  48. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js.map +1 -1
  49. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImportPipeline.d.ts +45 -0
  50. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImportPipeline.d.ts.map +1 -0
  51. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImportPipeline.js +141 -0
  52. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImportPipeline.js.map +1 -0
  53. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImporterAnalysis.d.ts +326 -0
  54. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImporterAnalysis.d.ts.map +1 -0
  55. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImporterAnalysis.js +1743 -0
  56. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImporterAnalysis.js.map +1 -0
  57. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.d.ts +8 -8
  58. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.d.ts.map +1 -1
  59. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js +6 -6
  60. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js.map +1 -1
  61. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRTriggerEnrichment.d.ts +21 -15
  62. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRTriggerEnrichment.d.ts.map +1 -1
  63. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRTriggerEnrichment.js +83 -80
  64. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRTriggerEnrichment.js.map +1 -1
  65. package/FormSpec.FS/Integrations/CorEMR/CoreMRPathwayMapper.d.ts +51 -0
  66. package/FormSpec.FS/Integrations/CorEMR/CoreMRPathwayMapper.d.ts.map +1 -0
  67. package/FormSpec.FS/Integrations/CorEMR/CoreMRPathwayMapper.js +939 -0
  68. package/FormSpec.FS/Integrations/CorEMR/CoreMRPathwayMapper.js.map +1 -0
  69. package/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.d.ts +2 -17
  70. package/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.d.ts.map +1 -1
  71. package/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.js +1 -66
  72. package/FormSpec.FS/Integrations/CorEMR/{TemplateManifestDecoder.d.ts → FormTemplateDecoder.d.ts} +53 -45
  73. package/FormSpec.FS/Integrations/CorEMR/FormTemplateDecoder.d.ts.map +1 -0
  74. package/FormSpec.FS/Integrations/CorEMR/{TemplateManifestDecoder.js → FormTemplateDecoder.js} +544 -254
  75. package/FormSpec.FS/Integrations/CorEMR/FormTemplateDecoder.js.map +1 -0
  76. package/FormSpec.FS/Integrations/CorEMR/FormTemplateDomainDecoder.d.ts +7 -0
  77. package/FormSpec.FS/Integrations/CorEMR/FormTemplateDomainDecoder.d.ts.map +1 -0
  78. package/FormSpec.FS/Integrations/CorEMR/FormTemplateDomainDecoder.js +280 -0
  79. package/FormSpec.FS/Integrations/CorEMR/FormTemplateDomainDecoder.js.map +1 -0
  80. package/FormSpec.FS/Interop/FormSpec.Api.Helpers.d.ts +16 -4
  81. package/FormSpec.FS/Interop/FormSpec.Api.Helpers.d.ts.map +1 -1
  82. package/FormSpec.FS/Interop/FormSpec.Api.Helpers.js +63 -18
  83. package/FormSpec.FS/Interop/FormSpec.Api.Helpers.js.map +1 -1
  84. package/FormSpec.FS/Interop/FormSpec.Api.Option.d.ts +4 -4
  85. package/FormSpec.FS/Interop/FormSpec.Api.Option.d.ts.map +1 -1
  86. package/FormSpec.FS/Interop/FormSpec.Api.Option.js +2 -2
  87. package/FormSpec.FS/Interop/FormSpec.Api.Option.js.map +1 -1
  88. package/FormSpec.FS/PathwayDataExtractor.d.ts.map +1 -1
  89. package/FormSpec.FS/PathwayDataExtractor.js +39 -18
  90. package/FormSpec.FS/PathwayDataExtractor.js.map +1 -1
  91. package/FormSpec.FS/PathwayExecutor.d.ts +10 -10
  92. package/FormSpec.FS/PathwayExecutor.d.ts.map +1 -1
  93. package/FormSpec.FS/PathwayExecutor.js +14 -14
  94. package/FormSpec.FS/PathwayExecutor.js.map +1 -1
  95. package/FormSpec.FS/PathwayValidator.d.ts.map +1 -1
  96. package/FormSpec.FS/PathwayValidator.js +8 -5
  97. package/FormSpec.FS/PathwayValidator.js.map +1 -1
  98. package/FormSpec.FS/Provenance.d.ts +15 -7
  99. package/FormSpec.FS/Provenance.d.ts.map +1 -1
  100. package/FormSpec.FS/Provenance.js +11 -11
  101. package/FormSpec.FS/Provenance.js.map +1 -1
  102. package/FormSpec.FS/Renderers/FormSpecMarkdownRenderer.d.ts.map +1 -1
  103. package/FormSpec.FS/Renderers/FormSpecMarkdownRenderer.js +16 -7
  104. package/FormSpec.FS/Renderers/FormSpecMarkdownRenderer.js.map +1 -1
  105. package/FormSpec.FS/Renderers/MermaidRenderer.d.ts.map +1 -1
  106. package/FormSpec.FS/Renderers/MermaidRenderer.js +4 -8
  107. package/FormSpec.FS/Renderers/MermaidRenderer.js.map +1 -1
  108. package/FormSpec.FS/Renderers/PathwayRenderers.d.ts.map +1 -1
  109. package/FormSpec.FS/Renderers/PathwayRenderers.js +5 -4
  110. package/FormSpec.FS/Renderers/PathwayRenderers.js.map +1 -1
  111. package/FormSpec.FS/TriggerActionDto.d.ts +32 -21
  112. package/FormSpec.FS/TriggerActionDto.d.ts.map +1 -1
  113. package/FormSpec.FS/TriggerActionDto.js +247 -61
  114. package/FormSpec.FS/TriggerActionDto.js.map +1 -1
  115. package/README.md +7 -7
  116. package/package.json +1 -1
  117. package/plugins/allergyfinder/src/AllergyFinderField.d.ts.map +1 -1
  118. package/plugins/allergyfinder/src/AllergyFinderField.js +2 -2
  119. package/plugins/allergyfinder/src/AllergyFinderField.js.map +1 -1
  120. package/plugins/bmi/src/BMIField.d.ts.map +1 -1
  121. package/plugins/bmi/src/BMIField.js +21 -15
  122. package/plugins/bmi/src/BMIField.js.map +1 -1
  123. package/plugins/demographics/src/DemographicsField.d.ts.map +1 -1
  124. package/plugins/demographics/src/DemographicsField.js +4 -4
  125. package/plugins/demographics/src/DemographicsField.js.map +1 -1
  126. package/plugins/likert/src/LikertField.d.ts.map +1 -1
  127. package/plugins/likert/src/LikertField.js +40 -35
  128. package/plugins/likert/src/LikertField.js.map +1 -1
  129. package/plugins/signature/src/SignatureField.d.ts.map +1 -1
  130. package/plugins/signature/src/SignatureField.js +4 -3
  131. package/plugins/signature/src/SignatureField.js.map +1 -1
  132. package/plugins/vitals/src/VitalsField.d.ts.map +1 -1
  133. package/plugins/vitals/src/VitalsField.js +4 -4
  134. package/plugins/vitals/src/VitalsField.js.map +1 -1
  135. package/src/FormSpec.FS/BlueprintValidation.ts +55 -24
  136. package/src/FormSpec.FS/Designer.ts +2 -2
  137. package/src/FormSpec.FS/FormSpec.ts +223 -100
  138. package/src/FormSpec.FS/FormSpecHelpers.ts +2 -2
  139. package/src/FormSpec.FS/FormSpecValues.ts +6 -3
  140. package/src/FormSpec.FS/Helpers.ts +16 -11
  141. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.ts +2 -2
  142. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFormSpecValidator.ts +3 -3
  143. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSectioning.ts +10 -8
  144. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRSemanticReportBuilder.ts +6 -5
  145. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.ts +1 -10
  146. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateMapper.ts +35 -30
  147. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts +7 -26
  148. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts +2 -6
  149. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImportPipeline.ts +115 -0
  150. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRImporterAnalysis.ts +1059 -0
  151. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts +10 -10
  152. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRTriggerEnrichment.ts +61 -88
  153. package/src/FormSpec.FS/Integrations/CorEMR/CoreMRPathwayMapper.ts +926 -0
  154. package/src/FormSpec.FS/Integrations/CorEMR/CoreMRTypes.ts +3 -37
  155. package/src/FormSpec.FS/Integrations/CorEMR/FormTemplateDecoder.ts +1284 -0
  156. package/src/FormSpec.FS/Integrations/CorEMR/FormTemplateDomainDecoder.ts +287 -0
  157. package/src/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts +76 -25
  158. package/src/FormSpec.FS/Interop/FormSpec.Api.Option.ts +6 -6
  159. package/src/FormSpec.FS/PathwayDataExtractor.ts +40 -20
  160. package/src/FormSpec.FS/PathwayExecutor.ts +26 -26
  161. package/src/FormSpec.FS/PathwayValidator.ts +8 -5
  162. package/src/FormSpec.FS/Provenance.ts +23 -15
  163. package/src/FormSpec.FS/Renderers/FormSpecMarkdownRenderer.ts +18 -8
  164. package/src/FormSpec.FS/Renderers/MermaidRenderer.ts +6 -10
  165. package/src/FormSpec.FS/Renderers/PathwayRenderers.ts +5 -5
  166. package/src/FormSpec.FS/TriggerActionDto.ts +247 -74
  167. package/src/plugins/allergyfinder/src/AllergyFinderField.ts +3 -3
  168. package/src/plugins/bmi/src/BMIField.ts +12 -5
  169. package/src/plugins/demographics/src/DemographicsField.ts +5 -5
  170. package/src/plugins/likert/src/LikertField.ts +16 -11
  171. package/src/plugins/signature/src/SignatureField.ts +4 -3
  172. package/src/plugins/vitals/src/VitalsField.ts +5 -5
  173. package/src/vye-os-contracts-fs/src/Core/Ids.ts +8 -8
  174. package/src/vye-os-contracts-fs/src/CoreMR/FormTemplate.ts +715 -0
  175. package/vye-os-contracts-fs/src/Core/Ids.d.ts +4 -4
  176. package/vye-os-contracts-fs/src/Core/Ids.d.ts.map +1 -1
  177. package/vye-os-contracts-fs/src/Core/Ids.js +18 -18
  178. package/vye-os-contracts-fs/src/CoreMR/FormTemplate.d.ts +310 -0
  179. package/vye-os-contracts-fs/src/CoreMR/FormTemplate.d.ts.map +1 -0
  180. package/vye-os-contracts-fs/src/CoreMR/FormTemplate.js +1242 -0
  181. package/vye-os-contracts-fs/src/CoreMR/FormTemplate.js.map +1 -0
  182. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.d.ts +0 -69
  183. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.d.ts.map +0 -1
  184. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.js +0 -447
  185. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.js.map +0 -1
  186. package/FormSpec.FS/Integrations/CorEMR/ItemTriggerConverter.d.ts +0 -19
  187. package/FormSpec.FS/Integrations/CorEMR/ItemTriggerConverter.d.ts.map +0 -1
  188. package/FormSpec.FS/Integrations/CorEMR/ItemTriggerConverter.js +0 -643
  189. package/FormSpec.FS/Integrations/CorEMR/ItemTriggerConverter.js.map +0 -1
  190. package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.d.ts.map +0 -1
  191. package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.js.map +0 -1
  192. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTriggerConverter.ts +0 -412
  193. package/src/FormSpec.FS/Integrations/CorEMR/ItemTriggerConverter.ts +0 -588
  194. package/src/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.ts +0 -1054
@@ -1,15 +1,20 @@
1
- import { ClinicalPathway_TerminalInfo, Shared_StateKey, ClinicalPathway_StateType_$union, ClinicalPathway_EvaluationInfo, ClinicalPathway_ActionInfo_$union, ClinicalPathway_MedicationAction, ClinicalPathway_FieldValueSource_$union, ClinicalPathway_SetFieldValueAction, ClinicalPathway_NavigateToFormAction, ClinicalPathway_PrescriptionAction, ClinicalPathway_ProblemAction, ClinicalPathway_AlertAction, ClinicalPathway_TaskAction, ClinicalPathway_DocumentationAction, ClinicalPathway_ReferralAction, ClinicalPathway_TestAction, ClinicalPathway_EducationAction, ClinicalPathway_ProcedureAction, ClinicalPathway_MedsetAction, ClinicalPathway_TreatmentAction } from "./FormSpec.js";
1
+ import { value as value_1, Option, defaultArg } from "@fable-org/fable-library-js/Option.js";
2
2
  import { split, replace, join, isNullOrWhiteSpace, substring, printf, toText } from "@fable-org/fable-library-js/String.js";
3
- import { Option, value as value_1, defaultArg } from "@fable-org/fable-library-js/Option.js";
4
- import { singleton, append, map, FSharpList, empty } from "@fable-org/fable-library-js/List.js";
3
+ import { ClinicalPathway_TerminalInfo, Shared_StateKey, ClinicalPathway_StateType_$union, ClinicalPathway_EvaluationInfo, ClinicalPathway_TreatmentAction, ClinicalPathway_ActionInfo_$union, ClinicalPathway_MedicationAction, ClinicalPathway_GroupRef, ClinicalPathway_GroupChangeAction, ClinicalPathway_FieldValueSource_$union, ClinicalPathway_SetFieldValueAction, ClinicalPathway_NavigateToFormAction, ClinicalPathway_PrescriptionAction, ClinicalPathway_AlertAction, ClinicalPathway_TaskAction, ClinicalPathway_DocumentationAction, ClinicalPathway_ReferralAction, ClinicalPathway_TestAction, ClinicalPathway_EducationAction, ClinicalPathway_ProcedureAction, ClinicalPathway_MedsetAction } from "./FormSpec.js";
4
+ import { singleton, append, FSharpList, empty, map } from "@fable-org/fable-library-js/List.js";
5
+ import { int32ToString } from "@fable-org/fable-library-js/Util.js";
5
6
  import { item, map as map_1 } from "@fable-org/fable-library-js/Array.js";
6
7
  import { int32 } from "@fable-org/fable-library-js/Int32.js";
7
8
 
9
+ function stated(o: Option<string>): string {
10
+ return defaultArg<string>(o, "(none stated)");
11
+ }
12
+
8
13
  export function extractActionText(action: ClinicalPathway_ActionInfo_$union): string {
9
14
  switch (action.tag) {
10
15
  case /* Treatment */ 1: {
11
- const t: ClinicalPathway_TreatmentAction = action.fields[0];
12
- return toText(printf("Treatment: %s"))(t.Name);
16
+ const arg_1: string = stated(action.fields[0].Name);
17
+ return toText(printf("Treatment: %s"))(arg_1);
13
18
  }
14
19
  case /* Medset */ 2: {
15
20
  const m_1: ClinicalPathway_MedsetAction = action.fields[0];
@@ -37,15 +42,16 @@ export function extractActionText(action: ClinicalPathway_ActionInfo_$union): st
37
42
  }
38
43
  case /* Task */ 8: {
39
44
  const t_2: ClinicalPathway_TaskAction = action.fields[0];
40
- return toText(printf("Task: %s"))(t_2.Description);
45
+ const arg_7: string = defaultArg<string>(t_2.Description, t_2.Category);
46
+ return toText(printf("Task: %s"))(arg_7);
41
47
  }
42
48
  case /* Alert */ 9: {
43
49
  const a: ClinicalPathway_AlertAction = action.fields[0];
44
50
  return toText(printf("Alert: %s"))(a.Message);
45
51
  }
46
52
  case /* Problem */ 10: {
47
- const p_1: ClinicalPathway_ProblemAction = action.fields[0];
48
- return toText(printf("Problem: %s"))(p_1.ProblemName);
53
+ const arg_9: string = stated(action.fields[0].ProblemName);
54
+ return toText(printf("Problem: %s"))(arg_9);
49
55
  }
50
56
  case /* Prescription */ 11: {
51
57
  const p_2: ClinicalPathway_PrescriptionAction = action.fields[0];
@@ -79,6 +85,12 @@ export function extractActionText(action: ClinicalPathway_ActionInfo_$union): st
79
85
  }
80
86
  return toText(printf("Set Field: %s = %s"))(shortGuid)(valueText);
81
87
  }
88
+ case /* ChangeGroups */ 14: {
89
+ const g_2: ClinicalPathway_GroupChangeAction = action.fields[0];
90
+ const verb: string = (g_2.Change.tag === /* RemoveFromGroups */ 1) ? "Remove from groups" : "Add to groups";
91
+ const arg_15: string = join(", ", map<ClinicalPathway_GroupRef, string>((r_1: ClinicalPathway_GroupRef): string => defaultArg<string>(r_1.Name, int32ToString(r_1.GroupId)), g_2.Groups));
92
+ return toText(printf("%s: %s"))(verb)(arg_15);
93
+ }
82
94
  default: {
83
95
  const m: ClinicalPathway_MedicationAction = action.fields[0];
84
96
  return toText(printf("Rx: %s"))(m.Name);
@@ -90,8 +102,9 @@ export function extractActionDetails(action: ClinicalPathway_ActionInfo_$union):
90
102
  switch (action.tag) {
91
103
  case /* Treatment */ 1: {
92
104
  const t: ClinicalPathway_TreatmentAction = action.fields[0];
105
+ const arg_4: string = stated(t.Name);
93
106
  const arg_5: string = defaultArg(t.Signature, "");
94
- return toText(printf("Treatment: %s (%s)"))(t.Name)(arg_5);
107
+ return toText(printf("Treatment: %s (%s)"))(arg_4)(arg_5);
95
108
  }
96
109
  case /* Medset */ 2: {
97
110
  const m_1: ClinicalPathway_MedsetAction = action.fields[0];
@@ -115,15 +128,16 @@ export function extractActionDetails(action: ClinicalPathway_ActionInfo_$union):
115
128
  }
116
129
  case /* Task */ 8: {
117
130
  const t_2: ClinicalPathway_TaskAction = action.fields[0];
118
- return toText(printf("Task: %s"))(t_2.Description);
131
+ const arg_11: string = defaultArg<string>(t_2.Description, t_2.Category);
132
+ return toText(printf("Task: %s"))(arg_11);
119
133
  }
120
134
  case /* Alert */ 9: {
121
135
  const a: ClinicalPathway_AlertAction = action.fields[0];
122
136
  return toText(printf("Alert: %s"))(a.Message);
123
137
  }
124
138
  case /* Problem */ 10: {
125
- const p_1: ClinicalPathway_ProblemAction = action.fields[0];
126
- return toText(printf("Problem: %s"))(p_1.ProblemName);
139
+ const arg_13: string = stated(action.fields[0].ProblemName);
140
+ return toText(printf("Problem: %s"))(arg_13);
127
141
  }
128
142
  case /* Prescription */ 11: {
129
143
  const p_2: ClinicalPathway_PrescriptionAction = action.fields[0];
@@ -154,6 +168,12 @@ export function extractActionDetails(action: ClinicalPathway_ActionInfo_$union):
154
168
  }
155
169
  return toText(printf("Set Field %s = %s"))(guid)(valueText);
156
170
  }
171
+ case /* ChangeGroups */ 14: {
172
+ const g_2: ClinicalPathway_GroupChangeAction = action.fields[0];
173
+ const verb: string = (g_2.Change.tag === /* RemoveFromGroups */ 1) ? "Remove from groups" : "Add to groups";
174
+ const arg_19: string = join(", ", map<ClinicalPathway_GroupRef, string>((r_1: ClinicalPathway_GroupRef): string => int32ToString(r_1.GroupId), g_2.Groups));
175
+ return toText(printf("%s: %s"))(verb)(arg_19);
176
+ }
157
177
  default: {
158
178
  const m: ClinicalPathway_MedicationAction = action.fields[0];
159
179
  return toText(printf("%s %s %s %s"))(m.Name)(m.Dose)(m.Route)(m.Frequency);
@@ -189,6 +209,8 @@ export function extractActionType(action: ClinicalPathway_ActionInfo_$union): st
189
209
  return "SetFieldValue";
190
210
  case /* NavigateToForm */ 13:
191
211
  return "NavigateToForm";
212
+ case /* ChangeGroups */ 14:
213
+ return "ChangeGroups";
192
214
  default:
193
215
  return "Medication";
194
216
  }
@@ -205,23 +227,21 @@ export function extractEvaluationName(evaluation: ClinicalPathway_EvaluationInfo
205
227
 
206
228
  export function stateTypeToString(stateType: ClinicalPathway_StateType_$union): string {
207
229
  switch (stateType.tag) {
208
- case /* Evaluation */ 1:
209
- return "Evaluation";
210
- case /* Action */ 2:
230
+ case /* Action */ 1:
211
231
  return "Action";
212
- case /* CompoundAction */ 3:
232
+ case /* CompoundAction */ 2:
213
233
  return "CompoundAction";
214
- case /* ConditionalAction */ 4:
234
+ case /* ConditionalAction */ 3:
215
235
  return "ConditionalAction";
216
- case /* Terminal */ 5:
236
+ case /* Terminal */ 4:
217
237
  return "Terminal";
218
238
  default:
219
- throw new Error("Match failure: F1.Studio.ClinicalPathway.StateType");
239
+ return "Evaluation";
220
240
  }
221
241
  }
222
242
 
223
243
  export function isTerminalState(stateType: ClinicalPathway_StateType_$union): boolean {
224
- if (stateType.tag === /* Terminal */ 5) {
244
+ if (stateType.tag === /* Terminal */ 4) {
225
245
  return true;
226
246
  }
227
247
  else {
@@ -1,7 +1,7 @@
1
1
  import { FSharpRef, Record, Union } from "@fable-org/fable-library-js/Types.js";
2
- import { fold, findIndex, tryPick, sortByDescending, truncate, length, sortBy, tryHead, filter as filter_1, ofArray as ofArray_1, append, empty, head, tail, concat, exists, singleton, forAll, collect, map as map_1, sumBy, sum, isEmpty, choose, tryFind, FSharpList } from "@fable-org/fable-library-js/List.js";
2
+ import { fold, findIndex, tryPick, sortByDescending, truncate, length, sortBy, tryHead, filter as filter_1, ofArray as ofArray_1, append, empty, head, tail, concat, exists, singleton, forAll, map as map_1, collect, sumBy, sum, isEmpty, choose, tryFind, FSharpList } from "@fable-org/fable-library-js/List.js";
3
3
  import { tuple_type, bool_type, float64_type, lambda_type, class_type, record_type, int32_type, union_type, list_type, string_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
4
- import { ClinicalPathway_PathwayExecutionMode_$reflection, ClinicalPathway_SetFieldValueAction, ClinicalPathway_FieldValueSource_$union, ClinicalPathway_PathwayExecutionMode_$union, ClinicalPathway_SelectionStrategy_$union, ClinicalPathway_CombinationStrategy_$union, ClinicalPathway_StateType_$union, ClinicalPathway_StateDefinition, Shared_PluginPropertyKey, Shared_FieldOptionKey, ClinicalPathway_TransitionCondition_$union, ClinicalPathway_LogicalOp_$union, ClinicalPathway_StateEvaluator_$union, Shared_FieldValue_Single, Shared_ConditionValue_$union, Shared_MatrixAnswer, ClinicalPathway_FieldEvaluator_$union, Shared_PluginDataProperty, Shared_PluginDataProperty_$reflection, Spec_Score, Spec_ScoreRange, Spec_FormStep$1, Spec_FormField$1, Shared_FieldValue_$union, Shared_MatrixItemKey, Shared_FieldAnswer, Shared_FieldOption, Spec_FieldType, Shared_TransitionKey_$reflection, Shared_TransitionKey, Shared_FieldKey_$reflection, ClinicalPathway_ActionInfo_$reflection, Spec_FormSpec$1_$reflection, Spec_FieldType_$reflection, ClinicalPathway_ClinicalPathwaySpec_$reflection, Shared_FieldKey, ClinicalPathway_ActionInfo_$union, Spec_FieldType_$union, Spec_FormSpec$1, ClinicalPathway_ClinicalPathwaySpec, Shared_StateKey_$reflection, Shared_StateKey, ClinicalPathway_TransitionDefinition_$reflection, ClinicalPathway_TransitionDefinition } from "./FormSpec.js";
4
+ import { ClinicalPathway_PathwayExecutionMode_$reflection, ClinicalPathway_ActionInfo_$union, ClinicalPathway_SetFieldValueAction, Spec_Label_shown, ClinicalPathway_FieldValueSource_$union, ClinicalPathway_PathwayExecutionMode_$union, ClinicalPathway_SelectionStrategy_$union, ClinicalPathway_CombinationStrategy_$union, ClinicalPathway_StateType_$union, ClinicalPathway_StateDefinition, Shared_PluginPropertyKey, Shared_FieldOptionKey, ClinicalPathway_TransitionCondition_$union, ClinicalPathway_LogicalOp_$union, ClinicalPathway_StateEvaluator_$union, Shared_FieldValue_Single, Shared_ConditionValue_$union, Shared_MatrixAnswer, ClinicalPathway_FieldEvaluator_$union, Shared_PluginDataProperty, Shared_PluginDataProperty_$reflection, Spec_Score, Spec_ScoreRange, Spec_FormStep$1, Spec_FormField$1, Shared_FieldValue_$union, Shared_MatrixItemKey, Shared_FieldAnswer, Shared_FieldOption, Spec_FieldType, Shared_TransitionKey_$reflection, Shared_TransitionKey, Shared_FieldKey_$reflection, ClinicalPathway_PathwayAction_$reflection, Spec_FormSpec$1_$reflection, Spec_FieldType_$reflection, ClinicalPathway_ClinicalPathwaySpec_$reflection, Shared_FieldKey, ClinicalPathway_PathwayAction, Spec_FieldType_$union, Spec_FormSpec$1, ClinicalPathway_ClinicalPathwaySpec, Shared_StateKey_$reflection, Shared_StateKey, ClinicalPathway_TransitionDefinition_$reflection, ClinicalPathway_TransitionDefinition } from "./FormSpec.js";
5
5
  import { tryParse as tryParse_1, float64, int32 } from "@fable-org/fable-library-js/Int32.js";
6
6
  import { int32ToString, equals, compare, comparePrimitives, IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
7
7
  import { difference, union, empty as empty_1, FSharpSet__get_IsEmpty, FSharpSet__get_Count, contains, isSubset, ofArray, FSharpSet__Contains, ofList as ofList_1, map as map_2, toList, FSharpSet } from "@fable-org/fable-library-js/Set.js";
@@ -95,10 +95,10 @@ export class ExecutionContext extends Record {
95
95
  readonly CompletedStates: FSharpSet<Shared_StateKey>;
96
96
  readonly ActiveTransitions: FSharpList<MatchedTransition>;
97
97
  readonly PendingTransitions: FSharpList<MatchedTransition>;
98
- readonly ExecutedActions: FSharpList<ClinicalPathway_ActionInfo_$union>;
98
+ readonly ExecutedActions: FSharpList<ClinicalPathway_PathwayAction>;
99
99
  readonly FieldResolver: ((arg0: string) => Shared_FieldKey);
100
100
  readonly ExecutionLog: FSharpList<ExecutionLogEntry>;
101
- constructor(PathwaySpec: ClinicalPathway_ClinicalPathwaySpec, FormSpec: Spec_FormSpec$1<Spec_FieldType_$union>, CurrentStates: FSharpSet<Shared_StateKey>, VisitedStates: FSharpSet<Shared_StateKey>, CompletedStates: FSharpSet<Shared_StateKey>, ActiveTransitions: FSharpList<MatchedTransition>, PendingTransitions: FSharpList<MatchedTransition>, ExecutedActions: FSharpList<ClinicalPathway_ActionInfo_$union>, FieldResolver: ((arg0: string) => Shared_FieldKey), ExecutionLog: FSharpList<ExecutionLogEntry>) {
101
+ constructor(PathwaySpec: ClinicalPathway_ClinicalPathwaySpec, FormSpec: Spec_FormSpec$1<Spec_FieldType_$union>, CurrentStates: FSharpSet<Shared_StateKey>, VisitedStates: FSharpSet<Shared_StateKey>, CompletedStates: FSharpSet<Shared_StateKey>, ActiveTransitions: FSharpList<MatchedTransition>, PendingTransitions: FSharpList<MatchedTransition>, ExecutedActions: FSharpList<ClinicalPathway_PathwayAction>, FieldResolver: ((arg0: string) => Shared_FieldKey), ExecutionLog: FSharpList<ExecutionLogEntry>) {
102
102
  super();
103
103
  this.PathwaySpec = PathwaySpec;
104
104
  this.FormSpec = FormSpec;
@@ -114,16 +114,16 @@ export class ExecutionContext extends Record {
114
114
  }
115
115
 
116
116
  export function ExecutionContext_$reflection(): TypeInfo {
117
- return record_type("F1.Studio.PathwayExecutor.ExecutionContext", [], ExecutionContext, () => [["PathwaySpec", ClinicalPathway_ClinicalPathwaySpec_$reflection()], ["FormSpec", Spec_FormSpec$1_$reflection(Spec_FieldType_$reflection())], ["CurrentStates", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [Shared_StateKey_$reflection()])], ["VisitedStates", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [Shared_StateKey_$reflection()])], ["CompletedStates", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [Shared_StateKey_$reflection()])], ["ActiveTransitions", list_type(MatchedTransition_$reflection())], ["PendingTransitions", list_type(MatchedTransition_$reflection())], ["ExecutedActions", list_type(ClinicalPathway_ActionInfo_$reflection())], ["FieldResolver", lambda_type(string_type, Shared_FieldKey_$reflection())], ["ExecutionLog", list_type(ExecutionLogEntry_$reflection())]]);
117
+ return record_type("F1.Studio.PathwayExecutor.ExecutionContext", [], ExecutionContext, () => [["PathwaySpec", ClinicalPathway_ClinicalPathwaySpec_$reflection()], ["FormSpec", Spec_FormSpec$1_$reflection(Spec_FieldType_$reflection())], ["CurrentStates", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [Shared_StateKey_$reflection()])], ["VisitedStates", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [Shared_StateKey_$reflection()])], ["CompletedStates", class_type("Microsoft.FSharp.Collections.FSharpSet`1", [Shared_StateKey_$reflection()])], ["ActiveTransitions", list_type(MatchedTransition_$reflection())], ["PendingTransitions", list_type(MatchedTransition_$reflection())], ["ExecutedActions", list_type(ClinicalPathway_PathwayAction_$reflection())], ["FieldResolver", lambda_type(string_type, Shared_FieldKey_$reflection())], ["ExecutionLog", list_type(ExecutionLogEntry_$reflection())]]);
118
118
  }
119
119
 
120
120
  export class PredictedPathway extends Record implements IEquatable<PredictedPathway>, IComparable<PredictedPathway> {
121
121
  readonly PathwayId: string;
122
122
  readonly Probability: float64;
123
123
  readonly RequiredFields: FSharpList<string>;
124
- readonly ExpectedActions: FSharpList<ClinicalPathway_ActionInfo_$union>;
124
+ readonly ExpectedActions: FSharpList<ClinicalPathway_PathwayAction>;
125
125
  readonly TargetState: string;
126
- constructor(PathwayId: string, Probability: float64, RequiredFields: FSharpList<string>, ExpectedActions: FSharpList<ClinicalPathway_ActionInfo_$union>, TargetState: string) {
126
+ constructor(PathwayId: string, Probability: float64, RequiredFields: FSharpList<string>, ExpectedActions: FSharpList<ClinicalPathway_PathwayAction>, TargetState: string) {
127
127
  super();
128
128
  this.PathwayId = PathwayId;
129
129
  this.Probability = Probability;
@@ -134,7 +134,7 @@ export class PredictedPathway extends Record implements IEquatable<PredictedPath
134
134
  }
135
135
 
136
136
  export function PredictedPathway_$reflection(): TypeInfo {
137
- return record_type("F1.Studio.PathwayExecutor.PredictedPathway", [], PredictedPathway, () => [["PathwayId", string_type], ["Probability", float64_type], ["RequiredFields", list_type(string_type)], ["ExpectedActions", list_type(ClinicalPathway_ActionInfo_$reflection())], ["TargetState", string_type]]);
137
+ return record_type("F1.Studio.PathwayExecutor.PredictedPathway", [], PredictedPathway, () => [["PathwayId", string_type], ["Probability", float64_type], ["RequiredFields", list_type(string_type)], ["ExpectedActions", list_type(ClinicalPathway_PathwayAction_$reflection())], ["TargetState", string_type]]);
138
138
  }
139
139
 
140
140
  export class IncrementalExecutionResult extends Record {
@@ -161,10 +161,10 @@ export function IncrementalExecutionResult_$reflection(): TypeInfo {
161
161
 
162
162
  export class ClinicalPlan extends Record implements IEquatable<ClinicalPlan>, IComparable<ClinicalPlan> {
163
163
  readonly PlanId: string;
164
- readonly Actions: FSharpList<ClinicalPathway_ActionInfo_$union>;
164
+ readonly Actions: FSharpList<ClinicalPathway_PathwayAction>;
165
165
  readonly TargetState: string;
166
166
  readonly Priority: int32;
167
- constructor(PlanId: string, Actions: FSharpList<ClinicalPathway_ActionInfo_$union>, TargetState: string, Priority: int32) {
167
+ constructor(PlanId: string, Actions: FSharpList<ClinicalPathway_PathwayAction>, TargetState: string, Priority: int32) {
168
168
  super();
169
169
  this.PlanId = PlanId;
170
170
  this.Actions = Actions;
@@ -174,7 +174,7 @@ export class ClinicalPlan extends Record implements IEquatable<ClinicalPlan>, IC
174
174
  }
175
175
 
176
176
  export function ClinicalPlan_$reflection(): TypeInfo {
177
- return record_type("F1.Studio.PathwayExecutor.ClinicalPlan", [], ClinicalPlan, () => [["PlanId", string_type], ["Actions", list_type(ClinicalPathway_ActionInfo_$reflection())], ["TargetState", string_type], ["Priority", int32_type]]);
177
+ return record_type("F1.Studio.PathwayExecutor.ClinicalPlan", [], ClinicalPlan, () => [["PlanId", string_type], ["Actions", list_type(ClinicalPathway_PathwayAction_$reflection())], ["TargetState", string_type], ["Priority", int32_type]]);
178
178
  }
179
179
 
180
180
  export class VisualizationState extends Record implements IEquatable<VisualizationState>, IComparable<VisualizationState> {
@@ -322,7 +322,7 @@ export function ScoreCalculator_getScoreRange(score: Option<Spec_Score>, value:
322
322
  */
323
323
  export function FieldResolver_createResolver(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>): ((arg0: string) => Shared_FieldKey) {
324
324
  const formCode: string = defaultArg(map<string, string>(Helpers_canonicalizeFieldKey, formSpec.Code), "unknown");
325
- const labelToFieldKey: FSharpMap<string, Shared_FieldKey> = ofList<string, Shared_FieldKey>(map_1<Spec_FormField$1<Spec_FieldType_$union>, [string, Shared_FieldKey]>((field: Spec_FormField$1<Spec_FieldType_$union>): [string, Shared_FieldKey] => ([field.Label.toLocaleLowerCase().trim(), field.FieldKey] as [string, Shared_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, formSpec.Steps)), {
325
+ const labelToFieldKey: FSharpMap<string, Shared_FieldKey> = ofList<string, Shared_FieldKey>(choose<Spec_FormField$1<Spec_FieldType_$union>, [string, Shared_FieldKey]>((field: Spec_FormField$1<Spec_FieldType_$union>): Option<[string, Shared_FieldKey]> => map<string, [string, Shared_FieldKey]>((label: string): [string, Shared_FieldKey] => ([label.toLocaleLowerCase().trim(), field.FieldKey] as [string, Shared_FieldKey]), field.Label), 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, formSpec.Steps)), {
326
326
  Compare: comparePrimitives,
327
327
  });
328
328
  return (fieldReference: string): Shared_FieldKey => {
@@ -949,19 +949,19 @@ export function findState(stateKey: Shared_StateKey, states: FSharpList<Clinical
949
949
  /**
950
950
  * Extract actions from state
951
951
  */
952
- export function extractActionsFromState(state: ClinicalPathway_StateDefinition): FSharpList<ClinicalPathway_ActionInfo_$union> {
952
+ export function extractActionsFromState(state: ClinicalPathway_StateDefinition): FSharpList<ClinicalPathway_PathwayAction> {
953
953
  const matchValue: ClinicalPathway_StateType_$union = state.StateType;
954
954
  switch (matchValue.tag) {
955
- case /* Action */ 2:
955
+ case /* Action */ 1:
956
956
  return singleton(matchValue.fields[0]);
957
- case /* CompoundAction */ 3:
957
+ case /* CompoundAction */ 2:
958
958
  return matchValue.fields[0];
959
- case /* ConditionalAction */ 4: {
959
+ case /* ConditionalAction */ 3: {
960
960
  const condition: ClinicalPathway_TransitionCondition_$union = matchValue.fields[0];
961
- return append(singleton(matchValue.fields[1]), ofArray_1(toArray<ClinicalPathway_ActionInfo_$union>(matchValue.fields[2])));
961
+ return append(singleton(matchValue.fields[1]), ofArray_1(toArray<ClinicalPathway_PathwayAction>(matchValue.fields[2])));
962
962
  }
963
963
  default:
964
- return empty<ClinicalPathway_ActionInfo_$union>();
964
+ return empty<ClinicalPathway_PathwayAction>();
965
965
  }
966
966
  }
967
967
 
@@ -969,7 +969,7 @@ export function extractActionsFromState(state: ClinicalPathway_StateDefinition):
969
969
  * Check if a state is terminal
970
970
  */
971
971
  export function isTerminalState(state: ClinicalPathway_StateDefinition): boolean {
972
- if (state.StateType.tag === /* Terminal */ 5) {
972
+ if (state.StateType.tag === /* Terminal */ 4) {
973
973
  return true;
974
974
  }
975
975
  else {
@@ -1147,7 +1147,7 @@ export function initializeExecution(formSpec: Spec_FormSpec$1<Spec_FieldType_$un
1147
1147
  Compare: compare,
1148
1148
  }), empty_1<Shared_StateKey>({
1149
1149
  Compare: compare,
1150
- }), empty<MatchedTransition>(), empty<MatchedTransition>(), empty<ClinicalPathway_ActionInfo_$union>(), resolver, map_1<Shared_StateKey, ExecutionLogEntry>((stateKey: Shared_StateKey): ExecutionLogEntry => (new ExecutionLogEntry(now(), stateKey, "Initialized", "Starting state")), initialStates));
1150
+ }), empty<MatchedTransition>(), empty<MatchedTransition>(), empty<ClinicalPathway_PathwayAction>(), resolver, map_1<Shared_StateKey, ExecutionLogEntry>((stateKey: Shared_StateKey): ExecutionLogEntry => (new ExecutionLogEntry(now(), stateKey, "Initialized", "Starting state")), initialStates));
1151
1151
  }
1152
1152
  }
1153
1153
 
@@ -1194,7 +1194,7 @@ export function executeSetFieldValueAction(action: ClinicalPathway_SetFieldValue
1194
1194
  }
1195
1195
  else {
1196
1196
  const step_2: Spec_FormStep$1<Spec_FieldType_$union> = value_4(stepOpt);
1197
- return updateField<Spec_FieldType_$union>(formSpec, action.TargetField, Shared_FieldValue_Single(new Shared_FieldAnswer(action.TargetField, targetField.Label, valueToSet, undefined)), findIndex<Spec_FormStep$1<Spec_FieldType_$union>>((s: Spec_FormStep$1<Spec_FieldType_$union>): boolean => (s.StepOrder === step_2.StepOrder), formSpec.Steps));
1197
+ return updateField<Spec_FieldType_$union>(formSpec, action.TargetField, Shared_FieldValue_Single(new Shared_FieldAnswer(action.TargetField, Spec_Label_shown(targetField.Label), valueToSet, undefined)), findIndex<Spec_FormStep$1<Spec_FieldType_$union>>((s: Spec_FormStep$1<Spec_FieldType_$union>): boolean => (s.StepOrder === step_2.StepOrder), formSpec.Steps));
1198
1198
  }
1199
1199
  }
1200
1200
  }
@@ -1241,8 +1241,8 @@ export function executeStep(context_mut: ExecutionContext, maxIterations_mut: in
1241
1241
  const newStates: FSharpSet<Shared_StateKey> = ofList_1<Shared_StateKey>(map_1<MatchedTransition, Shared_StateKey>((t: MatchedTransition): Shared_StateKey => t.Transition.ToState, selectedTransitions), {
1242
1242
  Compare: compare,
1243
1243
  });
1244
- const newActions: FSharpList<ClinicalPathway_ActionInfo_$union> = collect<ClinicalPathway_StateDefinition, ClinicalPathway_ActionInfo_$union>(extractActionsFromState, choose<Shared_StateKey, ClinicalPathway_StateDefinition>((sk: Shared_StateKey): Option<ClinicalPathway_StateDefinition> => findState(sk, context.PathwaySpec.States), toList<Shared_StateKey>(newStates)));
1245
- const updatedFormSpec: Spec_FormSpec$1<Spec_FieldType_$union> = executeActions(newActions, context.FormSpec);
1244
+ const newActions: FSharpList<ClinicalPathway_PathwayAction> = collect<ClinicalPathway_StateDefinition, ClinicalPathway_PathwayAction>(extractActionsFromState, choose<Shared_StateKey, ClinicalPathway_StateDefinition>((sk: Shared_StateKey): Option<ClinicalPathway_StateDefinition> => findState(sk, context.PathwaySpec.States), toList<Shared_StateKey>(newStates)));
1245
+ const updatedFormSpec: Spec_FormSpec$1<Spec_FieldType_$union> = executeActions(map_1<ClinicalPathway_PathwayAction, ClinicalPathway_ActionInfo_$union>((a: ClinicalPathway_PathwayAction): ClinicalPathway_ActionInfo_$union => a.Action, newActions), context.FormSpec);
1246
1246
  const newLogEntries: FSharpList<ExecutionLogEntry> = map_1<MatchedTransition, ExecutionLogEntry>((t_1: MatchedTransition): ExecutionLogEntry => {
1247
1247
  let arg: string, arg_1: string;
1248
1248
  return new ExecutionLogEntry(now(), t_1.Transition.ToState, "Transitioned", (arg = t_1.Transition.FromState.fields[0], (arg_1 = t_1.Transition.TransitionKey.fields[0], toText(printf("From %s via %s"))(arg)(arg_1))));
@@ -1325,14 +1325,14 @@ export class PathwayExecutionResult$1<FieldType> extends Record implements IEqua
1325
1325
  readonly ExecutionMode: ClinicalPathway_PathwayExecutionMode_$union;
1326
1326
  readonly SelectedPaths: FSharpList<string>;
1327
1327
  readonly RejectedPaths: FSharpList<[string, string]>;
1328
- readonly ExecutedActions: FSharpList<ClinicalPathway_ActionInfo_$union>;
1328
+ readonly ExecutedActions: FSharpList<ClinicalPathway_PathwayAction>;
1329
1329
  readonly VisitedStates: FSharpList<string>;
1330
1330
  readonly TransitionsUsed: FSharpList<string>;
1331
1331
  readonly FormSpec: Spec_FormSpec$1<FieldType>;
1332
1332
  readonly ExecutionTime: Date;
1333
1333
  readonly Success: boolean;
1334
1334
  readonly Errors: FSharpList<string>;
1335
- constructor(PathwayId: string, StartState: string, CurrentState: string, ExecutionMode: ClinicalPathway_PathwayExecutionMode_$union, SelectedPaths: FSharpList<string>, RejectedPaths: FSharpList<[string, string]>, ExecutedActions: FSharpList<ClinicalPathway_ActionInfo_$union>, VisitedStates: FSharpList<string>, TransitionsUsed: FSharpList<string>, FormSpec: Spec_FormSpec$1<FieldType>, ExecutionTime: Date, Success: boolean, Errors: FSharpList<string>) {
1335
+ constructor(PathwayId: string, StartState: string, CurrentState: string, ExecutionMode: ClinicalPathway_PathwayExecutionMode_$union, SelectedPaths: FSharpList<string>, RejectedPaths: FSharpList<[string, string]>, ExecutedActions: FSharpList<ClinicalPathway_PathwayAction>, VisitedStates: FSharpList<string>, TransitionsUsed: FSharpList<string>, FormSpec: Spec_FormSpec$1<FieldType>, ExecutionTime: Date, Success: boolean, Errors: FSharpList<string>) {
1336
1336
  super();
1337
1337
  this.PathwayId = PathwayId;
1338
1338
  this.StartState = StartState;
@@ -1351,7 +1351,7 @@ export class PathwayExecutionResult$1<FieldType> extends Record implements IEqua
1351
1351
  }
1352
1352
 
1353
1353
  export function PathwayExecutionResult$1_$reflection(gen0: TypeInfo): TypeInfo {
1354
- return record_type("F1.Studio.PathwayExecutor.PathwayExecutionResult`1", [gen0], PathwayExecutionResult$1, () => [["PathwayId", string_type], ["StartState", string_type], ["CurrentState", string_type], ["ExecutionMode", ClinicalPathway_PathwayExecutionMode_$reflection()], ["SelectedPaths", list_type(string_type)], ["RejectedPaths", list_type(tuple_type(string_type, string_type))], ["ExecutedActions", list_type(ClinicalPathway_ActionInfo_$reflection())], ["VisitedStates", list_type(string_type)], ["TransitionsUsed", list_type(string_type)], ["FormSpec", Spec_FormSpec$1_$reflection(gen0)], ["ExecutionTime", class_type("System.DateTime")], ["Success", bool_type], ["Errors", list_type(string_type)]]);
1354
+ return record_type("F1.Studio.PathwayExecutor.PathwayExecutionResult`1", [gen0], PathwayExecutionResult$1, () => [["PathwayId", string_type], ["StartState", string_type], ["CurrentState", string_type], ["ExecutionMode", ClinicalPathway_PathwayExecutionMode_$reflection()], ["SelectedPaths", list_type(string_type)], ["RejectedPaths", list_type(tuple_type(string_type, string_type))], ["ExecutedActions", list_type(ClinicalPathway_PathwayAction_$reflection())], ["VisitedStates", list_type(string_type)], ["TransitionsUsed", list_type(string_type)], ["FormSpec", Spec_FormSpec$1_$reflection(gen0)], ["ExecutionTime", class_type("System.DateTime")], ["Success", bool_type], ["Errors", list_type(string_type)]]);
1355
1355
  }
1356
1356
 
1357
1357
  //# sourceMappingURL=PathwayExecutor.ts.map
@@ -1,6 +1,6 @@
1
1
  import { Record } from "@fable-org/fable-library-js/Types.js";
2
2
  import { tryFind, fold, toList, ofList, FSharpMap } from "@fable-org/fable-library-js/Map.js";
3
- import { ClinicalPathway_StateDefinition, Shared_FieldValue_Single, Shared_FieldAnswer, Shared_FieldValue_Matrix, Shared_MatrixAnswer, Shared_MatrixItemKey, Shared_FieldValue_$union, Spec_FormSpec$1, Spec_FormStep$1, ClinicalPathway_ClinicalPathwaySpec, ClinicalPathway_TransitionDefinition, ClinicalPathway_TransitionCondition_$union, Spec_FormField$1, Shared_FieldOption, Spec_FieldType_$union, Shared_StateKey_$reflection, Shared_StateKey, Shared_FieldKey_$reflection, Shared_FieldKey } from "./FormSpec.js";
3
+ import { ClinicalPathway_StateDefinition, Shared_FieldValue_Single, Shared_FieldAnswer, Shared_FieldValue_Matrix, Shared_MatrixAnswer, Spec_Label_shown, Shared_MatrixItemKey, Shared_FieldValue_$union, Spec_FormSpec$1, Spec_FormStep$1, ClinicalPathway_ClinicalPathwaySpec, ClinicalPathway_TransitionDefinition, ClinicalPathway_TransitionCondition_$union, Spec_FormField$1, Shared_FieldOption, Spec_FieldType_$union, Shared_StateKey_$reflection, Shared_StateKey, Shared_FieldKey_$reflection, Shared_FieldKey } from "./FormSpec.js";
4
4
  import { stringHash, safeHash, compare, equals, IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
5
5
  import { option_type, list_type, int32_type, bool_type, record_type, class_type, string_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
6
6
  import { ofList as ofList_1, intersect, isEmpty as isEmpty_1, empty as empty_1, FSharpSet } from "@fable-org/fable-library-js/Set.js";
@@ -165,15 +165,18 @@ export function generateTestScenarios(formSpec: Spec_FormSpec$1<Spec_FieldType_$
165
165
  }
166
166
 
167
167
  function scenarioToFormSpec(formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, scenario: TestScenario): Spec_FormSpec$1<Spec_FieldType_$union> {
168
- return fold<Shared_FieldKey, Shared_FieldValue_$union, Spec_FormSpec$1<Spec_FieldType_$union>>((spec: Spec_FormSpec$1<Spec_FieldType_$union>, fieldKey: Shared_FieldKey, fieldValue_1: Shared_FieldValue_$union): Spec_FormSpec$1<Spec_FieldType_$union> => defaultArg(map_1<int32, Spec_FormSpec$1<Spec_FieldType_$union>>((stepIdx: int32): Spec_FormSpec$1<Spec_FieldType_$union> => updateField<Spec_FieldType_$union>(spec, fieldKey, fieldValue_1, stepIdx), findStepIndexForField<Spec_FieldType_$union>(spec, fieldKey)), spec), formSpec, ofList<Shared_FieldKey, Shared_FieldValue_$union>(choose<Spec_FormField$1<Spec_FieldType_$union>, [Shared_FieldKey, Shared_FieldValue_$union]>((field: Spec_FormField$1<Spec_FieldType_$union>): Option<[Shared_FieldKey, Shared_FieldValue_$union]> => map_1<string, [Shared_FieldKey, Shared_FieldValue_$union]>((value: string): [Shared_FieldKey, Shared_FieldValue_$union] => ([field.FieldKey, (field.FieldType.tag === /* Matrix */ 19) ? Shared_FieldValue_Matrix(new Shared_MatrixAnswer(field.FieldKey, field.Label, ofList<Shared_MatrixItemKey, string>(map<Shared_MatrixItemKey, [Shared_MatrixItemKey, string]>((itemKey: Shared_MatrixItemKey): [Shared_MatrixItemKey, string] => ([itemKey, value] as [Shared_MatrixItemKey, string]), singleton(new Shared_MatrixItemKey(newGuid()))), {
169
- Compare: compare,
170
- }), undefined)) : Shared_FieldValue_Single(new Shared_FieldAnswer(field.FieldKey, field.Label, value, undefined))] as [Shared_FieldKey, Shared_FieldValue_$union]), tryFind<Shared_FieldKey, string>(field.FieldKey, scenario.FieldValues)), 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, formSpec.Steps)), {
168
+ return fold<Shared_FieldKey, Shared_FieldValue_$union, Spec_FormSpec$1<Spec_FieldType_$union>>((spec: Spec_FormSpec$1<Spec_FieldType_$union>, fieldKey: Shared_FieldKey, fieldValue_1: Shared_FieldValue_$union): Spec_FormSpec$1<Spec_FieldType_$union> => defaultArg(map_1<int32, Spec_FormSpec$1<Spec_FieldType_$union>>((stepIdx: int32): Spec_FormSpec$1<Spec_FieldType_$union> => updateField<Spec_FieldType_$union>(spec, fieldKey, fieldValue_1, stepIdx), findStepIndexForField<Spec_FieldType_$union>(spec, fieldKey)), spec), formSpec, ofList<Shared_FieldKey, Shared_FieldValue_$union>(choose<Spec_FormField$1<Spec_FieldType_$union>, [Shared_FieldKey, Shared_FieldValue_$union]>((field: Spec_FormField$1<Spec_FieldType_$union>): Option<[Shared_FieldKey, Shared_FieldValue_$union]> => map_1<string, [Shared_FieldKey, Shared_FieldValue_$union]>((value: string): [Shared_FieldKey, Shared_FieldValue_$union] => {
169
+ let matrixValues: FSharpMap<Shared_MatrixItemKey, string>;
170
+ return [field.FieldKey, (field.FieldType.tag === /* Matrix */ 19) ? ((matrixValues = ofList<Shared_MatrixItemKey, string>(map<Shared_MatrixItemKey, [Shared_MatrixItemKey, string]>((itemKey: Shared_MatrixItemKey): [Shared_MatrixItemKey, string] => ([itemKey, value] as [Shared_MatrixItemKey, string]), singleton(new Shared_MatrixItemKey(newGuid()))), {
171
+ Compare: compare,
172
+ }), Shared_FieldValue_Matrix(new Shared_MatrixAnswer(field.FieldKey, Spec_Label_shown(field.Label), matrixValues, undefined)))) : Shared_FieldValue_Single(new Shared_FieldAnswer(field.FieldKey, Spec_Label_shown(field.Label), value, undefined))] as [Shared_FieldKey, Shared_FieldValue_$union];
173
+ }, tryFind<Shared_FieldKey, string>(field.FieldKey, scenario.FieldValues)), 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, formSpec.Steps)), {
171
174
  Compare: compare,
172
175
  }));
173
176
  }
174
177
 
175
178
  function isTerminalState(state: ClinicalPathway_StateDefinition): boolean {
176
- if (state.StateType.tag === /* Terminal */ 5) {
179
+ if (state.StateType.tag === /* Terminal */ 4) {
177
180
  return true;
178
181
  }
179
182
  else {
@@ -6,42 +6,50 @@ import { isNullOrWhiteSpace } from "@fable-org/fable-library-js/String.js";
6
6
  export class IntegrationProvenance extends Record implements IEquatable<IntegrationProvenance>, IComparable<IntegrationProvenance> {
7
7
  readonly Vendor: string;
8
8
  readonly TenantId: string;
9
- readonly SiteId: string;
9
+ readonly DbName: string;
10
10
  readonly Payload: string;
11
- constructor(Vendor: string, TenantId: string, SiteId: string, Payload: string) {
11
+ constructor(Vendor: string, TenantId: string, DbName: string, Payload: string) {
12
12
  super();
13
13
  this.Vendor = Vendor;
14
14
  this.TenantId = TenantId;
15
- this.SiteId = SiteId;
15
+ this.DbName = DbName;
16
16
  this.Payload = Payload;
17
17
  }
18
18
  }
19
19
 
20
20
  export function IntegrationProvenance_$reflection(): TypeInfo {
21
- return record_type("F1.Studio.Provenance.IntegrationProvenance", [], IntegrationProvenance, () => [["Vendor", string_type], ["TenantId", string_type], ["SiteId", string_type], ["Payload", string_type]]);
21
+ return record_type("F1.Studio.Provenance.IntegrationProvenance", [], IntegrationProvenance, () => [["Vendor", string_type], ["TenantId", string_type], ["DbName", string_type], ["Payload", string_type]]);
22
22
  }
23
23
 
24
24
  export class ImportOrigin extends Record implements IEquatable<ImportOrigin>, IComparable<ImportOrigin> {
25
25
  readonly Vendor: string;
26
26
  readonly TenantId: string;
27
- readonly SiteId: string;
28
- constructor(Vendor: string, TenantId: string, SiteId: string) {
27
+ readonly DbName: string;
28
+ constructor(Vendor: string, TenantId: string, DbName: string) {
29
29
  super();
30
30
  this.Vendor = Vendor;
31
31
  this.TenantId = TenantId;
32
- this.SiteId = SiteId;
32
+ this.DbName = DbName;
33
33
  }
34
34
  }
35
35
 
36
36
  export function ImportOrigin_$reflection(): TypeInfo {
37
- return record_type("F1.Studio.Provenance.ImportOrigin", [], ImportOrigin, () => [["Vendor", string_type], ["TenantId", string_type], ["SiteId", string_type]]);
37
+ return record_type("F1.Studio.Provenance.ImportOrigin", [], ImportOrigin, () => [["Vendor", string_type], ["TenantId", string_type], ["DbName", string_type]]);
38
38
  }
39
39
 
40
40
  /**
41
- * ⛔ FAILS LOUDLY. A blank tenant or site is not "unknown, fill it in later" — it is an import
42
- * whose payload can never be resolved back, and it must not be written at all.
41
+ * ⛔ FAILS LOUDLY. A blank tenant or database is not "unknown, fill it in later" — it is an
42
+ * import whose payload can never be resolved back, and it must not be written at all.
43
+ *
44
+ * ⚖️ THE PARAMETER WAS NAMED `siteId` UNTIL 2026-09-25 (#123 W3b) AND THE VALUE NEVER CHANGED.
45
+ * ⚰️ It has always been a LEVEL 3 **database name** — `coremr_st_johns_fl` — and the failure
46
+ * message said so in words (*"scoped to ONE CoreMR database"*) while the parameter said
47
+ * LEVEL 2 in its name. ⭐ That is the whole #123 defect in four lines: **the comment was
48
+ * right, the name was wrong, and nothing could disagree because there was only ever one
49
+ * value.** The language is [`TAXONOMY_SSOT.md`](../../../../TAXONOMY_SSOT.md) — a SITE is a
50
+ * place (a minted Guid, #106); a DB NAME is what a connection opens.
43
51
  */
44
- export function ImportOriginModule_create(vendor: string, tenantId: string, siteId: string): ImportOrigin {
52
+ export function ImportOriginModule_create(vendor: string, tenantId: string, dbName: string): ImportOrigin {
45
53
  const blank = isNullOrWhiteSpace;
46
54
  if (blank(vendor)) {
47
55
  throw new Error("ImportOrigin: vendor is required (e.g. \"coremr\").");
@@ -49,17 +57,17 @@ export function ImportOriginModule_create(vendor: string, tenantId: string, site
49
57
  if (blank(tenantId)) {
50
58
  throw new Error("ImportOrigin: tenantId is required — a blueprint belongs to an organisation.");
51
59
  }
52
- if (blank(siteId)) {
53
- throw new Error("ImportOrigin: siteId is required — every formId/itemId/choiceId in the payload is scoped to ONE CoreMR database, and without it the provenance cannot be resolved back.");
60
+ if (blank(dbName)) {
61
+ throw new Error("ImportOrigin: dbName is required — every formId/itemId/choiceId in the payload is scoped to ONE CoreMR database, and without it the provenance cannot be resolved back.");
54
62
  }
55
- return new ImportOrigin(vendor.trim(), tenantId.trim(), siteId.trim());
63
+ return new ImportOrigin(vendor.trim(), tenantId.trim(), dbName.trim());
56
64
  }
57
65
 
58
66
  /**
59
67
  * The provenance for a payload read under this origin.
60
68
  */
61
69
  export function ImportOriginModule_provenance(o: ImportOrigin, payload: string): IntegrationProvenance {
62
- return new IntegrationProvenance(o.Vendor, o.TenantId, o.SiteId, payload);
70
+ return new IntegrationProvenance(o.Vendor, o.TenantId, o.DbName, payload);
63
71
  }
64
72
 
65
73
  //# sourceMappingURL=Provenance.ts.map
@@ -1,7 +1,7 @@
1
1
  import { printf, toText, isNullOrWhiteSpace, join, replicate } from "@fable-org/fable-library-js/String.js";
2
2
  import { int32 } from "@fable-org/fable-library-js/Int32.js";
3
3
  import { value as value_4, Option, map, defaultArg } from "@fable-org/fable-library-js/Option.js";
4
- import { Shared_FieldKey, Values_StepOrder, Spec_FormStep$1, Spec_FormSpec$1, ClinicalPathway_ClinicalPathwaySpec, Spec_MatrixInfo, Shared_MatrixItemKey, Shared_MatrixAnswer, Spec_FormField$1, Shared_FieldValue_$union, Spec_FieldType_$union, Spec_MultiChoiceInfo, Spec_SingleChoiceInfo, Shared_PluginDataProperty, Shared_FieldAnswer, Shared_FieldOption } from "../FormSpec.js";
4
+ import { Shared_FieldKey, Values_StepOrder, Spec_Label_shown, Spec_FormStep$1, Spec_FormSpec$1, ClinicalPathway_ClinicalPathwaySpec, Spec_MatrixInfo, Shared_MatrixItemKey, Shared_MatrixAnswer, Spec_FormField$1, Shared_FieldValue_$union, Spec_FieldType_$union, Spec_MultiChoiceInfo, Spec_SingleChoiceInfo, Shared_PluginDataProperty, Shared_FieldAnswer, Shared_FieldOption } from "../FormSpec.js";
5
5
  import { partition, isEmpty, FSharpList, map as map_1, choose, tryFind } from "@fable-org/fable-library-js/List.js";
6
6
  import { FSharpSet, toList } from "@fable-org/fable-library-js/Set.js";
7
7
  import { singleton, append, delay, toList as toList_1 } from "@fable-org/fable-library-js/Seq.js";
@@ -722,7 +722,7 @@ function generatePathwayMermaid(pathway: ClinicalPathway_ClinicalPathwaySpec, fo
722
722
  * Uses well-typed Spec.FieldType and Values.FieldValue throughout - NO boxing/unboxing.
723
723
  */
724
724
  export function renderFormSpecToMarkdown(startHeading: int32, withPathway: boolean, formSpec: Spec_FormSpec$1<Spec_FieldType_$union>, formValues: Option<FSharpMap<Values_StepOrder, FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>>>): string {
725
- let matchValue_4: Option<FieldDetails$1<Spec_FieldType_$union>>, matchValue_5: Shared_FieldValue_$union;
725
+ let arg_3: string, arg_6: string, arg_2: string, arg: string;
726
726
  const lines: string[] = [];
727
727
  const titleHeading: string = generateHeadingLevel(startHeading);
728
728
  void (lines.push(`${titleHeading} ${formSpec.Title}`));
@@ -777,7 +777,7 @@ export function renderFormSpecToMarkdown(startHeading: int32, withPathway: boole
777
777
  try {
778
778
  while (enumerator_2["System.Collections.IEnumerator.MoveNext"]()) {
779
779
  const step: Spec_FormStep$1<Spec_FieldType_$union> = enumerator_2["System.Collections.Generic.IEnumerator`1.get_Current"]();
780
- const stepLabel: string = isNullOrWhiteSpace(step.StepLabel) ? (`Step ${step.StepOrder}`) : step.StepLabel;
780
+ const stepLabel: string = Spec_Label_shown(step.StepLabel);
781
781
  void (lines.push(`${stepHeading} ${stepLabel}`));
782
782
  void (lines.push(""));
783
783
  const patternInput: [FSharpList<Spec_FormField$1<Spec_FieldType_$union>>, FSharpList<Spec_FormField$1<Spec_FieldType_$union>>] = partition<Spec_FormField$1<Spec_FieldType_$union>>((field: Spec_FormField$1<Spec_FieldType_$union>): boolean => {
@@ -799,7 +799,7 @@ export function renderFormSpecToMarkdown(startHeading: int32, withPathway: boole
799
799
  const field_3: Spec_FormField$1<Spec_FieldType_$union> = enumerator_5["System.Collections.Generic.IEnumerator`1.get_Current"]();
800
800
  const fieldTypeName: string = getFieldTypeName(field_3.FieldType);
801
801
  const requiredText: string = field_3.IsOptional ? "" : " *(required)*";
802
- void (lines.push(toText(printf("- %s%s [%s]"))(field_3.Label)(requiredText)(fieldTypeName)));
802
+ void (lines.push((arg_3 = Spec_Label_shown(field_3.Label), toText(printf("- %s%s [%s]"))(arg_3)(requiredText)(fieldTypeName))));
803
803
  }
804
804
  }
805
805
  finally {
@@ -813,7 +813,7 @@ export function renderFormSpecToMarkdown(startHeading: int32, withPathway: boole
813
813
  const field_4: Spec_FormField$1<Spec_FieldType_$union> = enumerator_6["System.Collections.Generic.IEnumerator`1.get_Current"]();
814
814
  const fieldTypeName_1: string = getFieldTypeName(field_4.FieldType);
815
815
  const requiredText_1: string = field_4.IsOptional ? "" : " *(required)*";
816
- void (lines.push(toText(printf("- %s%s [%s]"))(field_4.Label)(requiredText_1)(fieldTypeName_1)));
816
+ void (lines.push((arg_6 = Spec_Label_shown(field_4.Label), toText(printf("- %s%s [%s]"))(arg_6)(requiredText_1)(fieldTypeName_1))));
817
817
  }
818
818
  }
819
819
  finally {
@@ -830,12 +830,12 @@ export function renderFormSpecToMarkdown(startHeading: int32, withPathway: boole
830
830
  const field_1: Spec_FormField$1<Spec_FieldType_$union> = enumerator_3["System.Collections.Generic.IEnumerator`1.get_Current"]();
831
831
  const matchValue_2: Option<FieldDetails$1<Spec_FieldType_$union>> = FSharpMap__TryFind(stepValues, field_1.FieldKey);
832
832
  if (matchValue_2 == null) {
833
- void (lines.push(toText(printf("- **%s**: *No response provided*"))(field_1.Label)));
833
+ void (lines.push((arg_2 = Spec_Label_shown(field_1.Label), toText(printf("- **%s**: *No response provided*"))(arg_2))));
834
834
  }
835
835
  else {
836
836
  const formattedValue: string = formatFieldValue(field_1.FieldType, value_4(matchValue_2).FieldValue, field_1);
837
837
  if (!isNullOrWhiteSpace(formattedValue)) {
838
- void (lines.push(toText(printf("- **%s**: %s"))(field_1.Label)(formattedValue)));
838
+ void (lines.push((arg = Spec_Label_shown(field_1.Label), toText(printf("- **%s**: %s"))(arg)(formattedValue))));
839
839
  }
840
840
  }
841
841
  }
@@ -849,7 +849,17 @@ export function renderFormSpecToMarkdown(startHeading: int32, withPathway: boole
849
849
  const field_2: Spec_FormField$1<Spec_FieldType_$union> = enumerator_4["System.Collections.Generic.IEnumerator`1.get_Current"]();
850
850
  const matchValue_3: Spec_FieldType_$union = field_2.FieldType;
851
851
  if (matchValue_3.tag === /* Matrix */ 19) {
852
- const tableMarkdown: string = formatMatrixFieldAsTable(field_2.Label, matchValue_3.fields[0], (matchValue_4 = FSharpMap__TryFind(stepValues, field_2.FieldKey), (matchValue_4 == null) ? undefined : ((matchValue_5 = value_4(matchValue_4).FieldValue, (matchValue_5.tag === /* Single */ 0) ? undefined : ((matchValue_5.tag === /* Multiple */ 1) ? undefined : ((matchValue_5.tag === /* PluginData */ 3) ? undefined : matchValue_5.fields[0]))))));
852
+ const matrixInfo: Spec_MatrixInfo = matchValue_3.fields[0];
853
+ let matrixAnswer_1: Option<Shared_MatrixAnswer>;
854
+ const matchValue_4: Option<FieldDetails$1<Spec_FieldType_$union>> = FSharpMap__TryFind(stepValues, field_2.FieldKey);
855
+ if (matchValue_4 == null) {
856
+ matrixAnswer_1 = undefined;
857
+ }
858
+ else {
859
+ const matchValue_5: Shared_FieldValue_$union = value_4(matchValue_4).FieldValue;
860
+ matrixAnswer_1 = ((matchValue_5.tag === /* Single */ 0) ? undefined : ((matchValue_5.tag === /* Multiple */ 1) ? undefined : ((matchValue_5.tag === /* PluginData */ 3) ? undefined : matchValue_5.fields[0])));
861
+ }
862
+ const tableMarkdown: string = formatMatrixFieldAsTable(Spec_Label_shown(field_2.Label), matrixInfo, matrixAnswer_1);
853
863
  if (!isNullOrWhiteSpace(tableMarkdown)) {
854
864
  void (lines.push(""));
855
865
  void (lines.push(tableMarkdown));
@@ -1,8 +1,8 @@
1
1
  import { StringBuilder_$ctor, StringBuilder__AppendLine_Z721C83C5 } from "@fable-org/fable-library-js/System.Text.js";
2
- import { sanitizeMermaidText, extractActionText, extractEvaluationName, getTerminalOutcome, stateTypeToString, extractStateKeyString, sanitizeMermaidId } from "../PathwayDataExtractor.js";
2
+ import { sanitizeMermaidText, getTerminalOutcome, extractActionText, extractEvaluationName, stateTypeToString, extractStateKeyString, sanitizeMermaidId } from "../PathwayDataExtractor.js";
3
3
  import { isNullOrEmpty, join, printf, toText } from "@fable-org/fable-library-js/String.js";
4
4
  import { empty, exists, isEmpty, iterateIndexed, FSharpList, mapIndexed, cons, map } from "@fable-org/fable-library-js/List.js";
5
- import { ClinicalPathway_PathRequirement, ClinicalPathway_ConstraintDefinition, ClinicalPathway_ClinicalPathwaySpec, ClinicalPathway_TransitionDefinition, ClinicalPathway_StateType_$union, ClinicalPathway_StateDefinition, ClinicalPathway_ActionInfo_$union } from "../FormSpec.js";
5
+ import { ClinicalPathway_PathRequirement, ClinicalPathway_ConstraintDefinition, ClinicalPathway_ClinicalPathwaySpec, ClinicalPathway_TransitionDefinition, ClinicalPathway_StateType_$union, ClinicalPathway_StateDefinition, ClinicalPathway_PathwayAction } from "../FormSpec.js";
6
6
  import { toString } from "@fable-org/fable-library-js/Types.js";
7
7
  import { int32, float64 } from "@fable-org/fable-library-js/Int32.js";
8
8
  import { formatRequiredPathLabel, formatConstraintLabel, isTransitionRequired, getTransitionArrowStyle, IGraphRenderer$3 } from "./PathwayRenderers.js";
@@ -24,13 +24,11 @@ export class MermaidRenderer implements IGraphRenderer$3<void, void, string> {
24
24
  StringBuilder__AppendLine_Z721C83C5(_.sb, "graph TD");
25
25
  }
26
26
  AddNode(state: ClinicalPathway_StateDefinition): void {
27
- let matchValue: ClinicalPathway_StateType_$union, outcome: string, evalName: string, actionText: string, arg_11: string, actionText_1: string;
27
+ let matchValue: ClinicalPathway_StateType_$union, evalName: string, actionText: string, arg_11: string, actionText_1: string, outcome: string;
28
28
  const _: MermaidRenderer = this;
29
29
  const nodeId: string = sanitizeMermaidId(extractStateKeyString(state.StateKey));
30
30
  const stateTypeStr: string = stateTypeToString(state.StateType);
31
- StringBuilder__AppendLine_Z721C83C5(_.sb, (matchValue = state.StateType, (matchValue.tag === /* Terminal */ 5) ? ((outcome = getTerminalOutcome(matchValue.fields[0]), toText(printf(" %s((\"%s<br/>%s\"))"))(nodeId)(state.StateLabel)(outcome))) : ((matchValue.tag === /* Evaluation */ 1) ? ((evalName = extractEvaluationName(matchValue.fields[0]), toText(printf(" %s[/\"%s<br/>%s\"/]:::evaluation"))(nodeId)(state.StateLabel)(evalName))) : ((matchValue.tag === /* Action */ 2) ? ((actionText = extractActionText(matchValue.fields[0]), toText(printf(" %s[\"%s<br/>%s\"]:::action"))(nodeId)(state.StateLabel)(actionText))) : ((matchValue.tag === /* CompoundAction */ 3) ? ((arg_11 = join("<br/>", map<ClinicalPathway_ActionInfo_$union, string>(extractActionText, matchValue.fields[0])), toText(printf(" %s[\"%s<br/>%s\"]:::action"))(nodeId)(state.StateLabel)(arg_11))) : ((matchValue.tag === /* ConditionalAction */ 4) ? ((actionText_1 = extractActionText(matchValue.fields[1]), toText(printf(" %s[\"%s<br/>%s\"]:::action"))(nodeId)(state.StateLabel)(actionText_1))) : (() => {
32
- throw new Error("Match failure: F1.Studio.ClinicalPathway.StateType");
33
- })()))))));
31
+ StringBuilder__AppendLine_Z721C83C5(_.sb, (matchValue = state.StateType, (matchValue.tag === /* Evaluation */ 0) ? ((evalName = extractEvaluationName(matchValue.fields[0]), toText(printf(" %s[/\"%s<br/>%s\"/]:::evaluation"))(nodeId)(state.StateLabel)(evalName))) : ((matchValue.tag === /* Action */ 1) ? ((actionText = extractActionText(matchValue.fields[0].Action), toText(printf(" %s[\"%s<br/>%s\"]:::action"))(nodeId)(state.StateLabel)(actionText))) : ((matchValue.tag === /* CompoundAction */ 2) ? ((arg_11 = join("<br/>", map<ClinicalPathway_PathwayAction, string>((action_1: ClinicalPathway_PathwayAction): string => extractActionText(action_1.Action), matchValue.fields[0])), toText(printf(" %s[\"%s<br/>%s\"]:::action"))(nodeId)(state.StateLabel)(arg_11))) : ((matchValue.tag === /* ConditionalAction */ 3) ? ((actionText_1 = extractActionText(matchValue.fields[1].Action), toText(printf(" %s[\"%s<br/>%s\"]:::action"))(nodeId)(state.StateLabel)(actionText_1))) : ((outcome = getTerminalOutcome(matchValue.fields[0]), toText(printf(" %s((\"%s<br/>%s\"))"))(nodeId)(state.StateLabel)(outcome))))))));
34
32
  }
35
33
  AddEdge(transition: ClinicalPathway_TransitionDefinition, label: string): void {
36
34
  let sanitizedLabel: string;
@@ -92,14 +90,12 @@ export class EnhancedMermaidRenderer implements IGraphRenderer$3<void, void, str
92
90
  StringBuilder__AppendLine_Z721C83C5(_.sb, "graph TD");
93
91
  }
94
92
  AddNode(state: ClinicalPathway_StateDefinition): void {
95
- let matchValue: ClinicalPathway_StateType_$union, outcome: string, arg_1: string, evalName: string, arg_4: string, actionText: string, arg_7: string, actionTexts: FSharpList<string>, arg_10: string, arg_11: string, actionText_2: string, arg_13: string;
93
+ let matchValue: ClinicalPathway_StateType_$union, evalName: string, arg_4: string, actionText: string, arg_7: string, actionTexts: FSharpList<string>, arg_10: string, arg_11: string, actionText_2: string, arg_13: string, outcome: string, arg_1: string;
96
94
  const _: EnhancedMermaidRenderer = this;
97
95
  _.addedStates = cons(state, _.addedStates);
98
96
  const nodeId: string = sanitizeMermaidId(extractStateKeyString(state.StateKey));
99
97
  const stateTypeStr: string = stateTypeToString(state.StateType);
100
- StringBuilder__AppendLine_Z721C83C5(_.sb, (matchValue = state.StateType, (matchValue.tag === /* Terminal */ 5) ? ((outcome = sanitizeMermaidText(getTerminalOutcome(matchValue.fields[0])), (arg_1 = sanitizeMermaidText(state.StateLabel), toText(printf(" %s((\"%s<br/>%s\"))"))(nodeId)(arg_1)(outcome)))) : ((matchValue.tag === /* Evaluation */ 1) ? ((evalName = sanitizeMermaidText(extractEvaluationName(matchValue.fields[0])), (arg_4 = sanitizeMermaidText(state.StateLabel), toText(printf(" %s[/\"%s<br/>%s\"/]:::evaluation"))(nodeId)(arg_4)(evalName)))) : ((matchValue.tag === /* Action */ 2) ? ((actionText = sanitizeMermaidText(extractActionText(matchValue.fields[0])), (arg_7 = sanitizeMermaidText(state.StateLabel), toText(printf(" %s[\"%s<br/>%s\"]:::action"))(nodeId)(arg_7)(actionText)))) : ((matchValue.tag === /* CompoundAction */ 3) ? ((actionTexts = mapIndexed<ClinicalPathway_ActionInfo_$union, string>((i: int32, action_1: ClinicalPathway_ActionInfo_$union): string => (`${i + 1}. ${sanitizeMermaidText(extractActionText(action_1))}`), matchValue.fields[0]), (arg_10 = sanitizeMermaidText(state.StateLabel), (arg_11 = join("<br/>", actionTexts), toText(printf(" %s[\"%s<br/>📋 Multiple Actions:<br/>%s\"]:::compound"))(nodeId)(arg_10)(arg_11))))) : ((matchValue.tag === /* ConditionalAction */ 4) ? ((actionText_2 = sanitizeMermaidText(extractActionText(matchValue.fields[1])), (arg_13 = sanitizeMermaidText(state.StateLabel), toText(printf(" %s[\"%s<br/>%s\"]:::action"))(nodeId)(arg_13)(actionText_2)))) : (() => {
101
- throw new Error("Match failure: F1.Studio.ClinicalPathway.StateType");
102
- })()))))));
98
+ StringBuilder__AppendLine_Z721C83C5(_.sb, (matchValue = state.StateType, (matchValue.tag === /* Evaluation */ 0) ? ((evalName = sanitizeMermaidText(extractEvaluationName(matchValue.fields[0])), (arg_4 = sanitizeMermaidText(state.StateLabel), toText(printf(" %s[/\"%s<br/>%s\"/]:::evaluation"))(nodeId)(arg_4)(evalName)))) : ((matchValue.tag === /* Action */ 1) ? ((actionText = sanitizeMermaidText(extractActionText(matchValue.fields[0].Action)), (arg_7 = sanitizeMermaidText(state.StateLabel), toText(printf(" %s[\"%s<br/>%s\"]:::action"))(nodeId)(arg_7)(actionText)))) : ((matchValue.tag === /* CompoundAction */ 2) ? ((actionTexts = mapIndexed<ClinicalPathway_PathwayAction, string>((i: int32, action_1: ClinicalPathway_PathwayAction): string => (`${i + 1}. ${sanitizeMermaidText(extractActionText(action_1.Action))}`), matchValue.fields[0]), (arg_10 = sanitizeMermaidText(state.StateLabel), (arg_11 = join("<br/>", actionTexts), toText(printf(" %s[\"%s<br/>📋 Multiple Actions:<br/>%s\"]:::compound"))(nodeId)(arg_10)(arg_11))))) : ((matchValue.tag === /* ConditionalAction */ 3) ? ((actionText_2 = sanitizeMermaidText(extractActionText(matchValue.fields[1].Action)), (arg_13 = sanitizeMermaidText(state.StateLabel), toText(printf(" %s[\"%s<br/>%s\"]:::action"))(nodeId)(arg_13)(actionText_2)))) : ((outcome = sanitizeMermaidText(getTerminalOutcome(matchValue.fields[0])), (arg_1 = sanitizeMermaidText(state.StateLabel), toText(printf(" %s((\"%s<br/>%s\"))"))(nodeId)(arg_1)(outcome)))))))));
103
99
  }
104
100
  AddEdge(transition: ClinicalPathway_TransitionDefinition, label: string): void {
105
101
  let sanitizedLabel: string, fullLabel: string, matchValue_1: Option<ClinicalPathway_ClinicalPathwaySpec>, p_2: ClinicalPathway_ClinicalPathwaySpec;