GithubHelp home page GithubHelp logo

lhncbc / formbuilder-lhcforms Goto Github PK

View Code? Open in Web Editor NEW
26.0 4.0 21.0 7.87 MB

Build LHC-Forms and FHIR Questionnaires

License: Other

JavaScript 3.83% CSS 1.02% HTML 10.45% TypeScript 84.70%
lhc-forms fhir-questionnaire

formbuilder-lhcforms's Introduction

Installation

  1. Install nodejs package globally on your system.

  2. Clone git repository of formbuilder-lhcforms.

     $ git clone https://github.com/lhncbc/formbuilder-lhcforms.git
    
  3. Build the project.

    • To build the project, change to formbuilder-lhcforms directory. Edit bashrc.formbuilder file to suit your development environment. Make sure that ./node_modules/.bin is in your path for the rest of the installation.

       $ cd formbuilder-lhcforms
       $ source bashrc.formbuilder
       $ npm ci && npm run build
       $ npm test ## Optional
      

Running the application

  • To deploy on a production webserver:

      $ cp dist/formbuilder-lhcforms {webserver docs location}
    
  • To start dev server locally:

      $ npm start
    

    Point the browser at http://localhost:9030

Application Programming Interface (API)

The form builder is an application. However, it is possible to control it via JavaScript from another web page. Refer to API.md for documentation.

formbuilder-lhcforms's People

Contributors

akanduru avatar dependabot[bot] avatar ghaliouss avatar jcy1225 avatar kanduru avatar lhcye avatar muhammad-levi avatar plynchnlm avatar wamorn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

formbuilder-lhcforms's Issues

security and audit

Hello,

we forked from your project at the 9.1.6 version.

we developped some new functionalities to adapt the FB to the needs of our institution (APHP) and we run audit tools (sonar) to highlight, and correct, flaws in "our" code.

It also higligth some (not critical) flaws in "your" code :

image

Were you aware of these?

And subsidiarily, would it be possible to have an insight on the quality/security checks you are implementing?

Sincerely

Nicolas

conditional display > Answer field does not work with answerValueSet

Hello,

The following JSON was created using the formbuilder :

{
  "resourceType": "Questionnaire",
  "extension": [
    {
      "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-preferredTerminologyServer",
      "valueUrl": "https://hapi-fhir-server-dev-ext-k8s.eds.aphp.fr/fhir/"
    }
  ],
  "title": "New Form",
  "status": "draft",
  "item": [
    {
      "item": [
        {
          "type": "string",
          "linkId": "9191010295087",
          "text": "item that should be enabled only in certain circumstances, but it don't work so, there is no condition"
        }
      ],
      "type": "choice",
      "extension": [
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
          "valueCodeableConcept": {
            "coding": [
              {
                "system": "http://hl7.org/fhir/questionnaire-item-control",
                "code": "drop-down",
                "display": "Drop down"
              }
            ]
          }
        }
      ],
      "linkId": "2643956466117",
      "text": "choice item with answerValueSet",
      "answerValueSet": "https://aphp.fr/ig/fhir/sdc/ValueSet/aphp-sdc-aph-mat-ddg-vs"
    }
  ]
}

my apologize for using a local terminology serveur, but it works :

image

However, it is not possible to file the conditional display > answer field of the 9191010295087 item, the list is desperatly empty :

image

Application integration

There are useful functions to work with forms:

form_data=LForms.Util.getFormFHIRData('QuestionnaireResponse', "R4", div)
. . .
LForms.Util.addFormToPage(form_data, div);

But for formbuilder no such functionality.

Formbuilder can connect to fhir server, but do not remember it, cannot send authentiation data, cant add search criteria.
Can only save as new QuestionnaireResponse, but cannot modify existing.

It would be nice to add similar functions (getFormFHIRData,addFormToPage) for formbuilder.

v8.0.2 missing scoring toggle

In previous version of builder a scoring attribute was included for selection in builder.
Is this an oversight or was feature removed.

Also noted lforms export from previous builder many time will import in v8 however will not enable the Edit Questions button.

grunt build is taking too much of time

grunt build is taking too much of time

OS : CentOS Linux 8
Kernel : Linux 4.18.0-305.10.2.el8_4.x86_64 x86_64
node : v14.17.4
npm : 6.14.14
grunt-cli : v1.4.3

grunt build --unhandled-rejections=none --verbose
Initializing
Command-line options: --verbose, --no-respawning, --gruntfile=./formbuilder-lhcforms/Gruntfile.js

Reading "Gruntfile.js" Gruntfile...OK

