Stream: implementers
Topic: search based on value in QuestionnaireResponse field
Razvan Sfat (Jul 28 2021 at 22:42):
hello,
i have a hapi server with some Questionnaires and QuestionnaireResponses.
how can i find all the QuestionnaireResponses based on the value of Questionnaire field in the QuestionnaireResponse ?
thank you
Lloyd McKenzie (Jul 28 2021 at 23:22):
Should just be a question of using the 'questionnaire' search parameter and specifying the URL of the questionnaire. Is that not working?
Razvan Sfat (Jul 28 2021 at 23:32):
thank you for response.
i dont think it works.
this is the url for the search:
http://localhost:8080/fhir/QuestionnaireResponse?questionnaire=5003&_include=QuestionnaireResponse:questionnaire&_pretty=true
and the result:
{
"resourceType": "Bundle",
"id": "9747b239-8304-4327-b035-d7a3473f4cae",
"meta": {
"lastUpdated": "2021-07-29T01:37:09.318+03:00"
},
"type": "searchset",
"total": 0,
"link": [ {
"relation": "self",
"url": "http://localhost:8080/fhir/QuestionnaireResponse?_include=QuestionnaireResponse%3Aquestionnaire&_pretty=true&questionnaire=5003"
} ]
}
response code is 200
maybe i have not explained too clear.
let's say that i have 10 QuestionnaireResponse records.
from this 10 i want only that ones that have in the field questionnaire the id of a specific Questionnaire
example of QuestionnaireResponse record:
{
"resourceType": "QuestionnaireResponse",
"id": "5053",
"meta": {
"versionId": "1",
"lastUpdated": "2021-07-28T19:50:30.627+03:00",
"source": "#bAjZh5nPLT5Yrfle"
},
"questionnaire": "5002",
"item": [ {
"linkId": "1",
"text": "intrebare_1",
"answer": [ {
"valueString": "raspuns"
} ]
}
Lloyd McKenzie (Jul 28 2021 at 23:34):
You can't say "questionnaire=5003" because questionnaire needs to be the canonical URL of the Questionnaire. @James Agnew, does HAPI support _include on canonical references yet?
Razvan Sfat (Jul 28 2021 at 23:42):
i will say it support _include.
on the test server on the hapi website i have this url:
http://hapi.fhir.org/baseR4/QuestionnaireResponse?questionnaire=https://protocol-service.icanbwell.com/Questionnaire/medstar-squeeze\|1.1.0&_include=*&_pretty=true
but the result is the same:
{
"resourceType": "Bundle",
"id": "72a2ebe9-b5d2-43c5-8b38-8dff57869781",
"meta": {
"lastUpdated": "2021-07-28T23:38:05.859+00:00"
},
"type": "searchset",
"total": 0,
"link": [ {
"relation": "self",
"url": "http://hapi.fhir.org/baseR4/QuestionnaireResponse?_include=*&_pretty=true&questionnaire=https%3A%2F%2Fprotocol-service.icanbwell.com%2FQuestionnaire%2Fmedstar-squeeze%5C%7C1.1.0"
} ]
}
but first i should change de value of questionnaire field from the id of question to the url
Eric Haas (Jul 29 2021 at 14:40):
It did not work for me as while back either, I thought I lodged an issue.
Elliot Silver (Jul 29 2021 at 15:42):
Eric Haas said:
I thought I lodged an issue.
Oooh, "lodging an issue." That's when you submit it, and it gets stuck in roadmap purgatory forever. It's not until you escalate to the CTO that the issue gets dis-lodged. :laughing:
Michele Mottini (Jul 29 2021 at 16:21):
It is open source: https://github.com/hapifhir/hapi-fhir/
Razvan Sfat (Dec 27 2021 at 13:04):
Hello,
Did anyone manage to search for QuestionnaireResponses after the id of the Questionnaire?
Thank you.
Lloyd McKenzie (Jan 03 2022 at 04:49):
QuestionnaireResponses point to the Questionnaire by the Questionnaire.url, not the Questionnaire.id
Last updated: Apr 12 2022 at 19:14 UTC