lforms 29.3.0 → 33.2.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/CHANGELOG.md +261 -0
- package/README.md +97 -14
- package/changed-features.md +99 -0
- package/dist/lforms/LICENSE.md +70 -0
- package/dist/lforms/README.md +100 -0
- package/dist/lforms/fhir/R4/lformsFHIR.min.js +2 -0
- package/dist/lforms/fhir/R4/lformsFHIR.min.js.map +1 -0
- package/dist/lforms/fhir/STU3/lformsFHIR.min.js +2 -0
- package/dist/lforms/fhir/STU3/lformsFHIR.min.js.map +1 -0
- package/dist/lforms/fhir/lformsFHIRAll.min.js +2 -0
- package/dist/lforms/fhir/lformsFHIRAll.min.js.map +1 -0
- package/dist/lforms/webcomponent/assets/lib/zone.min.js +134 -0
- package/dist/lforms/webcomponent/down_arrow_gray_10_10.png +0 -0
- package/dist/lforms/webcomponent/favicon.ico +0 -0
- package/dist/lforms/webcomponent/index.html +9 -0
- package/dist/lforms/webcomponent/lhc-forms.js +2471 -0
- package/dist/lforms/webcomponent/magnifying_glass.png +0 -0
- package/dist/lforms/webcomponent/main.js +2464 -0
- package/dist/lforms/webcomponent/main.js.map +1 -0
- package/dist/lforms/webcomponent/polyfills.js +2 -0
- package/dist/lforms/webcomponent/polyfills.js.map +1 -0
- package/dist/lforms/webcomponent/runtime.js +2 -0
- package/dist/lforms/webcomponent/runtime.js.map +1 -0
- package/dist/lforms/webcomponent/scripts.js +3 -0
- package/dist/lforms/webcomponent/scripts.js.map +1 -0
- package/dist/lforms/webcomponent/styles.css +3 -0
- package/dist/lforms/webcomponent/styles.css.map +1 -0
- package/form_definition.md +382 -0
- package/lforms-33.2.0.tgz +0 -0
- package/package.json +94 -88
- package/r4-support.md +147 -0
- package/sdc-support.md +127 -0
- package/app/.npmignore +0 -3
- package/app/images/blank.gif +0 -0
- package/app/images/signal-stop.png +0 -0
- package/app/index.html +0 -10
- package/app/lforms.js +0 -56
- package/app/lforms.tpl.js +0 -964
- package/app/scripts/angular-packages.js +0 -11
- package/app/scripts/bootstrap-decorators.js +0 -31
- package/app/scripts/bower-index.js +0 -14
- package/app/scripts/fhir/R4/export.js +0 -33
- package/app/scripts/fhir/R4/fhirRequire.js +0 -36
- package/app/scripts/fhir/R4/lformsFHIR.js +0 -27260
- package/app/scripts/fhir/R4/sdc-export.js +0 -455
- package/app/scripts/fhir/R4/sdc-import.js +0 -483
- package/app/scripts/fhir/STU3/export.js +0 -27
- package/app/scripts/fhir/STU3/fhirRequire.js +0 -36
- package/app/scripts/fhir/STU3/lformsFHIR.js +0 -27291
- package/app/scripts/fhir/STU3/sdc-export.js +0 -493
- package/app/scripts/fhir/STU3/sdc-import.js +0 -494
- package/app/scripts/fhir/diagnostic-report.js +0 -707
- package/app/scripts/fhir/export-common.js +0 -209
- package/app/scripts/fhir/expression-processor.js +0 -670
- package/app/scripts/fhir/extensions/rendering-style.js +0 -23
- package/app/scripts/fhir/fhir-common.js +0 -3
- package/app/scripts/fhir/obs-prepop.mjs +0 -97
- package/app/scripts/fhir/runtime-common.js +0 -33
- package/app/scripts/fhir/sdc-common.js +0 -334
- package/app/scripts/fhir/sdc-export-common.js +0 -1046
- package/app/scripts/fhir/sdc-import-common.js +0 -1343
- package/app/scripts/fhir/versions.js +0 -8
- package/app/scripts/index.js +0 -20
- package/app/scripts/lforms-config.js +0 -12
- package/app/scripts/lforms-constants.js +0 -10
- package/app/scripts/lforms-controllers.js +0 -1196
- package/app/scripts/lforms-directives.js +0 -424
- package/app/scripts/lforms-index.js +0 -20
- package/app/scripts/lib/cross_browser.js +0 -21
- package/app/scripts/lib/lforms-data.js +0 -3591
- package/app/scripts/lib/lforms-hl7.js +0 -525
- package/app/scripts/lib/lforms-util.js +0 -1122
- package/app/scripts/lib/lforms-validate.js +0 -277
- package/app/scripts/lib/polyfill.js +0 -81
- package/app/scripts/themeList.js +0 -17
- package/app/styles/lforms.css +0 -1219
- package/app/styles/redmond-theme/README.txt +0 -2
- package/app/styles/redmond-theme/images/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
- package/app/styles/redmond-theme/images/ui-bg_glass_85_dfeffc_1x400.png +0 -0
- package/app/styles/redmond-theme/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- package/app/styles/redmond-theme/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
- package/app/styles/redmond-theme/images/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
- package/app/styles/redmond-theme/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
- package/app/styles/redmond-theme/images/ui-icons_217bc0_256x240.png +0 -0
- package/app/styles/redmond-theme/images/ui-icons_2e83ff_256x240.png +0 -0
- package/app/styles/redmond-theme/images/ui-icons_469bdd_256x240.png +0 -0
- package/app/styles/redmond-theme/images/ui-icons_6da8d5_256x240.png +0 -0
- package/app/styles/redmond-theme/images/ui-icons_cd0a0a_256x240.png +0 -0
- package/app/styles/redmond-theme/images/ui-icons_d8e7f3_256x240.png +0 -0
- package/app/styles/redmond-theme/images/ui-icons_f9bd01_256x240.png +0 -0
- package/app/styles/redmond-theme/jquery-ui.css +0 -1311
- package/app/styles/redmond-theme/jquery-ui.min.css +0 -7
- package/app/styles/redmond-theme/theme.css +0 -443
- package/app/styles/themes.css +0 -1541
- package/app/styles/themes.css.map +0 -9
- package/app/styles/themes.scss +0 -411
- package/app/version.json +0 -1
- package/app/views/partials/attachment.html +0 -38
- package/app/views/partials/field-answers.html +0 -67
- package/app/views/partials/field-units.html +0 -24
- package/app/views/partials/form-controls.html +0 -19
- package/app/views/partials/form-header.html +0 -35
- package/app/views/partials/form-options.html +0 -50
- package/app/views/partials/form-title.html +0 -20
- package/app/views/partials/form-view.html +0 -13
- package/app/views/partials/item-options.html +0 -48
- package/app/views/partials/item.html +0 -126
- package/app/views/partials/itemPrefixAndText.html +0 -4
- package/app/views/partials/layout-horizontal.html +0 -156
- package/app/views/partials/layout-matrix.html +0 -145
- package/app/views/partials/popover-content.html +0 -1
- package/app/views/partials/repeating-button.html +0 -16
- package/app/views/partials/table-item.html +0 -30
- package/app/views/partials/template-table.html +0 -69
- package/app/views/partials/uib-popover-templates/uib-popover-template.html +0 -13
- package/app/views/partials/uib-popover-templates/uib-popover.html +0 -11
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
# Form Definition Format
|
|
2
|
+
|
|
3
|
+
The forms rendered by the LForms widget are defined in a JSON format, examples
|
|
4
|
+
of which can be seen in the __app/data__ directory. Note that
|
|
5
|
+
LForms also provides APIs for importing forms defined in the FHIR Questionnaire
|
|
6
|
+
format. (See the [documentation](http://lhncbc.github.io/lforms/) for details.) The
|
|
7
|
+
basic structure (some of which is optional) is shown below, followed by comments
|
|
8
|
+
about the meaning of each key:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
{
|
|
12
|
+
"code": string,
|
|
13
|
+
"name": string,
|
|
14
|
+
"template": string
|
|
15
|
+
"templateOptions": {
|
|
16
|
+
},
|
|
17
|
+
"items": [{
|
|
18
|
+
"questionCode": string,
|
|
19
|
+
"linkId": string,
|
|
20
|
+
"questionCardinality": {
|
|
21
|
+
"min": "1",
|
|
22
|
+
"max": "1" or "*"
|
|
23
|
+
},
|
|
24
|
+
"question": string,
|
|
25
|
+
"answerCardinality": {
|
|
26
|
+
min: "0" or "1",
|
|
27
|
+
max: "1" or "*"
|
|
28
|
+
},
|
|
29
|
+
"answers": [{
|
|
30
|
+
"text": string,
|
|
31
|
+
"code": string,
|
|
32
|
+
"label": string,
|
|
33
|
+
"other": string,
|
|
34
|
+
"score": number
|
|
35
|
+
}],
|
|
36
|
+
"answerCodeSystem": "string",
|
|
37
|
+
"externallyDefined": string,
|
|
38
|
+
"dataType": string,
|
|
39
|
+
"units": [{
|
|
40
|
+
"name": string,
|
|
41
|
+
"code": string,
|
|
42
|
+
"system": string,
|
|
43
|
+
"default": boolean
|
|
44
|
+
}],
|
|
45
|
+
"header": boolean,
|
|
46
|
+
"skipLogic": {
|
|
47
|
+
"conditions": [{
|
|
48
|
+
"source": string
|
|
49
|
+
"trigger": {
|
|
50
|
+
"value": string/number/boolean/code-object, or
|
|
51
|
+
"minExclusive": number,
|
|
52
|
+
"minInclusive": number,
|
|
53
|
+
"maxExclusive": number,
|
|
54
|
+
"maxInclusive": number
|
|
55
|
+
}
|
|
56
|
+
}],
|
|
57
|
+
"action": string
|
|
58
|
+
},
|
|
59
|
+
displayControl: {
|
|
60
|
+
"colCSS": [{"name":"width","value":"30%"}, ...],
|
|
61
|
+
"listColHeaders": ["Column 1 Title", "Column 2", ...]
|
|
62
|
+
}
|
|
63
|
+
"codingInstructions": string,
|
|
64
|
+
"calculationMethod": {
|
|
65
|
+
"name": string
|
|
66
|
+
}
|
|
67
|
+
}],
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Keys:
|
|
72
|
+
|
|
73
|
+
* **code** - a code (identifier) for a panel, or in the context of answer
|
|
74
|
+
lists, for an individual answer in the list. For answer lists, codes are
|
|
75
|
+
optional.
|
|
76
|
+
* **codeSystem** - (optional) the code system for the code of the form.
|
|
77
|
+
* **name** - (required) the name of the form (to be shown to the user).
|
|
78
|
+
* **copyrightNotice** - the copyright information of the form.
|
|
79
|
+
* **template** - (optional) a template name that is used for rendering the form.
|
|
80
|
+
'table' (default) is the only template supported. More supported templates would be added.
|
|
81
|
+
* <a name="templateOptions"></a>**templateOptions** - a hash of options for the template. This can be
|
|
82
|
+
omitted, but supported values are below.
|
|
83
|
+
* showQuestionCode - a boolean that controls whether to show question codes.
|
|
84
|
+
The default is false.
|
|
85
|
+
* showCodingInstruction - a boolean that controls whether to show coding
|
|
86
|
+
instructions inline or as popover messages (false: in popover; true: inline).
|
|
87
|
+
The default is false;
|
|
88
|
+
* allowMultipleEmptyRepeatingItems - a boolean that controls whether to allow
|
|
89
|
+
more than one unused repeating item/section The default is false.
|
|
90
|
+
* allowHTMLInInstructions - a boolean that controls whether to allow HTML
|
|
91
|
+
content in the codingInstructions field. The default is false. If it is false,
|
|
92
|
+
the **codingInstructionsFormat** field on item level is ignored, and no HTML
|
|
93
|
+
formatted coding instructions will be displayed.
|
|
94
|
+
* <a name="defaultAnswer"></a>defaultAnswer - The default answer for a
|
|
95
|
+
question. For an answer list, it can be an answer label, text, code or
|
|
96
|
+
their combination, using the syntax such as: {"code": "B12"}, {"label: "A"},
|
|
97
|
+
{"text": "Male"}, {"text": "Male", "code": "LA2-8"} and etc.
|
|
98
|
+
For a date field, it can be a date shortcut (like "t" for today).
|
|
99
|
+
For other field types, it can be a text string or a number.
|
|
100
|
+
* displayControl - an object that controls the display of the selected template.
|
|
101
|
+
Currently it only supports a 'questionLayout' attribute, which has supported
|
|
102
|
+
values as 'vertical' (default), 'horizontal' and 'matrix'. Here is an example:
|
|
103
|
+
`{"questionLayout": "matrix"}`
|
|
104
|
+
* <a name="viewMode"></a>viewMode - (optional) the view mode for the form. Permitted values are 'lg',
|
|
105
|
+
'md', 'sm', and 'auto', which determine the 4 predefined layouts for large
|
|
106
|
+
screen/container, medium screen/container, small screen/container and a
|
|
107
|
+
responsive layout. The default value is 'auto'.
|
|
108
|
+
* <a name="defaultAnswerLayout"></a>defaultAnswerLayout -
|
|
109
|
+
an object that controls the answer layout for each item
|
|
110
|
+
that has a dataType of CWE or CNE and has an answer list but does not specify
|
|
111
|
+
answerLayout on the item itself. It has a single key of "answerLayout", which
|
|
112
|
+
has two keys, "type" and "columns". If "type" is set to be "COMBO_BOX", the
|
|
113
|
+
[autocomplete-lhc](http://lhncbc.github.io/autocomplete-lhc/) widget
|
|
114
|
+
will be used to handle the list. If "type" is set to be "RADIO_CHECKBOX", then
|
|
115
|
+
all the answers are displayed as either radio buttons or check boxes,
|
|
116
|
+
and "columns" controls how many columns are used.
|
|
117
|
+
If value of "columns" is "0", or there are no "columns". The answers will fill
|
|
118
|
+
in available space one after another. If the value of "columns" is "1"
|
|
119
|
+
(or any value other than "0"), the answers are displayed in one column.
|
|
120
|
+
"columns" is valid only when "type" is set to be "RADIO_CHECKBOX".
|
|
121
|
+
Here is an example:
|
|
122
|
+
`{"answerLayout": {"type": "RADIO_CHECKBOX", "columns": "1"}}`
|
|
123
|
+
* hideTreeLine - a boolean that controls whether to hide tree line styles. The default is false.
|
|
124
|
+
* hideIndentation - a boolean that controls whether to hide indentation. The default is false.
|
|
125
|
+
Note that if this is set true, tree line style will not apply regardless of "hideTreeLine" setting.
|
|
126
|
+
* hideRepetitionNumber - a boolean that controls whether to hide repetition numbers next to the
|
|
127
|
+
item's text. The default is false.
|
|
128
|
+
* displayScoreWithAnswerText - a boolean that controls whether to display scores along
|
|
129
|
+
with answer texts for answers that have scores. The default is true.
|
|
130
|
+
* <a name="items"></a><b>items</b> - This is an array of form questions and
|
|
131
|
+
sections. Questions and sections (containing sub-questions) are mostly
|
|
132
|
+
represented the same in this array, but a section will contain its own
|
|
133
|
+
"items" array to specify what it contains. Sections can be nested to create
|
|
134
|
+
sub-sections, so that the definition forms tree-like structure with questions
|
|
135
|
+
at the leaf nodes. Each question/section in the array is represented by a hash
|
|
136
|
+
with the following keys:
|
|
137
|
+
|
|
138
|
+
* linkId - (required) An ID identifying the question or section.
|
|
139
|
+
This code needs to be unique across the form.
|
|
140
|
+
* questionCode - (optional) A code for the question or section.
|
|
141
|
+
* questionCodeSystem - (optional) the code system for the question code. The default value
|
|
142
|
+
is "LOINC" when the form's **type** is "LOINC".
|
|
143
|
+
* questionCardinality - This controls whether the there is a button for
|
|
144
|
+
adding another of this question/section. It is a hash with "min" and
|
|
145
|
+
"max" keys, and by default both of those are "1" (i.e., not repeatable).
|
|
146
|
+
If you wish for a question or section to be repeatable, pass in `{"min":
|
|
147
|
+
"1", "max": "*"}`.
|
|
148
|
+
* question - The label for the question, or the title of the section.
|
|
149
|
+
* answerCardinality - The same as <a href="#answerCardinality">above</a>.
|
|
150
|
+
* <a name="answers"></a>answers - For questions with answer lists, this is
|
|
151
|
+
an array of hashes for items in the list. Each hash can contain:
|
|
152
|
+
* text - (required) the display string for this list item. This should
|
|
153
|
+
be unique within the list.
|
|
154
|
+
* code - (optional) an identifier for the list item. This can be
|
|
155
|
+
omitted if you do not need coded answers.
|
|
156
|
+
* system - (optional) a code system for the answer's code. If not
|
|
157
|
+
present, the item's answerCodeSystem is used as the default code system.
|
|
158
|
+
* label - (optional) Some lists have a label for each list item, such as
|
|
159
|
+
'a', 'b', etc. This is an array of such labels, corresponding to the
|
|
160
|
+
items in the "text" array. When this is present, the automatic number
|
|
161
|
+
of list items will be turned off avoid confusion.
|
|
162
|
+
* other - (optional) If this answer is an "Other" item, then this "other" key
|
|
163
|
+
provides a label like "Please specify" for an additional field that
|
|
164
|
+
will be available with the user chooses this answer.
|
|
165
|
+
* <a name="score"></a>score - (optional) Some forms have scored answers
|
|
166
|
+
which get summed into a total field. See TOTALSCORE under <a
|
|
167
|
+
href="#calculationMethod">calculationMethod</a> below for how to
|
|
168
|
+
specify which field holds the total.
|
|
169
|
+
* answerCodeSystem - The default code system for the answer list
|
|
170
|
+
(specified either in "answers" or in "externallyDefined").
|
|
171
|
+
* externallyDefined - List fields can be configured to obtain their lists
|
|
172
|
+
from a URL as the user types. This is usually used for larger lists for
|
|
173
|
+
which it would not be practical to include the whole list with the form.
|
|
174
|
+
The [Clinical Table Search
|
|
175
|
+
Service](https://clin-table-search.lhc.nlm.nih.gov/) website provides a number
|
|
176
|
+
of ready-to-use web APIs that can plugged in here to provide
|
|
177
|
+
searchable lists of drugs, medical conditions, disease names, and more.
|
|
178
|
+
If you wish to set up your own web API on a website, then you just need to
|
|
179
|
+
understand what query parameters to handle on the webserver, and what the
|
|
180
|
+
response format needs to be. LForms uses the
|
|
181
|
+
[autocomplete-lhc](http://lhncbc.github.io/autocomplete-lhc/) package for
|
|
182
|
+
its lists, so see the documentation for its [url
|
|
183
|
+
parameter](http://lhncbc.github.io/autocomplete-lhc/docs.html#url) if you
|
|
184
|
+
are setting up your own list.
|
|
185
|
+
* dataType - (required) The data type of the answer for the question. This determines
|
|
186
|
+
what sort of field control is provided. Supported types are:
|
|
187
|
+
* CWE - an answer list where the user is permitted to enter something
|
|
188
|
+
not on the list.
|
|
189
|
+
* CNE - an answer list where the user is **not** permitted to enter something
|
|
190
|
+
not on the list.
|
|
191
|
+
* REAL - a number which might not be an integer
|
|
192
|
+
* QTY - a type which has both a REAL value and unit object (see "units" below for
|
|
193
|
+
the structure).
|
|
194
|
+
* INT - an integer
|
|
195
|
+
* DT - a date (displayed with a calendar widget)
|
|
196
|
+
* DTM - a string with date and time
|
|
197
|
+
* TM - a string in the time format
|
|
198
|
+
* ST - a normal free-text string
|
|
199
|
+
* YEAR - a string in the format of one to four digits that represents a year
|
|
200
|
+
* MONTH - a string in the format of one or two digits that represents a month
|
|
201
|
+
* DAY - a string in the format of one or two digits that represents a day
|
|
202
|
+
* URL - a string in a valid URL format
|
|
203
|
+
* EMAIL - a string in a valid email format
|
|
204
|
+
* PHONE - a string in a valid phone number format
|
|
205
|
+
* NR - a numeric range, in the format of two values separated by "^".
|
|
206
|
+
Having one number on either side of "^" is allowed.
|
|
207
|
+
* SECTION - a special type for sections, which contain sub items in the
|
|
208
|
+
<a href="#items">items</a> field
|
|
209
|
+
* TITLE - a special type for separators that display some text.
|
|
210
|
+
* attachment - a control to upload and download attachment files.
|
|
211
|
+
* units - For numeric answer fields, this is an optional list for the units
|
|
212
|
+
for the quantity being entered. If the data type is INT or REAL, units
|
|
213
|
+
should only have one unit; otherwise the data type will be converted to
|
|
214
|
+
QTY. Each hash in this array can contain the following keys:
|
|
215
|
+
* name - The display string for the unit
|
|
216
|
+
* code - Code associated with the unit
|
|
217
|
+
* system - Code system associated with the unit
|
|
218
|
+
* default - If true, this unit will be the default unit, which means it
|
|
219
|
+
will show up in the field when the question is shown and the user does
|
|
220
|
+
not have to pick it. If false, this key can be omitted.
|
|
221
|
+
* editable - (optional) If "0" the input field is readonly/disabled; any other value
|
|
222
|
+
makes the input field editable.
|
|
223
|
+
* header - If true, then this is not a question but a section, which can
|
|
224
|
+
contain its own <a href="#items">items</a> array of questions and sections.
|
|
225
|
+
* skipLogic - Controls the hiding/showing of this question or section based
|
|
226
|
+
on data entered in other parts of the form. The value is a hash with the
|
|
227
|
+
following keys:
|
|
228
|
+
* conditions - An array of the conditions to be met. Each condition is a
|
|
229
|
+
hash with the following keys:
|
|
230
|
+
* source - The linkId of another question. The source item could be any question on the form.
|
|
231
|
+
* trigger - A hash defining a condition about the value for the
|
|
232
|
+
question specified by "source". The hash can either have a "value"
|
|
233
|
+
key, or some combination of minExclusive, minInclusive, maxExclusive,
|
|
234
|
+
or maxInclusive. The meaning of the keys is as follows:
|
|
235
|
+
* value - A value that the answer for the “source” question must match to fire the trigger.
|
|
236
|
+
* For value types string, number, or boolean, the answer and trigger value
|
|
237
|
+
must exactly match.
|
|
238
|
+
* For (source) questions with lists (CNE/CWE), the trigger value should
|
|
239
|
+
be a "code object" with any or all of these three fields: code, system, and text,
|
|
240
|
+
for example: {"code": "LA2-8", "system": "http://loinc.org"}.
|
|
241
|
+
The trigger value will be considered to match the answer if 1) code systems
|
|
242
|
+
either match or are unspecified, and 2) either a) codes are specified and match
|
|
243
|
+
or b) codes are unspecified and the texts are specified and match.
|
|
244
|
+
Other trigger value fields, if any, are not used for matching.
|
|
245
|
+
* notEqual - a value which the source question's value is not equal to. it's value could be
|
|
246
|
+
a string, number, or boolean, or a 'code object'. See "value" above.
|
|
247
|
+
* exists - if it is true, the condition is met if the source question has a answer.
|
|
248
|
+
if it is false, the condition is met if the source question has no answers.
|
|
249
|
+
* minExclusive - a value which the source question's value must exceed
|
|
250
|
+
* minInclusive - a value which the source question's value must equal
|
|
251
|
+
or exceed
|
|
252
|
+
* maxExclusive - a value which the source question's value must be
|
|
253
|
+
less than
|
|
254
|
+
* maxInclusive - a value which the source question's value must equal
|
|
255
|
+
or be less than
|
|
256
|
+
* action - (optional) the action to take when the conditions are met. For now the
|
|
257
|
+
one supported value is "show" (which is also the default), and when
|
|
258
|
+
conditions are not met the question or section is disabled (and hidden).
|
|
259
|
+
* logic - (optional) either "ANY" or "ALL". If "ANY" is used, then any condition in
|
|
260
|
+
"conditions" being met will trigger the action, while for "ALL" all
|
|
261
|
+
conditions must be met. If not specified, the default is "ANY".
|
|
262
|
+
* codingInstructions - (optional) a string of help text. When this is
|
|
263
|
+
present, a help button will appear next to the question, or if the "Show
|
|
264
|
+
Help/Description" checkbox is used, the text will appear next to the
|
|
265
|
+
question (so it should be brief).
|
|
266
|
+
* codingInstructionsFormat - (optional) the text format of the codingInstructions,
|
|
267
|
+
either 'html' or 'text'. If not specified, the default is 'text'.
|
|
268
|
+
If **allowHTMLInInstructions** in **templateOptions** is set to be false,
|
|
269
|
+
then codingInstructionsFormat is ignored and treated as if it is set to 'text'.
|
|
270
|
+
No HTML formatted coding instructions will be displayed.
|
|
271
|
+
* <a name="calculationMethod"></a>calculationMethod - For fields whose value
|
|
272
|
+
is calculated from other fields, the means of calculation is specified
|
|
273
|
+
here. At present we only support a formula for summing the <a
|
|
274
|
+
href="#score">scores</a> for all the questions on the form. To have a field be the sum
|
|
275
|
+
of the scores, set calculationMethod to `{"name": "TOTALSCORE"}`.
|
|
276
|
+
* defaultAnswer - The same as [defaultAnswer](#defaultAnswer) in the
|
|
277
|
+
templateOptions section.
|
|
278
|
+
* displayControl - an object that controls the display of the item or the section.
|
|
279
|
+
Supported the fields are:
|
|
280
|
+
* answerLayout - the layout of the answers when a item has a dataType of 'CNE' or 'CWE'.
|
|
281
|
+
The supported values are 'COMBO_BOX' (default), and 'RADIO_CHECKBOX'. (see
|
|
282
|
+
[defaultAnswerLayout](#defaultAnswerLayout))
|
|
283
|
+
* css - an array of valid CSS settings that could apply to an item. (limited supports).
|
|
284
|
+
* colCSS - an array of valid CSS settings that could apply to its related column in a
|
|
285
|
+
horizontal table. It only works when its parent item/section has a
|
|
286
|
+
{"questionLayout": "horizontal"} value in its "displayControl".
|
|
287
|
+
* listColHeaders - For questions that are search lists (specified with a
|
|
288
|
+
URL in "externallyDefined" and dataType "CNE" or "CWE") this specifies
|
|
289
|
+
the column headers (as an array) that will appear over the rows of choices.
|
|
290
|
+
This is useful when each list item displays multiple fields. If
|
|
291
|
+
nothing is specified for this attribute, column headers will not be
|
|
292
|
+
shown. Headers can contain " " for non-breaking spaces between
|
|
293
|
+
words, but cannot contain HTML tags.
|
|
294
|
+
* questionLayout - the layout of the questions in the section. It works on items
|
|
295
|
+
that are sections, i.e. they contain sub items. Supported values are:
|
|
296
|
+
'vertical' (default), 'horizontal' and 'matrix'.
|
|
297
|
+
* viewMode - (optional) the view mode for the item. Permitted values are 'lg',
|
|
298
|
+
'md', 'sm', and 'auto', which determine the 4 predefined layouts for large
|
|
299
|
+
screen/container, medium screen/container, small screen/container and a
|
|
300
|
+
responsive layout. It has the priority over the value in the form level [viewMode](#viewMode).
|
|
301
|
+
If its value is not set, then the form level viewMode value is used for the item.
|
|
302
|
+
* dataControl - an array of objects that control the current question's attributes when the controlling
|
|
303
|
+
source question's value changes. Supported fields are:
|
|
304
|
+
* source - an object identifying the controlling source question. It has the following fields:
|
|
305
|
+
* sourceType - optional, the source type. Currently only "INTERNAL" is supported. The
|
|
306
|
+
default value is "INTERNAL".
|
|
307
|
+
* sourceLinkId - the linkId of the source question in the form. The source question
|
|
308
|
+
must be a question on the form.
|
|
309
|
+
* onAttribute - optional, the attribute on this question, whose value will be updated by the newly
|
|
310
|
+
constructed value. The default value is "value".
|
|
311
|
+
* dataFormat - the format of the newly constructed value. It is a hash, such as
|
|
312
|
+
`{"code": "value.RXCUIS", "text": "value.STRENGTHS_AND_FORMS"}`, when the **construction**
|
|
313
|
+
is set to be "ARRAY" or "OBJECT". It is a string, such as `"value.STRENGTHS_AND_FORMS[0]"`,
|
|
314
|
+
when the **construction** is "SIMPLE". See **construction** for details on how these formats are used.
|
|
315
|
+
* construction - the method to construct a new value based on the source question's value.
|
|
316
|
+
It supports three types:
|
|
317
|
+
* SIMPLE - the new value is a direct copy of what is on the controlling source question.
|
|
318
|
+
The **dataFormat**'s value must be string.
|
|
319
|
+
For example, if it's value is `"value.STRENGTHS_AND_FORMS[0]"`,
|
|
320
|
+
the new value could be `"325-2.25-0.19 mg Tab"`.
|
|
321
|
+
* OBJECT - the new value is a hash object. The **dataFormat**'s value must be a hash object.
|
|
322
|
+
For each key/value pair in the **dataFormat** hash object, the key is a key in the new hash object,
|
|
323
|
+
and the value is from the controlling source question's value or its attributes.
|
|
324
|
+
For example, if the **dataFormat** is `{"code": "value.code", "text": "value.GeneSymbol"}`,
|
|
325
|
+
the new object could be created as `{"code": "NM_004315.5", "text": "ASAH1"}`, where "NM_004315.5"
|
|
326
|
+
and "ASAH1" are values retrieved from the controlling source question for "value.code" and
|
|
327
|
+
"value.GeneSymbol", respectively.
|
|
328
|
+
* ARRAY - the new value is an array. The **dataFormat**'s value must be a hash object.
|
|
329
|
+
Each element object in the array is constructed according to that hash object.
|
|
330
|
+
It is similar to the processing for "OBJECT", except that for each key/value pair in the
|
|
331
|
+
**dataFormat** hash object, the value contains an array.
|
|
332
|
+
If there are more than one pairs, the arrays retrieved should have the same length.
|
|
333
|
+
Elements in the new array are constructed with the corresponding elements in these retrieved arrays.
|
|
334
|
+
For example, if the **dataFormat** is `{"code": "value.RXCUIS", "text": "value.STRENGTHS_AND_FORMS"}`,
|
|
335
|
+
the "value.RXCUIS" and the "value.STRENGTHS_AND_FORMS" of the controlling source question should
|
|
336
|
+
both contains an array and these two arrays should have the same length.
|
|
337
|
+
A sample constructed array could be
|
|
338
|
+
`[{"code": "724614", "text": "325-2.25-0.19 mg Tab"},{"code": "637540", "text": "325-4.5-0.38 mg Tab"},{"code": "848768", "text": "325-4.84 mg Tab"}]`
|
|
339
|
+
where "value.RXCUIS" is `["724614", "637540", "848768"]` and "value.STRENGTHS_AND_FORMS" is
|
|
340
|
+
`["325-2.25-0.19 mg Tab", "325-4.5-0.38 mg Tab", "325-4.84 mg Tab"]`.
|
|
341
|
+
|
|
342
|
+
### Web Component Properties:
|
|
343
|
+
* **questionnaire** - A JSON object of a FHIR Questionnaire (including FHIR SDC Questionnaire),
|
|
344
|
+
or the above LHC-Forms internal format.
|
|
345
|
+
* **options** - Optional, a JSON object. The options defined in [templateOptions](#templateOptions).
|
|
346
|
+
* **prepop** - Optional, a boolean value. A flag indicating whether to run the pre-populate operation
|
|
347
|
+
for the FHIR Questionnaire. The default value is false.
|
|
348
|
+
* **fhirVersion** - Optional, a string value. The specified FHIR version of the data provided in
|
|
349
|
+
'questionnaire'. If this is not provided, a FHIR version will be determined from
|
|
350
|
+
the 'questionnaire'. The supported FHIR versions are 'R4' and 'STU3'.
|
|
351
|
+
|
|
352
|
+
### Emitted Events:
|
|
353
|
+
|
|
354
|
+
* **onFormReady** - emitted when the form is fully initialied, and FHIRPath expressions
|
|
355
|
+
are run if any, data are pre-populated if any, and the form is ready for user interactions.
|
|
356
|
+
No data is returned in this event.
|
|
357
|
+
* **onError** - emitted when the ValueSets are not retrieved during the form initialization.
|
|
358
|
+
The form is still initialized and might be rendered, with possible missing data.
|
|
359
|
+
The first error is returned in this event.
|
|
360
|
+
|
|
361
|
+
### How to use properties and events:
|
|
362
|
+
* In HTML:
|
|
363
|
+
```
|
|
364
|
+
<wc-lhc-form id='test-form'></wc-lhc-form>
|
|
365
|
+
```
|
|
366
|
+
* JavaScript Code:
|
|
367
|
+
```
|
|
368
|
+
lhcFormWidget = document.getElementById('test-form');
|
|
369
|
+
lhcFormWidget.questionnaire = aQuesionnaire;
|
|
370
|
+
...
|
|
371
|
+
lhcFormWidget.addEventListener('onFormReady', e => {
|
|
372
|
+
// do something
|
|
373
|
+
...
|
|
374
|
+
});
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
### Utility Functions:
|
|
379
|
+
For a description of functions provided for retrieving user-entered data in
|
|
380
|
+
various formats, including FHIR, and for importing and exporting FHIR resources,
|
|
381
|
+
see the [documentation](https://lhncbc.github.io/lforms/) website.
|
|
382
|
+
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,102 +1,108 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lforms",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "33.2.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"fhir",
|
|
6
6
|
"Questionnaire",
|
|
7
7
|
"SDC"
|
|
8
8
|
],
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
"repository": "github:lhncbc/lforms",
|
|
10
|
+
"license": "See LICENSE.md",
|
|
11
|
+
"config": {
|
|
12
|
+
"testPort": "4200",
|
|
13
|
+
"testPortFhir": "4201"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"ng": "ng",
|
|
17
|
+
"start": "start-server-and-test start:fhir-dev http://localhost:$npm_package_config_testPortFhir start:lforms-dev",
|
|
18
|
+
"start:lforms-dev": "ng serve --configuration=debugging",
|
|
19
|
+
"start:fhir-dev": "webpack serve -c webpack.fhir.config.js --host localhost --env debugging=true",
|
|
20
|
+
"start-public": "node bin/start-public.js",
|
|
21
|
+
"start-dist-public": "node bin/start-public.js --dist",
|
|
22
|
+
"build:lforms-dev:update": "npm run build:lforms-dev && npm run build:prepare-zip",
|
|
23
|
+
"build:lforms-dev": "ng build --configuration=debugging --extra-webpack-config webpack.lforms.extra.config.js && node concatenate.js",
|
|
24
|
+
"build:lforms": "ng build --configuration production --extra-webpack-config webpack.lforms.extra.config.js && node concatenate.js",
|
|
25
|
+
"build:fhir-dev:update": "npm run build:fhir-dev",
|
|
26
|
+
"build:fhir-dev": "webpack --config ./webpack.fhir.config.js --env fhirOnly=true --env debugging=true",
|
|
27
|
+
"build:fhir": "webpack --config ./webpack.fhir.config.js --env fhirOnly=true",
|
|
28
|
+
"build-dev": "npm run build:init && npm run build:fhir-dev && npm run build:lforms-dev && npm run build:prepare-zip && npm run build:zip",
|
|
29
|
+
"build": "npm run build:init && npm run build:fhir && npm run build:lforms && npm run build:prepare-zip && npm run build:zip",
|
|
30
|
+
"build:clean": "shx rm -rf dist src/test/lib",
|
|
31
|
+
"build:init": "npm run build:clean && shx mkdir -p dist/$npm_package_name && shx cp src/index.js dist && npm run build:version",
|
|
32
|
+
"build:prepare-zip": "node prepare-zip.js",
|
|
33
|
+
"build:zip": "cd dist; shx mv $npm_package_name $npm_package_name-$npm_package_version; bestzip $npm_package_name-$npm_package_version.zip $npm_package_name-$npm_package_version/*; shx mv $npm_package_name-$npm_package_version $npm_package_name",
|
|
34
|
+
"build:version": "node -e 'require(\"fs\").writeFileSync(\"src/version.json\", JSON.stringify({lformsVersion: require(\"./package.json\").version}))'",
|
|
35
|
+
"test:fhir-unit": "karma start test/karma.conf.js",
|
|
36
|
+
"test:ng-unit": "ng test --watch=false",
|
|
37
|
+
"test:unit": "npm run test:fhir-unit && npm run test:ng-unit",
|
|
38
|
+
"test:e2e:fhir-server": "start-server-and-test start:fhir-dev http://localhost:$npm_package_config_testPortFhir test:e2e:lforms-server",
|
|
39
|
+
"test:e2e:lforms-server": "start-server-and-test start:lforms-dev http://localhost:$npm_package_config_testPort cy:run",
|
|
40
|
+
"test:e2e": "npm run test:e2e:fhir-server",
|
|
41
|
+
"test:e2e:fhir-server:open": "start-server-and-test start:fhir-dev http://localhost:$npm_package_config_testPortFhir test:e2e:lforms-server:open",
|
|
42
|
+
"test:e2e:lforms-server:open": "start-server-and-test start:lforms-dev http://localhost:$npm_package_config_testPort cy:open",
|
|
43
|
+
"test:e2e:open": "npm run test:e2e:fhir-server:open",
|
|
44
|
+
"test": "npm run test:unit && npm run test:e2e",
|
|
45
|
+
"test-coverage": "ng test --no-watch --code-coverage",
|
|
46
|
+
"cy:open": "cypress open",
|
|
47
|
+
"cy:run": "cypress run",
|
|
48
|
+
"test-pages": "http-server -o /test/pages/build_test_fhirpath.html"
|
|
49
|
+
},
|
|
13
50
|
"dependencies": {
|
|
14
|
-
"@
|
|
15
|
-
"angular": "
|
|
16
|
-
"angular
|
|
17
|
-
"angular
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"jquery": "^3.
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
51
|
+
"@angular/animations": "~14.2.12",
|
|
52
|
+
"@angular/common": "~14.2.12",
|
|
53
|
+
"@angular/compiler": "~14.2.12",
|
|
54
|
+
"@angular/core": "~14.2.12",
|
|
55
|
+
"@angular/elements": "^14.2.12",
|
|
56
|
+
"@angular/forms": "~14.2.12",
|
|
57
|
+
"@angular/platform-browser": "~14.2.12",
|
|
58
|
+
"@angular/platform-browser-dynamic": "~14.2.12",
|
|
59
|
+
"@angular/router": "~14.2.12",
|
|
60
|
+
"@lhncbc/ucum-lhc": "^4.1.6",
|
|
61
|
+
"@types/jquery": "^3.5.14",
|
|
62
|
+
"autocomplete-lhc": "^18.5.0",
|
|
63
|
+
"deep-equal": "^2.0.5",
|
|
64
|
+
"fast-copy": "^2.1.7",
|
|
65
|
+
"fhirpath": "3.2.0",
|
|
66
|
+
"jquery": "^3.6.1",
|
|
67
|
+
"moment": "^2.29.4",
|
|
68
|
+
"ng-zorro-antd": "^14.1.1",
|
|
69
|
+
"rxjs": "~6.6.7",
|
|
70
|
+
"tslib": "^2.4.1",
|
|
71
|
+
"zone.js": "~0.11.8"
|
|
31
72
|
},
|
|
32
73
|
"devDependencies": {
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"grunt-wiredep": "^3.0.1",
|
|
52
|
-
"jasmine-core": "^2.3.4",
|
|
53
|
-
"jasmine-spec-reporter": "^2.7.0",
|
|
54
|
-
"jit-grunt": "^0.10.0",
|
|
55
|
-
"jshint-stylish": "^1.0.0",
|
|
56
|
-
"karma": "^6.3.4",
|
|
74
|
+
"@angular-devkit/build-angular": "~14.2.10",
|
|
75
|
+
"@angular/cli": "^14.2.10",
|
|
76
|
+
"@angular/compiler-cli": "~14.2.12",
|
|
77
|
+
"@cypress/schematic": "^2.2.0",
|
|
78
|
+
"@types/jasmine": "~4.3.0",
|
|
79
|
+
"@types/jasminewd2": "~2.0.10",
|
|
80
|
+
"@types/node": "^18.11.9",
|
|
81
|
+
"bestzip": "^2.2.0",
|
|
82
|
+
"chai": "^4.3.6",
|
|
83
|
+
"concat": "^1.0.3",
|
|
84
|
+
"cypress": "^10.10.0",
|
|
85
|
+
"cypress-plugin-tab": "^1.0.5",
|
|
86
|
+
"fs-extra": "^10.1.0",
|
|
87
|
+
"http-server": "^14.1.1",
|
|
88
|
+
"jasmine-core": "~4.5.0",
|
|
89
|
+
"jasmine-spec-reporter": "~5.0.0",
|
|
90
|
+
"jszip": "^3.10.0",
|
|
91
|
+
"karma": "^6.4.1",
|
|
57
92
|
"karma-chai": "^0.1.0",
|
|
58
|
-
"karma-chrome-launcher": "
|
|
59
|
-
"karma-
|
|
60
|
-
"karma-
|
|
93
|
+
"karma-chrome-launcher": "~3.1.1",
|
|
94
|
+
"karma-coverage": "^2.2.0",
|
|
95
|
+
"karma-jasmine": "~5.1.0",
|
|
96
|
+
"karma-jasmine-html-reporter": "^2.0.0",
|
|
97
|
+
"karma-mocha": "^2.0.1",
|
|
61
98
|
"karma-mocha-reporter": "^2.2.5",
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"node
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"serve-static": "^1.13.2",
|
|
71
|
-
"style-loader": "^0.23.1",
|
|
72
|
-
"time-grunt": "^1.0.0",
|
|
73
|
-
"tmp": "^0.2.1",
|
|
74
|
-
"uglify-js": "^3.4.10",
|
|
75
|
-
"webpack": "^4.42.1",
|
|
76
|
-
"webpack-cli": "^3.3.11",
|
|
77
|
-
"wiredep": "^4.0.0"
|
|
78
|
-
},
|
|
79
|
-
"repository": "github:lhncbc/lforms",
|
|
80
|
-
"license": "See LICENSE.md",
|
|
81
|
-
"scripts": {
|
|
82
|
-
"wiredep": "grunt wiredep",
|
|
83
|
-
"webpack": "webpack",
|
|
84
|
-
"webpack:fhir": "webpack --env.fhirOnly=true",
|
|
85
|
-
"webpack:r4": "webpack --env.r4Only=true",
|
|
86
|
-
"webpack:main": "webpack --env.mainOnly=true",
|
|
87
|
-
"test": "npm run update-webdriver && grunt test",
|
|
88
|
-
"test:e2e": "npm run update-webdriver && grunt test:e2e",
|
|
89
|
-
"build:clean": "rm -rf dist bower-dist app/generated .tmp",
|
|
90
|
-
"build:mkdist": "mkdir dist; mkdir -p dist/$npm_package_name-$npm_package_version/styles; (cd dist; ln -s $npm_package_name-$npm_package_version latest)",
|
|
91
|
-
"build:version": "node -e 'require(\"fs\").writeFileSync(\"app/version.json\", JSON.stringify({lformsVersion: require(\"./package.json\").version}))'",
|
|
92
|
-
"build:css:lforms": "cleancss --skip-rebase -o dist/latest/styles/lforms.min.css dist/latest/styles/lforms.css",
|
|
93
|
-
"build:css:themes": "node-sass app/styles/themes.scss --output .tmp/styles && cleancss --skip-rebase -o dist/latest/styles/themes.min.css .tmp/styles/themes.css",
|
|
94
|
-
"build:css": "npm run build:css:themes && npm run build:css:lforms",
|
|
95
|
-
"build:zip": "cd dist; dirname=$npm_package_name-$npm_package_version; zip -r $dirname.zip $dirname",
|
|
96
|
-
"build:ngtemplates": "grunt ngtemplates",
|
|
97
|
-
"build": "npm run build:clean && npm run build:mkdist && npm run build:version && npm run build:ngtemplates && webpack && npm run build:css && npm run wiredep && npm run build:zip",
|
|
98
|
-
"update-webdriver": "node node_modules/protractor/bin/webdriver-manager update --versions.chrome $(google-chrome --version |awk '{print $NF}')",
|
|
99
|
-
"debug-karma": "karma start karma.conf.js --browsers=Chrome --single-run=false",
|
|
100
|
-
"start": "grunt serve"
|
|
99
|
+
"mocha": "^10.1.0",
|
|
100
|
+
"ngx-build-plus": "^14.0.0",
|
|
101
|
+
"shx": "^0.3.4",
|
|
102
|
+
"start-server-and-test": "^1.14.0",
|
|
103
|
+
"ts-node": "~10.9.1",
|
|
104
|
+
"tslint": "~6.1.3",
|
|
105
|
+
"typescript": "~4.8.4",
|
|
106
|
+
"webpack-cli": "^4.10.0"
|
|
101
107
|
}
|
|
102
108
|
}
|