Aidbox/Issues

Support _has for chained search (new FHIR Search spec)

Closed this issue · 2 comments

Problem I need to solve

There's a new _has behavior for chained search, e.g.

GET [base]/Encounter?patient._has:Group:member:_id=102

See https://www.hl7.org/fhir/search.html#has

Solution I see

Add support for this great feature

Alternatives I've considered, but they don't work

I've tried to create a custom Search with name patient._has:Group:member:_id but it didn't helped.

I've found a workaround: I've created Search resource for Patient.has-group-member-id with something like (just an example)

name: has-group-member-id
where: >-
  exists((select * from "group" where "group".id = {{param}} and
  knife_extract_text("group".resource, '[["member", "entity", "id"]]') &&
  ARRAY[{{table}}.id]))
format: '?'
resource:
  id: Patient
  resourceType: Entity
id: Patient.has-group-member-id

and now I use get /Encounter?patient:Patient.has-group-member-id=102

@ruscoder Please provide us feedback regarding this feature if possible