query_dataset
Run custom ODSQL queries on SNS Transparency portal datasets to retrieve filtered, aggregated, or grouped official health statistics.
Instructions
Run an ODSQL query on any SNS Transparency portal dataset (Opendatasoft Explore API v2.1).
Use after search_datasets for anything the curated tools don't cover. Clauses are ODSQL:
where:
instituicao like "santa maria" and tempo >= date'2026-01-01'(likeis a case- and accent-insensitive "contains"; dates use date'YYYY-MM-DD')select:
tempo, instituicao, total_urgenciasor aggregatessum(total_urgencias) as totalgroup_by:
regiaoortempo(combine with aggregates in select)order_by:
tempo descMost hospital-activity datasets (fieldtempo, monthly) store YEAR-TO-DATE CUMULATIVE values: December is the annual total; a single month = this month minus the previous one. Many datasets have aregiaoand aninstituicao(orentidade) field. Official statistics, not live data.
Args: dataset_id: e.g. "ocupacao-do-internamento" (from search_datasets). where, select, group_by, order_by: ODSQL clauses (optional). limit: Rows to return (default 20, max 100). offset: Skip rows, for paging.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| where | No | ||
| offset | No | ||
| select | No | ||
| group_by | No | ||
| order_by | No | ||
| dataset_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||