Search parameter for CCRI Fhir Resource


#1

Hi,

I am trying to build a Fhir Server for Patient resource and enabling the search for patients by many attributes.

  1. search all patients born between two dates, how should the query look like? following url is not working?
    https://data.developer.nhs.uk/ccri-fhir/STU3/Patient?birthdate=gt2016-01-04&birthdate=lt2019-03-15

2.birthdate or birth-date which is correct?
https://try.smilecdr.com:8000/Patient?death-date=1950-04-30

why there are two different attribute name for date of birth of patient resource ?

please advice

thanks in advance


(Kev Mayfield) #2

Thats a fault on the released version of CCRI.

This works https://data.developer-test.nhs.uk/ccri-fhir/STU3/Patient?birthdate=gt2016-01-01&birthdate=lt2019-01-01

We are having brexit related issues releasing software at the moment.

birthdate is the correct query according to the FHIR website https://www.hl7.org/fhir/stu3/patient.html


(Rik Smithies) #3

And the reason for the being two versions, birthDate vs birthdate (there is no birth-date), is that the first is the element name in the resource and the second is the name of the corresponding search parameter.

The search params can be seen as a slightly simplified view of the elements, optimised for a different purpose.

There is not a one to one correspondence between the elements and the search parameters, for several reasons.

The latter are all lower case, I think because of worries that some systems (perhaps intermediaries, proxies etc.) don’t properly treat URLs as case sensitive. So you are asking for trouble if you depend on case, and we instead use hyphens. But within FHIR resources we have more control, so make use of case to help us.

Also some search params are based on an element and part of its data type (e.g. address-city).

So they can’t be named exactly the same. death-date does look a bit inconsistent next to birthdate (no hyphen), it is true.

That is partly because “birthdate” is an actual word, unlike “deathdate”. But also that is because death-date is not based solely on the name of an element (unlike birthdate).

It’s friendly way to access the date part of the two part element deceasedDateTime/deceasedBoolean.

There is a method to it :slight_smile:

See Patient - FHIR v4.0.0 for the list (doesn’t look like it but that is a direct link to the search part of the resource), which is at the end of every resource’s page.