Search code examples
hl7-fhir

search Patient on EPIC FHIR


I'm trying to figure out how the patient searching on EPIC FHIR is working. Testing all on the sandbox here: https://fhir.epic.com/Documentation?docId=testpatients.

The docs:

Starting in May 2019, Patient.Search requests require one of the following minimum data sets by > default in order to match and return a patient record:

  • FHIR ID
  • {IDType}|{ID}
  • SSN identifier
  • Given name, family name, and birthdate
  • Given name, family name, legal sex, and phone number/email

This is working correctly (returning one patient):

/api/FHIR/R4/Patient?family=Lin&given=Derrick&birthdate=1973-06-03

But this is also returning same record (extra character in family, wrong gender) :

/api/FHIR/R4/Patient?family=Lina&given=Derrick&birthdate=1973-06-03&gender=female

Also this one is returning one record (extra character in family, no given name):

/api/FHIR/R4/Patient?family=Lina&birthdate=1973-06-03

Not sure what I am doing wrong, or is it expected behaviour?


Solution

  • There is a bunch of history here, but Epic's current Patient.search behaves more like Patient.$match. Specifically, the criteria provided to Patient.search are combined using (approximately) OR logic rather than AND logic. Behind the scenes, it is actually more of weighted score, but ultimately, the more criteria you provide, the more possible results you might get. This is often counterintuitive if you are used to how REST API query params normally work. Technically it is spec legal though, since FHIR has a blurb in there about servers being able to return other appropriate results as it sees fit.

    https://build.fhir.org/search.html#Introduction

    However, the server has the prerogative to return additional search results if it believes them to be relevant.

    We don't have any specific updates right now, but there may be changes coming in Soon(tm).