Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formation of questionnaire response #25

Closed
GitHubUNCStudent opened this issue Jan 24, 2020 · 6 comments
Closed

Formation of questionnaire response #25

GitHubUNCStudent opened this issue Jan 24, 2020 · 6 comments

Comments

@GitHubUNCStudent
Copy link

NLMformscreenshot

Consent-questionnaire.lforms 2020jan10.json.txt
Consent.questionnaire.response 2020.01.17.json.txt

We are having a new issue where some of the items (but not all) in the questionnaire response have an unusual formation as the beginning.

In the past, the response for a question was not embedded in an "answer" array. Is this new? Some of our other repeating elements do not have this "answer" array. Some do and some don't.

Also, the linkID is nested much deeper than in the past. Is this new? Is the developer able to safely assume that the link ID that applies to the whole element will always be found at answer[item][0][linkId] because the linkID at answer[item][2][linkId] is for a child question and generally the linkIDs nested this deeply are for the child questions.

Is this a problem with LHC Forms or how the questionnaire was built?

I have attached a screen shot, the questionnaire LHC Code and the questionnaire response.

This is the formation that I am concerned about:

  "answer": [

    {

      "item": [

        {

          "linkId": "9.1",

          "text": "Risk List",

          "item": [

            {

              "linkId": "9.1.1",

              "text": "Name of the risk",

              "answer": [

                {

                  "valueString": "Unanticipated reactions"

                }

              ]

            },

{etc.}

@plynchnlm
Copy link
Member

The only reason for that kind of structure is if the item containing linkId 9.1 (linkId 9) was itself a question that had an answer. (See Lloyd's comment at https://chat.fhir.org/#narrow/stream/179255-questionnaire/topic/QuestionnaireResponse.20item.2Eitem.20vs.20item.2Eanswer.2Eitem/near/154018519, "item.item is used when the parent is a group (and thus will not have answers). item.answer.item is used when the parent is a question (and thus will have an answer).")

LForms' handling of this rule was corrected in version 20.1.0. Which version are you using? It could be there is a bug with our "fix".

However, when I load your attached form into 20.1.3, I don't see that problem in the QuestionnaireResponse. Here is an excerpt of what I get after filling out "Name of the risk":

        {
            "linkId": "9",
            "text": "Risks",
            "item": [
                {
                    "linkId": "9.1",
                    "text": "Risk List",
                    "item": [
                        {
                            "linkId": "9.1.1",
                            "text": "Name of the risk",
                            "answer": [
                                {
                                    "valueString": "zzz"
                                }
                            ]
                        }
                    ]
                }
            ]
        },

@GitHubUNCStudent
Copy link
Author

Hi plynchnlm,

I am not sure if I understand your answer, exactly, but it is informative.

Our problem is that all of our questionnaire responses in the past were in the format (at the parent level) of a linkId, text and either an item or an answer such as:

{
  "linkId": "9",
  "text": "Risks"
  "item": [
    {more FHIR stuff here }
]
}	

OR

{
  "linkId": "9",
  "text": "Risks",
  "answer": [
    {more FHIR stuff here }
]
}

But not just an answer without a link ID and text, which is what is happening:

{
  "answer": [
    {more FHIR stuff here }
]
}

Are you saying that moving to version 20.1.0 or 20.1.3 will fix this? We are still using version 17.3.2 because we were afraid that a newer version might not be backwards compatible with our questionnaires that work with 17.3.2.
If our questionnaires will still work and this will make the parent have a linkId and text, then I will change my scripts to call version 20.1.0 or 20.1.3.

@plynchnlm
Copy link
Member

Okay, now I see what you mean. The 10th item (linkId 9) is missing its linkId field in your output. However, I am not sure how that is happening. I checked out version 17.3.2 (thanks for mentioning the specific version), loaded your form, filled in some values around linkId 9, and I get this structure for the QuestionnaireResponse:

 {
            "linkId": "9",
            "text": "Risks",
            "item": [
                {
                    "linkId": "9.1",
                    "text": "Risk List",
                    "item": [
                        {
                            "linkId": "9.1.1",
                            "text": "Name of the risk",
                            "answer": [
                                {
                                    "valueString": "falling"
                                }

So, for me, the linkId not missing. I wonder if there is some special combination of filled-in fields that triggers the problem. If the only answer you fill in is Name of the risk (9.1.1), do you still see the problem?

@plynchnlm
Copy link
Member

(Please note my question in my previous post as well.) Here is a jsFiddle using LForms 17.3.2, which shows your form, and at the bottom of the form (best viewed on a large screen if possible) there is a "Show QuestionnaireResponse" button which will display the JSON of the QuestionnaireResponse. When I fill in a value for "Name of the risk", I get the structure I mentioned above (which has the linkId). https://jsfiddle.net/lforms/5czb8217/23/
Please give it a try and let me know if you find a way to reproduce the problem.

@GitHubUNCStudent
Copy link
Author

Hello,

You can close this ticket. The person responsible for creating the questionnaire on our team made some changes to the questionnaire and it is now properly making FHIR JSON questionnaire responses. Thank you.

@GitHubUNCStudent
Copy link
Author

I have closed this ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants