For AI agents: the documentation index is at /docs/aidbox/llms.txt. A Markdown version of this page is available at /docs/aidbox/notebooks.md or by requesting it with the Accept: text/markdown header.
Aidbox Docs
All notebooks

Search API: _include, _revinclude

Description

18 cells · updated Jul 17, 2023

This is a read-only view. Responses shown were saved when the notebook was published — open it in your own Aidbox to run the cells against live data.

FHIR _include and _revinclude search parameters in Aidbox

Create resources to search for

REST Send Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
PUT /Patient
content-type: text/yaml
accept: text/yaml

resourceType: Patient
id: pat-123
identifier:
- {system: 'ssn', value: '78787878'}
Response: Body
Status: 201
identifier:
- {value: '78787878', system: ssn}
id: pat-123
resourceType: Patient
meta: {lastUpdated: '2023-07-17T15:04:23.088692Z', createdAt: '2023-07-17T15:04:23.088692Z', versionId: '495'}
REST Send Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
PUT /Encounter
content-type: text/yaml
accept: text/yaml

resourceType: Encounter
id: enc-123
subject: 
  type: Patient
  identifier: {system: 'ssn', value: '78787878'}
class: {code: 'IMP', 
  system: 'http://terminology.hl7.org/CodeSystem/v3-ActCode', 
  display: 'inpatient encounter'}
status: finished
Response: Body
Status: 201
class: {code: IMP, system: 'http://terminology.hl7.org/CodeSystem/v3-ActCode', display: inpatient encounter}
status: finished
subject:
  type: Patient
  identifier: {value: '78787878', system: ssn}
id: enc-234
resourceType: Encounter
meta: {lastUpdated: '2023-07-17T15:05:06.825704Z', createdAt: '2023-07-17T15:05:06.825704Z', versionId: '497'}
REST Send Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
PUT /RequestGroup/example
content-type: text/yaml
accept: text/yaml


encounter: {id: enc-123, resourceType: Encounter}
reasonCode:
- {text: Treatment}
authoredOn: '2019-03-06T17:31:00Z'
resourceType: RequestGroup
note:
- {text: Additional notes about the request group}
author: {display: Practitioner/1}
contained:
- id: medicationrequest-1
  intent: proposal
  status: unknown
  subject: {id: pat-123, resourceType: Patient}
  medication:
    CodeableConcept: {text: Medication 1}
  resourceType: MedicationRequest
- id: medicationrequest-2
  intent: proposal
  status: unknown
  subject: {id: pat-123, resourceType: Patient}
  medication:
    CodeableConcept: {text: Medication 2}
  resourceType: MedicationRequest
priority: routine
status: draft
id: example
groupIdentifier: {value: '00001', system: 'http://example.org/treatment-group'}
identifier:
- {value: requestgroup-1}
intent: plan
action:
- description: Administer medications at the appropriate time
  textEquivalent: Administer medication 1, followed an hour later by medication 2
  participant:
  - {display: Practitioner/1}
  title: Administer Medications
  prefix: '1'
  selectionBehavior: all
  requiredBehavior: must
  timing: {dateTime: '2019-03-06T19:00:00Z'}
  groupingBehavior: logical-group
  action:
  - id: medication-action-1
    type:
      coding:
      - {code: create}
    resource: {localRef: medicationrequest-1}
    description: Administer medication 1
  - id: medication-action-2
    type:
      coding:
      - {code: create}
    resource: {localRef: medicationrequest-2}
    description: Administer medication 2
    relatedAction:
    - offset:
        Duration: {unit: h, value: 1}
      actionId: medication-action-1
      relationship: after-end
  precheckBehavior: 'yes'
  cardinalityBehavior: single
subject: {id: pat-123, resourceType: Patient}
text: {div: '<div xmlns="http://www.w3.org/1999/xhtml">Example RequestGroup illustrating related actions to administer medications in sequence with time delay.</div>', status: generated}
Response: Body
Status: 201
meta: {lastUpdated: '2023-07-17T15:05:51.034423Z', createdAt: '2023-07-17T15:05:51.034423Z', versionId: '498'}
encounter: {id: enc-123, resourceType: Encounter}
reasonCode:
- {text: Treatment}
authoredOn: '2019-03-06T17:31:00Z'
resourceType: RequestGroup
note:
- {text: Additional notes about the request group}
author: {display: Practitioner/1}
contained:
- id: medicationrequest-1
  intent: proposal
  status: unknown
  subject: {id: pat-123, resourceType: Patient}
  medication:
    CodeableConcept: {text: Medication 1}
  resourceType: MedicationRequest
