/
Technical Case Study

Primary Care Clinical Intelligence

BigQuery SQL pipelines and models integrated into municipal electronic health records (Vitacare), stratifying clinical risk and wait times to support primary care decision-making.

IMPACT SYNTHESIS

Translating clinical guidelines into versioned and auditable SQL rules for decision support across municipal healthcare.

DIAGRAMA DE ARQUITETURA METODOLÓGICA
Pipeline em Produção
ETAPA 01

Prontuário (EHR)

Microdados longitudinais da APS

ETAPA 02

Camada de Limpeza SQL

Desduplicação e conformidade

ETAPA 03

Regras Clínicas BigQuery

Janelas e critérios da saúde do adulto

ETAPA 04

Estratificação e Painel APS

Apoio à decisão e busca ativa

MODELAGEM CONCEITUAL · APS

Curva de Retenção e Cobertura Longitudinal

Pipeline ETL · Dados Protegidos por LGPD

Taxa de retenção e acompanhamento contínuo da coorte hipertensa/diabética em 24 meses.

Meta Nacional = 85%Ponto Crítico: 6º mês (Busca Ativa)← Meses de Acompanhamento (0 a 24) →Taxa de Retenção (%)
Parâmetro0 meses
Estimativa52.0%
IC 95%48.5% – 55.5%
ClassificaçãoFase de Captação Ativa
Coorte Monitorada25.000+ pacientes
Equipes ESF82 equipes
Retenção aos 24m94,0% (meta: 85%)
* Visualização esquemática e modelagem conceitual baseada em microdados públicos do DATASUS/SINAN.

Context and Challenge

Primary healthcare management deals with millions of longitudinal EHR records encompassing clinical consultations, laboratory exams, chronic diagnoses, and territorial care assignments. When clinical metrics lack transparent, auditable business logic, conflicting numerators/denominators arise, hindering proactive patient outreach.

Architecture and Analytics

At the Clinical Intelligence Unit (NIA / SMS-Rio), work bridges public health domain knowledge with analytical data engineering:

  1. Clinical and epidemiological specification: rigorous inclusion criteria, follow-up temporal windows, risk stratification layers, and outcome rules for adult chronic disease lines.
  2. SQL analytical pipelines (Google Cloud BigQuery): partitioned, modular queries over electronic health records, isolating raw staging, validated clinical business logic, and reporting views.
  3. Cross-validation with clinical frontline: systematic reconciliation of audit trails with primary care health teams prior to production dashboard deployment.

Key Outcomes and Impact

  • Version-controlled, reproducible SQL definitions for primary care health indicators.
  • Drastic reduction in ambiguity between EHR registration and municipal population health dashboards.
  • Scalable technical foundation supporting risk stratification across 1.4M+ patient records.

Governance note: complying with patient data privacy regulations (LGPD), this case study documents computational architecture and epidemiological methodologies without disclosing individual microdata.

Core Deliverables and Architecture
  • • Modular BigQuery SQL pipelines over municipal EHR (Vitacare)
  • • Clinical risk stratification and chronic care decision support
  • • Auditable operational metric definitions in BigQuery