feat(web): linha do tempo cívica — torna os 130k civic_events visíveis - #37
Conversation
Conecta o app ao banco canônico que o codex construiu: a página /eventos lê os ~130 mil acontecimentos reais de Americana (pagamentos, contratos, atos, sanções, receitas) direto de civic_events. - lib/eventos.ts: read model resiliente (degrada para vazio sem DATABASE_URL, então o build no CI não quebra); helpers de legibilidade pro cidadão (categoria, fonte humana, valor BRL, data extensa) - app/eventos/page.tsx: força dynamic (lê banco em runtime); cabeçalho com total real, filtros por categoria com contagem, cards com FONTE e VALOR sempre visíveis + link "ver documento" - @deolho/db reexporta operadores do drizzle (app não declara drizzle direto) - web passa a depender de @deolho/db (workspace) Validado live: HTTP 200, 129.736 eventos, 50 cards, filtros corretos (Pagamento 124.794 · Contrato 602 · Sanção 20). Build/lint/typecheck OK. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f307e0006a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return ( | ||
| <article className="rounded-xl border border-foreground/10 bg-card p-4"> | ||
| <header className="flex items-center justify-between gap-2"> | ||
| <span className="inline-flex items-center gap-1.5 text-xs font-semibold text-foreground/60"> | ||
| <span aria-hidden>{meta.emoji}</span> | ||
| {meta.label} | ||
| </span> | ||
| <span className="text-[11px] text-muted-foreground">{dataExtensa(evento.dataEvento)}</span> |
There was a problem hiding this comment.
Show the required disclaimer for attention signals
When civic_events includes rows with trust_type = 'sinal_atencao' (for example the existing diário mapper writes limitacao_fonte events this way for unclassified publications), this card renders them just like official facts and never displays the required warning that an attention signal does not indicate irregularity. That makes the new public timeline violate the product rule for signals of attention in exactly the all-events view where those rows will appear.
Useful? React with 👍 / 👎.
| const CATS_VALIDAS: CategoriaEvento[] = [ | ||
| "contratacao", | ||
| "pagamento", | ||
| "receita", | ||
| "ato_normativo", | ||
| "nomeacao_exoneracao", | ||
| "sancao", | ||
| "audiencia_conselho", | ||
| "obra_zeladoria", | ||
| ]; |
There was a problem hiding this comment.
Accept every category emitted by the stats chips
The filter UI renders one chip for every category returned by getEventosStats(), but this whitelist rejects several valid database enum values (limitacao_fonte, proposta_legislativa, indicacao_requerimento, relacionamento). If any of those rows exist, the generated chip links to /eventos?cat=..., then this validation drops the category to undefined, so the user gets the unfiltered timeline and the chip can never become active.
Useful? React with 👍 / 👎.
O que muda
A fundação cívica do codex construiu ~130 mil eventos no banco — mas estavam invisíveis (o app só mostrava o JSON antigo). Esta é a Onda 1: torná-los visíveis.
/eventos— linha do tempo cívica lendocivic_eventsreal: total, filtros por categoria com contagem, cards com fonte e valor sempre visíveis + link "ver documento".lib/eventos.ts— read model resiliente (semDATABASE_URLdegrada pra vazio → build no CI não quebra) + helpers de legibilidade pro cidadão.@deolho/dbreexporta operadores do Drizzle (o app não declaradrizzle-ormdireto).Validação (live, com o banco real)
pnpm -r build / lint / typecheck✅ (/eventoséƒdynamic)Próximas ondas
Tipo