John
John

Reputation: 4006

Is there a way to get a count of the number of patients (or other resources) from a FHIR server?

Is it possible to get a count for the number of Patients on an FHIR server. Searching for FHIR and count I get several results for using _count to limit the number of records returned by a query, but I'm not seeing anything that shows how to get a count for the number of Patients on a FHIR Patient server.

Upvotes: 4

Views: 4466

Answers (3)

Oyeme
Oyeme

Reputation: 11225

To get the total amount of patient

https://.../?_summary=count&_type=Patient

To get the total amount of patient with their versions

https://../Patient/?_summary=count

Upvotes: 0

BlessedHIT
BlessedHIT

Reputation: 1971

You could use _total

https://syntheticmass.mitre.org/v1/fhir/Patient?apikey=<your key here>&_total=accurate

Which should return something along these lines (see example below). You can access the total # of Patients resources via the total element in the returned Bundle

{
   "entry":[
...
   ],
   "link":[
...
   ],
   "resourceType":"Bundle",
   "total":500,
   "type":"searchset"
}

Read more about this option from the fhir wiki

Upvotes: 4

John
John

Reputation: 4006

It looks like this is being done with the _summary=count parameter:

https://syntheticmass.mitre.org/v1/fhir/Patient?_summary=count&apikey=API_KEY_GOES_HERE

Unfortunately it looks like this isn't supported by syntheicmass

{
  "issue": [
    {
      "code": "value",
      "details": {
        "text": "invalid_query"
      },
      "diagnostics": "generic::unimplemented: _summary argument is not supported yet.",
      "severity": "error"
    }
  ],
  "resourceType": "OperationOutcome"
}

Upvotes: 8

Related Questions