Registering Gruntfile tasks.
Reading package.json...OK
Parsing package.json...OK
Initializing config...OK
Loading "Gruntfile.js" tasks...OK

  • build, createDir, createDockerImage, createFreshDockerImage, default, deleteDir, express-keepalive, open, prune_modules, s, serve, server, test, update_webdriver, wait

Running tasks: build

Running "build" task

Loading "grunt-contrib-clean" plugin

Registering "./formbuilder-lhcforms/node_modules/grunt-contrib-clean/tasks" tasks.
Loading "clean.js" tasks...OK

  • clean

Running "clean:dist" (clean) task
Verifying property clean.dist exists in config...OK
Files: [no src]
Options: force=false, no-write=false

0 paths cleaned.

Loading "grunt-concurrent" plugin

Registering "./formbuilder-lhcforms/node_modules/grunt-concurrent/tasks" tasks.
Loading "concurrent.js" tasks...OK

  • concurrent

Running "concurrent:dist" (concurrent) task
Verifying property concurrent.dist exists in config...OK
Files: [no src] -> dist
Options: limit=4

--STUCK at above line from several minutes--
Any reason or anything I am missing. I can grunt server command and check application run in the browser.

unit field limited by precoordinated ucum unit

It is not possible to enter valid ucum unit in the unit field if they are not 'precoordinated' in the API used.

For exemple :

image

image

image

In such case, it leads to the following extension :

      "extension": [
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit",
          "valueCoding": {
            "code": "/mm3",
            "display": "/mm3"
          }
        }
      ]

it is of course possible to :

  • convert the unit for precoordinated : /mm3 --> /ul
  • discard the annotation :
    • wk{gestationnal} --> wk
    • I'm less confident in {pack}.a --> a ?

but we loose some convenient annotation and possibly some users used to one unit

Instead of relying on a limited precoordinated set of unit, it could be possible just to validate the unit filed by the user in the field ?
Or just enriching the list of precoordinated units ?
Or add an option in the formbuilder to fully specify unit (codesystem, code and display) ?

There is probably tons of solution...

Conditional color formatting

Is it possible to create a form with conditional formatting using the formbuilder? For example: an answer field becomes e.g. RED if a value is bigger than 100 and green otherwise.
If so, how?

Export form as lforms json

When using the new version, it does not allow to export the created questionnaire in the LFORMS structure. Using the /previous version does allow it.

We need this format to be able to render forms that calculate scores based on answers. When rendering it from the FHIR structure using the renderer widget, it does not calculate scores that should be automatically calculated.

Is this export possible in the new builder version?

Thanks!

Customize display feature for choices and open choices missing in new editor

Are there any plans to port / re-implement the 'Customize display' functionality (e.g. radio buttons or checkboxes for choice and open choice questions), like it was available in the previous version of the editor (under advanced item attributes)? Having checkboxes or radio buttons reduces the number of clicks, especially for questions having only a few answers.

Current work-around is to first save the form on disk and manually add the FHIR extension where needed ...

Thanks for building the NLM Form builder, I am not aware of a better editor to create FHIR questionnaires!

Customizing UI via formbuilder - gtable

Linked to LHNCBC/lforms#115 (comment)

When using Lforms you can adapt the json structure of your questionnaire to use gtable to customize your UI a bit. However, our doctors cannot change the json. Therefore we would like a way to implement tables in Lforms by doing some setup in formbuilder.

suppression of unit in the UI impact on json not correct

filling the unit field of an integer item

image

leads to the following json :

{
  "item": [
    {
      "type": "integer",
      "extension": [
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit",
          "valueCoding": {
            "system": "http://unitsofmeasure.org",
            "code": "g/L",
            "display": "gram per liter"
          }
        }
      ],
      "linkId": "2603837273225",
      "text": "New item 1"
    }
  ],
  "resourceType": "Questionnaire",
  "title": "New Form",
  "status": "draft"
}

And it is good.

However, deleting the content of the units field :

image

leads to the following json :

{
  "item": [
    {
      "type": "integer",
      "extension": [
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit",
          "valueCoding": {
            "system": "http://unitsofmeasure.org",
            "code": "g/L",
            "display": "gram per liter"
          }
        },
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit"
        }
      ],
      "linkId": "2603837273225",
      "text": "New item 1"
    }
  ],
  "resourceType": "Questionnaire",
  "title": "New Form",
  "status": "draft"
}

Which is not good I think.

help for finding valueSet.url

As formBuilder user, not necessarily familiar with ValueSet en CodeSystem management, the current field answer value set requires me to find the url on my own, which is not very user friendly.

