hapifhir / hapi-fhir

🔥 HAPI FHIR - Java API for HL7 FHIR Clients and Servers
http://hapifhir.io
Apache License 2.0
2.04k stars 1.33k forks source link

Email (and potentially other token search parameters) not case-insensitive #6361

Open felixwiemuth opened 1 month ago

felixwiemuth commented 1 month ago

Describe the bug According to the FHIR spec, search on a token type should be case-insensitive if the underlying system (e.g. email) is, or generally when the underlying datatype is string:

Match is case sensitive unless the underlying semantics for the context indicate that the token should be interpreted case-insensitively (see, e.g. CodeSystem.caseSensitive). Note that matches on _id are always case sensitive. If the underlying data type is string then the search is not case sensitive.

However, e.g. for a patient with email myname@mydomain.com, {{server}}/fhir/Patient?email=myname@mydomain.com returns that patient, while {{server}}/fhir/Patient?email=Myname@mydomain.com (first letter capitalized) does not. If adding another patient with the capitalized email, you still only get the one exactly matching the capitalization in the request.

This probably applies to other token search parameters as well.

To Reproduce Steps to reproduce the behavior:

  1. Create a Patient with email myname@mydomain.com
  2. Send request /fhir/Patient?email=Myname@mydomain.com

Expected behavior The created patient is returned.

Environment (please complete the following information):