Search for QuestionnaireResponse on subject's birthdate

37 views
Skip to first unread message

Jordan Force

unread,
Nov 3, 2022, 10:12:50 AM11/3/22
to HAPI FHIR
Hi,

I'm having some trouble with querying HAPI. Basically, trying to filter by the birthdate of the QuestionnaireResponse's subject. I'm running this (https://github.com/hapifhir/hapi-fhir-jpaserver-starter) inside a docker container, and I inserted 2 Patients (Bill Smith with birth date 1999-12-14 and Bill Smith with birth date 1998-12-14), and 3 QuestionnaireResponses. 2 of the QR's have Bill Smith 1999 as their Subject, and the other has Bill Smith 1998 as its subject.

If I query for all of the QuestionnaireResponse objects with this code:
    Bundle bundle = client.search()
                .forResource(QuestionnaireResponse.class)
               .returnBundle(Bundle.class)
                .execute();

The resulting bundle has 3 QuestionnaireResponses, with subjects set to their respective patients. The Subject has a birthdate. This screenshot shows what it looks like in the Eclipse debugger:

Screenshot from 2022-11-03 09-53-05.png

If I go into the bundle object, the link->url property has the query URL: http://localhost:40829/fhir/QuestionnaireResponse

If I run "wget http://localhost:40829/fhir/QuestionnaireResponse", I get three QuestionnaireResponse objects back in a JSON file, which I'm attaching (allQuestionnaireResponses.txt). Now, if I run query but adding this condition:

     .where(QuestionnaireResponse.SUBJECT.hasChainedProperty(Patient.BIRTHDATE.exactly().day("1999-12-14")))

I get 0 results. What am I doing wrong here? The underlying URL (from the Bundle object) is http://localhost:40829/fhir/QuestionnaireResponse?subject.birthdate=1999-12-14

I'm also attaching the results of wget-ing http://localhost:40829/fhir/Patient

Thanks,

Jordan
patients.txt
allQuestionnaireResponses.txt
Reply all
Reply to author
Forward
0 new messages