Count Patient Data
curl --request GET \
--url https://api.sandbox.metriport.com/medical/v1/patient/{id}/consolidated/count \
--header 'x-api-key: <api-key>'import requests
url = "https://api.sandbox.metriport.com/medical/v1/patient/{id}/consolidated/count"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.sandbox.metriport.com/medical/v1/patient/{id}/consolidated/count', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.metriport.com/medical/v1/patient/{id}/consolidated/count",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.metriport.com/medical/v1/patient/{id}/consolidated/count"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.sandbox.metriport.com/medical/v1/patient/{id}/consolidated/count")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.metriport.com/medical/v1/patient/{id}/consolidated/count")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_bodyimport { 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"
);
FHIR
Count Patient Data
Get a count of a Patient’s data per resource.
Listen to this pageabout 1 min
GET
/
medical
/
v1
/
patient
/
{id}
/
consolidated
/
count
Count Patient Data
curl --request GET \
--url https://api.sandbox.metriport.com/medical/v1/patient/{id}/consolidated/count \
--header 'x-api-key: <api-key>'import requests
url = "https://api.sandbox.metriport.com/medical/v1/patient/{id}/consolidated/count"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.sandbox.metriport.com/medical/v1/patient/{id}/consolidated/count', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sandbox.metriport.com/medical/v1/patient/{id}/consolidated/count",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.metriport.com/medical/v1/patient/{id}/consolidated/count"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.sandbox.metriport.com/medical/v1/patient/{id}/consolidated/count")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.metriport.com/medical/v1/patient/{id}/consolidated/count")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_bodyimport { 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"
);
Returns the amount of resources for each resource type, for a given Patient.
Path Params
Query Params
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"
);
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.
Show Filter properties
Show Filter properties
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.{
"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"
}
}

