formbuilder-lhcforms 12.9.0 → 12.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -87,6 +87,56 @@ cp .env .env.local
87
87
 
88
88
  The npm scripts automatically load `.env` plus `.env.local` (when present), with `.env.local` taking precedence.
89
89
 
90
+ ### Choosing the LHC-Forms version and server
91
+
92
+ By default, the form builder loads the latest version of LHC-Forms from
93
+ https://lhcforms-static.nlm.nih.gov/lforms-versions/ at run time. To change that, set `source` and/or
94
+ `version` in `assets/lforms-config.json5`. Edit `src/assets/lforms-config.json5` before building, or the copy
95
+ in the `assets` folder of the built application. The file is in [JSON5](https://json5.org/) format, and its
96
+ comments describe both values.
97
+
98
+ To load a specific version from the NLM server, set only `version`:
99
+
100
+ ```json5
101
+ {
102
+ source: "",
103
+ version: "44.1.0"
104
+ }
105
+ ```
106
+
107
+ To use a fixed copy served by your own server instead (for example a version that matches the forms renderer
108
+ of your application), set both values:
109
+
110
+ ```json5
111
+ {
112
+ // Base URL of the LHC-Forms files.
113
+ source: "/path/to/lforms-44.1.0",
114
+ // X.Y.Z version of the LHC-Forms files at source.
115
+ version: "44.1.0"
116
+ }
117
+ ```
118
+
119
+ `source` is the base URL of the extracted
120
+ [LHC-Forms release](https://lhcforms-static.nlm.nih.gov/lforms-versions/) (or of `dist/lforms` of the
121
+ `lforms` npm package). A relative URL is resolved against the form builder's base URL (`<base href>`), and
122
+ `/` is the root of the server. The base URL must contain `webcomponent/styles.css`,
123
+ `webcomponent/assets/lib/zone.min.js`, `webcomponent/lhc-forms.js` and `fhir/lformsFHIRAll.min.js`. `version`
124
+ must be the `X.Y.Z` version, 37.0.0 or later, of that copy, or of the release on the NLM server if `source` is
125
+ not set; older versions lack features the form builder requires, such as FHIR R5 support. The form builder
126
+ logs a warning in the browser console if the version of the loaded copy differs from `version`. Use a recent
127
+ LHC-Forms version; the form builder is developed and tested with the latest one.
128
+
129
+ The default behavior applies if the file is missing or empty, or if both values are empty or omitted. It also
130
+ applies if the file cannot be read: on an HTTP error other than 404, the form builder logs a warning in the
131
+ browser console and loads the latest version from the NLM server, even if the file sets `source`. A response
132
+ with the content type `text/html` is treated as a missing file, without a warning, because single-page
133
+ application servers return their HTML page for missing files. Make sure the file is served as-is (for
134
+ example, not behind a login page) if your deployment must not load LHC-Forms from the NLM server. If the
135
+ file is not valid JSON5, has `source` without `version`, or has an invalid `version`, the form builder reports
136
+ an error instead of loading LHC-Forms. It also reports an error, without falling back to another version, if
137
+ the configured version cannot be loaded. Browsers may cache the file, so configure your server to revalidate
138
+ it if you change it after deployment.
139
+
90
140
  ## **Contributing**
91
141
  - If you plan to contribute new functionality, it is important to coordinate with the maintainers to ensure proper integration and to avoid duplicating efforts. Reach out to the maintainers for guidance on contributing.
92
142
 
@@ -950,6 +950,9 @@ Awesome, nor vice versa. **Please do not use brand logos for any purpose except
950
950
  to represent the company, product, or service to which they refer.**
951
951
 
952
952
 
953
+ @lhncbc/expression-editor
954
+ SEE LICENSE IN LICENSE.md
955
+
953
956
  @lhncbc/ngx-schema-form
954
957
  MIT
955
958
 
@@ -2902,8 +2905,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2902
2905
  SOFTWARE.
2903
2906
 
2904
2907
 
2905
- ngx-expression-editor
2906
-
2907
2908
  object-inspect
2908
2909
  MIT
2909
2910
  MIT License
@@ -43,6 +43,29 @@
43
43
  "pattern": "^\\S*$",
44
44
  "type": "string"
45
45
  },
