fhirbase / fhirbase-plv8

[DEPRECATED] Fhirbase 2.0 is an FHIR relational storage
https://health-samurai.io/fhirbase
Other
105 stars 39 forks source link

fhir_search returns `entry: [ ]` (an empty array) if search query doesn't return any results which is not valid according to fhir documentation #139

Open bartek-sarul opened 8 years ago

bartek-sarul commented 8 years ago

Steps to reproduce:

select fhir_search('{"resourceType":"Patient", "queryString":"identifier=SOME_NON_EXISTING_IDENTIFIER"}');

This returns

{
  "resourceType":"Bundle",
  "type":"searchset",
  "total":0,
  "link":[{
    "relation":"self",
    "url":"Patient/search?identifier=SOME_NON_EXISTING_IDENTIFIER&_page=0"
  }],
  "entry":[]
}

According to fhir documentation https://www.hl7.org/fhir/json.html

Objects are never empty. If an element is present in the resource, it SHALL have properties as defined for its type, or 1 or more extensions

String property values can never be empty. Either the property is absent, or it is present with at least one character of content

This has also been confirmed on fhir implementers chat https://chat.fhir.org/#narrow/stream/implementers/topic/returning.20search.20bundle.20with.20no.20result

Empty elements (arrays or strings) are not permitted.

Expected result:

{
  "resourceType":"Bundle",
  "type":"searchset",
  "total":0,
  "link":[{
    "relation":"self",
    "url":"Patient/search?identifier=SOME_NON_EXISTING_IDENTIFIER&_page=0"
  }]
}