Returns a LogQuery builder scoped to the whole organization or an explicit patient cohort.
POST
/
v1
/
state
/
logs
/
query
import olira
olira.init(api_key="YOUR_API_KEY")
# Whole org
rows = (
olira.population_logs()
.eq("type", "health_metric")
.order("timestamp", desc=True)
.limit(50)
.execute()
)
print(rows.count)
# Explicit cohort + aggregation
agg = (
olira.population_logs(patient_ids=["8a4fde23-0f1b-4c2a-9d7e-b36c1a5f0e82", "other-patient-id"])
.group_by("type")
.count_agg("n")
.execute()
)
for row in agg:
print(row["type"], row["n"])
using Olira;
OliraModule.Init(apiKey: "YOUR_API_KEY");
// Whole org
var rows = OliraModule.PopulationLogs()
.Eq("type", "health_metric")
.Order("timestamp", desc: true)
.Limit(50)
.Execute();
Console.WriteLine(rows.Count);
// Explicit cohort + aggregation
var agg = OliraModule.PopulationLogs(patientIds: ["8a4fde23-0f1b-4c2a-9d7e-b36c1a5f0e82", "other-patient-id"])
.GroupBy("type")
.CountAgg("n")
.Execute();
foreach (var row in agg)
Console.WriteLine($"{row["type"]} {row["n"]}");
POST /v1/state/logs/query
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"filter": [{"field": "type", "op": "eq", "value": "health_metric"}],
"order": [{"field": "timestamp", "desc": true}],
"limit": 50
}
LogQueryResult(
count=3,
rows=[
{"id": "log-a", "type": "health_metric", "timestamp": "2026-01-06T00:00:00Z", "payload": {...}},
{"id": "log-b", "type": "health_metric", "timestamp": "2026-01-05T00:00:00Z", "payload": {...}},
{"id": "log-c", "type": "health_metric", "timestamp": "2026-01-01T00:00:00Z", "payload": {...}},
],
patient_id=None,
organization_id="org-001",
)
{
"error": true,
"status_code": 401,
"error_type": "authentication_error",
"message": "Could not validate credentials",
"details": [
{
"type": "authentication_error",
"message": "Could not validate credentials"
}
],
"timestamp": "2026-05-06T12:00:00+00:00"
}
{
"error": true,
"status_code": 403,
"error_type": "authorization_error",
"message": "Insufficient OAuth scope for this endpoint",
"details": [
{
"type": "authorization_error",
"message": "Insufficient OAuth scope for this endpoint"
}
],
"timestamp": "2026-05-06T12:00:00+00:00"
}
{
"error": true,
"status_code": 404,
"error_type": "not_found_error",
"message": "Patient not found",
"details": [
{
"type": "not_found_error",
"message": "Patient not found"
}
],
"timestamp": "2026-05-06T12:00:00+00:00"
}
{
"error": true,
"status_code": 422,
"error_type": "validation_error",
"message": "Request validation failed (1 error)",
"details": [
{
"type": "missing",
"message": "Field required",
"field": "patient_id",
"location": ["body", "patient_id"],
"input_value": null
}
],
"timestamp": "2026-05-06T12:00:00+00:00"
}
{
"error": true,
"status_code": 429,
"error_type": "server_error",
"message": "Rate limit exceeded",
"details": [
{
"type": "rate_limit",
"message": "Too many requests; retry after backoff"
}
],
"timestamp": "2026-05-06T12:00:00+00:00"
}
{
"error": true,
"status_code": 500,
"error_type": "internal_server_error",
"message": "An internal server error occurred",
"details": [
{
"type": "internal_server_error",
"message": "An unexpected error occurred while processing your request"
}
],
"timestamp": "2026-05-06T12:00:00+00:00"
}
olira.population_logs(patient_ids: list[str] | None = None) -> LogQueryResult
OliraModule.PopulationLogs(IReadOnlyList<string>? patientIds = null) // -> LogQueryResult
sdk:state-read
Omit patient_ids (or pass None) for org-wide queries; pass a list to restrict to a cohort. All chainable builder methods are identical to logs — see that entry.
Parameters
list[str] | None
default:"None"
Cohort of patient ids. None = whole org. Omitting queries all patients org-wide — use filters and limits when running at scale.
Returns
LogQueryResult — Same shape as logs — call .execute() or another terminal to run.
int
Total rows matched.
list[dict]
Log dicts or aggregated dicts.
str | None
Echo of the org id.
str | None
Null for population queries.
Raises
| Exception | When |
|---|---|
ValidationError | Unknown operator (client-side) or HTTP 422 from server. |
AuthError | HTTP 401 or 403 — invalid API key or insufficient OAuth scope for this endpoint. |
ServerError | HTTP 409 (e.g. conflicting external identifier) or repeated 5xx after retries; includes status_code when applicable. |
RateLimitError | HTTP 429 — rate limited; check retry_after (seconds). |
NetworkError | Connection timeout, DNS failure, or read error after retries. |
import olira
olira.init(api_key="YOUR_API_KEY")
# Whole org
rows = (
olira.population_logs()
.eq("type", "health_metric")
.order("timestamp", desc=True)
.limit(50)
.execute()
)
print(rows.count)
# Explicit cohort + aggregation
agg = (
olira.population_logs(patient_ids=["8a4fde23-0f1b-4c2a-9d7e-b36c1a5f0e82", "other-patient-id"])
.group_by("type")
.count_agg("n")
.execute()
)
for row in agg:
print(row["type"], row["n"])
using Olira;
OliraModule.Init(apiKey: "YOUR_API_KEY");
// Whole org
var rows = OliraModule.PopulationLogs()
.Eq("type", "health_metric")
.Order("timestamp", desc: true)
.Limit(50)
.Execute();
Console.WriteLine(rows.Count);
// Explicit cohort + aggregation
var agg = OliraModule.PopulationLogs(patientIds: ["8a4fde23-0f1b-4c2a-9d7e-b36c1a5f0e82", "other-patient-id"])
.GroupBy("type")
.CountAgg("n")
.Execute();
foreach (var row in agg)
Console.WriteLine($"{row["type"]} {row["n"]}");
POST /v1/state/logs/query
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"filter": [{"field": "type", "op": "eq", "value": "health_metric"}],
"order": [{"field": "timestamp", "desc": true}],
"limit": 50
}
LogQueryResult(
count=3,
rows=[
{"id": "log-a", "type": "health_metric", "timestamp": "2026-01-06T00:00:00Z", "payload": {...}},
{"id": "log-b", "type": "health_metric", "timestamp": "2026-01-05T00:00:00Z", "payload": {...}},
{"id": "log-c", "type": "health_metric", "timestamp": "2026-01-01T00:00:00Z", "payload": {...}},
],
patient_id=None,
organization_id="org-001",
)
{
"error": true,
"status_code": 401,
"error_type": "authentication_error",
"message": "Could not validate credentials",
"details": [
{
"type": "authentication_error",
"message": "Could not validate credentials"
}
],
"timestamp": "2026-05-06T12:00:00+00:00"
}
{
"error": true,
"status_code": 403,
"error_type": "authorization_error",
"message": "Insufficient OAuth scope for this endpoint",
"details": [
{
"type": "authorization_error",
"message": "Insufficient OAuth scope for this endpoint"
}
],
"timestamp": "2026-05-06T12:00:00+00:00"
}
{
"error": true,
"status_code": 404,
"error_type": "not_found_error",
"message": "Patient not found",
"details": [
{
"type": "not_found_error",
"message": "Patient not found"
}
],
"timestamp": "2026-05-06T12:00:00+00:00"
}
{
"error": true,
"status_code": 422,
"error_type": "validation_error",
"message": "Request validation failed (1 error)",
"details": [
{
"type": "missing",
"message": "Field required",
"field": "patient_id",
"location": ["body", "patient_id"],
"input_value": null
}
],
"timestamp": "2026-05-06T12:00:00+00:00"
}
{
"error": true,
"status_code": 429,
"error_type": "server_error",
"message": "Rate limit exceeded",
"details": [
{
"type": "rate_limit",
"message": "Too many requests; retry after backoff"
}
],
"timestamp": "2026-05-06T12:00:00+00:00"
}
{
"error": true,
"status_code": 500,
"error_type": "internal_server_error",
"message": "An internal server error occurred",
"details": [
{
"type": "internal_server_error",
"message": "An unexpected error occurred while processing your request"
}
],
"timestamp": "2026-05-06T12:00:00+00:00"
}
⌘I
import olira
olira.init(api_key="YOUR_API_KEY")
# Whole org
rows = (
olira.population_logs()
.eq("type", "health_metric")
.order("timestamp", desc=True)
.limit(50)
.execute()
)
print(rows.count)
# Explicit cohort + aggregation
agg = (
olira.population_logs(patient_ids=["8a4fde23-0f1b-4c2a-9d7e-b36c1a5f0e82", "other-patient-id"])
.group_by("type")
.count_agg("n")
.execute()
)
for row in agg:
print(row["type"], row["n"])
using Olira;
OliraModule.Init(apiKey: "YOUR_API_KEY");
// Whole org
var rows = OliraModule.PopulationLogs()
.Eq("type", "health_metric")
.Order("timestamp", desc: true)
.Limit(50)
.Execute();
Console.WriteLine(rows.Count);
// Explicit cohort + aggregation
var agg = OliraModule.PopulationLogs(patientIds: ["8a4fde23-0f1b-4c2a-9d7e-b36c1a5f0e82", "other-patient-id"])
.GroupBy("type")
.CountAgg("n")
.Execute();
foreach (var row in agg)
Console.WriteLine($"{row["type"]} {row["n"]}");
POST /v1/state/logs/query
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
{
"filter": [{"field": "type", "op": "eq", "value": "health_metric"}],
"order": [{"field": "timestamp", "desc": true}],
"limit": 50
}
LogQueryResult(
count=3,
rows=[
{"id": "log-a", "type": "health_metric", "timestamp": "2026-01-06T00:00:00Z", "payload": {...}},
{"id": "log-b", "type": "health_metric", "timestamp": "2026-01-05T00:00:00Z", "payload": {...}},
{"id": "log-c", "type": "health_metric", "timestamp": "2026-01-01T00:00:00Z", "payload": {...}},
],
patient_id=None,
organization_id="org-001",
)
{
"error": true,
"status_code": 401,
"error_type": "authentication_error",
"message": "Could not validate credentials",
"details": [
{
"type": "authentication_error",
"message": "Could not validate credentials"
}
],
"timestamp": "2026-05-06T12:00:00+00:00"
}
{
"error": true,
"status_code": 403,
"error_type": "authorization_error",
"message": "Insufficient OAuth scope for this endpoint",
"details": [
{
"type": "authorization_error",
"message": "Insufficient OAuth scope for this endpoint"
}
],
"timestamp": "2026-05-06T12:00:00+00:00"
}
{
"error": true,
"status_code": 404,
"error_type": "not_found_error",
"message": "Patient not found",
"details": [
{
"type": "not_found_error",
"message": "Patient not found"
}
],
"timestamp": "2026-05-06T12:00:00+00:00"
}
{
"error": true,
"status_code": 422,
"error_type": "validation_error",
"message": "Request validation failed (1 error)",
"details": [
{
"type": "missing",
"message": "Field required",
"field": "patient_id",
"location": ["body", "patient_id"],
"input_value": null
}
],
"timestamp": "2026-05-06T12:00:00+00:00"
}
{
"error": true,
"status_code": 429,
"error_type": "server_error",
"message": "Rate limit exceeded",
"details": [
{
"type": "rate_limit",
"message": "Too many requests; retry after backoff"
}
],
"timestamp": "2026-05-06T12:00:00+00:00"
}
{
"error": true,
"status_code": 500,
"error_type": "internal_server_error",
"message": "An internal server error occurred",
"details": [
{
"type": "internal_server_error",
"message": "An unexpected error occurred while processing your request"
}
],
"timestamp": "2026-05-06T12:00:00+00:00"
}