46
+ // The id and/or extensions of the primitive fields, copied from
47
+ // $.definitions.Extension in fhir.schema.json. Without them, the form drops e.g. a
48
+ // child extension's _valueString when the extension array is rebuilt.
49
+ "_url": {"description": "Extensions for url", "$ref": "#/definitions/Element", "widget": {"id": "hidden"}},
50
+ "_valueBase64Binary": {"description": "Extensions for valueBase64Binary", "$ref": "#/definitions/Element", "widget": {"id": "hidden"}},
51
+ "_valueBoolean": {"description": "Extensions for valueBoolean", "$ref": "#/definitions/Element", "widget": {"id": "hidden"}},
52
+ "_valueCanonical": {"description": "Extensions for valueCanonical", "$ref": "#/definitions/Element", "widget": {"id": "hidden"}},
53
+ "_valueCode": {"description": "Extensions for valueCode", "$ref": "#/definitions/Element", "widget": {"id": "hidden"}},
54
+ "_valueDate": {"description": "Extensions for valueDate", "$ref": "#/definitions/Element", "widget": {"id": "hidden"}},
55
+ "_valueDateTime": {"description": "Extensions for valueDateTime", "$ref": "#/definitions/Element", "widget": {"id": "hidden"}},
56
+ "_valueDecimal": {"description": "Extensions for valueDecimal", "$ref": "#/definitions/Element", "widget": {"id": "hidden"}},
57
+ "_valueId": {"description": "Extensions for valueId", "$ref": "#/definitions/Element", "widget": {"id": "hidden"}},
58
+ "_valueInstant": {"description": "Extensions for valueInstant", "$ref": "#/definitions/Element", "widget": {"id": "hidden"}},
59
+ "_valueInteger": {"description": "Extensions for valueInteger", "$ref": "#/definitions/Element", "widget": {"id": "hidden"}},
60
+ "_valueMarkdown": {"description": "Extensions for valueMarkdown", "$ref": "#/definitions/Element", "widget": {"id": "hidden"}},
61
+ "_valueOid": {"description": "Extensions for valueOid", "$ref": "#/definitions/Element", "widget": {"id": "hidden"}},
62
+ "_valuePositiveInt": {"description": "Extensions for valuePositiveInt", "$ref": "#/definitions/Element", "widget": {"id": "hidden"}},
63
+ "_valueString": {"description": "Extensions for valueString", "$ref": "#/definitions/Element", "widget": {"id": "hidden"}},
64
+ "_valueTime": {"description": "Extensions for valueTime", "$ref": "#/definitions/Element", "widget": {"id": "hidden"}},
65
+ "_valueUnsignedInt": {"description": "Extensions for valueUnsignedInt", "$ref": "#/definitions/Element", "widget": {"id": "hidden"}},
66
+ "_valueUri": {"description": "Extensions for valueUri", "$ref": "#/definitions/Element", "widget": {"id": "hidden"}},
67
+ "_valueUrl": {"description": "Extensions for valueUrl", "$ref": "#/definitions/Element", "widget": {"id": "hidden"}},
68
+ "_valueUuid": {"description": "Extensions for valueUuid", "$ref": "#/definitions/Element", "widget": {"id": "hidden"}},
46
69
  "valueBase64Binary": {
47
70
  "description": "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).",
48
71
  "pattern": "^(\\s*([0-9a-zA-Z\\+/=]){4}\\s*)+$",
@@ -23,6 +23,7 @@
23
23
  { field: "identifier", col: 12},
24
24
  { field: "meta", col: 12},
25
25
  { field: "useContext", col: 12},
26
+ { field: "jurisdiction", col: 12},
26
27
  { field: "subjectType", "col": 12},
27
28
  { field: "date", col: 12},
28
29
  { field: "publisher", col: 12},
@@ -31,6 +32,7 @@
31
32
  { field: "lastReviewDate", col: 12},
32
33
  { field: "effectivePeriod", col: 12},
33
34
  { field: "contained", "col": 12},
35
+ { field: "__$templateExtract", "col": 12},
34
36
  { field: "__$variable", col: 12},
35
37
  { field: "__$extensionContainer", col: 12}
36
38
  ]
