| Title: | Access the Swedish Code of Statutes via Riksdagen's Open Data |
|---|---|
| Description: | Provides functions to search and retrieve the consolidated text of Swedish statutes (Svensk författningssamling, SFS) via the Riksdag's open data API. Part of the lexverse ecosystem of packages for accessing legal and regulatory data. |
| Authors: | Kristian Vepsäläinen [aut, cre] |
| Maintainer: | Kristian Vepsäläinen <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-09-15 11:31:09 UTC |
| Source: | https://github.com/kristianvepsalainen/swelex |
Retrieves the consolidated, up-to-date text and metadata of a Swedish statute from Riksdagen's open data API.
swe_get_doc(sfs_nr)swe_get_doc(sfs_nr)
sfs_nr |
Character. SFS number in the format "1974:152". |
A one-row tibble with columns: sfs_nr, titel, departement,
utfardad, andrad_tom, upphavd, upphavd_av, is_repealed, text.
A thin wrapper around swe_get_doc() that drops the text column.
Note: this still performs the same API call as swe_get_doc() — the
underlying endpoint does not support a text-free response — so it is a
convenience wrapper, not a lighter-weight one. See ROADMAP.md for a
possible future optimisation via the dokumentlista endpoint.
swe_get_metadata(sfs_nr)swe_get_metadata(sfs_nr)
sfs_nr |
Character. SFS number in the format "1974:152". |
A one-row tibble with columns: sfs_nr, titel, departement,
utfardad, andrad_tom, upphavd, upphavd_av, is_repealed.
A thin wrapper around swe_get_doc() that returns only the text.
swe_get_text(sfs_nr)swe_get_text(sfs_nr)
sfs_nr |
Character. SFS number in the format "1974:152". |
Character. The consolidated statute text.
A thin wrapper around swe_get_doc().
swe_is_repealed(sfs_nr)swe_is_repealed(sfs_nr)
sfs_nr |
Character. SFS number in the format "1974:152". |
Logical. TRUE if repealed, FALSE otherwise.
Searches Riksdagen's open data for statutes matching free text, a date
range, an issuing department, or a session year, sorted by relevance.
Unlike swe_get_doc(), an empty result set is not an error — it simply
means no statutes matched.
swe_search( query = NULL, from_date = NULL, to_date = NULL, org = NULL, rm = NULL, max_results = 50 )swe_search( query = NULL, from_date = NULL, to_date = NULL, org = NULL, rm = NULL, max_results = 50 )
query |
Character. Free-text search term, matched against title and body text. Optional. |
from_date, to_date
|
Character or Date, format "YYYY-MM-DD". Restrict to statutes issued within this range. Optional. |
org |
Character. Filter by issuing department/authority, e.g. "Justitiedepartementet". Optional. |
rm |
Character. Filter by Riksdag session year, e.g. "2022". Optional. |
max_results |
Integer. Maximum number of results to return. Default 50. |
A tibble with columns: sfs_nr, titel, departement, datum,
dok_id, summary, score. Zero rows if nothing matched. Sorted by
relevance (descending) when query is supplied.