--- name: government-strategy-documents description: Retrieve Government Office strategy document tables: development plans, Estonia 2035, action programme. module: strateegia.mjs execution: get --- # Government Strategy Documents Riigikantselei (Government Office) publishes the state's strategy layer on `valitsus.ee`: the registry of development plans in force, plans in preparation, policy fundamentals, the versioned Estonia 2035 action plan, and the current government's action programme. ## Access - Development plans in force: `https://www.valitsus.ee/strateegia-eesti-2035-arengukavad-ja-planeering/strateegilised-arengudokumendid/kehtivad` - Development plans in preparation: `https://www.valitsus.ee/strateegia-eesti-2035-arengukavad-ja-planeering/strateegilised-arengudokumendid/koostamisel` - Policy fundamentals (`poliitika põhialused`): `https://www.valitsus.ee/strateegia-eesti-2035-arengukavad-ja-planeering/strateegilised-arengudokumendid/poliitika` - Estonia 2035 action-plan versions: `https://www.valitsus.ee/strateegia-eesti-2035-arengukavad-ja-planeering/eesti-2035-tegevuskava` - Government action programme: `https://www.valitsus.ee/valitsuse-eesmargid-ja-tegevused/valitsemise-alused/tegevusprogramm-0` - Public server-rendered HTML and files; no authentication is required. ## Retrieve Every document page above except the action programme uses one identical embedded-table contract: 1. Fetch the page HTML. 2. Find `script` elements whose `type` is `application/json` and whose generated `id` starts with `datatable-`. The bare `datatable-` block is an array of rows; `datatable--options` is the column configuration (titles `Nimetus` / `Sisestamise kuupäev`) — ignore it. 3. JSON-decode the array first. Each row is three cells whose values are HTML strings: title with file metadata, publication date, and the download action link. Parse the HTML only after decoding. 4. From cell 1 take the anchor text and `href` plus the trailing `| 8.36 MB | pdf` size/format suffix; from cell 2 take `time[datetime]`. Classify each `href` as a Government Office file (`/sites/default/files/...` or `/media//download`) or a `riigiteataja.ee` legal reference. 5. `paging` is `false` in the options block, so the array already holds every row — there is no pagination and no request parameters to vary. Filter and sort locally. 6. On the Estonia 2035 page, label each row's language from its title (Estonian rows read `tegevuskava (uuendatud …)`, English ones `'Estonia 2035' Action Plan (approved by Government …)`) and separate action-plan versions from implementation-overview attachments. The action programme page carries no table. Read its lead text for scope, the monitoring cadence and the date the government confirmed the programme; take task-level execution status from the two embedded PowerBI dashboards, whose `iframe src` values are `https://app.powerbi.com/view?r=eyJrIjoiYzUxMTg3MWUtN2M4My00N2E5LWExMzItZWFhMzEzYmQzMmJhIiwidCI6IjhmZTA5OGQyLTQyOGQtNGJkNC05ODAzLTcxOTVmZTk2ZjBlMiIsImMiOjl9&pageName=06bb907844ed3bab3769&iframe=1&langcode=et` and the same URL with `pageName=80b7f5658c06fa5ad0c1`; and collect the `Seotud viited` sidebar links to the coalition agreement and to earlier governments' programme files. ## Return - Return the source page URL, document title, publication timestamp, document URL, URL type (`file` or `riigiteataja`), file format and size when present, and retrieval time. Preserve the absolute host each row supplies — both bare and `www` forms occur. - Keep the registry a row carries with it: in force, in preparation, and policy fundamentals are separate pages and must not be merged into one undated list. - For Estonia 2035, return a chronological version table with language and record type, not a single "current" file. - For the action programme, return the confirmation date, the monitoring description, both dashboard URLs, and the linked earlier programme files. State task, responsible body, deadline or status only when they appear in output you actually printed. ## Limits - These tables are the current published state, not a historical archive; files are point-in-time snapshots, so compare `time[datetime]` values instead of assuming one canonical latest file. - The generated `datatable-` id and the file hostname change when a page is republished. Never hard-code either — rediscover the block by its `datatable-` prefix on every run. - The PowerBI dashboards have no public export API and are not machine-readable at all; the embed URL returns the viewer shell, not task rows. Treat them as a link for the citizen, and do not state programme task statuses that you have not printed from a source. ```probe-declined claim The PowerBI dashboards have no public export API reason no-such-route because Executing this would mean showing that no endpoint of the report serves its rows to an anonymous caller, and PowerBI's own export API is tenant-authenticated, so every request we can send answers the same way whether or not such a route exists for someone holding the tenant's credentials. ``` - The action programme page publishes no downloadable file for the *current* programme — only the dashboards. A PDF exists for the previous (53rd) government's programme at `https://www.valitsus.ee/media/6721/download`. - The page's `töödeldaval kujul` (machine-readable) link for the previous programme points at `https://pilv.riigikantselei.ee/index.php/s/DMesdRA5AQRExwL`, which returns **HTTP 404** (probed 2026-07-27). Government Office cloud-storage links expire; do not cite that link as retrievable. ```probe-limit claim `https://pilv.riigikantselei.ee/index.php/s/DMesdRA5AQRExwL`, which returns **HTTP 404** GET https://pilv.riigikantselei.ee/index.php/s/DMesdRA5AQRExwL expect-status 404 expect /This share does not exist or is no longer available/ # The share page says which kind of 404 this is — an expired share, not a # mistyped host — and that is the sentence the guide is built on. # The control is the cloud host's own front page, which must answer. Without # it, the day pilv.riigikantselei.ee is down every share link "expires" and # this claim confirms itself. control GET https://pilv.riigikantselei.ee/ ``` - Content is predominantly Estonian. Only the Estonia 2035 table reliably carries English versions, and older translated titles are named inconsistently. ## Verify - Require a non-empty array of three-cell rows from a `datatable-` block, with a parsable `time[datetime]` in cell 2 and a resolvable `href` in cell 1. - Require at least one file link to return HTTP 200 with a `%PDF` signature before treating a row as a retrievable document; the in-force registry must also expose at least one `riigiteataja.ee` reference. Known-good acceptance check, run against the live page by `scripts/check-sources.mjs` (issue #82): ```probe GET https://www.valitsus.ee/strateegia-eesti-2035-arengukavad-ja-planeering/strateegilised-arengudokumendid/kehtivad expect /id="datatable-[a-f0-9]{64}"/ expect /riigiteataja\.ee/ # 25 rows on 2026-08-01 — 24 Government Office files and 1 Riigi Teataja # reference (Eesti keskkonnastrateegia aastani 2030). The id is a 64-character # content hash that changes whenever the page is republished, so only its shape # may be relied on; rediscover the block by its `datatable-` prefix every run. # # The counter is the action-programme page, which is the same site and the same # layout but carries NO table at all. A parse that reported rows from it would # be reporting rows that are not there — and this page is the one a question # about government tasks lands on first. counter GET https://www.valitsus.ee/valitsuse-eesmargid-ja-tegevused/valitsemise-alused/tegevusprogramm-0 ``` - For the action programme, require both PowerBI `pageName` iframes to be present on the page and the lead text to state a confirmation date; if either is missing, the page has been restructured — re-verify rather than reporting stale figures. ## Module API strategyDocuments(registry) -> {source, page, registry, label, totals, rows, note} actionProgramme() -> {source, page, confirmed, lead, totals, dashboards, files, note}