@@ -49,6 +51,11 @@
49
51
  '$.properties.meta': 'Meta',
50
52
  '$.properties.useContext': 'Usage Context',
51
53
  '$.properties.useContext.items.properties.__$valueSummary': 'Value',
54
+ '$.properties.jurisdiction.items.properties.text': 'Text',
55
+ '$.properties.jurisdiction.items.properties.coding': 'Coding',
56
+ '$.properties.jurisdiction.items.properties.coding.items.properties.display': 'Display',
57
+ '$.properties.jurisdiction.items.properties.coding.items.properties.code': 'Code',
58
+ '$.properties.jurisdiction.items.properties.coding.items.properties.system': 'System',
52
59
  '$.definitions.Meta.properties.versionId': 'Version ID (Read-only)',
53
60
  '$.definitions.Meta.properties.lastUpdated': 'Last updated (Read-only)',
54
61
  '$.definitions.Meta.properties.source': 'Source',
@@ -64,6 +71,7 @@
64
71
  inputBox: 'formStringField',
65
72
  textArea: 'formTextareaField',
66
73
  inlineTextArea: 'formInlineTextareaField',
74
+ jurisdictionCoding: 'dialogCodingTable',
67
75
  instant: 'formInstantField',
68
76
  'positive-integer': 'formPositiveIntegerField',
69
77
  'unsigned-integer': 'formUnsignedIntegerField'
@@ -185,21 +193,39 @@
185
193
  {"field": "__$valueSummary", "title": "Value", "col": 4, "nolabel": true}
186
194
  ]
187
195
  },
196
+ jurisdiction: {
197
+ "id": "array",
198
+ "addDefaultItemIfEmpty": false,
199
+ "labelPosition": "left",
200
+ "labelClasses": "col-sm-2 ps-0 pe-1",
201
+ "controlClasses": "col-sm-10",
202
+ "addButtonLabel": "Add jurisdiction",
203
+ "noCollapseButton": true
204
+ },
205
+ jurisdictionConcept: {
206
+ "id": "lfb-object",
207
+ "nolabel": true,
208
+ "childOffsetClass": "ms-0",
209
+ "showFields": [
210
+ {"field": "text", "col": 12},
211
+ {"field": "coding", "col": 12}
212
+ ]
213
+ },
188
214
  contained: {
189
215
  "id": "contained",
190
216
  "addEditAction": true,
191
217
  "labelPosition": "left",
192
218
  "labelClasses": "col-sm-2 ps-0 pe-1",
193
219
  "controlClasses": "col-sm-10",
194
- "addButtonLabel": "Add new ValueSet",
195
- "addButtonTitle": "At present, only ValueSet is supported as contained resource.",
220
+ "addButtonLabel": "Add contained resource",
221
+ "addButtonTitle": "Create or import a contained FHIR resource.",
196
222
  "showFields": [
197
223
  // The fields here are canonical paths of FormProperty.
198
- {"field": "resourceType", "col": 1, "nolabel": true},
199
- {"field": "id", "col": 3, "nolabel": true},
200
- {"field": "title", "col": 4, "nolabel": true},
201
- {"field": "date", "col": 2, "nolabel": true},
202
- {"field": "status", "col": 1, "nolabel": true}
224
+ {"field": "resourceType", "title": "Type", "col": 2, "nolabel": true},
225
+ {"field": "id", "title": "Id", "col": 3, "nolabel": true},
226
+ {"field": "__$resourceDisplay", "title": "Display", "col": 4, "nolabel": true},
227
+ {"field": "__$fhirVersionInfo.version", "title": "FHIR version", "col": 1, "nolabel": true},
228
+ {"field": "status", "title": "Status", "col": 1, "nolabel": true}
203
229
  ]
204
230
  },
