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

Feature request: support near as single chained search expression #4792

Open jkiddo opened 1 year ago

jkiddo commented 1 year ago

Following up on the great work on https://github.com/hapifhir/hapi-fhir/pull/4687 https://github.com/hapifhir/hapi-fhir/issues/4650 https://github.com/hapifhir/hapi-fhir/pull/4633 it would be SO neat if the following queries could be supported:

/fhir/PractitionerRole?location.near=47.3686498|8.5391825|16.0|km&practitioner.name=Irene&_include=PractitionerRole:location&_include=PractitionerRole:practitioner&_sort=location.near

jkiddo commented 1 year ago

Expected response would be like the following:

{
  "entry": [
    {
      "resource": {
        "resourceType": "PractitionerRole",
        "id": "1",
        "practitioner": {
          "reference": "Practitioner/2"
        },
        "location": [
          {
            "reference": "Location/3"
          }
        ]
      },
      "search": {
        "mode": "match"
      }
    },
    {
      "resource": {
        "resourceType": "Location",
        "id": "3",
        "name": "Praxis Irene",
        "address": {
          "line": [
            "Dorfstrasse 78"
          ],
          "city": "Meilen",
          "district": "ZH",
          "postalCode": "8706",
          "country": "CH"
        },
        "position": {
          "longitude": 8.6424,
          "latitude": 47.2697
        }
      },
      "search": {
        "mode": "include"
      }
    },
    {
      "resource": {
        "resourceType": "Practitioner",
        "id": "2",
        "name": [
          {
            "family": "Test",
            "given": [
              "Irene"
            ]
          }
        ],
        "telecom": [
          {
            "system": "email",
            "value": "example@example.com"
          }
        ]
      },
      "search": {
        "mode": "include"
      }
    }
  ]
}