- id: medicationrequest-2
  intent: proposal
  status: unknown
  subject: {id: pat-123, resourceType: Patient}
  medication:
    CodeableConcept: {text: Medication 2}
  resourceType: MedicationRequest
priority: routine
status: draft
id: example
groupIdentifier: {value: '00001', system: 'http://example.org/treatment-group'}
identifier:
- {value: requestgroup-1}
intent: plan
action:
- description: Administer medications at the appropriate time
  textEquivalent: Administer medication 1, followed an hour later by medication 2
  participant:
  - {display: Practitioner/1}
  title: Administer Medications
  prefix: '1'
  selectionBehavior: all
  requiredBehavior: must
  timing: {dateTime: '2019-03-06T19:00:00Z'}
  groupingBehavior: logical-group
  action:
  - id: medication-action-1
    type:
      coding:
      - {code: create}
    resource: {localRef: medicationrequest-1}
    description: Administer medication 1
  - id: medication-action-2
    type:
      coding:
      - {code: create}
    resource: {localRef: medicationrequest-2}
    description: Administer medication 2
    relatedAction:
    - offset:
        Duration: {unit: h, value: 1}
      actionId: medication-action-1
      relationship: after-end
  precheckBehavior: 'yes'
  cardinalityBehavior: single
subject: {id: pat-123, resourceType: Patient}
text: {div: '<div xmlns="http://www.w3.org/1999/xhtml">Example RequestGroup illustrating related actions to administer medications in sequence with time delay.</div>', status: generated}
REST Send Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
PUT /Observation/bloodgroup
content-type: text/yaml
accept: text/yaml

category:
- text: Laboratory
  coding:
  - {code: laboratory, 
  system: 'http://terminology.hl7.org/CodeSystem/observation-category', 
  display: Laboratory}
value:
  CodeableConcept:
    text: A
    coding:
    - {code: '112144000', system: 'http://snomed.info/sct', 
    display: Blood group A (finding)}
resourceType: Observation
status: final
effective: {dateTime: '2018-03-11T16:07:54+00:00'}
id: bloodgroup
code:
  text: Blood Group
  coding:
  - {code: 883-9, system: 'http://loinc.org', 
  display: 'ABO group [Type] in Blood'}
subject: {id: pat-123, resourceType: Patient}
Response: Body
Status: 200
category:
- text: Laboratory
  coding:
  - {code: laboratory, system: 'http://terminology.hl7.org/CodeSystem/observation-category', display: Laboratory}
meta: {lastUpdated: '2023-07-17T15:07:23.287598Z', createdAt: '2023-07-17T15:07:23.287598Z', versionId: '499'}
value:
  CodeableConcept:
    text: A
    coding:
    - {code: '112144000', system: 'http://snomed.info/sct', display: Blood group A (finding)}
resourceType: Observation
status: final
effective: {dateTime: '2018-03-11T16:07:54+00:00'}
id: bloodgroup
code:
  text: Blood Group
  coding:
  - {code: 883-9, system: 'http://loinc.org', display: 'ABO group [Type] in Blood'}
subject: {id: pat-123, resourceType: Patient}
REST Send Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
PUT /Observation/rhstatus
content-type: text/yaml
accept: text/yaml

category:
- text: Laboratory
  coding:
  - {code: laboratory, system: 'http://terminology.hl7.org/CodeSystem/observation-category', display: Laboratory}
meta: {lastUpdated: '2019-12-17T13:44:27.218564Z', createdAt: '2019-12-17T13:44:27.218564Z', versionId: '99'}
value:
  CodeableConcept:
    text: A
    coding:
    - {code: '112144000', system: 'http://snomed.info/sct', display: Blood group A (finding)}
resourceType: Observation
status: final
effective: {dateTime: '2018-03-11T16:07:54+00:00'}
id: rhstatus
code:
  text: Blood Group
  coding:
  - {code: 883-9, system: 'http://loinc.org', display: 'ABO group [Type] in Blood'}
subject: {id: pat-123, resourceType: Patient}
Response: Body
Status: 201
category:
- text: Laboratory
  coding:
  - {code: laboratory, system: 'http://terminology.hl7.org/CodeSystem/observation-category', display: Laboratory}
meta: {lastUpdated: '2023-07-17T15:08:04.124713Z', createdAt: '2023-07-17T15:08:04.124713Z', versionId: '501'}
value:
  CodeableConcept:
    text: A
    coding:
    - {code: '112144000', system: 'http://snomed.info/sct', display: Blood group A (finding)}