We are thinking of adding some feature on the formbuilder to help Questionnaire conceptors to fill this field.

We have currently 3 ideas in mind.

Autocomplete for Answer value set field

This option consists only in providing an autocomplete feature in this field based on the ValueSets available in the FHIR serveur defined in the preferredTerminologyServer extension.

The autocomplete can be based on the url only, or on other attributes of the questionnaire (name, title, id... like for the units field with UCUM).

ValueSet search engine

It consists in :

  • adding a button in the answer value set field to call a pop up with a ValueSet search engine
  • the pop up is similar to the one used for importing questionnaire from a fhirserver. We thought that it should allow the creation of query based on the following search parameter :
    • _content:contains
    • publication-status
    • context-type-value (we are also thinking about ading this field in the Form level attributes page)
  • each result is described by : title, description, useContext
  • selecting a ValueSet in the results automaticaly close the popup and fill the answer value set field with the corresponding url

ValueSet (and CodeSystem) management tool (light)

It consists in having a new interface that allows ValueSet edition "for dummies".
We do not have a clear idea on how to manage this, because we don't want the user to face the complexity of valueSet composition from codesystem.

One option would be to associate resources (valueSet, codeSystem and questionnaire) based on their useContext. The FormBuilder would only allow, for a questionnaire with useContext A :

  • the addition of concept in the codeSystem with useContext A
  • the creation/edition of valueSet with useContext A. Such valueset would :
    • be extensional
    • contain only concepts belonging to the codeSystem with useContext A
  • the association of a choice item with valueSet with useContext A

The user interface would mask most of the complexity to the user by only asking for a title, a list of terms, and maybe a description and a status.
The tool would automatically create the codeSystem
The tool would automatically add any term filled by the user as a concept (flat list)

However it is clearly not an option that allow the creation of well managed terminological resources...

Are you interested in working on such development? (We will do but having more brain on this topic could lead to better feature and less maintenance).

Sincerely

Option to manually set linkId for a question

In the previous version of the form builder one needed to set a unique linkId for every question. The new version automatically generates linkIds, which is great.

We have code that prepopulates a form based on linkId, value pairs and therefore it would be nice to have the ability to manually set more meaningful linkIds in the form editor. For example, one option could be to make the linkId available again (already prefilled with a UID) under "Advanced fields". Don't know how complicated this is to implement, but wondering if others might also miss the linkId in the new form editor.

questionnaire level terminology server not working in rendered preview

If I specify a terminology server on a specific item :

{
  "item": [
    {
      "type": "choice",
      "extension": [
        {
          "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-preferredTerminologyServer",
          "valueUrl": "http://localhost:8080/fhir"
        }
      ],
      "linkId": "6023150328635",
      "text": "Item 0",
      "answerValueSet": "http://terminology.aphp.fr/ValueSet/risqueatcdmaternel-vs"
    }
  ],
  "resourceType": "Questionnaire",
  "title": "New Form",
  "status": "draft"
}

It 'works' on the preview rendered :
image

But if I specify the server at the questionnaire level :

{
  "item": [
    {
      "type": "choice",
      "linkId": "6023150328635",
      "text": "Item 0",
      "answerValueSet": "http://terminology.aphp.fr/ValueSet/risqueatcdmaternel-vs"
    }
  ],
  "resourceType": "Questionnaire",
  "extension": [
    {
      "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-preferredTerminologyServer",
      "valueUrl": "http://localhost:8080/fhir"
    }
  ],
  "title": "New Form",
  "status": "draft"
}

It does not work :
image

Able to create and export complex Questionnaire that does not pass FHIR v4 schema validation

When testing application output using the Form Builder, I was able to create and export a complex Questionnaire that then does not pass FHIR 4.0 schema validation.

The form that is giving errors is included at the end of the post.
Code Snippet:

def test_complex():
    import json
    import jsonschema
    
    with open("complex.json", "r") as f:
        complex = json.load(f)
        
    with open("fhir_schema_4.json", "r") as f:
        schema = json.load(f)

    jsonschema.validate(instance=complex, schema=schema)

The error is broken into the three parts:

  • message:
