Liigu sisu juurde

Raha, ettevõtted ja riigi vara

Riigieelarve ja rahandusdokumendid

Rahandusministeeriumi eelarve-, kohustuste- ja maksedokumendid fin.ee-lt.

Rahandusministeeriumi veebis (fin.ee) avaldatakse riigieelarve, selle seletuskiri ja riigi eelarvestrateegia, aastate kaupa ja allalaaditavate failidena. Failil on kaks eri aastat: eelarveaasta, millest dokument räägib, ja kuu, millal see üles pandi, ning need ei lange kokku, sest 2026. aasta eelarve seletuskiri ilmus 2025. aasta septembris. Neljal teemal kuuest faile ei olegi: finantskohustised, investorsuhted, maksed ja koondaruanded on ainult veebis olevate töölaudadena.

Mida su agent peab oskama

KOODVajab käivitatavat koodi. Vähemalt üks samm nõuab koodi käivitamist: seansiküpsis, turvamärgise vahetus, PDF-i või ZIP-i lahtipakkimine, või vastus, mis on mudeli konteksti jaoks liiga suur.

Milline agent selle läbi teeb

Juhend ise

Inglise keeles, sest seda loeb mudel.

Ministry of Finance Records

fin.ee is where the state budget, its explanatory memorandum and the budget strategy are actually published. Public HTML with direct PDF/DOCX/XLSX downloads; no login.

Retrieve

Use the module below. It reads the topic page, follows the per-year pages it links to, and returns every document with the fiscal year read off its title.

const r = await financeDocuments({ topic: "riigieelarve" });
show(r.totals);            // { documents, years: "2012..2026", byYear, byType }
show(r.rows.slice(0, 5));  // title, year, published, type, sizeMb, url

const one = await financeDocument({ topic: "riigieelarve", year: 2026, find: "seletuskiri" });

Leave year out and one call covers every year, with totals.byYear naming each. That is the whole series; do not follow it with a call per year.

Then read a file with fileText(url) — the budget itself is an XLSX and the seletuskiri a 10-14 MB DOCX/PDF.

Plain requests reach only the listing. The topic pages are ordinary HTML, so what fin.ee publishes and where can be read straight off them, but every figure is inside one of those files — stating a budget number needs a runtime that can open them.

Topics

riigieelarve, eelarvestrateegia, finantskohustised, investorsuhted, maksed, koondaruanded. financeTopics() lists them with a live count of what each currently publishes.

Only two of the six publish files. finantskohustised, investorsuhted, maksed and koondaruanded carry an embedded Power BI or Tableau view and no download at all — valitsussektori-maksed is one iframe to app.powerbi.com. documents: 0 there is the state of the source, not a failed fetch: send the reader to page rather than reporting the ministry as unreachable.

The year trap

year is the fiscal year the document is about, taken from its title. published is the month fin.ee uploaded it. They differ by design — the 2026 budget's seletuskiri was published in 2025-09 — so never substitute one for the other. When a title carries no year the module returns year: null rather than borrowing the upload month, because a confident wrong year is what files a figure under the wrong heading.

Note also that /…/riigieelarved is titled "Varasemad riigieelarved" and holds nothing newer than 2024; each recent year has its own page (/…/2026-riigieelarve). The module follows those, so read lists more than one URL.

Return

Keep title, year, published, type, sizeMb, url, and cite the topic page alongside the file. Label document status explicitly: these pages mix drafts, explanatory memoranda, approved laws and execution reports.

Verify

A real result has /sites/default/files/ links and the file returns the content type its extension claims — for an XLSX, ZIP magic bytes and a valid workbook. A rendered 404 page is not a document. totals.onPage reports how many files the topic holds in total, so a filtered zero is distinguishable from an empty page.

Module API

financeDocuments({topic, year, find}) -> {source, page, topic, title, totals, rows, note} financeTopics() -> {source, page, totals, rows, note}