205
231
  "__$extensionContainer": {
@@ -289,9 +315,13 @@
289
315
  '$.properties.publisher',
290
316
  '$.definitions.Meta.properties.versionId',
291
317
  '$.definitions.Meta.properties.lastUpdated',
318
+ '$.properties.jurisdiction.items.properties.text',
319
+ '$.properties.jurisdiction.items.properties.coding.items.properties.display',
320
+ '$.properties.jurisdiction.items.properties.coding.items.properties.code',
292
321
  ],
293
322
  url: [
294
323
  '$.definitions.Meta.properties.source',
324
+ '$.properties.jurisdiction.items.properties.coding.items.properties.system',
295
325
  ],
296
326
  inlineTextArea: [
297
327
  '$.properties.description',
@@ -328,6 +358,15 @@
328
358
  usageContext: [
329
359
  '$.properties.useContext'
330
360
  ],
361
+ jurisdiction: [
362
+ '$.properties.jurisdiction'
363
+ ],
364
+ jurisdictionConcept: [
365
+ '$.properties.jurisdiction.items'
366
+ ],
367
+ jurisdictionCoding: [
368
+ '$.properties.jurisdiction.items.properties.coding'
369
+ ],
331
370
  extension: [
332
371
  '$.properties.extension'
333
372
  ],
@@ -63,6 +63,7 @@
63
63
  { "field": "__$terminologyServer", "col": 12 },
64
64
  { "field": "__$observationLinkPeriod", "col": 12},
65
65
  { "field": "__$observationExtract", "col": 12},
66
+ { "field": "__$templateExtract", "col": 12},
66
67
  { "field": "__$extensionContainer", "col": 12 }
67
68
  ]
68
69
  }
@@ -0,0 +1,18 @@
1
+ {
2
+ // Optional: choose the LHC-Forms version and the server it is loaded from.
3
+ // - Both values empty (default): the latest version from
4
+ // https://lhcforms-static.nlm.nih.gov/lforms-versions/.
5
+ // - Only version set: that version from the same NLM server.
6
+ // - Both values set: your own copy of LHC-Forms at source. source requires version.
7
+ // See "Choosing the LHC-Forms version and server" in README.md.
8
+
9
+ // Base URL of the LHC-Forms files, e.g. "/lforms/44.1.0" or "https://example.org/lforms/44.1.0".
10
+ // A relative URL is resolved against the form builder's base URL (<base href>); "/" is the server
11
+ // root. It must contain webcomponent/styles.css, webcomponent/assets/lib/zone.min.js,
12
+ // webcomponent/lhc-forms.js and fhir/lformsFHIRAll.min.js.
13
+ source: "",
14
+
15
+ // X.Y.Z version of LHC-Forms, 37.0.0 or later, e.g. "44.1.0": the version of the files at source,
16
+ // or, without source, the version to load from the NLM server.
17
+ version: ""
18
+ }
@@ -1357,10 +1357,47 @@
1357
1357
  "contained": {
1358
1358
  "description": "These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.",
1359
1359
  "items": {
1360
- "$ref": "#/definitions/ValueSet"
1360
+ "description": "Any FHIR resource stored inline with the Questionnaire.",
1361
+ "type": "object",
1362
+ "properties": {
1363
+ "resourceType": {
1364
+ "description": "FHIR resource type.",
1365
+ "type": "string"
1366
+ },
1367
+ "id": {
1368
+ "description": "Logical id used for local references to the contained resource.",
1369
+ "$ref": "#/definitions/id"
1370
+ }
1371
+ },
1372
+ "required": ["resourceType"],
1373
+ "additionalProperties": true
1361
1374
  },
1362
1375
  "type": "array"
1363
1376
  },
