procesarEstadisticas() applies the active set of filters to produce datosAProcesar — the working slice of data that drives every count and every export. Three independent filters are available: date range, category, and media outlet.
Date range filter
The date range filter is the primary way to narrow the dataset. Two date fields — desde (from) and hasta (to) — are bound to ng-bootstrap datepicker widgets (ngb-datepicker) and stored in DataService.
Default range
When the application initialises,DataService sets a default window of 30 days before today through 30 days after today:
DataService constructor
Internal date format
Dates are stored as NgbDateStruct objects ({ year, month, day }) but compared as six-character strings in the format YYMMdd. The value is derived from the sendDate field on each record, which is stored in dd/mm/YY format:
Date normalisation
The comparison uses lexicographic ordering on the
YYMMdd string, which works correctly as long as all dates fall within the same century. Records without a valid sendDate value are excluded automatically because their normalised string will not satisfy the range condition.Applying a new date range
After you change the desde or hasta pickers, click Consultar to re-run the filter and refresh all three charts:Open the date pickers
The desde and hasta fields appear above the charts. Click either field to open the ng-bootstrap calendar widget.
Select your dates
Navigate to the desired month and click a day to set the boundary. Both fields accept any valid calendar date.
Category filter
Navigate to/controlmedios/estadisticas/c/:cat to restrict the dashboard to a single government-area category. The route parameter :cat is read on component init and stored in the categoria field (default: 'TOTALES').
Example routes
categoria is anything other than 'TOTALES', procesarEstadisticas() skips records whose topics field does not include that value. All three charts (outlets, programs, and topics) reflect only the matching records.
Category values must match the keyword group names configured in Google Sheets exactly, including accents and capitalisation.
Media outlet filter
Navigate to/controlmedios/estadisticas/m/:medio to restrict the dashboard to a single outlet. The route parameter :medio is read on init and stored in the medio field (default: 'TODOS').
Example routes
medio is anything other than 'TODOS', only records from that outlet are counted.
Filter interaction summary
| Filter | How to activate | Default |
|---|---|---|
| Date range | desde / hasta pickers + Consultar | Last 30 days → next 30 days |
| Category | Navigate to /estadisticas/c/:cat | TOTALES (all categories) |
| Outlet | Navigate to /estadisticas/m/:medio | TODOS (all outlets) |
Dashboard
Chart types and data loading overview.
Export
Export filtered data as CSV or print as PDF.