mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-13 15:13:07 +00:00
Generaliza aditivamente o pipeline C186 (default município; specs verdes) via o descritor scripts/lib/dossieUnit.mjs (municipality|institution), extrai o emit A4/fit-guard para scripts/lib/buildPdf.mjs e a receita read-only para scripts/lib/readOnlyExtract.mjs. - Catálogo fail-closed src/lib/institutionCatalog.ts + institutionNameAliases.ts (seed UFBA/Correios/Enfermagem; escape one-off --slug/--name; dedup). - Skill/command/subagente /dossie-solla-instituicao; eras A/B/C reusadas. - Abrangência instituição × setor × rede nunca somada; era sem fonte vira página de lacuna explícita; lista capada declara "e mais N" (regra C188 no dono). - Boletim modelo 1×A4 com fase junto ao valor, sem fontes, sem CTA; herda apenas fatos com fonte do dossiê (incl. falas do acervo read-only). - Sem schema/migration/DB write; artefatos gitignored.
67 lines
2.6 KiB
JavaScript
67 lines
2.6 KiB
JavaScript
/**
|
||
* Unit seam for the Solla dossiê pipeline (C187, owner: the C186 dossiê).
|
||
*
|
||
* The dossiê was born municipality-shaped (C186). C187 adds an INSTITUTION
|
||
* recorte that must not fork the pipeline, so the shared mechanics
|
||
* (research contract, print shell, PDF emit, bulletin ledger) take a `unit`
|
||
* descriptor and default to `MUNICIPALITY_UNIT` — the C186 behaviour stays
|
||
* byte-identical when no unit is passed.
|
||
*
|
||
* Vocabulary note: a unit's `spheres` are the item ABRANGÊNCIA values
|
||
* (`municipio|regiao|polo` × `instituicao|setor|rede`). The catalog `sphere`
|
||
* (federal/estadual/…) is a different object and never enters an item row.
|
||
*/
|
||
|
||
export const MUNICIPALITY_UNIT = {
|
||
id: 'municipality',
|
||
/** Key that carries the resolved unit slug in research/snapshot files. */
|
||
slugField: 'municipalitySlug',
|
||
spheres: ['municipio', 'regiao', 'polo'],
|
||
defaultSphere: 'municipio',
|
||
sphereLabels: { municipio: 'município', regiao: 'região', polo: 'polo' },
|
||
sphereBadgeClass: { municipio: '', regiao: 'scope-region', polo: 'scope-region' },
|
||
/** Bulletin ranking: a direct item outranks a shared-scope one. */
|
||
breadthRank: { municipio: 0, regiao: 1, polo: 2 },
|
||
researchDir: 'data/dossie-solla-cidade',
|
||
series: 'Série municipal · BA',
|
||
title: 'Dossiê Solla por cidade',
|
||
bulletinTitle: 'Boletim informativo modelo',
|
||
}
|
||
|
||
export const INSTITUTION_UNIT = {
|
||
id: 'institution',
|
||
slugField: 'institutionSlug',
|
||
spheres: ['instituicao', 'setor', 'rede'],
|
||
defaultSphere: 'instituicao',
|
||
sphereLabels: { instituicao: 'instituição', setor: 'setor', rede: 'rede' },
|
||
sphereBadgeClass: { instituicao: '', setor: 'scope-sector', rede: 'scope-network' },
|
||
breadthRank: { instituicao: 0, setor: 1, rede: 2 },
|
||
researchDir: 'data/dossie-solla-instituicao',
|
||
series: 'Série institucional · agenda com lastro',
|
||
title: 'Dossiê Solla por instituição',
|
||
bulletinTitle: 'Boletim informativo modelo',
|
||
}
|
||
|
||
const DOSSIER_UNITS = {
|
||
municipality: MUNICIPALITY_UNIT,
|
||
institution: INSTITUTION_UNIT,
|
||
}
|
||
|
||
/**
|
||
* Accepts an id string or a descriptor; absent → municipality (C186 default).
|
||
*
|
||
* @param {any} [unit]
|
||
* @returns {any}
|
||
*/
|
||
export const resolveDossierUnit = (unit) => {
|
||
if (!unit) return MUNICIPALITY_UNIT
|
||
if (typeof unit === 'string') {
|
||
const resolved = DOSSIER_UNITS[unit]
|
||
if (!resolved) throw new Error(`Unidade de dossiê desconhecida: "${unit}".`)
|
||
return resolved
|
||
}
|
||
return unit
|
||
}
|
||
|
||
/** Central predicate for the dispatch points (dossiê, boletim, blocks). */
|
||
export const isInstitutionUnit = (unit) => resolveDossierUnit(unit).id === 'institution'
|