1377
+ "__$templateExtract": {
1378
+ "description": "Create extracted FHIR resources from the Questionnaire's existing contained resource templates.",
1379
+ "title": "Template-based extraction",
1380
+ "type": "array",
1381
+ "items": {
1382
+ "$ref": "#/definitions/Extension"
1383
+ },
1384
+ "widget": {
1385
+ "id": "template-extract",
1386
+ "addEditAction": true,
1387
+ "addDefaultItemIfEmpty": false,
1388
+ "addButtonLabel": "Add new template extraction",
1389
+ "addButtonDisabledReason": "A contained resource is required before adding a template extraction. Add one under Contained resources above.",
1390
+ "labelPosition": "left",
1391
+ "labelClasses": "col-sm-2 ps-0 pe-1",
1392
+ "controlClasses": "col-sm-10",
1393
+ "showFields": [
1394
+ {"field": "template", "col": 3, "title": "Template"},
1395
+ {"field": "fullUrl", "col": 3, "title": "fullUrl"},
1396
+ {"field": "resourceId", "col": 2, "title": "resourceId"},
1397
+ {"field": "conditionalRequest", "col": 3, "title": "Conditional request"}
1398
+ ]
1399
+ }
1400
+ },
1364
1401
  "__$variable": {
1365
1402
  "description": "Use to store values derived from calculations, references to other answers, or external data.",
1366
1403
  "title": "Variables",
@@ -1406,6 +1443,7 @@
1406
1443
  "description",
1407
1444
  "purpose",
1408
1445
  "__$terminologyServer",
1446
+ "__$templateExtract",
1409
1447
  "__$variable",
1410
1448
  "__$extensionContainer"
1411
1449
  ]
@@ -2615,6 +2615,30 @@
2615
2615
  "type": ["$EXP$ target.value != 'display'"]
2616
2616
  }
2617
2617
  },
2618
+ "__$templateExtract": {
2619
+ "description": "Create extracted FHIR resources from the Questionnaire's existing contained resource templates.",
2620
+ "title": "Template-based extraction",
2621
+ "type": "array",
2622
+ "items": {
2623
+ "$ref": "#/definitions/Extension"
2624
+ },
2625
+ "widget": {
2626
+ "id": "template-extract",
2627
+ "addEditAction": true,
2628
+ "addDefaultItemIfEmpty": false,
2629
+ "addButtonLabel": "Add new template extraction",
2630
+ "addButtonDisabledReason": "A contained resource is required before adding a template extraction. Add one under Contained resources in the form-level fields.",
2631
+ "labelPosition": "left",
2632
+ "labelClasses": "col-2 ps-0 pe-1",
2633
+ "controlClasses": "col-10",
2634
+ "showFields": [
2635
+ {"field": "template", "col": 3, "title": "Template"},
2636
+ {"field": "fullUrl", "col": 3, "title": "fullUrl"},
2637
+ {"field": "resourceId", "col": 2, "title": "resourceId"},
2638
+ {"field": "conditionalRequest", "col": 3, "title": "Conditional request"}
2639
+ ]
2640
+ }
2641
+ },
2618
2642
  "__$extensionContainer": {
2619
2643
  "description": "May be used to represent additional information that is not part of the basic definition of the resource. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.",
2620
2644
  "title": "General Extensions",
@@ -3283,6 +3307,17 @@
3283
3307
  }
3284
3308
  ]
3285
3309
  },
3310
+ {
3311
+ "fields": [
3312
+ "__$templateExtract"
3313
+ ],
3314
+ "showFields": [
3315
+ {
3316
+ "field": "__$templateExtract",
3317
+ "col": 12
3318
+ }
3319
+ ]
3320
+ },
3286
3321
  {
3287
3322
  "fields": ["id", "__$treeNodeId", "__$extensionContainer", "extension", "modifierExtension", "definition"]
3288
3323
  }