Combining $lastn with _include and filtering

62 views
Skip to first unread message

Renske Talsma

unread,
Dec 20, 2021, 4:30:52 AM12/20/21
to HAPI FHIR
Hello all,

I recently changed jobs into the healthcare field and am currently working with the Hapi JPA server (DSTU3). I have enabled $lastn and this seems to work fine, the indices in ES are being populated. When I do a query like Observation/$lastn, I get back results that make sense and the server logs Operation[extended-operation-type $lastn Observation]. So I assume this part is working correctly.

The problem is that I also need to filter within this $lastn dataset, but if I add parameters to this request, it seems to stop working or at least there are unexpected results.

Observation/$lastn?subject=2 yields an empty bundle, despite all Observations in the dataset being related to this subject. A regular Observation?subject=2 query behaves as expected. Similar results are present when filtering for specific code categories.

If $lastn is the operation, any _include parameters are also ignored, while these work fine without $lastn. The server logs still show the operation logged as being of $lastn type, but it really seems to me that any parameters will yield 0 results.

At first I thought it might be a config/yaml issue, but now I suppose I need to add support for $lastn combined with other parameters myself, as I believe this part of the docs also hints at: https://hapifhir.io/hapi-fhir/docs/server_plain/rest_operations_operations.html

However I'm using the JPA starter server, so I don't even know if that's even possible? It seems to be something that can only be done if I'm using the plain server?

Apologies if this is a super obvious question but I couldn't really figure out where to add upon existing $lastn functionality, I am rather new to this. If anyone could point me in the right direction that would be awesome!

Thanks a lot in advance and kind regards,
Renske




Remco Overdevest

unread,
Jun 14, 2023, 9:02:43 AM6/14/23
to HAPI FHIR
Did you figure this out? Running into the same issue.
Reply all
Reply to author
Forward
0 new messages