0

I am currently working on a Hapi-FHIR project. There I want to implement a collection of Questionnar Responses by Patient. The collection gives back all QuestionnaireResponses of a Patient with a given PatientId. This works without problems but I also want to adhere to the REST Resource Naming Conventions. So the search URL for my Collection shoud look something like https://example.com/patient/{id}/questionnaireresponses. Right now my search URL looks like this: https://example.com/QuestionnaireResponse?patient={id} I already tried to set my own search Url with @Path("/patient/{id}/questionnaireresponses") but HAPI-FHIR seems to ignore this. I searched the HAPI-FHIR documentation already but I did not find anything related.

My question is where does the naming of the search urls happen in HAPI-FHIR and how can I change the name of a search url?

2 Answers2

0

While I also find the FHIR naming and syntax choices a bit annoying, they're an integral part of the FHIR specification, not specific to Hapi. If you change them, your server won't be usable by a client that is expecting the standardized FHIR API. Which kind of defeats the point of using FHIR, no?

It might well be trivial to change the resource name in a Hapi server request (Patient to patient or patients), but since it doesn't really make that much sense, it might not be. So technically you might be forced to prehandle requests to support even that part of your syntax.

For the kind of hierarchical interrogation that you want, (patient/{id}/questionnaireresponses), things are more complicated even pure semantically, because there might be more than one relationship between two resource types. Even for your example, would patient/{id}/questionnaireresponses return just the responses where the patient is the subject, or also those where he is only the author? And how would you retrieve just those he has authored? FHIR is designed to be as explicit as possible to avoid different interpretations that can lead to wrong information being sent.

GertG
  • 959
  • 1
  • 8
  • 21
0

HapiFhir offers a mechanism for grouping two resources together. Using compartments solved my problem.