hl7-fhirhapi-fhir

Reverse chaining in FHIR


I want to do a search in HAPI FHIR server as follows:

Example:

  "resourceType": "Observation",
  "device": {
    "reference": "Device/2412"
  },
  "hasMember": [
    {
      "reference": "Observation/1"
    },
    {
      "reference": "Observation/2"
    },
    {
      "reference": "Observation/3"
    }
  ]

And I'd like to get Observation/1, Observation/2, and Observation/3


Solution

  • Using reverse chaining (_has):

    Observation?_has:Observation:has-member:device=Device/2412

    That is, get Observation resources where another Observation with device=Device/2412 refers to this resource through has-member.

    This uses the definition of _has http://hl7.org/fhir/search.html#has and the search parameters on Observation http://hl7.org/fhir/observation.html#search