teqo/src/lib/territorialClassAnchors.ts
Francisco Ignácio Fontoura Solla 29f45e093a B13: escala relativa no mapa dos Municipios (quantis/LQ/posicao) + artefato TSE v3
O coropleto do Inicio era quase monocromatico porque 0-100% dos validos comprime
uma disputa cujo topo estadual e 4,71%. Tres escalas relativas ao proprio
candidato, todas em classes discretas: quantis (novo default), padrao proprio
(LQ) e posicao no municipio, ao lado de "% dos validos" (B11) e "Total (votos)".

Artefato v3: federalRankByIbgeCode com a colocacao entre todos os candidatos com
votos > 0 na geografia (2014/2018/2022), chaveado por ibgeCode porque e o que o
mapa desenha. Fica no artefato commitado, nao em query de request, que varreria
~100 mil linhas por ano para um dado imutavel. 534 -> 623 KB (orcamento 700 KB).

LQ virou 5 classes nas ancoras do E10, nao diverging: o plano pedia as duas
coisas e se contradizia. Vermelho x azul continua significando "Solla x
adversario" e segue exclusivo do compare.

computeAggregateTerritorialClass classifica um grupo de slugs como um territorio
so, somando insumos e rodando o mesmo classificador (LQ e razao; a media de
razoes nao e a razao das somas) - o E12 herda o helper. TERRITORIAL_CLASS_ANCHORS
mudou para src/lib/territorialClassAnchors.ts para nao arrastar o artefato TSE
ao bundle do cliente.

Quantis sobre o escopo de acesso do usuario, degradando para 3 classes abaixo de
10 municipios com a legenda declarando a contagem efetiva. Rank indisponivel em
2026 (dado TSE); LQ em 2026 reusa o padrao estadual de 2022.

Bolhas opcionais por validos projetados (area proporcional ao valor, cor da
classe E10, interactive: false). 417 marcadores medidos antes de otimizar - nao
derrubaram o frame, entao o corte para top-K nao foi feito.

Sem migration, sem collection, sem server action; bundle client de /campanha
byte a byte igual.
2026-07-26 04:22:56 -03:00

27 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* The cut points behind E10's territorial class, in one client-safe module.
*
* They live in `lib/` rather than next to the classifier because the map
* (B13) paints an LQ scale on the SAME cuts the list's "Classe" column uses,
* and the map panel is a client component: importing the classifier there
* would drag the committed TSE artifact (~600 KB of JSON) into the browser
* bundle. Numbers only, no data, no logic — the classifier
* (`municipalityTerritorialClass.ts`) and the copy
* (`municipalityLabels.ts`) both read from here, so a recalibration is still
* a one-line diff in one file.
*
* Cuts are ILLUSTRATIVE, not calibrated: the research report gives the shape
* (LQ > 2–3 = reduto, ~1 = padrão, < 0,5 = fraqueza) and says the exact
* numbers can only come from a backtest against 2014–2022 — that is **E15**.
*/
export const TERRITORIAL_CLASS_ANCHORS = {
/** LQ at or above this = performing at least 2× his own statewide standard. */
strongLq: 2,
/** LQ below this = performing at less than half his own standard. */
weakLq: 0.5,
/** Municípios that together hold this share of his statewide vote are the "core block". */
coreCumulativeShare: 0.5,
} as const
/** Band where the LQ multiple rounds to "1×", which says nothing — name it instead. */
export const AT_STANDARD_LQ = { min: 0.95, max: 1.15 } as const