Questionnaire/Assessment feature implementation instructions

hi @sjpadgett - i have two more problems this morning. I was having the problem described here - but when I made a small change to the json file, by changing only the ‘title’, and then importing again, which made a new questionnaire - the problem did not manifest? So maybe wait to see if it comes again??

i’m working with a questionnaire TimeDass which i’ve created -
TIMEDASS V.1.1.R4.json (11.7 KB)

having completed it for a patient it is listed in the encounter. When i press ‘edit’ (to add more answers) i get the following php errors:

[Tue Jan 10 12:40:25.126287 2023] [php:warn] [pid 45] [client 172.21.0.1:53006] PHP Warning: Undefined variable $q_list in /var/
www/localhost/htdocs/openemr/interface/forms/questionnaire_assessments/questionnaire_assessments.php on line 378, referer: http:/
/localhost:8300/interface/patient_file/encounter/encounter_top.php?set_encounter=7
[Tue Jan 10 12:40:25.126304 2023] [php:warn] [pid 45] [client 172.21.0.1:53006] PHP Warning: foreach() argument must be of type
array|object, null given in /var/www/localhost/htdocs/openemr/interface/forms/questionnaire_assessments/questionnaire_assessments
.php on line 378, referer: http://localhost:8300/interface/patient_file/encounter/encounter_top.php?set_encounter=7

and the screen shows only

the second issue is about the way a completed form is displayed in the encounter. Using the same form I sent in the message above. The form has conditional logic. e.g. i tested by replying ‘true’ to the question ‘do you have allergies’ in order to reveal the question ‘what are you allergic to’, which i filled in (kiwi fruit). The display in the encounter only shows the first question to be true (i.e. value ‘1’), but not the details as follows

is the problem in the way i’ve written the json for the form itself? (it seems to work when filling in the form for the first time). Is there any more information i can give you?
thanks.

also, would it be possible to show the answer to the question ‘have you any allergies’ as ‘true’ or ‘yes’ rather than ‘1’, which i think would make more sense to someone filling it in?

I answer this before!

I imported to builder but you are missing link ids. They must be unique and have order to the group
1

Thanks Jerry. If i understand what you are saying I think it’s the controlling question that needs a linkId - i.e. ‘are you taking any medication’. This has linkId = medic-1. in the ‘preview widget’ screen of NLM builder, if the box under the ‘are you taking any medication’ is checked one is shown the dependant questions

in OpenEMR the questionnaire itself works ok, i.e. the dependant question is only shown when the controlling question is ‘1’, or ‘true’ - but when the dependant question is answered it doesn’t show in the encounter summary

and the inability to edit bug, reported above, has shown up again consistently. I’m afraid it’s evening time in the uk now and i’ve something else to do, but i’ll explore this more tomorrow.

by the way this is the latest version of the questionnaire
TIMEDASS V.1.2.R4.json (11.8 KB)

just in case what you’d suggested is adding the link-id to the dependant questions as well, i tried that, with the same display result, although that doesn’t make any sense to me?

Every item, question and answer has to have an unique Link Id and code that makes sense(look for asterisk for required in builder).
Everything done for skip logic and answer lookups require a link path starting from group down.
Take a look at the FHIR spec example or pull in a similar form like this one.
USSG-Family-Health-Portrait.json (111.9 KB)

Reporting works fine if form is designed correctly. Remember to look on the Link Id as paths to the item starting at say the group o g1 then first question would be g1/q1 etc.

Also I think current lforms version has a rendering bug for these type forms. Your form would still break regrdless until link ids are fix. Note how many times I’ve stressed the link ids!

Once I verify, I’ll put up patch as a new lform release has come out.

1 Like

@ruth
Here is a new version of lhc-forms to test with.
The admins over at the project have been doing active work lately and are improving daily however, they are not updating or don’t seem to have plans to update the public builder except the new version builder so I suggest folks start getting use to using it. They recently updated to v8.0.7 which is supposed to have some lform updates besides moving to FHIR Paths away from the lform format.

I have to makes some changes to this version for adding an option to exclude appending the score to rendered answers which I will contribute a PR on LHC NIH git which they have already agreed to the contribution.
From openemr root unzip.

1 Like

thanks for your help and the zip file, i think i’m getting there!! - i’ve added linkIds, but need to add codes as well, then will test again.

The codes don’t need to be LOINC but any tag unique to the item so say the code used for question could be question-1 and the Link Id path with group id of group-1 /group-1/question-1
and so on…

1 Like

good morning. I’ve fed my master source code (git fetch… and git pull…) which seems to have bought in the latest questionnaire code, thanks.

sadly the ‘edit’ bug seems quite persistant now. I can sometimes edit previous filled in instances of the questionnaire, but when I filled in a new instance (to test modifictions) and i try to ‘edit’ it, i get the screen showing nothing, together with php warnings - as follows