resourceType: Observation
status: final
effective: {dateTime: '2018-03-11T16:07:54+00:00'}
id: rhstatus
code:
  text: Blood Group
  coding:
  - {code: 883-9, system: 'http://loinc.org', display: 'ABO group [Type] in Blood'}
subject: {id: pat-123, resourceType: Patient}
REST Send Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
PUT /Observation/bgpanel
content-type: text/yaml
accept: text/yaml

category:
- text: Laboratory
  coding:
  - {code: laboratory, system: 'http://terminology.hl7.org/CodeSystem/observation-category', display: Laboratory}
hasMember:
- {id: bloodgroup, resourceType: Observation}
- {id: rhstatus, resourceType: Observation}
meta: {lastUpdated: '2019-12-17T13:45:37.780512Z', createdAt: '2019-12-17T13:45:37.780512Z', versionId: '106'}
resourceType: Observation
status: final
effective: {dateTime: '2018-03-11T16:07:54+00:00'}
id: bgpanel
code:
  text: Blood Group Panel
  coding:
  - {code: 34532-2, system: 'http://loinc.org', display: ' Blood type and Indirect antibody screen panel - Blood'}
subject: {id: pat-123, resourceType: Patient}
Response: Body
Status: 201
category:
- text: Laboratory
  coding:
  - {code: laboratory, system: 'http://terminology.hl7.org/CodeSystem/observation-category', display: Laboratory}
hasMember:
- {id: bloodgroup, resourceType: Observation}
- {id: rhstatus, resourceType: Observation}
meta: {lastUpdated: '2023-07-17T15:08:27.004452Z', createdAt: '2023-07-17T15:08:27.004452Z', versionId: '502'}
resourceType: Observation
status: final
effective: {dateTime: '2018-03-11T16:07:54+00:00'}
id: bgpanel
code:
  text: Blood Group Panel
  coding:
  - {code: 34532-2, system: 'http://loinc.org', display: ' Blood type and Indirect antibody screen panel - Blood'}
subject: {id: pat-123, resourceType: Patient}

_include

REST Send Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
GET /Encounter?_include=subject:Patient
Response: Body
Status: 200
{
  "query-time": 14,
  "meta": {
    "versionId": "0"
  },
  "include-queries": [
    [
      "SELECT * FROM \"patient\" WHERE (id in (?))",
      "60178987"
    ]
  ],
  "type": "searchset",
  "resourceType": "Bundle",
  "total": 3,
  "link": [
    {
      "relation": "first",
      "url": "/Encounter?_include=subject:Patient&page=1"
    },
    {
      "relation": "self",
      "url": "/Encounter?_include=subject:Patient&page=1"
    }
  ],
  "query-timeout": 60000,
  "entry": [
    {
      "resource": {
        "class": {
          "code": "IMP",
          "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
          "display": "inpatient encounter"
        },
        "status": "planned",
        "subject": {
          "id": "60178987",
          "resourceType": "Patient"
        },
        "participant": [
          {
            "individual": {
              "id": "345",
              "resourceType": "Practitioner"
            }
          }
        ],
        "id": "0b4b3cba-8d98-4232-b3a1-b6057a5fbb25",
        "resourceType": "Encounter",
        "meta": {
          "lastUpdated": "2023-03-27T14:03:01.406918Z",
          "createdAt": "2023-03-27T14:03:01.406918Z",
          "versionId": "371"
        }
      },
      "search": {
        "mode": "match"
      },
      "fullUrl": "https://abnotebooks.aidbox.app/Encounter/0b4b3cba-8d98-4232-b3a1-b6057a5fbb25",
      "link": [
        {
          "relation": "self",
          "url": "https://abnotebooks.aidbox.app/Encounter/0b4b3cba-8d98-4232-b3a1-b6057a5fbb25"
        }
      ]
    },
    {
      "resource": {
        "class": {
          "code": "IMP",
          "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
          "display": "inpatient encounter"
        },
        "status": "finished",
        "subject": {
          "type": "Patient",
          "identifier": {
            "value": "78787878",
            "system": "ssn"
          }
        },
        "id": "enc-123",
        "resourceType": "Encounter",
        "meta": {
          "lastUpdated": "2023-07-17T15:04:43.695512Z",
          "createdAt": "2023-07-17T15:04:43.695512Z",
          "versionId": "496"
        }
      },
      "search": {
        "mode": "match"
      },
      "fullUrl": "https://abnotebooks.aidbox.app/Encounter/enc-123",
      "link": [
        {
          "relation": "self",
          "url": "https://abnotebooks.aidbox.app/Encounter/enc-123"
        }
      ]
    },
    {
      "resource": {
        "class": {
          "code": "IMP",
          "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
          "display": "inpatient encounter"
        },
        "status": "finished",
        "subject": {
          "type": "Patient",
          "identifier": {
            "value": "78787878",
            "system": "ssn"
          }
        },
        "id": "enc-234",
        "resourceType": "Encounter",
        "meta": {
          "lastUpdated": "2023-07-17T15:05:06.825704Z",
          "createdAt": "2023-07-17T15:05:06.825704Z",
          "versionId": "497"
        }
      },
      "search": {
        "mode": "match"
      },
      "fullUrl": "https://abnotebooks.aidbox.app/Encounter/enc-234",
      "link": [
        {
          "relation": "self",
          "url": "https://abnotebooks.aidbox.app/Encounter/enc-234"
        }
      ]
    },
    {
      "resource": {
        "gender": "male",
        "address": [
          {
            "city": "Austin",
            "line": [
              "1 Lane"
            ],
            "state": "TX",
            "postalCode": "78000"
          }
        ],
        "birthDate": "1999-01-01",
        "identifier": [
          {
            "type": {
              "text": "Facility ID",
              "coding": [
                {
                  "code": "FI",
                  "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
                  "display": "Facility ID"
                }
              ]
            },
            "system": "https://my-emr.com/patient/fi"
          }
        ],
        "managingOrganization": {
          "id": "org-1",
          "resourceType": "Organization"
        },
        "id": "60178987",
        "resourceType": "Patient",
        "meta": {
          "lastUpdated": "2023-03-27T14:03:01.406918Z",
          "createdAt": "2023-03-27T14:03:01.406918Z",
          "versionId": "369"
        }
      },
      "search": {
        "mode": "include"
      },
      "fullUrl": "https://abnotebooks.aidbox.app/Patient/60178987",
      "link": [
        {
          "relation": "self",
          "url": "https://abnotebooks.aidbox.app/Patient/60178987"
        }
      ]
    }
  ],
  "query-sql": [
    "SELECT \"encounter\".* FROM \"encounter\" LIMIT ? OFFSET ? ",
    100,
    0
  ]
}

