@f1studio/form-spec 5.0.0-alpha.139 → 5.0.0-alpha.141

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 (202) hide show
  1. package/FormSpec.FS/FormSpec.d.ts +5 -4
  2. package/FormSpec.FS/FormSpec.d.ts.map +1 -1
  3. package/FormSpec.FS/FormSpecValues.d.ts +0 -5
  4. package/FormSpec.FS/FormSpecValues.d.ts.map +1 -1
  5. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.d.ts +3 -2
  6. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.d.ts.map +1 -1
  7. package/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.d.ts.map +1 -1
  8. package/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.d.ts.map +1 -1
  9. package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.d.ts +1 -1
  10. package/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.d.ts.map +1 -1
  11. package/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.d.ts +74 -0
  12. package/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.d.ts.map +1 -0
  13. package/FormSpec.FS/Interop/Facade/BlueprintFilledForm.d.ts +106 -0
  14. package/FormSpec.FS/Interop/Facade/BlueprintFilledForm.d.ts.map +1 -0
  15. package/FormSpec.FS/Interop/Facade/FormAnswersGate.d.ts +105 -0
  16. package/FormSpec.FS/Interop/Facade/FormAnswersGate.d.ts.map +1 -0
  17. package/FormSpec.FS/Interop/FormSpec.Api.Helpers.d.ts +26 -13
  18. package/FormSpec.FS/Interop/FormSpec.Api.Helpers.d.ts.map +1 -1
  19. package/FormSpec.FS/Interop/FormSpec.Api.Option.d.ts +1 -2
  20. package/FormSpec.FS/Interop/FormSpec.Api.Option.d.ts.map +1 -1
  21. package/FormSpec.FS/Interop/FormSpec.Values.Api.Option.d.ts +5 -3
  22. package/FormSpec.FS/Interop/FormSpec.Values.Api.Option.d.ts.map +1 -1
  23. package/FormSpec.TS/FormSpec.FS/BlueprintValidation.js +1 -1
  24. package/FormSpec.TS/FormSpec.FS/BlueprintValidation.js.map +1 -1
  25. package/FormSpec.TS/FormSpec.FS/BlueprintValidation.ts.map +1 -1
  26. package/FormSpec.TS/FormSpec.FS/Designer.js +1 -1
  27. package/FormSpec.TS/FormSpec.FS/Designer.js.map +1 -1
  28. package/FormSpec.TS/FormSpec.FS/Designer.ts.map +1 -1
  29. package/FormSpec.TS/FormSpec.FS/FormSpec.js +13 -8
  30. package/FormSpec.TS/FormSpec.FS/FormSpec.js.map +1 -1
  31. package/FormSpec.TS/FormSpec.FS/FormSpec.ts.map +1 -1
  32. package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.js +5 -5
  33. package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.js.map +1 -1
  34. package/FormSpec.TS/FormSpec.FS/FormSpecHelpers.ts.map +1 -1
  35. package/FormSpec.TS/FormSpec.FS/FormSpecValues.js +2 -21
  36. package/FormSpec.TS/FormSpec.FS/FormSpecValues.js.map +1 -1
  37. package/FormSpec.TS/FormSpec.FS/FormSpecValues.ts.map +1 -1
  38. package/FormSpec.TS/FormSpec.FS/Helpers.js +12 -12
  39. package/FormSpec.TS/FormSpec.FS/Helpers.js.map +1 -1
  40. package/FormSpec.TS/FormSpec.FS/Helpers.ts.map +1 -1
  41. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.js +36 -30
  42. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.js.map +1 -1
  43. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.ts.map +1 -1
  44. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.js +5 -20
  45. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.js.map +1 -1
  46. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.ts.map +1 -1
  47. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.js +1 -1
  48. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.js.map +1 -1
  49. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.ts.map +1 -1
  50. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js +1 -1
  51. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.js.map +1 -1
  52. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts.map +1 -1
  53. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js +24 -10
  54. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.js.map +1 -1
  55. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts.map +1 -1
  56. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js +1 -1
  57. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.js.map +1 -1
  58. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts.map +1 -1
  59. package/FormSpec.TS/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.js +2 -2
  60. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.js +1 -1
  61. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.js.map +1 -1
  62. package/FormSpec.TS/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.ts.map +1 -1
  63. package/FormSpec.TS/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.js +282 -0
  64. package/FormSpec.TS/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.js.map +1 -0
  65. package/FormSpec.TS/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.ts.map +1 -0
  66. package/FormSpec.TS/FormSpec.FS/Interop/Facade/BlueprintFilledForm.js +184 -0
  67. package/FormSpec.TS/FormSpec.FS/Interop/Facade/BlueprintFilledForm.js.map +1 -0
  68. package/FormSpec.TS/FormSpec.FS/Interop/Facade/BlueprintFilledForm.ts.map +1 -0
  69. package/FormSpec.TS/FormSpec.FS/Interop/Facade/FormAnswersGate.js +752 -0
  70. package/FormSpec.TS/FormSpec.FS/Interop/Facade/FormAnswersGate.js.map +1 -0
  71. package/FormSpec.TS/FormSpec.FS/Interop/Facade/FormAnswersGate.ts.map +1 -0
  72. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js +317 -81
  73. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.js.map +1 -1
  74. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts.map +1 -1
  75. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.js +5 -10
  76. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.js.map +1 -1
  77. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Api.Option.ts.map +1 -1
  78. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Values.Api.Option.js +20 -10
  79. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Values.Api.Option.js.map +1 -1
  80. package/FormSpec.TS/FormSpec.FS/Interop/FormSpec.Values.Api.Option.ts.map +1 -1
  81. package/FormSpec.TS/FormSpec.FS/Migrator.js +1 -1
  82. package/FormSpec.TS/FormSpec.FS/Migrator.js.map +1 -1
  83. package/FormSpec.TS/FormSpec.FS/Migrator.ts.map +1 -1
  84. package/FormSpec.TS/FormSpec.FS/PathwayExecutor.js +3 -3
  85. package/FormSpec.TS/FormSpec.FS/PathwayExecutor.js.map +1 -1
  86. package/FormSpec.TS/FormSpec.FS/PathwayExecutor.ts.map +1 -1
  87. package/FormSpec.TS/FormSpec.FS/PathwayValidator.js +1 -1
  88. package/FormSpec.TS/FormSpec.FS/PathwayValidator.js.map +1 -1
  89. package/FormSpec.TS/FormSpec.FS/PathwayValidator.ts.map +1 -1
  90. package/FormSpec.TS/PluginRegistration.js +2 -0
  91. package/FormSpec.TS/PluginRegistration.js.map +1 -1
  92. package/FormSpec.TS/PluginRegistration.ts.map +1 -1
  93. package/FormSpec.TS/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Decode.js +63 -69
  94. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Decode.js.map +1 -0
  95. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Decode.ts.map +1 -0
  96. package/FormSpec.TS/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Encode.js +6 -10
  97. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Encode.js.map +1 -0
  98. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Encode.ts.map +1 -0
  99. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Extra.js.map +1 -0
  100. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Extra.ts.map +1 -0
  101. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Types.js.map +1 -0
  102. package/FormSpec.TS/Thoth.Json/packages/Thoth.Json/Types.ts.map +1 -0
  103. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs +57 -0
  104. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs.js +119 -0
  105. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs.js.map +1 -0
  106. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs.ts.map +1 -0
  107. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/Fable.Promise.fableproj +20 -0
  108. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/Promise.fs +766 -0
  109. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/Promise.fs.js +165 -0
  110. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/Promise.fs.js.map +1 -0
  111. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/Promise.fs.ts.map +1 -0
  112. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs +31 -0
  113. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.js +32 -0
  114. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.js.map +1 -0
  115. package/FormSpec.TS/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.ts.map +1 -0
  116. package/FormSpec.TS/fable_modules/Feliz.2.8.0/DateParsing.fs.js.map +1 -1
  117. package/FormSpec.TS/fable_modules/Feliz.2.8.0/DateParsing.fs.ts.map +1 -1
  118. package/FormSpec.TS/fable_modules/project_cracked.json +1 -1
  119. package/FormSpec.TS/plugins/allergyfinder/src/AllergyFinderField.js +2431 -0
  120. package/FormSpec.TS/plugins/allergyfinder/src/AllergyFinderField.js.map +1 -0
  121. package/FormSpec.TS/plugins/allergyfinder/src/AllergyFinderField.ts.map +1 -0
  122. package/FormSpec.TS/plugins/allergyfinder/src/OpenFdaClient.js +107 -0
  123. package/FormSpec.TS/plugins/allergyfinder/src/OpenFdaClient.js.map +1 -0
  124. package/FormSpec.TS/plugins/allergyfinder/src/OpenFdaClient.ts.map +1 -0
  125. package/FormSpec.TS/plugins/signature/src/SignatureField.js +1 -1
  126. package/FormSpec.TS/plugins/signature/src/SignatureField.js.map +1 -1
  127. package/FormSpec.TS/plugins/signature/src/SignatureField.ts.map +1 -1
  128. package/FormSpec.TS/plugins/vitals/src/VitalsField.js +29 -312
  129. package/FormSpec.TS/plugins/vitals/src/VitalsField.js.map +1 -1
  130. package/FormSpec.TS/plugins/vitals/src/VitalsField.ts.map +1 -1
  131. package/FormSpec.TS/plugins/vitals/src/VitalsLogic.js +506 -0
  132. package/FormSpec.TS/plugins/vitals/src/VitalsLogic.js.map +1 -0
  133. package/FormSpec.TS/plugins/vitals/src/VitalsLogic.ts.map +1 -0
  134. package/README.md +7 -7
  135. package/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Decode.d.ts +2 -2
  136. package/Thoth.Json/packages/Thoth.Json/Decode.d.ts.map +1 -0
  137. package/Thoth.Json/packages/Thoth.Json/Encode.d.ts.map +1 -0
  138. package/Thoth.Json/packages/Thoth.Json/Extra.d.ts.map +1 -0
  139. package/Thoth.Json/packages/Thoth.Json/Types.d.ts.map +1 -0
  140. package/fable_modules/Fable.Promise.3.2.0/Promise.fs.d.ts +112 -0
  141. package/fable_modules/Fable.Promise.3.2.0/Promise.fs.d.ts.map +1 -0
  142. package/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.d.ts +8 -0
  143. package/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.d.ts.map +1 -0
  144. package/package.json +9 -1
  145. package/plugins/allergyfinder/src/AllergyFinderField.d.ts +116 -0
  146. package/plugins/allergyfinder/src/AllergyFinderField.d.ts.map +1 -0
  147. package/plugins/allergyfinder/src/OpenFdaClient.d.ts +5 -0
  148. package/plugins/allergyfinder/src/OpenFdaClient.d.ts.map +1 -0
  149. package/plugins/vitals/src/VitalsField.d.ts +4 -43
  150. package/plugins/vitals/src/VitalsField.d.ts.map +1 -1
  151. package/plugins/vitals/src/VitalsLogic.d.ts +72 -0
  152. package/plugins/vitals/src/VitalsLogic.d.ts.map +1 -0
  153. package/src/FormSpec.FS/BlueprintValidation.ts +1 -1
  154. package/src/FormSpec.FS/Designer.ts +1 -1
  155. package/src/FormSpec.FS/FormSpec.ts +10 -8
  156. package/src/FormSpec.FS/FormSpecHelpers.ts +5 -5
  157. package/src/FormSpec.FS/FormSpecValues.ts +2 -25
  158. package/src/FormSpec.FS/Helpers.ts +12 -12
  159. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRElementTypeMap.ts +35 -32
  160. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRFieldTypeMapper.ts +6 -23
  161. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRStepsBuilder.ts +1 -1
  162. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CorEMRTemplateToFormSpec.ts +1 -1
  163. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMREncoder.ts +27 -11
  164. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/CoreMRSourceMap.ts +1 -1
  165. package/src/FormSpec.FS/Integrations/Adapters/CorEMR/FormSpecToCoreMRInsert.ts +3 -3
  166. package/src/FormSpec.FS/Integrations/CorEMR/TemplateManifestDecoder.ts +3 -3
  167. package/src/FormSpec.FS/Integrations/OpenFda/OpenFdaTypes.ts +160 -0
  168. package/src/FormSpec.FS/Interop/Facade/BlueprintFilledForm.ts +244 -0
  169. package/src/FormSpec.FS/Interop/Facade/FormAnswersGate.ts +508 -0
  170. package/src/FormSpec.FS/Interop/FormSpec.Api.Helpers.ts +376 -128
  171. package/src/FormSpec.FS/Interop/FormSpec.Api.Option.ts +6 -8
  172. package/src/FormSpec.FS/Interop/FormSpec.Values.Api.Option.ts +17 -13
  173. package/src/FormSpec.FS/Migrator.ts +1 -1
  174. package/src/FormSpec.FS/PathwayExecutor.ts +3 -3
  175. package/src/FormSpec.FS/PathwayValidator.ts +1 -1
  176. package/src/PluginRegistration.ts +2 -0
  177. package/src/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Decode.ts +38 -55
  178. package/src/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Encode.ts +10 -16
  179. package/src/plugins/allergyfinder/src/AllergyFinderField.ts +1341 -0
  180. package/src/plugins/allergyfinder/src/OpenFdaClient.ts +103 -0
  181. package/src/plugins/signature/src/SignatureField.ts +1 -1
  182. package/src/plugins/vitals/src/VitalsField.ts +35 -244
  183. package/src/plugins/vitals/src/VitalsLogic.ts +360 -0
  184. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Decode.js.map +0 -1
  185. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Decode.ts.map +0 -1
  186. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Encode.js.map +0 -1
  187. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Encode.ts.map +0 -1
  188. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Extra.js.map +0 -1
  189. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Extra.ts.map +0 -1
  190. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Types.js.map +0 -1
  191. package/FormSpec.TS/libs/Thoth.Json/packages/Thoth.Json/Types.ts.map +0 -1
  192. package/libs/Thoth.Json/packages/Thoth.Json/Decode.d.ts.map +0 -1
  193. package/libs/Thoth.Json/packages/Thoth.Json/Encode.d.ts.map +0 -1
  194. package/libs/Thoth.Json/packages/Thoth.Json/Extra.d.ts.map +0 -1
  195. package/libs/Thoth.Json/packages/Thoth.Json/Types.d.ts.map +0 -1
  196. /package/FormSpec.TS/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Extra.js +0 -0
  197. /package/FormSpec.TS/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Types.js +0 -0
  198. /package/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Encode.d.ts +0 -0
  199. /package/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Extra.d.ts +0 -0
  200. /package/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Types.d.ts +0 -0
  201. /package/src/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Extra.ts +0 -0
  202. /package/src/{libs/Thoth.Json → Thoth.Json}/packages/Thoth.Json/Types.ts +0 -0