"Additional properties are not allowed ('enableWhen', 'type' were unexpected)"
  • the invalid object
{
  "text": "List the Other Medications you've taken",
  "linkId": "498302662737",
  "type": "string",
  "enableWhen": [
    {
      "question": "953933492618",
      "operator": "=",
      "answerCoding": {
        "display": "Other"
      }
    }
  ]
}
  • schema being referenced (seems like QuestionnaireResponse_Item is being referenced somehow when it should still be QuestionnaireItem?)
{
  "additionalProperties": false,
  "description": "A structured set of questions and their answers. The questions are ordered and grouped into coherent subsets, corresponding to the structure of the grouping of the questionnaire being responded to.",
  "properties": {
    "_definition": {
      "$ref": "#/definitions/Element",
      "description": "Extensions for definition"
    },
    "_linkId": {
      "$ref": "#/definitions/Element",
      "description": "Extensions for linkId"
    },
    "_text": {
      "$ref": "#/definitions/Element",
      "description": "Extensions for text"
    },
    "answer": {
      "description": "The respondent's answer(s) to the question.",
      "items": {
        "$ref": "#/definitions/QuestionnaireResponse_Answer"
      },
      "type": "array"
    },
    "definition": {
      "$ref": "#/definitions/uri",
      "description": "A reference to an [[[ElementDefinition]]] that provides the details for the item."
    },
    "extension": {
      "description": "May be used to represent additional information that is not part of the basic definition of the element. 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.",
      "items": {
        "$ref": "#/definitions/Extension"
      },
      "type": "array"
    },
    "id": {
      "$ref": "#/definitions/string",
      "description": "Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces."
    },
    "item": {
      "description": "Questions or sub-groups nested beneath a question or group.",
      "items": {
        "$ref": "#/definitions/QuestionnaireResponse_Item"
      },
      "type": "array"
    },
    "linkId": {
      "$ref": "#/definitions/string",
      "description": "The item from the Questionnaire that corresponds to this item in the QuestionnaireResponse resource."
    },
    "modifierExtension": {
      "description": "May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. 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. Applications processing a resource are required to check for modifier extensions.\n\nModifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).",
      "items": {
        "$ref": "#/definitions/Extension"
      },
      "type": "array"
    },
    "text": {
      "$ref": "#/definitions/string",
      "description": "Text that is displayed above the contents of the group or as the text of the question being answered."
    }
  }
}

troublesome form:

{
  "resourceType": "Questionnaire",
  "title": "Complex Survey",
  "status": "draft",
  "item": [
    {
      "code": [
        {
          "system": "http://loinc.org",
          "code": "30525-0",
          "display": "Age"
        }
      ],
      "text": "How old are you?",
      "type": "integer",
      "extension": [
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit",
          "valueCoding": {
            "system": "http://unitsofmeasure.org",
            "code": {
              "unit": "a"
            },
            "display": {
              "unit": "a"
            }
          }
        },
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit",
          "valueCoding": {
            "system": "http://unitsofmeasure.org",
            "code": "a",
            "display": "year"
          }
        },
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit",
          "valueCoding": {
            "system": "http://unitsofmeasure.org",
            "code": "a",
            "display": "year"
          }
        },
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit",
          "valueCoding": {
            "code": "year",
            "display": "year"
          }
        },
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit",
          "valueCoding": {
            "system": "http://unitsofmeasure.org",
            "code": "a",
            "display": "year"
          }
        },
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit",
          "valueCoding": {
            "system": "http://unitsofmeasure.org",
            "code": "a",
            "display": "year"
          }
        }
      ],
      "linkId": "1923091934343",
      "required": true
    },
    {
      "code": [
        {
          "system": "http://loinc.org",
          "code": "8302-2",
          "display": "Body height"
        }
      ],
      "text": "Height",
      "type": "decimal",
      "extension": [
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit",
          "valueCoding": {
            "system": "http://unitsofmeasure.org",
            "code": {
              "unit": "[in_us]"
            },
            "display": {
              "unit": "[in_us]"
            }
          }
        },
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit",
          "valueCoding": {
            "system": "http://unitsofmeasure.org",
            "code": {
              "unit": "cm"
            },
            "display": {
              "unit": "cm"
            }
          }
        },
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit",
          "valueCoding": {
            "system": "http://unitsofmeasure.org",
            "code": {
              "unit": "m"
            },
            "display": {
              "unit": "m"
            }
          }
        },
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit",
          "valueCoding": {
            "system": "http://unitsofmeasure.org",
            "code": "[ft_i]",
            "display": "foot"
          }
        },
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit",
          "valueCoding": {
            "system": "http://unitsofmeasure.org",
            "code": "[in_i]",
            "display": "inch"
          }
        },
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit",
          "valueCoding": {
            "system": "http://unitsofmeasure.org",
            "code": "[in_i]",
            "display": "inch"
          }
        }
      ],
      "linkId": "6375311029779",
      "initial": [
        {
          "valueDecimal": 0
        }
      ],
      "item": [
        {
          "text": "Height in Inches",
          "type": "display",
          "linkId": "6375311029779_helpText",
          "extension": [
            {
              "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
              "valueCodeableConcept": {
                "text": "Help-Button",
                "coding": [
                  {
                    "code": "help",
                    "display": "Help-Button",
                    "system": "http://hl7.org/fhir/questionnaire-item-control"
                  }
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "code": [
        {
          "system": "http://loinc.org",
          "code": "29463-7",
          "display": "Weight"
        }
      ],
      "text": "Weight",
      "type": "integer",
      "extension": [
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit",
          "valueCoding": {
            "system": "http://unitsofmeasure.org",
            "code": {
              "unit": "[lb_av]"
            },
            "display": {
              "unit": "[lb_av]"
            }
          }
        },
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit",
          "valueCoding": {
            "system": "http://unitsofmeasure.org",
            "code": {
              "unit": "kg"
            },
            "display": {
              "unit": "kg"
            }
          }
        },
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit",
          "valueCoding": {
            "system": "http://unitsofmeasure.org",
            "code": "[lb_av]",
            "display": "pound"
          }
        },
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit",
          "valueCoding": {
            "system": "http://unitsofmeasure.org",
            "code": "[lb_av]",
            "display": "pound"
          }
        },
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unit",
          "valueCoding": {
            "system": "http://unitsofmeasure.org",
            "code": "[lb_av]",
            "display": "pound"
          }
        }
      ],
      "linkId": "5681920227726",
      "item": [
        {
          "text": "Weight in Pounds",
          "type": "display",
          "linkId": "5681920227726_helpText",
          "extension": [
            {
              "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
              "valueCodeableConcept": {
                "text": "Help-Button",
                "coding": [
                  {
                    "code": "help",
                    "display": "Help-Button",
                    "system": "http://hl7.org/fhir/questionnaire-item-control"
                  }
                ]
              }
            }
          ]
        }
      ]
    },
    {
      "text": "Sleep Habits",
      "linkId": "7830041069695",
      "type": "group",
      "item": [
        {
          "text": "About how many hours do you usually sleep a day?",
          "linkId": "975641938256",
          "type": "decimal",
          "maxLength": 24,
          "extension": [
            {
              "url": "http://hl7.org/fhir/StructureDefinition/maxValue",
              "valueDecimal": 24
            }
          ]
        },
        {
          "text": "What time do you usually go to bed at night",
          "linkId": "5595233028971",
          "type": "time"
        },
        {
          "text": "What time do you usually wake up in the morning",
          "linkId": "9775046682141",
          "type": "time"
        }
      ]
    },
    {
      "text": "Have you ever experienced back pain",
      "linkId": "7507688589592",
      "type": "boolean",
      "initial": [
        {
          "valueBoolean": true
        }
      ],
      "repeats": false,
      "required": true,
      "readOnly": false
    },
    {
      "text": "Back Pain Details",
      "linkId": "6696083212404",
      "type": "group",
      "enableBehavior": "all",
      "enableWhen": [
        {
          "question": "7507688589592",
          "operator": "=",
          "answerBoolean": true
        }
      ],
      "item": [
        {
          "text": "Have you ever taken medication to manage back pain?",
          "linkId": "6506631093455",
          "type": "boolean",
          "item": [
            {
              "text": "Which Medications have you taken?",
              "linkId": "953933492618",
              "type": "open-choice",
              "initial": [
                {
                  "valueCoding": {
                    "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
                    "code": "1243440",
                    "display": "Tylenol"
                  }
                }
              ],
              "answerOption": [
                {
                  "valueCoding": {
                    "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
                    "code": "1243440",
                    "display": "Tylenol"
                  }
                },
                {
                  "valueCoding": {
                    "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
                    "code": "1088953",
                    "display": "Codeine"
                  }
                },
                {
                  "valueCoding": {
                    "display": "Apirin"
                  }
                },
                {
                  "valueCoding": {
                    "display": "Other"
                  }
                }
              ],
              "repeats": true,
              "required": false,
              "enableBehavior": "all",
              "enableWhen": [
                {
                  "question": "6506631093455",
                  "operator": "=",
                  "answerBoolean": true
                }
              ],
              "item": [
                {
                  "text": "List the Other Medications you've taken",
                  "linkId": "498302662737",
                  "type": "string",
                  "enableWhen": [
                    {
                      "question": "953933492618",
                      "operator": "=",
                      "answerCoding": {
                        "display": "Other"
                      }
                    }
                  ]
                }
              ]
            }
          ],
          "enableWhen": [
            {
              "question": "7507688589592",
              "operator": "=",
              "answerBoolean": true
            }
          ]
        },
        {
          "text": "How long has it been since you last experienced back pain",
          "linkId": "4931421371812",
          "type": "choice",
          "answerOption": [
            {
              "valueCoding": {
                "display": "Within the last 2 weeks"
              }
            },
            {
              "valueCoding": {
                "display": "Within the last month"
              }
            },
            {
              "valueCoding": {
                "display": "Within the last year"
              }
            },
            {
              "valueCoding": {
                "display": "I don't remember"
              }
            }
          ],
          "enableWhen": [
            {
              "question": "7507688589592",
              "operator": "=",
              "answerBoolean": true
            }
          ],
          "enableBehavior": "all"
        },
        {
          "code": [
            {
              "system": "http://loinc.org",
              "code": "91348-3",
              "display": "Overall, how bothersome has your back pain been in the last 2 weeks?"
            }
          ],
          "text": "Overall, how bothersome has your back pain been in the last 2 weeks?",
          "answerOption": [
            {
              "valueCoding": {
                "system": "http://loinc.org",
                "code": "LA6568-5",
                "display": "Not at all"
              }
            },
            {
              "valueCoding": {
                "system": "http://loinc.org",
                "code": "LA14454-5",
                "display": "Slightly"
              }
            },
            {
              "valueCoding": {
                "system": "http://loinc.org",
                "code": "LA13939-6",
                "display": "Moderately"
              }
            },
            {
              "valueCoding": {
                "system": "http://loinc.org",
                "code": "LA13914-9",
                "display": "Very much"
              }
            },
            {
              "valueCoding": {
                "system": "http://loinc.org",
                "code": "LA14868-6",
                "display": "Extremely"
              }
            }
          ],
          "type": "choice",
          "linkId": "8557662912930",
          "enableWhen": [
            {
              "question": "4931421371812",
              "operator": "=",
              "answerCoding": {
                "display": "Within the last 2 weeks"
              }
            }
          ]
        }
      ]
    },
    {
      "text": "What day was your last visit with your doctor",
      "linkId": "1967077637018",
      "type": "date",
      "item": [
        {
          "text": "What is your doctor's name",
          "linkId": "6663760446550",
          "type": "text",
          "maxLength": 30
        },
        {
          "text": "Did you visit your doctor for your back pain?",
          "linkId": "4165088966004",
          "type": "boolean",
          "initial": [
            {
              "valueBoolean": false
            }
          ],
          "required": false,
          "enableBehavior": "all",
          "enableWhen": [
            {
              "question": "7507688589592",
              "operator": "=",
              "answerBoolean": true
            },
            {
              "question": "1967077637018",
              "operator": "exists",
              "answerBoolean": true
            }
          ]
        },
        {
          "text": "What is your Doctor or Health System's website",
          "linkId": "8109657622653",
          "type": "url"
        }
      ]
    },
    {
      "text": "Flags (Read Only)",
      "linkId": "3229889426425",
      "type": "group",
      "item": [
        {
          "text": "Senior Citizen?",
          "linkId": "6517365580072",
          "type": "boolean",
          "answerOption": [
            {
              "valueCoding": {
                "display": "Senior Citizen"
              }
            }
          ],
          "enableWhen": [
            {
              "question": "1923091934343",
              "operator": ">",
              "answerInteger": 54
            }
          ],
          "required": false,
          "readOnly": true,
          "initial": [
            {
              "valueBoolean": true
            }
          ]
        },
        {
          "text": "Minor",
          "linkId": "9565403118888",
          "type": "boolean",
          "initial": [
            {
              "valueBoolean": true
            }
          ],
          "readOnly": true,
          "enableWhen": [
            {
              "question": "1923091934343",
              "operator": "<",
              "answerInteger": 18
            }
          ],
          "required": false
        }
      ]
    }
  ]
}