Is the same as

REST Send Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
GET /Encounter?_include=Encounter:subject:Patient
Response: Body
Status: 200
{
  "query-time": 17,
  "meta": {
    "versionId": "0"
  },
  "include-queries": [
    [
      "SELECT * FROM \"patient\" WHERE (id in (?))",
      "60178987"
    ]
  ],
  "type": "searchset",
  "resourceType": "Bundle",
  "total": 3,
  "link": [
    {
      "relation": "first",
      "url": "/Encounter?_include=Encounter:subject:Patient&page=1"
    },
    {
      "relation": "self",
      "url": "/Encounter?_include=Encounter:subject:Patient&page=1"
    }
  ],
  "query-timeout": 60000,
  "entry": [
    {
      "resource": {
        "class": {
          "code": "IMP",
          "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
          "display": "inpatient encounter"
        },
        "status": "planned",
        "subject": {
          "id": "60178987",
          "resourceType": "Patient"
        },
        "participant": [
          {
            "individual": {
              "id": "345",
              "resourceType": "Practitioner"
            }
          }
        ],
        "id": "0b4b3cba-8d98-4232-b3a1-b6057a5fbb25",
        "resourceType": "Encounter",
        "meta": {
          "lastUpdated": "2023-03-27T14:03:01.406918Z",
          "createdAt": "2023-03-27T14:03:01.406918Z",
          "versionId": "371"
        }
      },
      "search": {
        "mode": "match"
      },
      "fullUrl": "https://abnotebooks.aidbox.app/Encounter/0b4b3cba-8d98-4232-b3a1-b6057a5fbb25",
      "link": [
        {
          "relation": "self",
          "url": "https://abnotebooks.aidbox.app/Encounter/0b4b3cba-8d98-4232-b3a1-b6057a5fbb25"
        }
      ]
    },
    {
      "resource": {
        "class": {
          "code": "IMP",
          "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
          "display": "inpatient encounter"
        },
        "status": "finished",
        "subject": {
          "type": "Patient",
          "identifier": {
            "value": "78787878",
            "system": "ssn"
          }
        },
        "id": "enc-123",
        "resourceType": "Encounter",
        "meta": {
          "lastUpdated": "2023-07-17T15:04:43.695512Z",
          "createdAt": "2023-07-17T15:04:43.695512Z",
          "versionId": "496"
        }
      },
      "search": {
        "mode": "match"
      },
      "fullUrl": "https://abnotebooks.aidbox.app/Encounter/enc-123",
      "link": [
        {
          "relation": "self",
          "url": "https://abnotebooks.aidbox.app/Encounter/enc-123"
        }
      ]
    },
    {
      "resource": {
        "class": {
          "code": "IMP",
          "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
          "display": "inpatient encounter"
        },
        "status": "finished",
        "subject": {
          "type": "Patient",
          "identifier": {
            "value": "78787878",
            "system": "ssn"
          }
        },
        "id": "enc-234",
        "resourceType": "Encounter",
        "meta": {
          "lastUpdated": "2023-07-17T15:05:06.825704Z",
          "createdAt": "2023-07-17T15:05:06.825704Z",
          "versionId": "497"
        }
      },
      "search": {
        "mode": "match"
      },
      "fullUrl": "https://abnotebooks.aidbox.app/Encounter/enc-234",
      "link": [
        {
          "relation": "self",
          "url": "https://abnotebooks.aidbox.app/Encounter/enc-234"
        }
      ]
    },
    {
      "resource": {
        "gender": "male",
        "address": [
          {
            "city": "Austin",
            "line": [
              "1 Lane"
            ],
            "state": "TX",
            "postalCode": "78000"
          }
        ],
        "birthDate": "1999-01-01",
        "identifier": [
          {
            "type": {
              "text": "Facility ID",
              "coding": [
                {
                  "code": "FI",
                  "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
                  "display": "Facility ID"
                }
              ]
            },
            "system": "https://my-emr.com/patient/fi"
          }
        ],
        "managingOrganization": {
          "id": "org-1",
          "resourceType": "Organization"
        },
        "id": "60178987",
        "resourceType": "Patient",
        "meta": {
          "lastUpdated": "2023-03-27T14:03:01.406918Z",
          "createdAt": "2023-03-27T14:03:01.406918Z",
          "versionId": "369"
        }
      },
      "search": {
        "mode": "include"
      },
      "fullUrl": "https://abnotebooks.aidbox.app/Patient/60178987",
      "link": [
        {
          "relation": "self",
          "url": "https://abnotebooks.aidbox.app/Patient/60178987"
        }
      ]
    }
  ],
  "query-sql": [
    "SELECT \"encounter\".* FROM \"encounter\" LIMIT ? OFFSET ? ",
    100,
    0
  ]
}

