Package 'swelex'

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

Help Index


Get a Swedish statute (SFS) document

Description

Retrieves the consolidated, up-to-date text and metadata of a Swedish statute from Riksdagen's open data API.

Usage

swe_get_doc(sfs_nr)

Arguments

sfs_nr

Character. SFS number in the format "1974:152".

Value

A one-row tibble with columns: sfs_nr, titel, departement, utfardad, andrad_tom, upphavd, upphavd_av, is_repealed, text.


Get metadata for a Swedish statute, without the full text

Description

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.

Usage

swe_get_metadata(sfs_nr)

Arguments

sfs_nr

Character. SFS number in the format "1974:152".

Value

A one-row tibble with columns: sfs_nr, titel, departement, utfardad, andrad_tom, upphavd, upphavd_av, is_repealed.


Get the consolidated text of a Swedish statute

Description

A thin wrapper around swe_get_doc() that returns only the text.

Usage

swe_get_text(sfs_nr)

Arguments

sfs_nr

Character. SFS number in the format "1974:152".

Value

Character. The consolidated statute text.


Check whether a Swedish statute has been repealed

Description

A thin wrapper around swe_get_doc().

Usage

swe_is_repealed(sfs_nr)

Arguments

sfs_nr

Character. SFS number in the format "1974:152".

Value

Logical. TRUE if repealed, FALSE otherwise.