Is this a bug? Am I just misunderstanding something?
Can someone who maybe understands this application and schema better than I do help explain what may be happening?

I am able to successfully validate simple and medium-complexity exports against this schema, running into issues with the complex Questionnaire. Other Python JSON schema validators raise the same issue.

Appreciate any and all help :)

FhirPath update?

Hi, I'm having some troubles with the FHIRPath expressions.

{
  "resourceType": "QuestionnaireResponse",
  "questionnaire": "Questionnaire/0631bd02-e8ac-4f24-9969-aeee03c00988",
  "status": "completed",
  "authored": "2021-07-05T13:09:39.102Z",
  "item": [
    {
      "linkId": "199",
      "text": "Scala condizionale",
      "item": [
        {
          "linkId": "/922",
          "text": "9.2.2",
          "answer": [
            {
              "valueBoolean": true
            }
          ]
        },
        {
          "linkId": "/8511",
          "text": "8.5.11",
          "answer": [
            {
              "valueCoding": {
                "code": "F",
                "display": "F"
              }
            }
          ]
        },
        {
          "linkId": "/192",
          "text": "Parziale condizionale",
          "answer": [
            {
              "valueDecimal": 13
            }
          ]
        }
      ]
    }
  ]
}

Using the online demo tool i would expect:

  • descendants().item.where(linkId = '/922').answer.value should equal true
  • descendants().item.where(linkId = '/922').answer.valueBoolean should equal true
  • descendants().item.where(linkId = '/8511').answer.value.code should equal F
  • descendants().item.where(linkId = '/8511').answer.valueCoding.code should equal F
  • descendants().item.where(linkId = '/192').answer.value should equal 13 <-- not working
  • descendants().item.where(linkId = '/192').answer.valueDecimal should equal 13

but the builder expression engine does not support the .value (it only supports the typed value, such as valueCoding, not anymore in the FhirPath spec). Is there any chance that you can update it to the latest version? Or at least guide me on how to update it locally?

Edit:
Actually expressions not evaluating properly seem to be only the ones which use valueDecimal.

example

help text considered as item

I'm not sure it is a bug, but filling the help text attributes lead to the creation of a new child item of type display in the Questions Tree.

If it is not a bug, may be having some information on the child item informing the user that this item is the help text of his father item should be considered.

initial value for boolean cannot be set to 'not answered'

Hello,

I can't find a way, If I check boolean item initial value to yes or no, to uncheck it.

A similar issue exist with (open-)choice item (with answer list source = answerOption), but it is possible to turnaround (deleting the default answerOption for example)

for (open-)choice item, with answer list source = answerValueSet , the initial value field is not available at all. It would be very interesting

Nicolas

Include builder and render in Angular 11 Application

Good afternoon to everyone. it's possible to include form builder and render in another angular application (version 11)?? I tried to include entire application of NLM but i don't understand in public_api.ts what i must espose. It's the right way?

!= operator bug within formbuilder

When trying to use the != operator within the form builder in the conditional show logic section, there seems to be no way to specify a specific value. When uploading a questionnaire json that contains a != associated with a value, the json output changes it to =

Can't find variable: LForms in base-page.component.ts:114

Hi,

When I click preview button, it throws error.

[Error] ERROR – ReferenceError: Can't find variable: LForms — base-page.component.ts:114
ReferenceError: Can't find variable: LForms — base-page.component.ts:114
	defaultErrorLogger (vendor.js:25942)
	handleError (vendor.js:25990)
	handleError (vendor.js:30685)
	executeListenerWithErrorHandling (vendor.js:35014)
	wrapListenerIn_markDirtyAndPreventDefault (vendor.js:35049)
	(anonymous function) (vendor.js:137303)
	onInvokeTask (vendor.js:48310)
	runTask (polyfills.js:494)
	invokeTask (polyfills.js:803)
	invokeTask (polyfills.js:1916)
	globalZoneAwareCallback (polyfills.js:1942)

Did I miss any configuration ? Thanks

skip logic problem

Error: Invalid lforms skip logic trigger: {
"value": null
} at lformsFHIR.js:22974

If source links to parent item, then trigger.value lost value.

{
  "name": "t1",
  "status": "draft",
  "items": [

    {
      "header": false,
      "dataType": "BL",
      "question": "Did you learn anything new that will help you in your job?",
      "linkId": "/q2",
      "questionCode": "/q2",
      "questionCardinality": {
        "min": "1",
        "max": "1"
      },
      "answerCardinality": {
        "min": "1",
        "max": "1"
      },
      "editable": "1",
      "items": [
        {
          "header": false,
          "dataType": "TX",
          "question": "Please explain:",
          "linkId": "/q2/q2_1",
          "questionCode": "q2_1",
          "questionCardinality": {
            "min": "1",
            "max": "1"
          },
          "answerCardinality": {
            "min": "1",
            "max": "1"
          },
          "editable": "1",
          "skipLogic": {
            "action": "show",
            "logic": "ANY",
            "conditions": [
              {
                "source": "/q2",
                "trigger": {
                  "value": true
                }
              }
            ]
          }
        }
      ]
    }
  ]
}

"EnableWhen" Error

