Check CBS codes and implausible dates; sweep 90 days weekly - #323
Merged
Merged
Conversation
VNG's weekly status of 28 September flagged Dordrecht without a CBS code and Oirschot (2078) and Schiermonnikoog (2099) with content dated decades ahead. - Dordrecht gets GM0505; a catalog test now requires every gemeente to carry a well-formed, unshared GM code (Amsterdam's stadsdelen excepted). - A date more than two years ahead is treated as a typo: an iBabs register entry falls back to its MutationDate, projection leaves start_date and document_month empty, and /api/status bounds latestContentDate so rows already indexed with such a year no longer report it.
Councils attach besluitenlijsten, notulen and answers to meetings weeks after they took place. The nightly -7..+7 day window has moved past those meetings by then, so the documents were never imported, and the weekly coverage check (12 months back) counted them as missing: VNG's status of 28 September saw the gaps grow by 677 documents across 179 municipalities in one week. On Saturday night the scheduler now also enqueues the 90..8 days before the nightly window, so Sunday's coverage check measures the result. Documents already held come from the object-store cache.
joepio
marked this pull request as ready for review
October 5, 2026 10:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Joep · project thread
Two responses to VNG's weekly status of 28 September, in separate commits.
1. CBS codes and implausible future dates
Before: Dordrecht had no
cbsIdin/api/status, so VNG's weekly check drops it from municipal coverage. Oirschot's newest content was 1 January 2078 (an ingekomen stuk whose iBabs "Datum" field reads 1-1-2078), and it heads every date-sorted search for Oirschot. VNG reports Schiermonnikoog with a 2099 date as well.After: Dordrecht carries GM0505, and a catalog test fails when any gemeente lacks a well-formed, unshared GM code (the Amsterdam stadsdelen under GM0363 excepted). A date more than two years ahead is treated as a typo at the source.
How:
src/util/plausible_date.ts: the two-year horizon.MutationDate.start_dateanddocument_monthempty for such a date (sorts last instead of first)./api/statuscomputeslatestContentDatein its own query bounded to the horizon, so rows already in the index with 2078 or 2099 stop reporting it as soon as this deploys. Kept separate from thelast_indexedquery because a range clause would drop rows withoutstart_datefrom that one.The Oirschot row in the index keeps its 2078 sort date until the entry is imported again. A manual import for Oirschot with a window covering that entry's MutationDate (or the next projection bump) fixes it.
2. Weekly 90-day sweep
Before: the nightly import only looks at meetings from 7 days back to 7 days ahead. Documents a council attaches to a meeting weeks later (besluitenlijsten, notulen, answers) are never imported, and the weekly coverage check counts them as missing. VNG saw the gaps grow by 677 documents across 179 municipalities in one week.
After: on Saturday night the scheduler also enqueues the 90..8 days before the nightly window for every source, so Sunday's coverage check measures what it found.
How:
scheduledWindows()insrc/scheduler.tsreturns the nightly window, plus the adjacent sweep window on Saturdays (Europe/Amsterdam). Runs are ordinaryscheduled/fullruns, so blocklist checks, the S3 cache shortcut and iBabs pacing all apply unchanged. The existing "skip while scheduled runs are still active" guard covers both windows.This is a hypothesis from the code, not yet measured: if the gaps in
coveragedo not shrink after the first Saturday, the cause lies elsewhere.Tests: touched suites (
plausible_date,registers,motions,source_catalog,status_api,scheduler,ingest_scheduler,scheduler_backfill_isolation) pass,deno checkon all tests, oxlint, oxfmt on changed files, vite build.