Skip to main content
Keywords are the core of the categorization engine. Each keyword maps a word or phrase to one or more government areas (categories). When a news item’s text contains a keyword, that item is assigned to the corresponding category and routed to the relevant officials. All keywords are defined in the Google Spreadsheet. There is no keyword configuration inside the application source — changes take effect on the next import without a rebuild.

Data structure

After loading and parsing the spreadsheet, keywords are stored in the palabrasClaveOriginal array:
palabrasClaveOriginal: Array<{ palabra: string; padre: string }>
FieldTypeDescription
palabrastringThe keyword or phrase to match against news text
padrestringThe category (or categories) this keyword belongs to. Use semicolons for multiple categories: Salud;Destacadas

How categories are built

The categories list is derived entirely from the padre values in the keywords array — there is no separate categories table. The application splits multi-category values on semicolons, trims whitespace, removes empty strings, deduplicates, and sorts alphabetically:
importar.component.ts
this.categorias = Array.from(
  new Set(
    this.palabrasClaveOriginal.flatMap((item) =>
      item.padre.split(';').map((p: string) => p.trim()).filter((p: string) => p)
    )
  )
).sort();
This means adding a new category is as simple as using a new padre value in the spreadsheet — no code changes are required.

How keyword matching works

During categorization, each news item’s body text is checked against every keyword using a case-insensitive full-text search. Both the keyword and the news text are lowercased before comparison, but diacritics (accents) are not normalized — the match is an exact substring search on the lowercased strings. This means córdoba and cordoba are treated as different strings.
Keep keywords specific enough to avoid false positives. A keyword like agua will match any mention of water in any context. Prefer more specific phrases like agua potable or corte de agua where the subject matter allows it.

The “General” fallback category

If no keyword matches a news item, the item is assigned to the General category. This ensures every item is classified and visible to operators — nothing is silently dropped.
Monitor the General category regularly. A high volume of items landing there may indicate that important keywords are missing from the spreadsheet.

The “Destacadas” special category

Destacadas is a reserved category name that triggers special handling. When a news item is assigned to Destacadas (either as its sole category or as one of multiple categories), the item’s destacada flag is set to true. Featured items appear prominently in the operator’s curation view and are typically included at the top of dispatched digests. To mark a keyword as always-featured, add Destacadas as one of its parent categories in column B of the spreadsheet:
Google Spreadsheet — Column B
Salud;Destacadas
This assigns the item to both the Salud category and flags it as a featured story.

Multi-category assignment

A single keyword can belong to more than one category. Separate category names with a semicolon in column B, with no spaces around the semicolon:
Column A (keyword)Column B (categories)
intendentePolítica
vacunaSalud;Destacadas
tránsitoTránsito;Movilidad
obra vialInfraestructura;Tránsito
When a news item matches a multi-category keyword, the item is added to every listed category.

Adding a new keyword

1

Open the master spreadsheet

Open the Google Spreadsheet configured in shared.service.ts. See Google Sheets integration for the spreadsheet ID and access instructions.
2

Add a new row

Scroll to the first empty row below the existing keywords. Do not insert rows above the header row (row 1).
3

Enter the keyword in column A

Type the word or phrase exactly as it should appear in news text, including any accent marks. Accent normalization is not applied — the keyword must match the actual form used in press clipping messages.
Column A: salud mental
4

Enter the category in column B

Type the category name. To assign multiple categories, separate them with a semicolon:
Column B: Salud;Destacadas
The category name must match exactly (case-sensitive) the names used by other keywords to ensure the categories list is consistent.
5

Save the spreadsheet

Google Sheets saves automatically. No manual publish step is needed unless you are using File → Publish to web.
6

Test against a real log sample

Perform a test import with a .txt log that contains the phrase you just added. Confirm the item appears in the correct category in the curation view.

Removing or modifying a keyword

To remove a keyword, delete its row from the spreadsheet. To change the category assignment, edit column B in place. Changes take effect on the next import.
Renaming a category by editing column B values does not retroactively update items that were already saved to the backend. Existing records in WordPress retain the old category name. Only new imports will use the updated name.

Best practices

  • Test new keywords against real log samples before relying on them in production. Paste recent press clipping text into a search tool to confirm the phrase appears as expected.
  • Avoid single-character or very common words as keywords. They will match almost every item and produce noisy category assignments.
  • Use the Destacadas category sparingly. If too many keywords are flagged as featured, the distinction loses meaning for operators.
  • Standardize category names. Because categories are derived dynamically from padre values, a typo like Salúd instead of Salud creates a duplicate category. Maintain a reference list of approved category names.
  • Review the General category weekly. Items that fall through to General often indicate coverage topics that have not yet been mapped to keywords.

Build docs developers (and LLMs) love