I was unable to upload fhir questionnaire (R4)into the NLM form builder if "enable when" extension is used. The error I am getting is as follows: "Cannot read property 'type' of undefined: Failed to convert the selected FHIR Questionnaire. File loading is aborted."
If I remove all "enable when" options, the form does upload without a problem.

In addition, even if I create a form using the NLM tool and upload it to FHIR server, I will get the same error if I try to import it back to the tool.

Bug when changing the type of an item having restrcition to a date, dateTime or time

The restriction function does not support date, dateTime and time item, yet. Those types should be removed from typeToOptions, otherwise it will generate a bug when changing the type of an item that has a restriction (a decimal item with maxValue restriction for example) to a date/dateTime or time type (we will have a broken extension having only the restriction url in the extension of the changed item )

Steps to reproduce the bug:

  1. create a decimal item having 'Maximum Value' and 'Minimum Value' as restrictions:
    image

  2. change the type of the item to 'Date'

image

  1. Verify the json from the preview: the two extensions still present in the model (but broken), we should not have those extension for date/time items

image

Missing dependency, insufficient README directions for first run

  1. Compilation fails due to missing easy-path-expressions dependency
    image
  2. After adding the above dependency and executing npm start, the following errors are displayed in the browser console:
    image
    the README does not specify that the npm run copy-lforms command should be executed prior to npm start.

Error on ng serve due to missing files

I was having trouble on deploying the app because down_arrow_gray_10_10.png and magnifying_glass.png files where missing. Adding these two elements to filePathMap object on copy-lforms.js solved the issue:

  'webcomponent/down_arrow_gray_10_10.png': 'elements',
  'webcomponent/magnifying_glass.png': 'elements',

Deploying the code

Is it possible to deploy the code in the tomcat/webapps folder ? With grunt build, I can generate the dist directory. When placed directly under webapps folder - it is not working.

Problem with complex extension, the inner extension is lost from the model

Hello,
We have a problem when importing a questionnaire that contains complex extension.
The data is lost and the inner extension is deleted from the model when we try to preview after clicking the button 'Edit question'

Here the test questionnaire used to reproduce the issue:

issue with complex extension.json

Step to reproduce the issue:

  1. Import questionnaire from local file:

image

  1. Click to the button 'Edit questions'

image

  1. Click to the button 'Preview' and verify the json (the R4 version)

the inner extension is lost in the model, we should have an extension like this:
"extension": [ { "url": "https://test.fr/ig/fhir/StructureDefinition/new-extension", "extension": [ { "url": "id", "valueInteger": 1 } ] } ]
image

Can you fix this issue please ?

Thanks in advance.

item selection in question tree is unclear/unconsistant with data in the current item part of the screen

using edge (Version 120.0.2210.121 (Version officielle) (64 bits))

starting from scratch : the current item (item 0), is gray-lighted in the question tree

image

adding a new item (Add new item button): the current item (New item 1), is yellow lighted in the question tree. item 0 is still gray-lighted. (The use of the 'more option' button in the question tree does not produce this bug. )

image

selecting properly New item 1 in the question tree, modifiing it and creating it (on your server, thanks) : the grey title bar is consistant with the question tree (New item 1 modified). But the fields in the current item part of the screen correspond to item 0...

image

The consequences (as I feel) are :

  • the user can't be sure on where he perform modification on the questionnaire
  • he can modify the wrong item without noticing it
  • the trust in the tool is reduced
  • maybe it is a possible source for other bug to build on

error with lform ?

There is a trouble with the formBuilder :

image

It seems to be linked to the last lform library deployement.

Sincerely

Nicolas

valueBoolean attribute from extensions gets deleted

I've got a questionnaire in a FHIR Server with the extension that enables the observationExtract mechanism:

"extension": [
    {
      "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationExtract",
      "valueBoolean": true
    }
  ]

When importing it through the formbuilder, the property valueBoolean gets cleared and, if saving again to the FHIR server, the observationExtract mechanism won't work:

"extension": [
    {
      "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-observationExtract"
    }
  ]

`answerValueSet` with a canonical URL doesn't work

If I specify "answerValueSet": "<canonical URL>", and upload the valueset and questionnaire to the same FHIR server, the SDC Questionnaire App will render it fine (good) but neither the form builder nor beta version load the valueset (bad).

I'm aware there's an extension to explicitly specify the terminology server explicitly, but I just want to have a self-contained bundle of my questionnaire+terminology resources, no external dependency on a terminology server needed.

Sample bundle -
Bundle-DebugBundleSACQPatientComorbidity.json.zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.