Stream: questionnaire
Topic: Searching QuestionnaireResponse via Contained Resource
Raheel Sayeed (Mar 11 2018 at 07:50):
A follow up to my earlier question, I've embedded Questionnaire
inside QuestionnaireResource
as a contained resource and added local reference to question. However, I am unable to retrieve the question through a contained resource based search
QuestionnaireResponse?questionnaire.code=qcode
This should have worked according to the docs but it does not.
Could this still be an issue? I'm using STU3 and HAPI. https://stackoverflow.com/questions/40404398/how-to-search-in-contained-resources/40422244#40422244
Lloyd McKenzie (Mar 11 2018 at 15:24):
Searching by questionnaire.code will just return the Questionnaire - there's no way to return an individual question. Finding the question within the Questionnaire is something you'll need to write code for. (Also, having Questionnaire contained within QuestionnaireResponse is saying "This Questionnaire can only be linked to by this response and doesn't have enough information to stand alone and separate from the response" - which is a weird thing to say about a Questionnaire. Remember that containment isn't a handy-dandy way to avoid publishing two resources - it's for when the resoruces truly can't exist or be used separately.)
Raheel Sayeed (Mar 11 2018 at 18:33):
You are right, The questionnaire I am dealing with cannot stand alone. It is specific to the Patient and therefore made sense to be contained within the QuestionnaireResponse. If I push questionnaire as an independent resource, it has no reusability for any other patient.
I'm not trying to return an individual question, but return the QuestionnaireResponse that contains a questionnaire that has a code – "bla".
I have a local contained reference at `QuestionnaireResponse.questionnaire = Reference('#<questionnaireId>')
I wanted a way to query and get all QuestionnaireResponses
whose containedquestionnaire.code
= something
.
Lloyd McKenzie (Mar 11 2018 at 18:55):
Ok. That should work if the server supports that particular chained parameter location then. Which server are you using?
Raheel Sayeed (Mar 12 2018 at 01:52):
That is good news then. Im using SMARTHealthIT.org's STU3. Will try a different one.
Last updated: Apr 12 2022 at 19:14 UTC