FHIR Chat · Search result requirement · implementers

Stream: implementers

Topic: Search result requirement


view this post on Zulip Peter Bernhardt (Jun 28 2017 at 17:36):

Pretty basic question. I want to know if there is a way, with a search query, to indicate to the server that you expect a particular number of results. The common use case is that I query for a patient based on a specific identifier and expect 0 or 1 results, and if there are more than one, that I consider this an error condition.

view this post on Zulip Stefan Lang (Jun 28 2017 at 19:30):

While I'm not aware of an easy way to trigger an error (in the sense of: OperationOutcome instead of a Bundle, when there's more than 1 result), others may prove me wrong.
As a first approach, I would use a profile on Bundle, constraining it to containing 0..1 Patient resources. You can validate that and use the validation result as an error indicator.

view this post on Zulip Elliot Silver (Jun 29 2017 at 22:43):

Its not exactly what you want, but you could request _count=1 and if the _next link is populated, then there is an error. That would at least prevent you getting a large result when you only expect one, and give you a simple way to check the condition.

view this post on Zulip Brian Postlethwaite (Jul 04 2017 at 04:15):

This is basically how I implement it, but I use _count=2 and check that I only got 1 (just in case the server isn't providing totals)


Last updated: Apr 12 2022 at 19:14 UTC