_revinclude

REST Send Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
GET /Patient?_revinclude=Encounter:patient:Patient
Response: Body
Status: 200
{
  "query-time": 21,
  "meta": {
    "versionId": "0"
  },
  "include-queries": [
    [
      "SELECT * FROM \"encounter\" WHERE ((knife_extract_text(resource, $$[[\"subject\",{\"resourceType\":\"Patient\"},\"id\"]]$$))[1] in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?))",
      "$_history",
      "4f4f6a0d-726c-414c-ae85-e49bfcfdedc3",
      "mypatient",
      "_history",
      "pat-123",
      "83bed5e5-1b40-4630-8c25-246afb849cd1",
      "6f5f696a-f092-48b4-a3bf-0cd7f73a2ebf",
      "5c527e5f-4634-4293-9c3d-ac658f743049",
      "_history1",
      "60178987"
    ]
  ],
  "type": "searchset",
  "resourceType": "Bundle",
  "total": 10,
  "link": [
    {
      "relation": "first",
      "url": "/Patient?_revinclude=Encounter:patient:Patient&page=1"
    },
    {
      "relation": "self",
      "url": "/Patient?_revinclude=Encounter:patient:Patient&page=1"
    }
  ],
  "query-timeout": 60000,
  "entry": [
    {
      "resource": {
        "id": "6f5f696a-f092-48b4-a3bf-0cd7f73a2ebf",
        "resourceType": "Patient",
        "meta": {
          "lastUpdated": "2022-11-10T15:08:20.051020Z",
          "createdAt": "2022-11-10T15:08:20.051020Z",
          "versionId": "39"
        }
      },
      "search": {
        "mode": "match"
      },
      "fullUrl": "https://abnotebooks.aidbox.app/Patient/6f5f696a-f092-48b4-a3bf-0cd7f73a2ebf",
      "link": [
        {
          "relation": "self",
          "url": "https://abnotebooks.aidbox.app/Patient/6f5f696a-f092-48b4-a3bf-0cd7f73a2ebf"
        }
      ]
    },
    {
      "resource": {
        "name": [
          {
            "given": [
              "FhirBob"
            ]
          }
        ],
        "id": "5c527e5f-4634-4293-9c3d-ac658f743049",
        "resourceType": "Patient",
        "meta": {
          "lastUpdated": "2022-11-24T11:32:18.286388Z",
          "createdAt": "2022-11-24T11:32:18.286388Z",
          "versionId": "42"
        }
      },
      "search": {
        "mode": "match"
      },
      "fullUrl": "https://abnotebooks.aidbox.app/Patient/5c527e5f-4634-4293-9c3d-ac658f743049",
      "link": [
        {
          "relation": "self",
          "url": "https://abnotebooks.aidbox.app/Patient/5c527e5f-4634-4293-9c3d-ac658f743049"
        }
      ]
    },
    {
      "resource": {
        "gender": "male",
        "address": [
          {
            "city": "Austin",
            "line": [
              "1 Lane"
            ],
            "state": "TX",
            "postalCode": "78000"
          }
        ],
        "birthDate": "1999-01-01",
        "identifier": [
          {
            "type": {
              "text": "Facility ID",
              "coding": [
                {
                  "code": "FI",
                  "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
                  "display": "Facility ID"
                }
              ]
            },
            "system": "https://my-emr.com/patient/fi"
          }
        ],
        "managingOrganization": {
          "id": "org-1",
          "resourceType": "Organization"
        },
        "id": "60178987",
        "resourceType": "Patient",
        "meta": {
          "lastUpdated": "2023-03-27T14:03:01.406918Z",
          "createdAt": "2023-03-27T14:03:01.406918Z",
          "versionId": "369"
        }
      },
      "search": {
        "mode": "match"
      },
      "fullUrl": "https://abnotebooks.aidbox.app/Patient/60178987",
      "link": [
        {
          "relation": "self",
          "url": "https://abnotebooks.aidbox.app/Patient/60178987"
        }
      ]
    },
    {
      "resource": {
        "meta": {
          "profile": [
            "http://hl7.org.nz/fhir/StructureDefinition/NzPatient"
          ],
          "lastUpdated": "2023-05-18T09:23:02.641960Z",
          "createdAt": "2023-05-18T09:23:02.641960Z",
          "versionId": "424"
        },
        "name": [
          {
            "text": "John Doe",
            "given": [
              "John"
            ],
            "family": "Doe"
          }
        ],
        "gender": "male",
        "extension": [
          {
            "url": "http://hl7.org.nz/fhir/StructureDefinition/domicile-code",
            "valueCodeableConcept": {
              "coding": [
                {
                  "code": "0125",
                  "system": "https://standards.digital.health.nz/ns/domicile-code",
                  "display": "Waipu"
                }
              ]
            }
          }
        ],
        "id": "4f4f6a0d-726c-414c-ae85-e49bfcfdedc3",
        "resourceType": "Patient"
      },
      "search": {
        "mode": "match"
      },
      "fullUrl": "https://abnotebooks.aidbox.app/Patient/4f4f6a0d-726c-414c-ae85-e49bfcfdedc3",
      "link": [
        {
          "relation": "self",
          "url": "https://abnotebooks.aidbox.app/Patient/4f4f6a0d-726c-414c-ae85-e49bfcfdedc3"
        }
      ]
    },
    {
      "resource": {
        "id": "83bed5e5-1b40-4630-8c25-246afb849cd1",
        "resourceType": "Patient",
        "meta": {
          "lastUpdated": "2023-06-19T10:35:10.447364Z",
          "createdAt": "2023-06-19T10:35:10.447364Z",
          "versionId": "469"
        }
      },
      "search": {
        "mode": "match"
      },
      "fullUrl": "https://abnotebooks.aidbox.app/Patient/83bed5e5-1b40-4630-8c25-246afb849cd1",
      "link": [
        {
          "relation": "self",
          "url": "https://abnotebooks.aidbox.app/Patient/83bed5e5-1b40-4630-8c25-246afb849cd1"
        }
      ]
    },
    {
      "resource": {
        "id": "_history",
        "resourceType": "Patient",
        "meta": {
          "lastUpdated": "2023-06-19T10:35:16.420454Z",
          "createdAt": "2023-06-19T10:35:16.420454Z",
          "versionId": "471"
        }
      },
      "search": {
        "mode": "match"
      },
      "fullUrl": "https://abnotebooks.aidbox.app/Patient/_history",
      "link": [
        {
          "relation": "self",
          "url": "https://abnotebooks.aidbox.app/Patient/_history"
        }
      ]
    },
    {
      "resource": {
        "id": "$_history",
        "resourceType": "Patient",
        "meta": {
          "lastUpdated": "2023-06-19T10:35:23.080846Z",
          "createdAt": "2023-06-19T10:35:23.080846Z",
          "versionId": "472"
        }
      },
      "search": {
        "mode": "match"
      },
      "fullUrl": "https://abnotebooks.aidbox.app/Patient/$_history",
      "link": [
        {
          "relation": "self",
          "url": "https://abnotebooks.aidbox.app/Patient/$_history"
        }
      ]
    },
    {
      "resource": {
        "id": "_history1",
        "resourceType": "Patient",
        "meta": {
          "lastUpdated": "2023-06-19T10:36:06.438252Z",
          "createdAt": "2023-06-19T10:36:06.438252Z",
          "versionId": "481"
        }
      },
      "search": {
        "mode": "match"
      },
      "fullUrl": "https://abnotebooks.aidbox.app/Patient/_history1",
      "link": [
        {
          "relation": "self",
          "url": "https://abnotebooks.aidbox.app/Patient/_history1"
        }
      ]
    },
    {
      "resource": {
        "payment_id": "abcd",
        "id": "mypatient",
        "resourceType": "Patient",
        "meta": {
          "lastUpdated": "2023-02-28T10:11:46.850639Z",
          "createdAt": "2023-02-28T09:55:30.871913Z",
          "versionId": "264"
        }
      },
      "search": {
        "mode": "match"
      },
      "fullUrl": "https://abnotebooks.aidbox.app/Patient/mypatient",
      "link": [
        {
          "relation": "self",
          "url": "https://abnotebooks.aidbox.app/Patient/mypatient"
        }
      ]
    },
    {
      "resource": {
        "identifier": [
          {
            "value": "78787878",
            "system": "ssn"
          }
        ],
        "id": "pat-123",
        "resourceType": "Patient",
        "meta": {
          "lastUpdated": "2023-07-17T15:04:23.088692Z",
          "createdAt": "2023-07-17T15:04:23.088692Z",
          "versionId": "495"
        }
      },
      "search": {
        "mode": "match"
      },
      "fullUrl": "https://abnotebooks.aidbox.app/Patient/pat-123",
      "link": [
        {
          "relation": "self",
          "url": "https://abnotebooks.aidbox.app/Patient/pat-123"
        }
      ]
    },
    {
      "resource": {
        "class": {
          "code": "IMP",
          "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
          "display": "inpatient encounter"
        },
        "status": "planned",
        "subject": {
          "id": "60178987",
          "resourceType": "Patient"
        },
        "participant": [
          {
            "individual": {
              "id": "345",
              "resourceType": "Practitioner"
            }
          }
        ],
        "id": "0b4b3cba-8d98-4232-b3a1-b6057a5fbb25",
        "resourceType": "Encounter",
        "meta": {
          "lastUpdated": "2023-03-27T14:03:01.406918Z",
          "createdAt": "2023-03-27T14:03:01.406918Z",
          "versionId": "371"
        }
      },
      "search": {
        "mode": "include"
      },
      "fullUrl": "https://abnotebooks.aidbox.app/Encounter/0b4b3cba-8d98-4232-b3a1-b6057a5fbb25",
      "link": [
        {
          "relation": "self",
          "url": "https://abnotebooks.aidbox.app/Encounter/0b4b3cba-8d98-4232-b3a1-b6057a5fbb25"
        }
      ]
    }
  ],
  "query-sql": [
    "SELECT \"patient\".* FROM \"patient\" LIMIT ? OFFSET ? ",
    100,
    0
  ]
}

