athenahealth / apiserver-athenaFlex

Software developers can use sample code and documentation to use athenahealth's athenaPractice/athenaFlow FHIR API Server.
https://mydata.athenahealth.com/home
17 stars 7 forks source link

How to use the _inlcude parameter #230

Closed Roger-Geacom closed 2 years ago

Roger-Geacom commented 2 years ago

I see mention of an _include parameter inside the search api calls. It's mentioned in passing in the description of the _count parameter, but not explicitly stated as its own parameter. It is also in the official Fhir docs found here: https://www.hl7.org/fhir/DSTU2/search.html#include

I'm wondering if this parameter is supported or not? I don't get an error when using it, but also don't get any different results either.

Here is an example request of how I've been constructing a query: {{url}}/fhir/Appointment?location=Location/FAC-2&_format=json&date=2022-01-18&_include=Appointment:slot%26*

This query should get the slot info with the appointment. This seemed like an easy test one to try, but I can't get it working.

The real use case I'd like to be able to do is include the Patient resource and Provider resources for an appointment. Constructing that query seemed to be tricker because they are all in a participant array, but I can't get a slot one to work so I'm not sure if the _include parameter is even functional.

We can survive without it, but it means we have to make 1 call for the appointment list, and then two calls for every appointment in the list to get all of the data we need to construct an appointment schedule feed. This is not ideal as it generally takes 30-60 seconds to load all the data.

Torin-Shepard-athena commented 2 years ago

@Roger-Geacom The link in the FHIR spec. you referenced states: Both _include and _revinclude are based on search parameters.

https://hl7.org/fhir/DSTU2/appointment.html#search Unfortunately, FHIR Appointment does not define any search parameter for the path to Appointment.slot.

This prevents us from being able to use _include to fetch the referenced slots in the Appointment query.

If you cannot search a resource type based on one of its elements, it cannot be fetched with _include searching.

Roger-Geacom commented 2 years ago

@Torin-Shepard-athena That makes sense now, thanks for the clarification!