@@ -113,30 +113,7 @@ export function updateField<FieldType>(spec: Spec_FormSpec$1<FieldType>, fieldKe
113
113
  if (i_1 === stepIndex) {
114
114
  return new Spec_FormStep$1(step.StepOrder, step.StepLabel, map<Spec_FormField$1<FieldType>, Spec_FormField$1<FieldType>>((f: Spec_FormField$1<FieldType>): Spec_FormField$1<FieldType> => {
115
115
  if (equals(f.FieldKey, fieldKey)) {
116
- return new Spec_FormField$1(f.FieldOrder, f.FieldKey, f.Label, f.Notes, f.DependsOn, f.IsOptional, f.IsDeprecated, f.NeedsDocumentation, f.Documentation, f.FieldType, newValue);
117
- }
118
- else {
119
- return f;
120
- }
121
- }, step.Fields));
122
- }
123
- else {
124
- return step;
125
- }
126
- }, spec.Steps), spec.CategoryTags, spec.Score, spec.AssociatedCodes, spec.RequiresReview, spec.RequiresReviewAndApproval, spec.ClinicalPathway, spec.Lifecycle, spec.FilledMeta, spec.CustomData, spec.Provenance, spec.Classification);
127
- }
128
-
129
- /**
130
- * Update a single field's Documentation. Returns new FormSpec.
131
- * If stepIndex is None, searches for the field across all steps.
132
- */
133
- export function updateFieldDocumentation<FieldType>(spec: Spec_FormSpec$1<FieldType>, fieldKey: Shared_FieldKey, newDoc: Option<string>, stepIndexOpt: Option<int32>): Spec_FormSpec$1<FieldType> {
134
- const stepIndex: int32 = ((stepIndexOpt == null) ? defaultArg(findStepIndexForField<FieldType>(spec, fieldKey), 0) : value_1(stepIndexOpt)) | 0;
135
- return new Spec_FormSpec$1(spec.Id, spec.Code, spec.Title, spec.Abstract, spec.Version, spec.FormSpecVersion, mapIndexed<Spec_FormStep$1<FieldType>, Spec_FormStep$1<FieldType>>((i_1: int32, step: Spec_FormStep$1<FieldType>): Spec_FormStep$1<FieldType> => {
136
- if (i_1 === stepIndex) {
137
- return new Spec_FormStep$1(step.StepOrder, step.StepLabel, map<Spec_FormField$1<FieldType>, Spec_FormField$1<FieldType>>((f: Spec_FormField$1<FieldType>): Spec_FormField$1<FieldType> => {
138
- if (equals(f.FieldKey, fieldKey)) {
139
- return new Spec_FormField$1(f.FieldOrder, f.FieldKey, f.Label, f.Notes, f.DependsOn, f.IsOptional, f.IsDeprecated, f.NeedsDocumentation, newDoc, f.FieldType, f.Value);
116
+ return new Spec_FormField$1(f.FieldOrder, f.FieldKey, f.Label, f.Notes, f.DependsOn, f.IsOptional, f.IsDeprecated, f.NeedsDocumentation, f.FieldType, newValue);
140
117
  }
141
118
  else {
142
119
  return f;
@@ -155,7 +132,7 @@ export function updateFieldDocumentation<FieldType>(spec: Spec_FormSpec$1<FieldT
155
132
  */
156
133
  export function fieldToDetails(field: Spec_FormField$1<Spec_FieldType_$union>): FieldDetails$1<Spec_FieldType_$union> {
157
134
  let matchValue: Option<Shared_FieldValue_$union>;
158
- return new FieldDetails$1(field.FieldOrder, field.FieldKey, field.Label, (matchValue = field.Value, (matchValue == null) ? Shared_FieldValue_Single(new Shared_FieldAnswer(field.FieldKey, field.Label, "")) : value_1(matchValue)), field.FieldType, optionsFromField(field));
135
+ return new FieldDetails$1(field.FieldOrder, field.FieldKey, field.Label, (matchValue = field.Value, (matchValue == null) ? Shared_FieldValue_Single(new Shared_FieldAnswer(field.FieldKey, field.Label, "", undefined)) : value_1(matchValue)), field.FieldType, optionsFromField(field));
159
136
  }
160
137
 
161
138
  /**
@@ -451,7 +451,7 @@ export function Helpers_FormSpecMutators_addFormFieldToStep<UserField>(formStep:
451
451
  export function Helpers_FormSpecMutators_removeFormFieldFromFormSpec<UserField>(formStepOrder: int32, formField: Spec_FormField$1<UserField>, formSpec: Spec_FormSpec$1<UserField>): Spec_FormSpec$1<UserField> {
452
452
  return new Spec_FormSpec$1(formSpec.Id, formSpec.Code, formSpec.Title, formSpec.Abstract, formSpec.Version, formSpec.FormSpecVersion, map_1<Spec_FormStep$1<UserField>, Spec_FormStep$1<UserField>>((s: Spec_FormStep$1<UserField>): Spec_FormStep$1<UserField> => {
453
453
  if (s.StepOrder === formStepOrder) {
454
- return new Spec_FormStep$1(s.StepOrder, s.StepLabel, mapIndexed<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((i: int32, f_1: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => (new Spec_FormField$1(i + 1, f_1.FieldKey, f_1.Label, f_1.Notes, f_1.DependsOn, f_1.IsOptional, f_1.IsDeprecated, f_1.NeedsDocumentation, f_1.Documentation, f_1.FieldType, f_1.Value)), filter<Spec_FormField$1<UserField>>((f: Spec_FormField$1<UserField>): boolean => (f.FieldOrder !== formField.FieldOrder), s.Fields)));
454
+ return new Spec_FormStep$1(s.StepOrder, s.StepLabel, mapIndexed<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((i: int32, f_1: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => (new Spec_FormField$1(i + 1, f_1.FieldKey, f_1.Label, f_1.Notes, f_1.DependsOn, f_1.IsOptional, f_1.IsDeprecated, f_1.NeedsDocumentation, f_1.FieldType, f_1.Value)), filter<Spec_FormField$1<UserField>>((f: Spec_FormField$1<UserField>): boolean => (f.FieldOrder !== formField.FieldOrder), s.Fields)));
455
455
  }
456
456
  else {
457
457
  return s;
@@ -463,7 +463,7 @@ export function Helpers_FormSpecMutators_removeFormFieldFromFormSpec<UserField>(
463
463
  * Inserts a form field at a specific position within a step.
464
464
  */
465
465
  export function Helpers_FormSpecMutators_insertFormFieldToStepAt<UserField>(formStep: Spec_FormStep$1<UserField>, newPositionFieldOrder: int32, fieldKey: Shared_FieldKey): FSharpList<Spec_FormField$1<UserField>> {
466
- return mapIndexed<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((index_1: int32, f_1: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => (new Spec_FormField$1(index_1 + 1, f_1.FieldKey, f_1.Label, f_1.Notes, f_1.DependsOn, f_1.IsOptional, f_1.IsDeprecated, f_1.NeedsDocumentation, f_1.Documentation, f_1.FieldType, f_1.Value)), insertAt<Spec_FormField$1<UserField>>(newPositionFieldOrder - 1, find<Spec_FormField$1<UserField>>((f: Spec_FormField$1<UserField>): boolean => equals(f.FieldKey, fieldKey), formStep.Fields), formStep.Fields));
466
+ return mapIndexed<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((index_1: int32, f_1: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => (new Spec_FormField$1(index_1 + 1, f_1.FieldKey, f_1.Label, f_1.Notes, f_1.DependsOn, f_1.IsOptional, f_1.IsDeprecated, f_1.NeedsDocumentation, f_1.FieldType, f_1.Value)), insertAt<Spec_FormField$1<UserField>>(newPositionFieldOrder - 1, find<Spec_FormField$1<UserField>>((f: Spec_FormField$1<UserField>): boolean => equals(f.FieldKey, fieldKey), formStep.Fields), formStep.Fields));
467
467
  }
468
468
 
469
469
  /**
@@ -472,12 +472,12 @@ export function Helpers_FormSpecMutators_insertFormFieldToStepAt<UserField>(form
472
472
  export function Helpers_FormSpecMutators_moveFormFieldUpInFormSpec<UserField>(formStepOrder: int32, formField: Spec_FormField$1<UserField>, formSpec: Spec_FormSpec$1<UserField>): Spec_FormSpec$1<UserField> {
473
473
  return new Spec_FormSpec$1(formSpec.Id, formSpec.Code, formSpec.Title, formSpec.Abstract, formSpec.Version, formSpec.FormSpecVersion, map_1<Spec_FormStep$1<UserField>, Spec_FormStep$1<UserField>>((s: Spec_FormStep$1<UserField>): Spec_FormStep$1<UserField> => {
474
474
  if (s.StepOrder === formStepOrder) {
475
- return new Spec_FormStep$1(s.StepOrder, s.StepLabel, mapIndexed<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((index: int32, f_2: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => (new Spec_FormField$1(index + 1, f_2.FieldKey, f_2.Label, f_2.Notes, f_2.DependsOn, f_2.IsOptional, f_2.IsDeprecated, f_2.NeedsDocumentation, f_2.Documentation, f_2.FieldType, f_2.Value)), sortBy<Spec_FormField$1<UserField>, int32>((f_1: Spec_FormField$1<UserField>): int32 => f_1.FieldOrder, map_1<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((f: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => {
475
+ return new Spec_FormStep$1(s.StepOrder, s.StepLabel, mapIndexed<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((index: int32, f_2: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => (new Spec_FormField$1(index + 1, f_2.FieldKey, f_2.Label, f_2.Notes, f_2.DependsOn, f_2.IsOptional, f_2.IsDeprecated, f_2.NeedsDocumentation, f_2.FieldType, f_2.Value)), sortBy<Spec_FormField$1<UserField>, int32>((f_1: Spec_FormField$1<UserField>): int32 => f_1.FieldOrder, map_1<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((f: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => {
476
476
  if (f.FieldOrder === formField.FieldOrder) {
477
- return new Spec_FormField$1(formField.FieldOrder - 1, f.FieldKey, f.Label, f.Notes, f.DependsOn, f.IsOptional, f.IsDeprecated, f.NeedsDocumentation, f.Documentation, f.FieldType, f.Value);
477
+ return new Spec_FormField$1(formField.FieldOrder - 1, f.FieldKey, f.Label, f.Notes, f.DependsOn, f.IsOptional, f.IsDeprecated, f.NeedsDocumentation, f.FieldType, f.Value);
478
478
  }
479
479
  else if (f.FieldOrder === (formField.FieldOrder - 1)) {
480
- return new Spec_FormField$1(formField.FieldOrder, f.FieldKey, f.Label, f.Notes, f.DependsOn, f.IsOptional, f.IsDeprecated, f.NeedsDocumentation, f.Documentation, f.FieldType, f.Value);
480
+ return new Spec_FormField$1(formField.FieldOrder, f.FieldKey, f.Label, f.Notes, f.DependsOn, f.IsOptional, f.IsDeprecated, f.NeedsDocumentation, f.FieldType, f.Value);
481
481
  }
482
482
  else {
483
483
  return f;
@@ -498,12 +498,12 @@ export function Helpers_FormSpecMutators_moveFormFieldUpInFormSpec<UserField>(fo
498
498
  export function Helpers_FormSpecMutators_moveFormFieldDownInFormSpec<UserField>(formStepOrder: int32, formField: Spec_FormField$1<UserField>, formSpec: Spec_FormSpec$1<UserField>): Spec_FormSpec$1<UserField> {
499
499
  return new Spec_FormSpec$1(formSpec.Id, formSpec.Code, formSpec.Title, formSpec.Abstract, formSpec.Version, formSpec.FormSpecVersion, map_1<Spec_FormStep$1<UserField>, Spec_FormStep$1<UserField>>((s: Spec_FormStep$1<UserField>): Spec_FormStep$1<UserField> => {
500
500
  if (s.StepOrder === formStepOrder) {
501
- return new Spec_FormStep$1(s.StepOrder, s.StepLabel, mapIndexed<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((index: int32, f_2: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => (new Spec_FormField$1(index + 1, f_2.FieldKey, f_2.Label, f_2.Notes, f_2.DependsOn, f_2.IsOptional, f_2.IsDeprecated, f_2.NeedsDocumentation, f_2.Documentation, f_2.FieldType, f_2.Value)), sortBy<Spec_FormField$1<UserField>, int32>((f_1: Spec_FormField$1<UserField>): int32 => f_1.FieldOrder, map_1<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((f: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => {
501
+ return new Spec_FormStep$1(s.StepOrder, s.StepLabel, mapIndexed<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((index: int32, f_2: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => (new Spec_FormField$1(index + 1, f_2.FieldKey, f_2.Label, f_2.Notes, f_2.DependsOn, f_2.IsOptional, f_2.IsDeprecated, f_2.NeedsDocumentation, f_2.FieldType, f_2.Value)), sortBy<Spec_FormField$1<UserField>, int32>((f_1: Spec_FormField$1<UserField>): int32 => f_1.FieldOrder, map_1<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((f: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => {
502
502
  if (f.FieldOrder === formField.FieldOrder) {
503
- return new Spec_FormField$1(formField.FieldOrder + 1, f.FieldKey, f.Label, f.Notes, f.DependsOn, f.IsOptional, f.IsDeprecated, f.NeedsDocumentation, f.Documentation, f.FieldType, f.Value);
503
+ return new Spec_FormField$1(formField.FieldOrder + 1, f.FieldKey, f.Label, f.Notes, f.DependsOn, f.IsOptional, f.IsDeprecated, f.NeedsDocumentation, f.FieldType, f.Value);
504
504
  }
505
505
  else if (f.FieldOrder === (formField.FieldOrder + 1)) {
506
- return new Spec_FormField$1(formField.FieldOrder, f.FieldKey, f.Label, f.Notes, f.DependsOn, f.IsOptional, f.IsDeprecated, f.NeedsDocumentation, f.Documentation, f.FieldType, f.Value);
506
+ return new Spec_FormField$1(formField.FieldOrder, f.FieldKey, f.Label, f.Notes, f.DependsOn, f.IsOptional, f.IsDeprecated, f.NeedsDocumentation, f.FieldType, f.Value);
507
507
  }
508
508
  else {
509
509
  return f;
@@ -527,7 +527,7 @@ export function Helpers_FormSpecMutators_moveFieldByKeyToPositionInFormStepSpec<
527
527
  const formStep_1: Spec_FormStep$1<UserField> = value_1(formStep);
528
528
  return new Spec_FormSpec$1(formSpec.Id, formSpec.Code, formSpec.Title, formSpec.Abstract, formSpec.Version, formSpec.FormSpecVersion, map_1<Spec_FormStep$1<UserField>, Spec_FormStep$1<UserField>>((s: Spec_FormStep$1<UserField>): Spec_FormStep$1<UserField> => {
529
529
  if (s.StepOrder === formStep_1.StepOrder) {
530
- return new Spec_FormStep$1(s.StepOrder, s.StepLabel, mapIndexed<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((index_1: int32, f_1: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => (new Spec_FormField$1(index_1 + 1, f_1.FieldKey, f_1.Label, f_1.Notes, f_1.DependsOn, f_1.IsOptional, f_1.IsDeprecated, f_1.NeedsDocumentation, f_1.Documentation, f_1.FieldType, f_1.Value)), List_distinct<Spec_FormField$1<UserField>>(insertAt<Spec_FormField$1<UserField>>(newPositionFieldOrder - 1, find<Spec_FormField$1<UserField>>((f: Spec_FormField$1<UserField>): boolean => equals(f.FieldKey, fieldKey), s.Fields), s.Fields), {
530
+ return new Spec_FormStep$1(s.StepOrder, s.StepLabel, mapIndexed<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((index_1: int32, f_1: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => (new Spec_FormField$1(index_1 + 1, f_1.FieldKey, f_1.Label, f_1.Notes, f_1.DependsOn, f_1.IsOptional, f_1.IsDeprecated, f_1.NeedsDocumentation, f_1.FieldType, f_1.Value)), List_distinct<Spec_FormField$1<UserField>>(insertAt<Spec_FormField$1<UserField>>(newPositionFieldOrder - 1, find<Spec_FormField$1<UserField>>((f: Spec_FormField$1<UserField>): boolean => equals(f.FieldKey, fieldKey), s.Fields), s.Fields), {
531
531
  Equals: equals,
532
532
  GetHashCode: safeHash,
533
533
  })));
@@ -599,7 +599,7 @@ export function Helpers_FormSpecTransformers_flattenSpecSteps<UserField>(formSpe
599
599
  if (!isEmpty(steps)) {
600
600
  const step: Spec_FormStep$1<UserField> = head(steps);
601
601
  steps_mut = tail(steps);
602
- acc_mut = append(acc, map_1<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((field: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => (new Spec_FormField$1((step.StepOrder * 1000) + field.FieldOrder, field.FieldKey, field.Label, field.Notes, field.DependsOn, field.IsOptional, field.IsDeprecated, field.NeedsDocumentation, field.Documentation, field.FieldType, field.Value)), step.Fields));
602
+ acc_mut = append(acc, map_1<Spec_FormField$1<UserField>, Spec_FormField$1<UserField>>((field: Spec_FormField$1<UserField>): Spec_FormField$1<UserField> => (new Spec_FormField$1((step.StepOrder * 1000) + field.FieldOrder, field.FieldKey, field.Label, field.Notes, field.DependsOn, field.IsOptional, field.IsDeprecated, field.NeedsDocumentation, field.FieldType, field.Value)), step.Fields));
603
603
  continue flatten;
604
604
  }
605
605
  else {
@@ -711,7 +711,7 @@ export function Helpers_readManyValue<FieldType>(fieldKey: Shared_FieldKey, valu
711
711
  export function Helpers_updateSingleFunc(formatter: ((arg0: string) => string), specField: Spec_FormField$1<Spec_FieldType_$union>, newValue: string, values: FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>): FSharpMap<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>> {
712
712
  let Value: string, matchValue: Option<Shared_FieldOption>;
713
713
  const fieldOptions: FSharpList<Shared_FieldOption> = Helpers_optionsFromSpecField(specField);
714
- const newFieldDetails: FieldDetails$1<Spec_FieldType_$union> = new FieldDetails$1(specField.FieldOrder, specField.FieldKey, specField.Label, Shared_FieldValue_Single((Value = formatter(newValue), new Shared_FieldAnswer(specField.FieldKey, (matchValue = tryFind<Shared_FieldOption>((o: Shared_FieldOption): boolean => (o.Value === newValue), fieldOptions), (matchValue == null) ? newValue : value_1(matchValue).Description), Value))), specField.FieldType, Helpers_specFieldOptionsToValueOptions(fieldOptions));
714
+ const newFieldDetails: FieldDetails$1<Spec_FieldType_$union> = new FieldDetails$1(specField.FieldOrder, specField.FieldKey, specField.Label, Shared_FieldValue_Single((Value = formatter(newValue), new Shared_FieldAnswer(specField.FieldKey, (matchValue = tryFind<Shared_FieldOption>((o: Shared_FieldOption): boolean => (o.Value === newValue), fieldOptions), (matchValue == null) ? newValue : value_1(matchValue).Description), Value, undefined))), specField.FieldType, Helpers_specFieldOptionsToValueOptions(fieldOptions));
715
715
  const matchValue_1: Option<Shared_FieldKey> = tryFind_1<Shared_FieldKey>((k: Shared_FieldKey): boolean => equals(k, newFieldDetails.Key), map_2<[Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>], Shared_FieldKey>((tuple: [Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>]): Shared_FieldKey => tuple[0], toSeq<Shared_FieldKey, FieldDetails$1<Spec_FieldType_$union>>(values)));
716
716
  if (matchValue_1 != null) {
717
717
  const key: Shared_FieldKey = value_1(matchValue_1);
@@ -727,7 +727,7 @@ export function Helpers_updateManyFunc(formatter: ((arg0: string) => string), sp
727
727
  const newFieldDetails: FieldDetails$1<Spec_FieldType_$union> = new FieldDetails$1(specField.FieldOrder, specField.FieldKey, specField.Label, Shared_FieldValue_Multiple(map_3<string, Shared_FieldAnswer>((v: string): Shared_FieldAnswer => {
728
728
  let matchValue: Option<Shared_FieldOption>;
729
729
  const Value: string = formatter(v);
730
- return new Shared_FieldAnswer(specField.FieldKey, (matchValue = tryFind<Shared_FieldOption>((o: Shared_FieldOption): boolean => (o.Value === v), Helpers_optionsFromSpecField(specField)), (matchValue == null) ? v : value_1(matchValue).Description), Value);
730
+ return new Shared_FieldAnswer(specField.FieldKey, (matchValue = tryFind<Shared_FieldOption>((o: Shared_FieldOption): boolean => (o.Value === v), Helpers_optionsFromSpecField(specField)), (matchValue == null) ? v : value_1(matchValue).Description), Value, undefined);
731
731
  }, newValue, {
732
732
  Compare: compare,
733
733
  })), specField.FieldType, Helpers_specFieldOptionsToValueOptions(Helpers_optionsFromSpecField(specField)));
@@ -2,18 +2,21 @@ import { Record } from "@fable-org/fable-library-js/Types.js";
2
2
  import { IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
3
3
  import { record_type, bool_type, string_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
4
4
  import { int32 } from "@fable-org/fable-library-js/Int32.js";
5
+ import { replace } from "@fable-org/fable-library-js/String.js";
5
6
 
6
7
  export class ElementTypeInfo extends Record implements IEquatable<ElementTypeInfo>, IComparable<ElementTypeInfo> {
7
8
  readonly Code: string;
9
+ readonly Label: string;
8
10
  readonly ValueEncoding: string;
9
11
  readonly TextFieldRole: string;
10
12
  readonly IsPlusNotes: boolean;
11
13
  readonly IsScaffold: boolean;
12
14
  readonly IsSkip: boolean;
13
15
  readonly IsNeedsDocumentation: boolean;
14
- constructor(Code: string, ValueEncoding: string, TextFieldRole: string, IsPlusNotes: boolean, IsScaffold: boolean, IsSkip: boolean, IsNeedsDocumentation: boolean) {
16
+ constructor(Code: string, Label: string, ValueEncoding: string, TextFieldRole: string, IsPlusNotes: boolean, IsScaffold: boolean, IsSkip: boolean, IsNeedsDocumentation: boolean) {
15
17
  super();
16
18
  this.Code = Code;
19
+ this.Label = Label;
17
20
  this.ValueEncoding = ValueEncoding;
18
21
  this.TextFieldRole = TextFieldRole;
19
22
  this.IsPlusNotes = IsPlusNotes;
@@ -24,67 +27,67 @@ export class ElementTypeInfo extends Record implements IEquatable<ElementTypeInf
24
27
  }
25
28
 
26
29
  export function ElementTypeInfo_$reflection(): TypeInfo {
27
- return record_type("FormSpec.Integrations.CorEMR.CorEMRElementTypeMap.ElementTypeInfo", [], ElementTypeInfo, () => [["Code", string_type], ["ValueEncoding", string_type], ["TextFieldRole", string_type], ["IsPlusNotes", bool_type], ["IsScaffold", bool_type], ["IsSkip", bool_type], ["IsNeedsDocumentation", bool_type]]);
30
+ return record_type("FormSpec.Integrations.CorEMR.CorEMRElementTypeMap.ElementTypeInfo", [], ElementTypeInfo, () => [["Code", string_type], ["Label", string_type], ["ValueEncoding", string_type], ["TextFieldRole", string_type], ["IsPlusNotes", bool_type], ["IsScaffold", bool_type], ["IsSkip", bool_type], ["IsNeedsDocumentation", bool_type]]);
28
31
  }
29
32
 
30
33
  export function getElementTypeInfo(itemTypeId: int32): ElementTypeInfo {
31
34
  switch (itemTypeId) {
32
35
  case 1:
33
- return new ElementTypeInfo("text", "zero", "content", false, false, false, false);
36
+ return new ElementTypeInfo("text", "Text", "zero", "content", false, false, false, false);
34
37
  case 2:
35
- return new ElementTypeInfo("text_multiline", "zero", "content", false, false, false, false);
38
+ return new ElementTypeInfo("text_multiline", "Text Multiline", "zero", "content", false, false, false, false);
36
39
  case 20:
37
- return new ElementTypeInfo("dropdown", "choice_score", "ignored", false, false, false, false);
40
+ return new ElementTypeInfo("dropdown", "Multiple Choice", "choice_score", "ignored", false, false, false, false);
38
41
  case 21:
39
- return new ElementTypeInfo("dropdown_notes", "choice_score", "optional_notes", true, false, false, true);
42
+ return new ElementTypeInfo("dropdown_notes", "Multiple Choice with Notes", "choice_score", "optional_notes", true, false, false, true);
40
43
  case 25:
41
- return new ElementTypeInfo("dropdown_notes_ui", "choice_score", "ignored", false, false, false, false);
44
+ return new ElementTypeInfo("dropdown_notes_ui", "Multiple Choice with Notes UI", "choice_score", "ignored", false, false, false, false);
42
45
  case 26:
43
- return new ElementTypeInfo("chips_notes", "choice_score", "optional_notes", true, false, false, true);
46
+ return new ElementTypeInfo("chips_notes", "Chips with Notes", "choice_score", "optional_notes", true, false, false, true);
44
47
  case 30:
45
- return new ElementTypeInfo("yes_no_text", "1_yes_2_no", "optional_notes", false, false, false, false);
48
+ return new ElementTypeInfo("yes_no_text", "Yes/No with Text", "1_yes_2_no", "optional_notes", false, false, false, false);
46
49
  case 31:
47
- return new ElementTypeInfo("yes_no_notes", "1_yes_2_no", "optional_notes", true, false, false, true);
50
+ return new ElementTypeInfo("yes_no_notes", "Yes/No with Notes", "1_yes_2_no", "optional_notes", true, false, false, true);
48
51
  case 32:
49
- return new ElementTypeInfo("exam_3choice", "choice_score", "ignored", false, false, false, false);
52
+ return new ElementTypeInfo("exam_3choice", "Exam 3-Choice", "choice_score", "ignored", false, false, false, false);
50
53
  case 40:
51
- return new ElementTypeInfo("checkbox", "choice_score", "ignored", false, false, false, false);
54
+ return new ElementTypeInfo("checkbox", "Checkboxes", "choice_score", "ignored", false, false, false, false);
52
55
  case 41:
53
- return new ElementTypeInfo("checkbox_notes", "choice_score", "optional_notes", true, false, false, true);
56
+ return new ElementTypeInfo("checkbox_notes", "Checkboxes with Notes", "choice_score", "optional_notes", true, false, false, true);
54
57
  case 50:
55
- return new ElementTypeInfo("date", "zero", "iso_date", false, false, false, false);
58
+ return new ElementTypeInfo("date", "Date", "zero", "iso_date", false, false, false, false);
56
59
  case 51:
57
- return new ElementTypeInfo("signature_date", "zero", "content", false, false, false, false);
60
+ return new ElementTypeInfo("signature_date", "Signature + Date", "zero", "content", false, false, false, false);
58
61
  case 60:
59
- return new ElementTypeInfo("datetime", "zero", "iso_date", false, false, false, false);
62
+ return new ElementTypeInfo("datetime", "DateTime", "zero", "iso_date", false, false, false, false);
60
63
  case 61:
61
- return new ElementTypeInfo("signature", "skip", "skip", false, false, true, false);
64
+ return new ElementTypeInfo("signature", "Signature", "skip", "skip", false, false, true, false);
62
65
  case 110:
63
- return new ElementTypeInfo("heading", "scaffold", "ignored", false, true, false, false);
66
+ return new ElementTypeInfo("heading", "Heading", "scaffold", "ignored", false, true, false, false);
64
67
  case 120:
65
- return new ElementTypeInfo("instructions", "scaffold", "ignored", false, true, false, false);
68
+ return new ElementTypeInfo("instructions", "Instructions", "scaffold", "ignored", false, true, false, false);
66
69
  case 121:
67
- return new ElementTypeInfo("group_row", "scaffold", "ignored", false, true, false, false);
70
+ return new ElementTypeInfo("group_row", "Group Row", "scaffold", "ignored", false, true, false, false);
68
71
  case 130:
69
- return new ElementTypeInfo("vitals_widget", "scaffold", "ignored", false, true, false, false);
72
+ return new ElementTypeInfo("vitals_widget", "Vitals Widget", "scaffold", "ignored", false, true, false, false);
70
73
  case 131:
71
- return new ElementTypeInfo("linked_data", "scaffold", "ignored", false, true, false, false);
74
+ return new ElementTypeInfo("linked_data", "Linked Data", "scaffold", "ignored", false, true, false, false);
72
75
  case 132:
73
- return new ElementTypeInfo("linked_data_rare", "scaffold", "ignored", false, true, false, false);
76
+ return new ElementTypeInfo("linked_data_rare", "Linked Data (Rare)", "scaffold", "ignored", false, true, false, false);
74
77
  case 133:
75
- return new ElementTypeInfo("sub_header", "scaffold", "ignored", false, true, false, false);
78
+ return new ElementTypeInfo("sub_header", "Sub Header", "scaffold", "ignored", false, true, false, false);
76
79
  case 134:
77
- return new ElementTypeInfo("score_display", "scaffold", "ignored", false, true, false, false);
80
+ return new ElementTypeInfo("score_display", "Score Display", "scaffold", "ignored", false, true, false, false);
78
81
  case 135:
79
- return new ElementTypeInfo("score_explanation", "scaffold", "ignored", false, true, false, false);
82
+ return new ElementTypeInfo("score_explanation", "Score Explanation", "scaffold", "ignored", false, true, false, false);
80
83
  case 138:
81
- return new ElementTypeInfo("unknown_138", "scaffold", "ignored", false, true, false, false);
84
+ return new ElementTypeInfo("unknown_138", "Unknown (138)", "scaffold", "ignored", false, true, false, false);
82
85
  case 140:
83
- return new ElementTypeInfo("allergy_autofill", "scaffold", "ignored", false, true, false, false);
86
+ return new ElementTypeInfo("allergy_autofill", "Allergy Autofill", "scaffold", "ignored", false, true, false, false);
84
87
  case 143:
85
- return new ElementTypeInfo("chips_ros", "choice_score", "ignored", false, false, false, false);
88
+ return new ElementTypeInfo("chips_ros", "Chips ROS", "choice_score", "ignored", false, false, false, false);
86
89
  default:
87
- return new ElementTypeInfo(`unknown_${itemTypeId}`, "unknown", "unknown", false, false, true, false);
90
+ return new ElementTypeInfo(`unknown_${itemTypeId}`, `Unknown (${itemTypeId})`, "unknown", "unknown", false, false, true, false);
88
91
  }
89
92
  }
90
93
 
@@ -102,11 +105,11 @@ export function hasTextHasDate(itemTypeId: int32): [boolean, boolean] {
102
105
 
103
106
  /**
104
107
  * Convert bridge format (code, valueEncoding, textField) to ElementTypeInfo.
105
- * Used when elementTypes come from bridge templates endpoint (SSOT).
108
+ * Label derived from code (bridge doesn't carry CoreMR designer labels).
106
109
  */
107
110
  export function fromBridgeFormat(code: string, valueEncoding: string, textField: string): ElementTypeInfo {
108
111
  const isPlusNotes: boolean = (textField === "optional_notes") && ((valueEncoding === "choice_score") ? true : (valueEncoding === "1_yes_2_no"));
109
- return new ElementTypeInfo(code, valueEncoding, textField, isPlusNotes, valueEncoding === "scaffold", (valueEncoding === "skip") ? true : (textField === "skip"), isPlusNotes);
112
+ return new ElementTypeInfo(code, replace(code, "_", " "), valueEncoding, textField, isPlusNotes, valueEncoding === "scaffold", (valueEncoding === "skip") ? true : (textField === "skip"), isPlusNotes);
110
113
  }
111
114
 
112
115
  //# sourceMappingURL=CorEMRElementTypeMap.ts.map
@@ -1,18 +1,15 @@
1
1
  import { isNullOrWhiteSpace } from "@fable-org/fable-library-js/String.js";
2
2
  import { Helpers_generateDeterministicGuidRaw, Helpers_canonicalizeFieldKey } from "../../../Helpers.js";
3
- import { defaultArg, Option, value as value_1 } from "@fable-org/fable-library-js/Option.js";
4
3
  import { int32 } from "@fable-org/fable-library-js/Int32.js";
5
4
  import { CoreMRChoice, CoreMRItem } from "../../CorEMR/CoreMRTypes.js";
6
5
  import { Spec_FormField$1, Spec_FieldType_$union, Spec_FieldType_UnsupportedField, Spec_UnsupportedFieldInfo, Spec_FieldType_PluginField, Spec_PluginFieldConfig, Spec_FieldType_Message, Spec_MessageInfo, Spec_MessageType_Info, Spec_FieldType_DateTimeLocal, Spec_FieldType_Signature, Spec_SignatureInfo, Spec_FieldType_Date, Spec_FieldType_Radio, Spec_FieldType_CheckboxList, Spec_MultiChoiceInfo, Spec_FieldType_Dropdown, Spec_SingleChoiceInfo, Spec_FieldType_TextArea, Spec_FieldType_Text, Spec_TextInfo, Shared_FieldOption, Shared_FieldOptionKey, Shared_FieldKey } from "../../../FormSpec.js";
7
- import { sort, isEmpty, ofArray, FSharpList, sortBy, map } from "@fable-org/fable-library-js/List.js";
6
+ import { isEmpty, ofArray, FSharpList, sortBy, map } from "@fable-org/fable-library-js/List.js";
8
7
  import { comparePrimitives } from "@fable-org/fable-library-js/Util.js";
9
8
  import { getElementTypeInfo } from "./CorEMRElementTypeMap.js";
10
- import { normalizeChoiceScores } from "../../../BitmaskHelpers.js";
11
- import { compare, int64 } from "@fable-org/fable-library-js/BigInt.js";
9
+ import { Option, defaultArg } from "@fable-org/fable-library-js/Option.js";
12
10
 
13
11
  function buildNamespacedFieldSeed(formCode: string, stepOrder: int32, item: CoreMRItem): string {
14
- let matchValue: Option<string>;
15
- return `formspec.${isNullOrWhiteSpace(formCode) ? "unknown" : Helpers_canonicalizeFieldKey(formCode)}:step${stepOrder}.${isNullOrWhiteSpace(item.Label) ? ((matchValue = item.Uuid, (matchValue == null) ? (`item_id_${item.ItemId}`) : (`item_uuid_${value_1(matchValue)}`))) : Helpers_canonicalizeFieldKey(item.Label)}`;
12
+ return `formspec.${isNullOrWhiteSpace(formCode) ? "unknown" : Helpers_canonicalizeFieldKey(formCode)}:step${stepOrder}.item${item.ItemId}.${isNullOrWhiteSpace(item.Label) ? "_blank_" : Helpers_canonicalizeFieldKey(item.Label)}`;
16
13
  }
17
14
 
18
15
  export function generateNamespacedFieldKey(formCode: string, stepOrder: int32, item: CoreMRItem): Shared_FieldKey {
@@ -72,23 +69,9 @@ export function mapFieldType(item: CoreMRItem, choices: FSharpList<CoreMRChoice>
72
69
  case 32:
73
70
  return Spec_FieldType_Dropdown(new Spec_SingleChoiceInfo(mappedChoices));
74
71
  case 40:
75
- if (normalizeChoiceScores(sort<int64>(map<CoreMRChoice, int64>((c: CoreMRChoice): int64 => c.Score, choices), {
76
- Compare: compare,
77
- }))[1]) {
78
- return Spec_FieldType_CheckboxList(new Spec_MultiChoiceInfo(mappedChoices));
79
- }
80
- else {
81
- return Spec_FieldType_Radio(new Spec_SingleChoiceInfo(mappedChoices));
82
- }
72
+ return Spec_FieldType_CheckboxList(new Spec_MultiChoiceInfo(mappedChoices));
83
73
  case 41:
84
- if (normalizeChoiceScores(sort<int64>(map<CoreMRChoice, int64>((c_1: CoreMRChoice): int64 => c_1.Score, choices), {
85
- Compare: compare,
86
- }))[1]) {
87
- return Spec_FieldType_CheckboxList(new Spec_MultiChoiceInfo(mappedChoices));
88
- }
89
- else {
90
- return Spec_FieldType_Radio(new Spec_SingleChoiceInfo(mappedChoices));
91
- }
74
+ return Spec_FieldType_CheckboxList(new Spec_MultiChoiceInfo(mappedChoices));
92
75
  case 50:
93
76
  return Spec_FieldType_Date(new Spec_TextInfo(undefined));
94
77
  case 51:
@@ -124,7 +107,7 @@ export function mapToFormField(formCode: string, stepOrder: int32, item: CoreMRI
124
107
  const fieldType: Spec_FieldType_$union = mapFieldType(item, choices);
125
108
  const mainLabel: string = item.Label.trim();
126
109
  const notesField: Option<string> = isPlusNotesType(item) ? "" : undefined;
127
- return new Spec_FormField$1(item.Sequence, generateNamespacedFieldKey(formCode, stepOrder, item), mainLabel, notesField, undefined, !item.IsRequired, false, isNeedsDocumentationType(item), undefined, fieldType, undefined);
110
+ return new Spec_FormField$1(item.Sequence, generateNamespacedFieldKey(formCode, stepOrder, item), mainLabel, notesField, undefined, !item.IsRequired, false, isNeedsDocumentationType(item), fieldType, undefined);
128
111
  }
129
112
 
130
113
  //# sourceMappingURL=CorEMRFieldTypeMapper.ts.map
@@ -15,7 +15,7 @@ export function createSteps(formCode: string, items: FSharpList<CoreMRItem>, cho
15
15
  return mapIndexed<Section, Spec_FormStep$1<Spec_FieldType_$union>>((index: int32, section: Section): Spec_FormStep$1<Spec_FieldType_$union> => (new Spec_FormStep$1(index + 1, section.HeadingLabel, map<CoreMRItem, Spec_FormField$1<Spec_FieldType_$union>>((item: CoreMRItem): Spec_FormField$1<Spec_FieldType_$union> => {
16
16
  const field: Spec_FormField$1<Spec_FieldType_$union> = mapToFormField(formCode, index + 1, item, defaultArg(tryFind<int32, FSharpList<CoreMRChoice>>(item.ItemId, choicesByItem), empty<CoreMRChoice>()));
17
17
  if (isNullOrWhiteSpace(field.Label)) {
18
- return new Spec_FormField$1(field.FieldOrder, field.FieldKey, "_(blank)_", field.Notes, field.DependsOn, field.IsOptional, field.IsDeprecated, field.NeedsDocumentation, field.Documentation, field.FieldType, field.Value);
18
+ return new Spec_FormField$1(field.FieldOrder, field.FieldKey, "_(blank)_", field.Notes, field.DependsOn, field.IsOptional, field.IsDeprecated, field.NeedsDocumentation, field.FieldType, field.Value);
19
19
  }
20
20
  else {
21
21
  return field;
@@ -13,7 +13,7 @@ import { List_groupBy } from "@fable-org/fable-library-js/Seq2.js";
13
13
  import { generateNamespacedFieldKey } from "./CorEMRFieldTypeMapper.js";
14
14
  import { nonHeadingItems } from "./CorEMRSectioning.js";
15
15
  import { convertTriggersToSinglePathway } from "./CorEMRTriggerConverter.js";
16
- import { Auto_generateBoxedEncoder_437914C6, toString } from "../../../../libs/Thoth.Json/packages/Thoth.Json/Encode.js";
16
+ import { Auto_generateBoxedEncoder_437914C6, toString } from "../../../../Thoth.Json/packages/Thoth.Json/Encode.js";
17
17
  import { FSharpResult$2_Ok, FSharpResult$2_$union, FSharpResult$2_Error } from "@fable-org/fable-library-js/Result.js";
18
18
  import { FormSpecValidator_validateConversion, ValidationResult } from "./CorEMRFormSpecValidator.js";
19
19
  import { buildReport } from "./CorEMRSemanticReportBuilder.js";
@@ -3,22 +3,23 @@ import { orElse, defaultArg, map, value as value_3, bind, unwrap, Option } from
3
3
  import { int32, float64 } from "@fable-org/fable-library-js/Int32.js";
4
4
  import { comparePrimitives, stringHash, uncurry2, IComparable, IEquatable } from "@fable-org/fable-library-js/Util.js";
5
5
  import { record_type, option_type, float64_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
6
- import { fold, contains, exists, tail, choose, map as map_1, singleton, empty, tryFind, head, isEmpty, FSharpList, collect, filter } from "@fable-org/fable-library-js/List.js";
6
+ import { fold, contains, exists, tail, mapIndexed, tryHead, choose, map as map_1, singleton, empty, tryFind, head, isEmpty, FSharpList, collect, filter } from "@fable-org/fable-library-js/List.js";
7
7
  import { Shared_MatrixItemKey, Shared_MatrixAnswer, Spec_MultiChoiceInfo, Spec_SingleChoiceInfo, Shared_FieldOption, Shared_FieldOptionKey, Shared_FieldKey, Spec_FormSpec$1, Shared_FieldValue, Shared_FieldAnswer, Shared_PluginDataProperty, Shared_FieldValue_$union, Spec_FormStep$1, Spec_FormField$1, Spec_PluginFieldConfig, Spec_FieldType_$union } from "../../../FormSpec.js";
8
8
  import { split, isNullOrWhiteSpace } from "@fable-org/fable-library-js/String.js";
9
9
  import { tryParse } from "@fable-org/fable-library-js/Double.js";
10
10
  import { item } from "@fable-org/fable-library-js/Array.js";
11
- import { Auto_generateBoxedDecoder_Z6670B51, fromString } from "../../../../libs/Thoth.Json/packages/Thoth.Json/Decode.js";
11
+ import { Auto_generateBoxedDecoder_Z6670B51, fromString } from "../../../../Thoth.Json/packages/Thoth.Json/Decode.js";
12
12
  import { CoreMRStepMap, CoreMRMatrixItemAnchor, CoreMRChoiceAnchor, CoreMRFieldAnchor, CoreMRSourceMap, CoreMRSourceMap_$reflection } from "./CoreMRSourceMap.js";
13
13
  import { FSharpResult$2_Ok, FSharpResult$2_Error, FSharpResult$2_$union } from "@fable-org/fable-library-js/Result.js";
14
- import { Auto_generateBoxedEncoder_437914C6, toString } from "../../../../libs/Thoth.Json/packages/Thoth.Json/Encode.js";
14
+ import { Auto_generateBoxedEncoder_437914C6, toString } from "../../../../Thoth.Json/packages/Thoth.Json/Encode.js";
15
15
  import { CoreMRAnswer, CoreMRFormInsertRequest, CoreMRFormInsertRequest_$reflection } from "./FormSpecToCoreMRInsert.js";
16
- import { CaseStrategy_CamelCase } from "../../../../libs/Thoth.Json/packages/Thoth.Json/Types.js";
16
+ import { CaseStrategy_CamelCase } from "../../../../Thoth.Json/packages/Thoth.Json/Types.js";
17
17
  import { Helpers_canonicalizeFieldKey } from "../../../Helpers.js";
18
18
  import { op_LeftShift, op_BitwiseOr, int64, fromInt32, toInt64 } from "@fable-org/fable-library-js/BigInt.js";
19
19
  import { toList, FSharpSet } from "@fable-org/fable-library-js/Set.js";
20
20
  import { computeBitmask } from "../../../BitmaskHelpers.js";
21
21
  import { FSharpMap, ofList, tryFind as tryFind_1 } from "@fable-org/fable-library-js/Map.js";
22
+ import { isMatch } from "@fable-org/fable-library-js/RegExp.js";
22
23
  import { Operators_FailurePattern } from "@fable-org/fable-library-js/FSharp.Core.js";
23
24
 
24
25
  export class ExtractedVitals extends Record implements IEquatable<ExtractedVitals>, IComparable<ExtractedVitals> {
@@ -217,6 +218,10 @@ function supportsTextContent(anchor: CoreMRFieldAnchor): boolean {
217
218
  }
218
219
  }
219
220
 
221
+ function supportsOptionalNotes(anchor: CoreMRFieldAnchor): boolean {
222
+ return anchor.Encoding.TextFieldRole === "optional_notes";
223
+ }
224
+
220
225
  function getOptionsFromFieldType(ft: Spec_FieldType_$union): FSharpList<Shared_FieldOption> {
221
226
  let matchResult: int32, info: Spec_SingleChoiceInfo, info_1: Spec_MultiChoiceInfo;
222
227
  switch (ft.tag) {
@@ -302,7 +307,7 @@ function fieldToAnswers(field: Spec_FormField$1<Spec_FieldType_$union>, vitalsId
302
307
  throw new Error(`🚨 ItemTypeId ${anchor.ItemTypeId} multiple choice field ${anchor.FieldKey} has no choices`);
303
308
  }
304
309
  else {
305
- return singleton(new CoreMRAnswer(anchor.Sequence, computeBitmask(choose<string, int32>((key: string): Option<int32> => map<[string, int32], int32>((tuple: [string, int32]): int32 => tuple[1], tryFind<[string, int32]>((tupledArg_1: [string, int32]): boolean => (tupledArg_1[0] === key), choicesWithBitPos_1)), choose<string, string>((valStr_1: string): Option<string> => map<Shared_FieldOption, string>((opt_4: Shared_FieldOption): string => getFieldOptionKeyGuid(opt_4.OptionKey), tryFind<Shared_FieldOption>((opt_3: Shared_FieldOption): boolean => (Helpers_canonicalizeFieldKey(opt_3.Value) === Helpers_canonicalizeFieldKey(valStr_1)), options_1)), map_1<Shared_FieldAnswer, string>((a: Shared_FieldAnswer): string => a.Value, toList<Shared_FieldAnswer>(answers))))), undefined));
310
+ return singleton(new CoreMRAnswer(anchor.Sequence, computeBitmask(choose<string, int32>((key: string): Option<int32> => map<[string, int32], int32>((tuple: [string, int32]): int32 => tuple[1], tryFind<[string, int32]>((tupledArg_1: [string, int32]): boolean => (tupledArg_1[0] === key), choicesWithBitPos_1)), choose<string, string>((valStr_1: string): Option<string> => map<Shared_FieldOption, string>((opt_4: Shared_FieldOption): string => getFieldOptionKeyGuid(opt_4.OptionKey), tryFind<Shared_FieldOption>((opt_3: Shared_FieldOption): boolean => (Helpers_canonicalizeFieldKey(opt_3.Value) === Helpers_canonicalizeFieldKey(valStr_1)), options_1)), map_1<Shared_FieldAnswer, string>((a: Shared_FieldAnswer): string => a.Value, toList<Shared_FieldAnswer>(answers))))), supportsOptionalNotes(anchor) ? bind<Shared_FieldAnswer, string>((fa: Shared_FieldAnswer): Option<string> => fa.Documentation, tryHead<Shared_FieldAnswer>(toList<Shared_FieldAnswer>(answers))) : undefined));
306
311
  }
307
312
  }
308
313
  default:
@@ -316,7 +321,8 @@ function fieldToAnswers(field: Spec_FormField$1<Spec_FieldType_$union>, vitalsId
316
321
  }
317
322
  else {
318
323
  const options_2: FSharpList<Shared_FieldOption> = getOptionsFromFieldType(field.FieldType);
319
- return choose<CoreMRMatrixItemAnchor, CoreMRAnswer>((rowAnchor: CoreMRMatrixItemAnchor): Option<CoreMRAnswer> => map<string, CoreMRAnswer>((selectedValue_1: string): CoreMRAnswer => (new CoreMRAnswer(rowAnchor.Sequence, defaultArg(getScoreFromOption(options_2, selectedValue_1), 0n), undefined)), tryFind_1<Shared_MatrixItemKey, string>(rowAnchor.MatrixItemKey, matrixAnswer.Values)), anchor.MatrixItemAnchors);
324
+ const docForFirst: Option<string> = supportsOptionalNotes(anchor) ? matrixAnswer.Documentation : undefined;
325
+ return choose<Option<CoreMRAnswer>, CoreMRAnswer>((x_1: Option<CoreMRAnswer>): Option<CoreMRAnswer> => x_1, mapIndexed<CoreMRMatrixItemAnchor, Option<CoreMRAnswer>>((i: int32, rowAnchor: CoreMRMatrixItemAnchor): Option<CoreMRAnswer> => map<string, CoreMRAnswer>((selectedValue_1: string): CoreMRAnswer => (new CoreMRAnswer(rowAnchor.Sequence, defaultArg(getScoreFromOption(options_2, selectedValue_1), 0n), (i === 0) ? docForFirst : undefined)), tryFind_1<Shared_MatrixItemKey, string>(rowAnchor.MatrixItemKey, matrixAnswer.Values)), anchor.MatrixItemAnchors));
320
326
  }
321
327
  }
322
328
  case /* PluginData */ 3: {
@@ -371,7 +377,7 @@ function fieldToAnswers(field: Spec_FormField$1<Spec_FieldType_$union>, vitalsId
371
377
  throw new Error(`🚨 No matching choice found for ItemTypeId ${anchor.ItemTypeId} field ${anchor.FieldKey} answer '${answer.Value}'`);
372
378
  }
373
379
  else {
374
- return singleton(new CoreMRAnswer(anchor.Sequence, value_3(scoreOpt), undefined));
380
+ return singleton(new CoreMRAnswer(anchor.Sequence, value_3(scoreOpt), supportsOptionalNotes(anchor) ? answer.Documentation : undefined));
375
381
  }
376
382
  }
377
383
  case 26:
@@ -404,17 +410,26 @@ function fieldToAnswers(field: Spec_FormField$1<Spec_FieldType_$union>, vitalsId
404
410
  if (isEmpty(bitPositions)) {
405
411
  throw new Error(`🚨 No matching bitmask choice found for ItemTypeId ${anchor.ItemTypeId} field ${anchor.FieldKey} answer '${answer.Value}'`);
406
412
  }
407
- return singleton(new CoreMRAnswer(anchor.Sequence, fold<int32, int64>((acc: int64, bit_1: int32): int64 => toInt64(op_BitwiseOr(acc, toInt64(op_LeftShift(1n, bit_1)))), 0n, bitPositions), undefined));
413
+ return singleton(new CoreMRAnswer(anchor.Sequence, fold<int32, int64>((acc: int64, bit_1: int32): int64 => toInt64(op_BitwiseOr(acc, toInt64(op_LeftShift(1n, bit_1)))), 0n, bitPositions), supportsOptionalNotes(anchor) ? answer.Documentation : undefined));
408
414
  }
409
415
  }
410
416
  case 30:
411
417
  case 31: {
412
418
  const valStr: string = canonicalizeForYesNo(answer.Value);
413
- return singleton(new CoreMRAnswer(anchor.Sequence, (((valStr === "yes") ? true : (valStr === "true")) ? true : (valStr === "1")) ? (1n) : (2n), supportsTextContent(anchor) ? answer.Value : undefined));
419
+ return singleton(new CoreMRAnswer(anchor.Sequence, (((valStr === "yes") ? true : (valStr === "true")) ? true : (valStr === "1")) ? (1n) : (2n), supportsOptionalNotes(anchor) ? answer.Documentation : undefined));
414
420
  }
415
421
  case 50:
416
- case 51:
417
422
  case 60:
423
+ if (isNullOrWhiteSpace(answer.Value)) {
424
+ return empty<CoreMRAnswer>();
425
+ }
426
+ else {
427
+ if (!(isMatch(/^\d{4}-\d{2}-\d{2}$/gu, answer.Value) ? true : isMatch(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2})?$/gu, answer.Value))) {
428
+ throw new Error(`🚨 INVALID DATE FORMAT for ItemTypeId ${anchor.ItemTypeId} field ${anchor.FieldKey}: '${answer.Value}' — expected ISO format (YYYY-MM-DD or YYYY-MM-DDTHH:mm). This is a DATA INTEGRITY violation.`);
429
+ }
430
+ return singleton(new CoreMRAnswer(anchor.Sequence, 0n, supportsTextContent(anchor) ? answer.Value : undefined));
431
+ }
432
+ case 51:
418
433
  return singleton(new CoreMRAnswer(anchor.Sequence, 0n, supportsTextContent(anchor) ? answer.Value : undefined));
419
434
  case 61:
420
435
  return empty<CoreMRAnswer>();
@@ -456,9 +471,10 @@ function fieldToAnswers(field: Spec_FormField$1<Spec_FieldType_$union>, vitalsId
456
471
  case 31:
457
472
  return singleton(new CoreMRAnswer(anchor.Sequence, 2n, undefined));
458
473
  case 50:
459
- case 51:
460
474
  case 60:
461
475
  return empty<CoreMRAnswer>();
476
+ case 51:
477
+ return empty<CoreMRAnswer>();
462
478
  case 61:
463
479
  return empty<CoreMRAnswer>();
464
480
  case 110:
@@ -12,7 +12,7 @@ import { CoreMRFormData, CoreMRItem, CoreMRChoice, CoreMRTag_$reflection, CoreMR
12
12
  import { List_groupBy } from "@fable-org/fable-library-js/Seq2.js";
13
13
  import { detectHeadings, groupItemsByHeadings, Section, HeadingItem } from "./CorEMRSectioning.js";
14
14
  import { convertToFormSpec } from "./CorEMRTemplateToFormSpec.js";
15
- import { Auto_generateBoxedEncoder_437914C6, toString } from "../../../../libs/Thoth.Json/packages/Thoth.Json/Encode.js";
15
+ import { Auto_generateBoxedEncoder_437914C6, toString } from "../../../../Thoth.Json/packages/Thoth.Json/Encode.js";
16
16
  import { IntegrationProvenance } from "../../../Provenance.js";
17
17
 
18
18
  export class ValueEncodingInfo extends Record implements IEquatable<ValueEncodingInfo>, IComparable<ValueEncodingInfo> {
@@ -9,10 +9,10 @@ import { defaultArg, toArray, value as value_6, map, bind, Option } from "@fable
9
9
  import { map as map_1, choose, mapIndexed, collect, head, tail, isEmpty, ofArray, empty, tryFind, FSharpList } from "@fable-org/fable-library-js/List.js";
10
10
  import { Helpers_canonicalizeFieldKey } from "../../../Helpers.js";
11
11
  import { isNullOrWhiteSpace } from "@fable-org/fable-library-js/String.js";
12
- import { object, toString } from "../../../../libs/Thoth.Json/packages/Thoth.Json/Encode.js";
13
- import { keyValuePairs, map as map_2, fromString, IOptionalGetter, list as list_4, IRequiredGetter, IGetters, int, object as object_1, string, fail, succeed, andThen, guid, index, field as field_1, oneOf } from "../../../../libs/Thoth.Json/packages/Thoth.Json/Decode.js";
12
+ import { object, toString } from "../../../../Thoth.Json/packages/Thoth.Json/Encode.js";
13
+ import { keyValuePairs, map as map_2, fromString, IOptionalGetter, list as list_4, IRequiredGetter, IGetters, int, object as object_1, string, fail, succeed, andThen, guid, index, field as field_1, oneOf } from "../../../../Thoth.Json/packages/Thoth.Json/Decode.js";
14
14
  import { FSharpResult$2_$union } from "@fable-org/fable-library-js/Result.js";
15
- import { ErrorReason_$union } from "../../../../libs/Thoth.Json/packages/Thoth.Json/Types.js";
15
+ import { ErrorReason_$union } from "../../../../Thoth.Json/packages/Thoth.Json/Types.js";
16
16
  import { tryParse } from "@fable-org/fable-library-js/Guid.js";
17
17
  import { IntegrationProvenance } from "../../../Provenance.js";
18
18
 
@@ -6,11 +6,11 @@ import { int32ToString, uncurry2, comparePrimitives, IComparable, IEquatable } f
6
6
  import { class_type, list_type, bool_type, record_type, option_type, string_type, int64_type, int32_type, TypeInfo } from "@fable-org/fable-library-js/Reflection.js";
7
7
  import { filter, length, sumBy as sumBy_1, empty, collect, map as map_2, isEmpty, FSharpList } from "@fable-org/fable-library-js/List.js";
8
8
  import { toSeq, ofList, FSharpMap } from "@fable-org/fable-library-js/Map.js";
9
- import { Auto_generateBoxedDecoder_Z6670B51 } from "../../../libs/Thoth.Json/packages/Thoth.Json/Decode.js";
9
+ import { Auto_generateBoxedDecoder_Z6670B51 } from "../../../Thoth.Json/packages/Thoth.Json/Decode.js";
10
10
  import { FSharpResult$2_$union } from "@fable-org/fable-library-js/Result.js";
11
- import { ErrorReason_$union } from "../../../libs/Thoth.Json/packages/Thoth.Json/Types.js";
11
+ import { ErrorReason_$union } from "../../../Thoth.Json/packages/Thoth.Json/Types.js";
12
12
  import { isNullOrEmpty, toConsole, printf, toText } from "@fable-org/fable-library-js/String.js";
13
- import { fromString, list as list_5, bool, IOptionalGetter, IGetters, string, int, IRequiredGetter, object, map, keyValuePairs } from "../../../libs/Thoth.Json/packages/Thoth.Json/Decode.js";
13
+ import { fromString, list as list_5, bool, IOptionalGetter, IGetters, string, int, IRequiredGetter, object, map, keyValuePairs } from "../../../Thoth.Json/packages/Thoth.Json/Decode.js";
14
14
  import { CoreMRFormData, CoreMRTag, CoreMRTrigger, CoreMRFormMetadata, CoreMRItem, CoreMRChoice } from "./CoreMRTypes.js";
15
15
  import { sumBy } from "@fable-org/fable-library-js/Seq.js";
16
16