Group _(rev)include

REST Send Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
GET /RequestGroup?_include=encounter,patient:Patient,author:PractitionerRole

Recursive (rev)includes

REST Send Cells run only inside Aidbox. Use Run in Aidbox above to open this notebook in your own instance.
GET /Observation?_include:recurse=has-member
Response: Body
Status: 200
{
  "query-time": 8,
  "meta": {
    "versionId": "0"
  },
  "include-queries": [
    [
      "SELECT * FROM \"observation\" WHERE (id in (?, ?))",
      "bloodgroup",
      "rhstatus"
    ]
  ],
  "type": "searchset",
  "resourceType": "Bundle",
  "total": 3,
  "link": [
    {
      "relation": "first",
      "url": "/Observation?_include:recurse=has-member&page=1"
    },
    {
      "relation": "self",
      "url": "/Observation?_include:recurse=has-member&page=1"
    }
  ],
  "query-timeout": 60000,
  "entry": [
    {
      "resource": {
        "category": [
          {
            "text": "Laboratory",
            "coding": [
              {
                "code": "laboratory",
                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                "display": "Laboratory"
              }
            ]
          }
        ],
        "meta": {
          "lastUpdated": "2023-07-17T15:07:23.287598Z",
          "createdAt": "2023-07-17T15:07:23.287598Z",
          "versionId": "499"
        },
        "value": {
          "CodeableConcept": {
            "text": "A",
            "coding": [
              {
                "code": "112144000",
                "system": "http://snomed.info/sct",
                "display": "Blood group A (finding)"
              }
            ]
          }
        },
        "resourceType": "Observation",
        "status": "final",
        "effective": {
          "dateTime": "2018-03-11T16:07:54+00:00"
        },
        "id": "bloodgroup",
        "code": {
          "text": "Blood Group",
          "coding": [
            {
              "code": "883-9",
              "system": "http://loinc.org",
              "display": "ABO group [Type] in Blood"
            }
          ]
        },
        "subject": {
          "id": "pat-123",
          "resourceType": "Patient"
        }
      },
      "search": {
        "mode": "match"
      },
      "fullUrl": "https://abnotebooks.aidbox.app/Observation/bloodgroup",
      "link": [
        {
          "relation": "self",
          "url": "https://abnotebooks.aidbox.app/Observation/bloodgroup"
        }
      ]
    },
    {
      "resource": {
        "category": [
          {
            "text": "Laboratory",
            "coding": [
              {
                "code": "laboratory",
                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                "display": "Laboratory"
              }
            ]
          }
        ],
        "meta": {
          "lastUpdated": "2023-07-17T15:08:04.124713Z",
          "createdAt": "2023-07-17T15:08:04.124713Z",
          "versionId": "501"
        },
        "value": {
          "CodeableConcept": {
            "text": "A",
            "coding": [
              {
                "code": "112144000",
                "system": "http://snomed.info/sct",
                "display": "Blood group A (finding)"
              }
            ]
          }
        },
        "resourceType": "Observation",
        "status": "final",
        "effective": {
          "dateTime": "2018-03-11T16:07:54+00:00"
        },
        "id": "rhstatus",
        "code": {
          "text": "Blood Group",
          "coding": [
            {
              "code": "883-9",
              "system": "http://loinc.org",
              "display": "ABO group [Type] in Blood"
            }
          ]
        },
        "subject": {
          "id": "pat-123",
          "resourceType": "Patient"
        }
      },
      "search": {
        "mode": "match"
      },
      "fullUrl": "https://abnotebooks.aidbox.app/Observation/rhstatus",
      "link": [
        {
          "relation": "self",
          "url": "https://abnotebooks.aidbox.app/Observation/rhstatus"
        }
      ]
    },
    {
      "resource": {
        "category": [
          {
            "text": "Laboratory",
            "coding": [
              {
                "code": "laboratory",
                "system": "http://terminology.hl7.org/CodeSystem/observation-category",
                "display": "Laboratory"
              }
            ]
          }
        ],
        "hasMember": [
          {
            "id": "bloodgroup",
            "resourceType": "Observation"
          },
          {
            "id": "rhstatus",
            "resourceType": "Observation"
          }
        ],
        "meta": {
          "lastUpdated": "2023-07-17T15:08:27.004452Z",
          "createdAt": "2023-07-17T15:08:27.004452Z",
          "versionId": "502"
        },
        "resourceType": "Observation",
        "status": "final",
        "effective": {
          "dateTime": "2018-03-11T16:07:54+00:00"
        },
        "id": "bgpanel",
        "code": {
          "text": "Blood Group Panel",
          "coding": [
            {
              "code": "34532-2",
              "system": "http://loinc.org",
              "display": " Blood type and Indirect antibody screen panel - Blood"
            }
          ]
        },
        "subject": {
          "id": "pat-123",
          "resourceType": "Patient"
        }
      },
      "search": {
        "mode": "match"
      },
      "fullUrl": "https://abnotebooks.aidbox.app/Observation/bgpanel",
      "link": [
        {
          "relation": "self",
          "url": "https://abnotebooks.aidbox.app/Observation/bgpanel"
        }
      ]
    }
  ],
  "query-sql": [
    "SELECT \"observation\".* FROM \"observation\" LIMIT ? OFFSET ? ",
    100,
    0
  ]
}