Changelog
Source:NEWS.md
stortingscrape 0.5.0
- Major changes
- The single-id data-retrieving functions now accept a vector of ids. Passing several ids (e.g.
get_question(c(id1, id2))) retrieves them all in one call: functions returning adata.framebind the rows together (with plain row names, as the ids are in the data), while functions returning a list (e.g.get_mp_bio(),get_case(),get_publication()) return a named list of results keyed by id. Passing a single id works as before. Individual ids that fail are turned into warnings so a single bad id does not discard the successful ones. In interactive sessions, a progress bar (from theclipackage) shows the progress when retrieval takes more than a few seconds. - All API calls now respect Stortinget’s documented rate limit of 100 calls per minute. Requests are throttled automatically and transient
429 Too Many Requestsresponses are retried (respecting theRetry-Afterheader). Thegood_mannersargument remains available for additional polite pacing. - New function
get_speeches()returns the speeches of a debate transcript (publication type “referat”) as a data frame, one row per speech, with the same variables for transcripts before and after the 2016-2017 format change. The raw speaker string is kept alongside the parsed title, name, party, and time stamp. Speech elements holding several speakers are split into one row per speaker, and the sitting chair (president or meeting leader) is tracked through each transcript. By default (link = TRUE), it also adds person ids linked from the speaker and chair names (seespeaker_links), including for transcripts before 2016-2017, where the API gives no ids. The example datasetspeeches140213holds the output for one transcript. - New dataset
speaker_links: person ids for the speakers and chairs in all debate transcripts from 1998-99 onward, linked from their names by session (see?speaker_linksfor the rules anddata-raw/speaker_links.Rfor the build).get_speeches()adds these links by default. -
Breaking: misspelled variable names are corrected:
qustion_*toquestion_*inget_question();answ_on_belhalf_of*toansw_on_behalf_of*andsendt_datetosent_dateinget_question(),get_session_questions(), and theinterp0203dataset; and$poceedings_stepsto$proceedings_stepsinget_proceedings(). - The
mp_idargument ofget_session_mp_speech_activity()is renamed tompid, as in the other functions.mp_idstill works, with a deprecation warning. -
Breaking:
get_publication()now parses publications as XML rather than HTML. The HTML parser lowercased all element and attribute names (e.g.personIDbecamepersonid) and split up nested paragraphs. Element names are now case sensitive: publications from 2016-2017 onward use capitalized names, so selectors such ashtml_elements(pub, "replikk")must becomehtml_elements(pub, "Replikk").
- The single-id data-retrieving functions now accept a vector of ids. Passing several ids (e.g.
- Minor changes
- The shared
httr2request pipeline was refactored into internal helpers (api_perform(),api_get()), removing roughly a thousand lines of duplicated boilerplate across the data-retrieving functions with no change to their returned output. - Minimum
httr2version is now 1.1.0. - The rate limit is now enforced over any 60-second window. The throttle’s token bucket starts full, so the previous setting (a bucket of 100 refilling at 100 per minute) allowed up to about 200 calls in the first minute; requests now come in bursts of at most 10 and then at 90 per minute.
-
get_session_cases(),get_session_hearings(),get_session_mp_speech_activity(), andget_mp_pic()now also accept vectors of ids (forget_mp_pic(), with onedestfileper id). -
get_session_mp_speech_activity()gains anmp_idvariable, andget_parlperiod_presidency()aperiod_idvariable, so results for several ids can be told apart. -
get_written_hearing_input()keeps the hearing id for hearings without written input. - Fixed
get_proposal_votes()failing for votes where a proposal had no delivering MP; the proposal variables are now read per proposal, withNAfor missing values. -
get_speeches()records the time of retrieval inresponse_date, as the transcripts have none of their own. - Fixed
get_session_questions()ignoringstatuswhen given several sessions, andget_session_hearings()ignoringcoresfor the hearing dates. - With several ids, a failing id in
get_mp_pic()gives a warning rather than stopping the rest. - The
parl_periodsandparl_sessionsdatasets are updated to include the 2025-2029 period and its sessions. - Corrected documentation, including the returned variables of several functions, the dataset descriptions, and examples using the vector of ids;
good_mannersis documented as numeric (seconds, e.g. 0.6). - Added offline tests (testthat) for the transcript parser, date handling, speaker linking, and the vector-of-ids helper.
- Fixed getters failing, or misaligning variables, when a hearing has no committee (
get_session_hearings(),get_hearing_program(),get_hearing_input(),get_written_hearing_input()), or when a representative has no party or county (the spokespersons inget_session_cases(), andget_vote(),get_result_vote(),get_parlperiod_mps(),get_question()). These variables are now read per record. -
get_hearing_input()returns a row ofNAfor hearings without input (the API answers with an error), likeget_written_hearing_input(). -
get_hearing_program()handles programs with a single element, andget_proceedings()compares step numbers as numbers. -
get_parlperiod_mps()no longer prints a message for each period, andget_session_cases()andget_session_hearings()use one core on Windows, wheremclapply()cannot use more. - Requests with Æ, Ø, or Å in an id (e.g. some person ids) are now sent as UTF-8, so they also work on systems whose native encoding is not UTF-8, and weekday names with å or ø in meeting headings are read correctly on such systems.
- The shared
stortingscrape 0.4.1
CRAN release: 2025-04-07
- Minor changes
- Fixed a CRAN issue with the
get_topics()function throwing an error because of an example- Fixed by adding in a
\dontrun{}for the example
- Fixed by adding in a
- Fixed a CRAN issue with the
stortingscrape 0.4.0
CRAN release: 2025-03-07
- Major changes
-
Stortinget’s API updated their ID scheme for all questions
- I cannot guarantee that it will be possible to convert previously downloaded data to the new format. The API change did not facilitate this. If you need to append your data, I advise starting from scratch
- I am not happy about this, but I can do nothing
-
get_question()has been updated to the new scheme, and thelegacy_idvariable added -
get_meeting_agenda()is updated withlegacy_question_idkeys
-
Stortinget’s API updated their ID scheme for all questions
stortingscrape 0.3.2
- Major changes
- Changed
get_mp_pic()to utilize themagickpackage instead ofimagerwhenshow_plot = TRUE
- Changed
- Minor changes
- Added color palette for current political parties in the Storting
stortingscrape 0.3.1
- Minor changes
- Fixed call to sleep in
get_publication()function (was missing) - Redirected citation to inst/CITATION file
- Fixed a minor error in the
get_proposal_votes()function for theproposal_delivered_by_mpvariable
- Fixed call to sleep in
stortingscrape 0.3.0
CRAN release: 2024-01-18
- Minor changes
- Fixed an error in
get_session_cases(), where the structuring of case proposers did not run in parallel, as was intended.
- Fixed an error in
stortingscrape 0.2.0
- Major changes:
- Replaced
magrittr(%>%) pipes with native pipes (|>) - Converted all get_*() functions from
httrtohttr2 - Changed $spokespersons in
get_session_cases()to data frame. This will break backwards compatibility (sorry!). - Rewrote the decision_text variable in
get_session_decisions()so that residual html is stripped from the output. This might break some text processing applications (sorry!). - Rewrote the date and info sections of
get_session_hearings()to data.frames instead of lists. This might break some text processing applications (sorry!).
- Replaced
- Minor changes:
- Rewrote the proceedings_steps variable in
get_proceedings()to be scalable to changes in the API. Should not break backwards compatibility.
- Rewrote the proceedings_steps variable in
stortingscrape 0.1.4
- Major changes
- Fixed a bug in
get_session_questions(), where the presence of unanswered questions returned an error instead ofNA - Removed a variable from
get_vote()because it suddenly disappeared from the API. - Fixed an issue where
ifelse()lines returned only one element when it was supposed to return several due to someone not realizing the vectorization rules of the function. Affected functions were:get_case(),get_hearing_program(),get_question(),get_result_vote(),get_session_cases(), andget_session_questions(). Onlyget_case()was significant, in that it listed all bill sponsors as being from the same party.
- Fixed a bug in
- Minor changes
- Fixed some typos in the readme
- Reworked the
read_obt()function for the package not to rely ondplyr - Added a hex badge logo. Extremely important.
stortingscrape 0.1.3
CRAN release: 2023-03-23
- Major changes
- Fixed an issue with
get_mp_bio(), which broke after an API update. - Fixed typo issue – renaming some variables in
get_session_questions()
- Fixed an issue with
- Minor changes
- Added pkgdown page via gh-pages
- Changed color of text in logo
- Added a
NEWS.mdfile to track changes to the package.