I am trying to build a Fhir Server for Patient resource and enabling the search for patients by many attributes.
- search all patients born between two dates, how should the query look like? following url is not working?
2.birthdate or birth-date which is correct?
why there are two different attribute name for date of birth of patient resource ?
thanks in advance
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
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
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.