[Mon Jan 16 11:09:38.499824 2023] [php:warn] [pid 37] [client 172.19.0.1:35490] PHP Warning: Undefined variable $q_list in /var/
www/localhost/htdocs/openemr/interface/forms/questionnaire_assessments/questionnaire_assessments.php on line 378, referer: http:/
/localhost:8300/interface/patient_file/encounter/encounter_top.php
[Mon Jan 16 11:09:38.499836 2023] [php:warn] [pid 37] [client 172.19.0.1:35490] PHP Warning: foreach() argument must be of type
array|object, null given in /var/www/localhost/htdocs/openemr/interface/forms/questionnaire_assessments/questionnaire_assessments
.php on line 378, referer: http://localhost:8300/interface/patient_file/encounter/encounter_top.php
ruth@localhost:~/software/OpenEMR/openemr/docker/development-easy>

this is quite persistent with existing patients. but when i created a new patient and filled in the questionnaire for them, then i could ‘edit’ successfully one time. when I tried to ‘edit’ a second time the bug manifested.

this makes working with questionnaires quite difficult, especially as the summary in the encounter pane does not display subordinate questions in a group (even when no skip logic is applied) so the only way to check these answers would be to go in and edit (or for developers look at the record in the db!!)

may i check: when linkIds are set . My LinkIds have the format <no.no.no…> where the text indicates a group of questions, e.g. medic-1 and the nos are the sub questions, e.g. medic-1-1, medic-1-2, medic-1-2-1. In the same form i have allergies-1 and allergies-1-1, with the assumption the different groups themselves don’t need numeric hierarchy?

when you said earlier (message 40 11th jan) that the form would still not work does that include for subordinate questions? i had assumed this would be so for skip logic questions only.

so if you’d like to see an example without skip logic with the current questionnaire form
TIMEDASS V.1.2.R4.json (18.2 KB)

filled in as shown here (medications, indications and quantity)

the encounter display is only medications

thanks

You need to turn on Globals User Debug or pay attention to your console errors because you have errors in your form.
Again the example I gave you here works Questionnaire/Assessment feature implementation instructions - #43 by sjpadgett
It has the elements you are trying to do and reports correctly.
Your link ids must be unique and make logical sense as a path to the item.

There are over a thousand examples of forms/panels that can be referenced for building forms.

Thanks for your help, it was really useful. I now have a working form (hooray). I’m not sure exactly why it was crashing for ‘edit’, but it seemed to be triggered using multiple answers from a drop down (i obvs didn’t have that right in .json) . In any case i’ve used ‘repeats’ for a group now, which in any case is a much better way to do what we wanted.

also to get a master question and then it’s subordinates to display in the encounter summary i changed tack and made the master a group heading rather than a question.

1 Like

Glad to see you’ve figured it out. Gold star!:slight_smile:

1 Like

@ruth and all others.
I highly recommend for building questionnaires you start using the SDC spec and FHIR Paths.
Here’s a basic example using a PHQ you’re used to seeing.
PHQ-9-quick-depression-assessment-panel.sdc.json (51.7 KB)

Question.
I don’t have Questionnaire displayed as in your screenshot. I only have Miscellaneous, Administration, Clinical Layout Based on my instance of OpenEMR V5.0.1 running on a local Windows machine with XAMPP


.

I have had a few modifications made here and there.

I would love to use the Questionnaire feature but I am having trouble following the tutorial since my menus items seem to differ.

I imported PHQ9 questionnaire from the NLM builder through my patient portal but I only have limited options available. There is just a box to choose file and import.

Can you point me in the right direction pls. Much appreciated.

Hi Mercy,

i think that questionnaires are only available in the latest version of OpenEMR, i.e. version 7, with patch 2. Are you able to upgrade and try again?
Ruth

1 Like

Unfortunately I can’t update for now. But I would love to.

I have had some modifications effected like adding Patient ID Number column to Flow board and a couple of LBFs. Configured Lab and populated in-house inventory and all that. Also have patient data that has accumulated.

I am afraid of losing these modifications. If there was a nice upgrade procedure to v7 and keep my modifications, I would totally try it.

I have done some googling but not sure exactly what will work for me or how to effect a nice upgrade.

Any tips would really help. Thanks for the clarification.

I’m maybe not the best person to answer this, but I think that your database records should remain in tact after the upgrade, but it’s best to do a backup first. Is anyone else able to give mercy some advice on how to safely do an upgrade?

1 Like

This is wonderful work, a nifty feature to have, but unfortunately for me I am running v5.0.1 OpenEMR with XAMPP on Windows.

My Question:
Is there a way for me to import a built questionnaire into my v5.0.1 and make it work?

Much appreciated.

To update you must first do it in a test environment. For example, you download mysql and apache from the xampp control panel, then close the control panel. Copy the xampp folder to xampp2. You use the xampp2 control panel, you start mysql and apache and you already have the test environment to update. I recommend you upgrade from 5.0.2 to 6 (and patches from 6). You make sure that everything is fine. Then upgrade from 6 to 7 and apply the patches.
You can use these guides:
https://www.open-emr.org/wiki/index.php/OpenEMR_Upgrade_Guides

1 Like