Retrieves a document from the generic document endpoint of the Finlex
Open Data API (/akn/fi/doc/...), which covers document types that are
not part of the Statute Book of Finland: treaties, government
proposals, authority regulations, and certain collective agreements.
flx_get_doc(doc_type, year, number)Character, length 1. One of "authority-regulation",
"treaty", "tax-treaty-consolidated", "government-proposal",
"collective-agreement-general-applicability-decision", or
"trade-union-center-agreement". Call this function separately for
different document types.
Integer vector. Year(s) of the document(s).
Character or integer vector. Number(s) of the
document(s) within that year. Recycled against year if shorter.
Accepts character because document numbers in these collections are
not always simple integers.
A tibble::tibble() with one row per document and the
columns:
As supplied.
As supplied.
As supplied.
One of "ok", "pdf_only" (the document exists but
has no machine-readable text, only a scanned/original PDF),
"not_found", or "error".
The document's official title.
Date the document was issued, as a Date.
The full body text of the document, or NA if only a
PDF is available.
URL of the document's PDF version. Populated for
both "ok" and "pdf_only" statuses.
Unlike flx_get_text(), this function does not split the document
into sections. The document types covered here (treaties, government
proposals, agreements) do not share a consistent internal structure
the way statutes do, so the full body text is returned as a single
block.
Some documents, particularly older ones, have never been digitised as
machine-readable text and exist only as a scanned or original PDF. For
these, status is "pdf_only", text is NA, and pdf_url points
to the PDF so the content is still reachable.
Two document types available in the underlying API are intentionally
not covered by this function: "treaty-metadata" (a lighter
reference record rather than a full document) and
"legal-literature-references" (an index of literature discussing
case law, not the case law itself). Both likely need bespoke handling
and may be added in a future version.
# \donttest{
flx_get_doc(
doc_type = "authority-regulation",
year = 1996, number = 32082
)
#> # A tibble: 1 × 8
#> doc_type year number status title date_issued text pdf_url
#> <chr> <int> <chr> <chr> <chr> <date> <chr> <chr>
#> 1 authority-regulation 1996 32082 pdf_only Kolin ka… 1996-11-18 NA https:…
# }