Count Patient Data
/medical/v1/patient/{id}/consolidated/count
curl --request GET \
--url https://api.sandbox.metriport.com/medical/v1/patient/{id}/consolidated/count \
--header 'x-api-key: <x-api-key>'
Returns the amount of resources for each resource type, for a given Patient.
Path Params
The ID of the Patient.
A comma separated, case sensitive list of resources to be counted. If none are provided all resources will be included.
The start date (inclusive) for which to filter resources to count - formatted YYYY-MM-DD
as per
ISO 8601. If not provided, no start date filter will be applied.
The end date (inclusive) for which to filter resources to count - formatted YYYY-MM-DD
as per
ISO 8601. If not provided, no end date filter will be applied.
Response
The amount of resources for each resource type, for a given Patient. It also includes the filters used to perform the query.
import { MetriportMedicalApi } from "@metriport/api-sdk";
const metriport = new MetriportMedicalApi(apiToken);
const count = await metriport.countPatientConsolidated(
patientId,
["AllergyIntolerance", "Appointment"] as const,
"2023-03-01",
"2023-04-01"
);
The sum of all resource type count.
Object containing resource types as properties and the amount of entries for the resource as the value (number). Only resource types with amount of entries higher than one are included.
The filters used to perform this operation.
{
"total": 8714,
"resources": {
"AllergyIntolerance": 11,
"Condition": 467,
"Coverage": 11,
"DiagnosticReport": 560,
"DocumentReference": 140,
"Encounter": 175,
"FamilyMemberHistory": 6,
"Immunization": 40,
"MedicationAdministration": 48,
"MedicationRequest": 1226,
"Observation": 5821,
"Procedure": 158,
"RelatedPerson": 17,
"Task": 34
},
"filter": {
"resources": "all",
"dateFrom": "2021-01-02",
"dateTo": "2022-01-02"
}
}
curl --request GET \
--url https://api.sandbox.metriport.com/medical/v1/patient/{id}/consolidated/count \
--header 'x-api-key: <x-api-key>'
import { MetriportMedicalApi } from "@metriport/api-sdk";
const metriport = new MetriportMedicalApi(apiToken);
const count = await metriport.countPatientConsolidated(
patientId,
["AllergyIntolerance", "Appointment"] as const,
"2023-03-01",
"2023-04-01"
);