Unable to run $apply on PlanDefinition in R5 mode on docker (400 error)

29 views
Skip to first unread message

Maciej Kleban

unread,
Nov 22, 2023, 10:25:30 AM11/22/23
to HAPI FHIR
Hi,

I set up JPA starter server using docker-compose (hapiproject/hapi:latest) just like the repository says in https://github.com/hapifhir/hapi-fhir-jpaserver-starter#example-using-docker-composeyml-for-docker-compose (postgres backend and the application.yaml part below). I also added fhir_version=R5 because I am interested in FHIR R5 standard (and I verified that it did work).
Then, following https://hapifhir.io/hapi-fhir/docs/clinical_reasoning/plan_definitions.html I added the opioidcds-10-patient-view-bundle.json PlanDefinition, example Patient from FHIR standard website (https://www.hl7.org/fhir/patient-example.html), example Practitioner (https://www.hl7.org/fhir/practitioner-example.html) and Encounter (https://www.hl7.org/fhir/encounter-example.html, with Patient id changed accordingly).

Finally, I tried running the GET request mentioned in the HAPI FHIR documentation:
http://localhost:9000/fhir/PlanDefinition/opioidcds-10-patient-view/$apply?subject=Patient/2&encounter=Encounter/4&practitioner=Practitioner/3

But then I get a 400 BAD REQUEST response from server saying:
Invalid request: The FHIR endpoint on this server does not know how to handle GET operation[PlanDefinition/opioidcds-10-patient-view/$apply] with parameters [[practitioner, subject, encounter]]

Now, I've been trying to get it to work for days now and I have no idea why it doesn't work (and I can't see any errors in the docker logs). I tried enabling Clinical Reasoning according to https://github.com/hapifhir/hapi-fhir/issues/4826, but it didn't change anything. I also tried cqf-ruler version and it worked (still returned errors, but at least it didn't throw 400 at me). I tried removing each part of the url (subject, encounter, practitioner) and it still doesn't work. I verified that all aforementioned resources have been created correctly. I tried to find some tests with mock data on both JPA starter server repository and HAPI FHIR repository, but was unable to find any for $apply. I wanted to try it on data from public test server, but it's broken (returns Timeout Exception when fetching any resource).

I don't have too much experience with FHIR PlanDefinition operators, so I might be missing something. Any help would be appreciated.

Taylor Le

unread,
Jan 25, 2024, 9:14:13 AMJan 25
to HAPI FHIR
I am encountering the same issue but with R4. The return is an operation outcome with a similar message. I'm curious to know if you found a solution?
Reply all
Reply to author
Forward
0 new messages