{"id":22518065,"url":"https://github.com/zumbov2/swissparl","last_synced_at":"2025-08-03T18:32:12.811Z","repository":{"id":217522069,"uuid":"185891713","full_name":"zumbov2/swissparl","owner":"zumbov2","description":"The Swiss Parliament Webservices R API","archived":false,"fork":false,"pushed_at":"2022-07-26T12:22:41.000Z","size":11354,"stargazers_count":32,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-01-17T01:22:53.354Z","etag":null,"topics":["api","opendata","politics","rstats","switzerland"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zumbov2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-05-10T00:39:23.000Z","updated_at":"2024-01-17T01:22:59.834Z","dependencies_parsed_at":"2024-01-17T01:22:58.586Z","dependency_job_id":"ec0186a8-bf48-4583-9a1c-145c6f000fe1","html_url":"https://github.com/zumbov2/swissparl","commit_stats":null,"previous_names":["zumbov2/swissparl"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zumbov2%2Fswissparl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zumbov2%2Fswissparl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zumbov2%2Fswissparl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zumbov2%2Fswissparl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zumbov2","download_url":"https://codeload.github.com/zumbov2/swissparl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228557113,"owners_count":17936452,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","opendata","politics","rstats","switzerland"],"created_at":"2024-12-07T04:14:09.243Z","updated_at":"2024-12-07T04:14:09.918Z","avatar_url":"https://github.com/zumbov2.png","language":"R","funding_links":[],"categories":["Politik \u0026 Demokratie"],"sub_categories":[],"readme":"[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/swissparl)](https://cran.r-project.org/package=swissparl)\n![Lifecycle](https://img.shields.io/badge/lifecycle-maturing-orange.svg)\n[![Build Status](https://travis-ci.org/zumbov2/swissparl.svg?branch=master)](https://travis-ci.org/zumbov2/swissparl)\n[![Licence](https://img.shields.io/badge/licence-GPL--3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html)\n[![cranlogs](https://cranlogs.r-pkg.org/badges/grand-total/swissparl)](http://cran.rstudio.com/web/packages/swissparl/index.html)\n\u003cimg src=\"logo.png\" height=\"120px\" align=\"right\" style=\"padding-left:10px;background-color:white;\"/\u003e\n\n# swissparl \nThis R package is an interface to the new, still unofficial and accordingly still undocumented [Webservices](https://ws.parlament.ch/odata.svc/) of [The Federal Assembly — The Swiss Parliament](https://www.parlament.ch/en) that offer an open, machine-readable interface to the most important data on parliamentary activities. The previous version of the package (interface to the old Webservices) can be found [here](https://github.com/zumbov2/swissparl/tree/master/old_ws).\n\n## Installation\nVersion 0.2.2 is on CRAN and can be installed as follows:\n\n```r\ninstall.packages(\"swissparl\")\n```\n\nThe latest version is available on GitHub (0.2.2):\n\n```r\ninstall.packages(\"devtools\")\ndevtools::install_github(\"zumbov2/swissparl\")\n```\n\n# Functions\n## Helpers\nThe new [Webservices](https://ws.parlament.ch/odata.svc/) are comprehensive and not yet documented. The following functions will help you make friends with them:\n\n### `get_tables`\nRetrieves the names of all available tables or datasets (currently 43).\n``` r\nswissparl::get_tables()\n#\u003e \n#\u003e  [1] \"Bill\"                   \"BillLink\"              \n#\u003e  [3] \"BillStatus\"             \"Business\"              \n#\u003e  [5] \"BusinessResponsibility\" \"BusinessRole\"          \n#\u003e  [7] \"BusinessStatus\"         \"BusinessType\"          \n#\u003e  [9] \"Canton\"                 \"Citizenship\"           \n#\u003e [11] \"Committee\"              \"Council\"               \n#\u003e [13] \"External\"               \"LegislativePeriod\"     \n#\u003e [15] \"Meeting\"                \"MemberCommittee\"       \n#\u003e [17] \"MemberCommitteeHistory\" \"MemberCouncil\"         \n#\u003e [19] \"MemberCouncilHistory\"   \"MemberParlGroup\"       \n#\u003e [21] \"MemberParty\"            \"Objective\"             \n#\u003e [23] \"ParlGroup\"              \"ParlGroupHistory\"      \n#\u003e [25] \"Party\"                  \"Person\"                \n#\u003e [27] \"PersonAddress\"          \"PersonCommunication\"   \n#\u003e [29] \"PersonEmployee\"         \"PersonInterest\"        \n#\u003e [31] \"PersonOccupation\"       \"Preconsultation\"       \n#\u003e [33] \"Publication\"            \"RelatedBusiness\"       \n#\u003e [35] \"Resolution\"             \"SeatOrganisationNr\"    \n#\u003e [37] \"Session\"                \"Subject\"               \n#\u003e [39] \"SubjectBusiness\"        \"Tags\"                  \n#\u003e [41] \"Transcript\"             \"Vote\"                  \n#\u003e [43] \"Voting\"\n```\n### `get_variables` \nRetrieves the names of all the variables of a given table.\n``` r\nswissparl::get_variables(\"Transcript\")\n#\u003e \n#\u003e  [1] \"CantonAbbreviation\"         \"CantonId\"                  \n#\u003e  [3] \"CantonName\"                 \"CouncilId\"                 \n#\u003e  [5] \"CouncilName\"                \"DisplaySpeaker\"            \n#\u003e  [7] \"End\"                        \"EndTimeWithTimezone\"       \n#\u003e  [9] \"Function\"                   \"ID\"                        \n#\u003e [11] \"IdSession\"                  \"IdSubject\"                 \n#\u003e [13] \"Language\"                   \"LanguageOfText\"            \n#\u003e [15] \"MeetingCouncilAbbreviation\" \"MeetingDate\"               \n#\u003e [17] \"MeetingVerbalixOid\"         \"Modified\"                  \n#\u003e [19] \"ParlGroupAbbreviation\"      \"ParlGroupName\"             \n#\u003e [21] \"PersonNumber\"               \"SortOrder\"                 \n#\u003e [23] \"SpeakerFirstName\"           \"SpeakerFullName\"           \n#\u003e [25] \"SpeakerFunction\"            \"SpeakerLastName\"           \n#\u003e [27] \"Start\"                      \"StartTimeWithTimezone\"     \n#\u003e [29] \"Text\"                       \"Type\"                      \n#\u003e [31] \"VoteBusinessNumber\"         \"VoteBusinessShortNumber\"   \n#\u003e [33] \"VoteBusinessTitle\"          \"VoteId\"\n```\n### `get_overview` \nWraps around `get_tables` and `get_variables` and retrieves all available tables and variables. \n``` r\nswissparl::get_overview(silent = T)\n#\u003e \n#\u003e # A tibble: 685 x 2\n#\u003e    table variable                \n#\u003e    \u003cchr\u003e \u003cchr\u003e                   \n#\u003e  1 Bill  BillNumber              \n#\u003e  2 Bill  BillType                \n#\u003e  3 Bill  BillTypeName            \n#\u003e  4 Bill  BusinessNumber          \n#\u003e  5 Bill  BusinessShortNumber     \n#\u003e  6 Bill  BusinessStatus          \n#\u003e  7 Bill  BusinessStatusDate      \n#\u003e  8 Bill  BusinessStatusText      \n#\u003e  9 Bill  BusinessType            \n#\u003e 10 Bill  BusinessTypeAbbreviation\n#\u003e # ... with 675 more rows\n```\n### `get_glimpse`\nDownloads the first rows of a given table and gives a first insight into the data structure.\n``` r\nswissparl::get_glimpse(\"Person\", rows = 100)\n#\u003e \n#\u003e # A tibble: 100 x 21\n#\u003e       ID Language PersonNumber PersonIdCode Title TitleText LastName\n#\u003e    \u003cint\u003e \u003cchr\u003e           \u003cint\u003e        \u003cint\u003e \u003cint\u003e \u003cchr\u003e     \u003cchr\u003e   \n#\u003e  1     1 DE                  1         2200    NA \u003cNA\u003e      Aguet   \n#\u003e  2     2 DE                  2         2002    NA \u003cNA\u003e      Allensp~\n#\u003e  3     6 DE                  6         2004     9 dipl. Ba~ Aregger \n#\u003e  4     7 DE                  7         2005    NA \u003cNA\u003e      Aubry   \n#\u003e  5     8 DE                  8         2008    NA \u003cNA\u003e      Bär     \n#\u003e  6     9 DE                  9         2268    10 dipl. In~ Baumann \n#\u003e  7    10 DE                 10         2269     6 Dr. iur.  Baumber~\n#\u003e  8    11 DE                 11         2011    12 lic. phi~ Bäumlin \n#\u003e  9    12 DE                 12         2335   115 lic. iur. Beerli  \n#\u003e 10    13 DE                 13         2202     3 lic. en ~ Béguin  \n#\u003e # ... with 90 more rows, and 14 more variables: GenderAsString \u003cchr\u003e,\n#\u003e #   DateOfBirth \u003cdate\u003e, DateOfDeath \u003cdate\u003e, MaritalStatus \u003clgl\u003e,\n#\u003e #   MaritalStatusText \u003clgl\u003e, PlaceOfBirthCity \u003cchr\u003e,\n#\u003e #   PlaceOfBirthCanton \u003cchr\u003e, Modified \u003cdttm\u003e, FirstName \u003cchr\u003e,\n#\u003e #   OfficialName \u003cchr\u003e, MilitaryRank \u003cint\u003e, MilitaryRankText \u003cchr\u003e,\n#\u003e #   NativeLanguage \u003cchr\u003e, NumberOfChildren \u003clgl\u003e\n```\n## Main function `get_data`\nThe main function of the package is `get_data`. It can be used to download entire datasets or selected rows from any available table.\n``` r\nswissparl::get_data(\"Person\", Language = \"DE\")\n#\u003e \n#\u003e # A tibble: 3,629 x 21\n#\u003e       ID Language PersonNumber PersonIdCode Title TitleText LastName\n#\u003e    \u003cint\u003e \u003cchr\u003e           \u003cint\u003e        \u003cint\u003e \u003cint\u003e \u003cchr\u003e     \u003cchr\u003e   \n#\u003e  1     1 DE                  1         2200    NA \u003cNA\u003e      Aguet   \n#\u003e  2     2 DE                  2         2002    NA \u003cNA\u003e      Allensp~\n#\u003e  3     6 DE                  6         2004     9 dipl. Ba~ Aregger \n#\u003e  4     7 DE                  7         2005    NA \u003cNA\u003e      Aubry   \n#\u003e  5     8 DE                  8         2008    NA \u003cNA\u003e      Bär     \n#\u003e  6     9 DE                  9         2268    10 dipl. In~ Baumann \n#\u003e  7    10 DE                 10         2269     6 Dr. iur.  Baumber~\n#\u003e  8    11 DE                 11         2011    12 lic. phi~ Bäumlin \n#\u003e  9    12 DE                 12         2335   115 lic. iur. Beerli  \n#\u003e 10    13 DE                 13         2202     3 lic. en ~ Béguin  \n#\u003e # ... with 3,619 more rows, and 14 more variables: GenderAsString \u003cchr\u003e,\n#\u003e #   DateOfBirth \u003cdate\u003e, DateOfDeath \u003cdate\u003e, MaritalStatus \u003cint\u003e,\n#\u003e #   MaritalStatusText \u003cchr\u003e, PlaceOfBirthCity \u003cchr\u003e,\n#\u003e #   PlaceOfBirthCanton \u003cchr\u003e, Modified \u003cdttm\u003e, FirstName \u003cchr\u003e,\n#\u003e #   OfficialName \u003cchr\u003e, MilitaryRank \u003cint\u003e, MilitaryRankText \u003cchr\u003e,\n#\u003e #   NativeLanguage \u003cchr\u003e, NumberOfChildren \u003cint\u003e\n```\n### Subsetting with ...\nThe function uses ... (ellipsis) to subset tables and can therefore be applied very flexibly. For example, it can be used to download all speech transcripts of a given councillor: \n``` r\nswissparl::get_data(\n    table = \"Transcript\", \n    SpeakerLastName = \"Blocher\", \n    Language = \"DE\"\n    )\n#\u003e \n#\u003e # A tibble: 1,380 x 34\n#\u003e    ID    Language IdSubject VoteId PersonNumber  Type Text \n#\u003e    \u003cchr\u003e \u003cchr\u003e    \u003cchr\u003e     \u003clgl\u003e         \u003cint\u003e \u003cint\u003e \u003cchr\u003e\n#\u003e  1 63    DE       8         NA               21     1 \"\u003cpd~\n#\u003e  2 617   DE       113       NA               21     1 \"\u003cpd~\n#\u003e  3 619   DE       113       NA               21     1 \"\u003cpd~\n#\u003e  4 639   DE       113       NA               21     1 \"\u003cpd~\n#\u003e  5 1506  DE       264       NA               21     1 \"\u003cpd~\n#\u003e  6 1519  DE       264       NA               21     1 \"\u003cpd~\n#\u003e  7 2517  DE       376       NA               21     1 \"\u003cpd~\n#\u003e  8 2565  DE       385       NA               21     1 \"\u003cpd~\n#\u003e  9 2567  DE       385       NA               21     1 \"\u003cpd~\n#\u003e 10 4254  DE       721       NA               21     1 \"\u003cpd~\n#\u003e # ... with 1,370 more rows, and 27 more variables:\n#\u003e #   MeetingCouncilAbbreviation \u003cchr\u003e, MeetingDate \u003cchr\u003e,\n#\u003e #   MeetingVerbalixOid \u003cint\u003e, IdSession \u003cchr\u003e, SpeakerFirstName \u003cchr\u003e,\n#\u003e #   SpeakerLastName \u003cchr\u003e, SpeakerFullName \u003cchr\u003e, SpeakerFunction \u003cchr\u003e,\n#\u003e #   CouncilId \u003cint\u003e, CouncilName \u003cchr\u003e, CantonId \u003cint\u003e, CantonName \u003cchr\u003e,\n#\u003e #   CantonAbbreviation \u003cchr\u003e, ParlGroupName \u003cchr\u003e,\n#\u003e #   ParlGroupAbbreviation \u003cchr\u003e, SortOrder \u003cint\u003e, Start \u003cdttm\u003e,\n#\u003e #   End \u003cdttm\u003e, Function \u003cchr\u003e, DisplaySpeaker \u003clgl\u003e,\n#\u003e #   LanguageOfText \u003cchr\u003e, Modified \u003cdttm\u003e, StartTimeWithTimezone \u003cdttm\u003e,\n#\u003e #   EndTimeWithTimezone \u003cdttm\u003e, VoteBusinessNumber \u003clgl\u003e,\n#\u003e #   VoteBusinessShortNumber \u003clgl\u003e, VoteBusinessTitle \u003clgl\u003e\n```\n\n### Periods\nOr it can also be used to fetch detailed information on all political businesses submitted during a **given period**:\n``` r\nswissparl::get_data(\n    table = \"Business\", \n    SubmissionDate = c(\"\u003e2019-06-30\", \"\u003c2019-12-08\"), \n    Language = \"DE\"\n    )\n#\u003e \n#\u003e # A tibble: 815 x 43\n#\u003e        ID Language BusinessShortNu~ BusinessType BusinessTypeName\n#\u003e     \u003cint\u003e \u003cchr\u003e    \u003cchr\u003e                   \u003cint\u003e \u003cchr\u003e           \n#\u003e  1 2.02e7 DE       19.005                      2 Geschäft des Pa~\n#\u003e  2 2.02e7 DE       19.041                      1 Geschäft des Bu~\n#\u003e  3 2.02e7 DE       19.042                      1 Geschäft des Bu~\n#\u003e  4 2.02e7 DE       19.045                      1 Geschäft des Bu~\n#\u003e  5 2.02e7 DE       19.046                      1 Geschäft des Bu~\n#\u003e  6 2.02e7 DE       19.047                      1 Geschäft des Bu~\n#\u003e  7 2.02e7 DE       19.048                      1 Geschäft des Bu~\n#\u003e  8 2.02e7 DE       19.049                      1 Geschäft des Bu~\n#\u003e  9 2.02e7 DE       19.050                      1 Geschäft des Bu~\n#\u003e 10 2.02e7 DE       19.051                      1 Geschäft des Bu~\n#\u003e # ... with 805 more rows, and 38 more variables:\n#\u003e #   BusinessTypeAbbreviation \u003cchr\u003e, Title \u003cchr\u003e, Description \u003cchr\u003e,\n#\u003e #   InitialSituation \u003cchr\u003e, Proceedings \u003cchr\u003e, DraftText \u003clgl\u003e,\n#\u003e #   SubmittedText \u003cchr\u003e, ReasonText \u003cchr\u003e, DocumentationText \u003clgl\u003e,\n#\u003e #   MotionText \u003clgl\u003e, FederalCouncilResponseText \u003cchr\u003e,\n#\u003e #   FederalCouncilProposal \u003cint\u003e, FederalCouncilProposalText \u003cchr\u003e,\n#\u003e #   FederalCouncilProposalDate \u003cdate\u003e, SubmittedBy \u003cchr\u003e,\n#\u003e #   BusinessStatus \u003cint\u003e, BusinessStatusText \u003cchr\u003e,\n#\u003e #   BusinessStatusDate \u003cdate\u003e, ResponsibleDepartment \u003cint\u003e,\n#\u003e #   ResponsibleDepartmentName \u003cchr\u003e,\n#\u003e #   ResponsibleDepartmentAbbreviation \u003cchr\u003e, IsLeadingDepartment \u003clgl\u003e,\n#\u003e #   Tags \u003cchr\u003e, Category \u003cchr\u003e, Modified \u003cdttm\u003e, SubmissionDate \u003cdate\u003e,\n#\u003e #   SubmissionCouncil \u003cint\u003e, SubmissionCouncilName \u003cchr\u003e,\n#\u003e #   SubmissionCouncilAbbreviation \u003cchr\u003e, SubmissionSession \u003cint\u003e,\n#\u003e #   SubmissionLegislativePeriod \u003cint\u003e, FirstCouncil1 \u003cint\u003e,\n#\u003e #   FirstCouncil1Name \u003cchr\u003e, FirstCouncil1Abbreviation \u003cchr\u003e,\n#\u003e #   FirstCouncil2 \u003cint\u003e, FirstCouncil2Name \u003cchr\u003e,\n#\u003e #   FirstCouncil2Abbreviation \u003cchr\u003e, TagNames \u003cchr\u003e\n```\n### Substrings\nTo a certain extent, it is also possible to search for **substring matches in texts**. For example, to search for all political businesses that contain *CO2* in the title, enter the following query: \n``` r\nswissparl::get_data(table = \"Business\", Title = \"~CO2\", Language = \"DE\")\n#\u003e \n#\u003e # A tibble: 207 x 43\n#\u003e        ID Language BusinessShortNu~ BusinessType BusinessTypeName\n#\u003e     \u003cint\u003e \u003cchr\u003e    \u003cchr\u003e                   \u003cint\u003e \u003cchr\u003e           \n#\u003e  1 1.99e7 DE       92.3245                     5 Motion          \n#\u003e  2 2.00e7 DE       95.2011                    10 Petition        \n#\u003e  3 2.00e7 DE       95.3546                     5 Motion          \n#\u003e  4 2.00e7 DE       97.030                      1 Geschäft des Bu~\n#\u003e  5 2.00e7 DE       00.5227                    14 Fragestunde. Fr~\n#\u003e  6 2.00e7 DE       01.420                      4 Parlamentarisch~\n#\u003e  7 2.00e7 DE       01.421                      4 Parlamentarisch~\n#\u003e  8 2.00e7 DE       01.422                      4 Parlamentarisch~\n#\u003e  9 2.00e7 DE       01.3178                     5 Motion          \n#\u003e 10 2.00e7 DE       01.3225                     8 Interpellation  \n#\u003e # ... with 197 more rows, and 38 more variables:\n#\u003e #   BusinessTypeAbbreviation \u003cchr\u003e, Title \u003cchr\u003e, Description \u003cchr\u003e,\n#\u003e #   InitialSituation \u003cchr\u003e, Proceedings \u003cchr\u003e, DraftText \u003clgl\u003e,\n#\u003e #   SubmittedText \u003cchr\u003e, ReasonText \u003cchr\u003e, DocumentationText \u003clgl\u003e,\n#\u003e #   MotionText \u003clgl\u003e, FederalCouncilResponseText \u003cchr\u003e,\n#\u003e #   FederalCouncilProposal \u003cint\u003e, FederalCouncilProposalText \u003cchr\u003e,\n#\u003e #   FederalCouncilProposalDate \u003cdate\u003e, SubmittedBy \u003cchr\u003e,\n#\u003e #   BusinessStatus \u003cint\u003e, BusinessStatusText \u003cchr\u003e,\n#\u003e #   BusinessStatusDate \u003cdate\u003e, ResponsibleDepartment \u003cint\u003e,\n#\u003e #   ResponsibleDepartmentName \u003cchr\u003e,\n#\u003e #   ResponsibleDepartmentAbbreviation \u003cchr\u003e, IsLeadingDepartment \u003clgl\u003e,\n#\u003e #   Tags \u003cchr\u003e, Category \u003cchr\u003e, Modified \u003cdttm\u003e, SubmissionDate \u003cdate\u003e,\n#\u003e #   SubmissionCouncil \u003cint\u003e, SubmissionCouncilName \u003cchr\u003e,\n#\u003e #   SubmissionCouncilAbbreviation \u003cchr\u003e, SubmissionSession \u003cint\u003e,\n#\u003e #   SubmissionLegislativePeriod \u003cint\u003e, FirstCouncil1 \u003cint\u003e,\n#\u003e #   FirstCouncil1Name \u003cchr\u003e, FirstCouncil1Abbreviation \u003cchr\u003e,\n#\u003e #   FirstCouncil2 \u003cint\u003e, FirstCouncil2Name \u003cchr\u003e,\n#\u003e #   FirstCouncil2Abbreviation \u003cchr\u003e, TagNames \u003cchr\u003e\n```\n\n### Advice for large queries\nLarge queries (especially the tables *Voting* and *Transcripts*) may result in **server-side errors** (*500 Internal Server Error*). In these cases it is recommended to download the data in smaller batches, save the individual blocks and combine them after the download. The following code snippet is from example 5, where all votes of the 50th legislature period are downloaded, session by session.\n\n``` r\n# Get Session IDs\nsessions50 \u003c- swissparl::get_data(\"Session\", Language = \"DE\", LegislativePeriodNumber = 50)\n\n# Define Function\nget_voting_buffered \u003c- function(id) {\n  \n  # Create folder\n  folder \u003c- \"voting50\"\n  if(!dir.exists(folder)) dir.create(folder)\n  \n  # Download\n  dt \u003c- swissparl::get_data(\"Voting\", Language = \"DE\", IdSession = id)\n  \n  # Save\n  saveRDS(dt, paste0(folder, \"/\", id, \".rds\"))\n  \n}\n\n# Apply Function to Session IDs\npurrr::walk(sessions50$ID, get_voting_buffered)\n\n# Combine to One Dataset\nv50 \u003c- purrr::map_dfr(list.files(\"voting50\", full.names = T), readRDS)\n```\n\n## Extra features\n### `ggswissparl`\nThe function `ggswissparl` uses the in-built data frame `seating_plan` (based on the the [schematic representation of the National Council Hall](https://www.parlament.ch/en/organe/national-council/groups-chamber-nc)) to visualize the results of ballots in the National Council. Since only the current seating arrangement can be retrieved from the API, only the most recent voting results can be displayed correctly.\n\n``` r\nswissparl::get_data(\"Voting\", Language = \"DE\", IdVote = 23458) %\u003e% \n    swissparl::ggswissparl(theme = \"scoreboard\")\n```\n\u003cimg src=\"https://github.com/zumbov2/swissparl/blob/master/plots/scoreboard.png\" width=\"500\"\u003e  \n\n``` r\nswissparl::get_data(\"Voting\", Language = \"DE\", IdVote = 23458) %\u003e% \n    swissparl::ggswissparl(theme = \"poly2\")\n```\n\u003cimg src=\"https://github.com/zumbov2/swissparl/blob/master/plots/poly2.png\" width=\"500\"\u003e  \n\n### `clean_text`\nClears all texts of line breaks and all non-text-relevant annotations (page numbers).\n\n``` r\nswissparl::get_data(\"Transcript\", Language = \"DE\", ID = 112146) %\u003e%\n  pull(Text) %\u003e%\n  swissparl::clean_text()\n\n#\u003e [1] \"Auf diese Antwort habe ich mich schon den ganzen Sonntag gefreut. (Heiterkeit) Das zur Diskussion stehende gewürzte Fleisch von Tieren der Rindviehgattung wird unter der Zolltarifnummer 1602.5099 (Schlüssel 914) ausserhalb des Zollkontingentes veranlagt. Dem schweizerischen Zolltarif kommt Gesetzesrang zu. Er basiert wie die kombinierte Nomenklatur (KN) der EU und die meisten Zolltarife weltweit auf dem international gültigen Harmonisierten System (HS). Ebenfalls materiell verbindliches internationales Staatsvertragsrecht sind gemäss Rechtsprechung des Bundesverwaltungsgerichtes die Erläuterungen zum HS. Diese sehen vor, dass gewürztes Fleisch (z. B. mit Pfeffer) als zubereitet gilt und somit grundsätzlich zum Kapitel 16 des Zolltarifs gehört. An der Grenze zu vollziehende wirtschaftliche Massnahmen im Allgemeinen und die Höhe der Zollansätze im Besonderen stellen ausdrücklich keine Gründe dar, eine Ware nicht tarifgemäss einzureihen. In Anlehnung an Anmerkung 6a zum Kapitel 2 der KN hat die Zollverwaltung zusätzlich (Heiterkeit) sogenannte 'schweizerische Erläuterungen zum Zolltarif' (Grosse Heiterkeit, Beifall) publiziert. Danach werden gewisse Erzeugnisse noch im Kapitel 2 eingereiht, denen bei der Herstellung Würzstoffe zugesetzt worden sind, sofern dadurch der Charakter einer Ware dieses Kapitels nicht verändert wird (z. B. Bündnerfleisch). (Grosse Heiterkeit) Ausgeschlossen von diesem Kapitel bleibt hingegen Fleisch, bei dem die Würzstoffe auf allen Flächen des Erzeugnisses verteilt und mit blossem Auge wahrnehmbar sind. (Heiterkeit) Nach der Besprechung vom 26. März 2010 mit Vertretern des Bauernverbandes und der Fleischbranche hat die Zollverwaltung diese Erläuterungen inzwischen auf dem Zirkularweg ergänzt. Seit dem 3. Mai 2010 gehört mit ganzen Pfefferkörnern bestreutes Fleisch ebenfalls zum Kapitel 2 des Zolltarifs. Damit wird verhindert, dass Fleischstücke mit Zusatz von ganzen Pfefferkörnern zu den markant tieferen Zollansätzen des Kapitels 16 eingeführt werden können. Eine noch weiter gehende Ausdehnung des Geltungsbereichs des Kapitels 2 stünde in eindeutigem Widerspruch zu den HS-Bestimmungen und damit auch zu den völkerrechtlichen Verpflichtungen der Schweiz. (Heiterkeit) Die Zollverwaltung hat im Rahmen ihrer Kontrolltätigkeit zudem ein Risikoprofil betreffend die Veranlagung von gewürztem Fleisch erstellt. Die entsprechenden Veranlagungen werden somit noch genauer kontrolliert. Ein höherer Zollschutz gegenüber dem geltenden in der Tarifnummer 1602.5099 müsste aus heutiger Sicht in einem Dekonsolidierungsverfahren im Rahmen der WTO aufgrund der Forderungen der Hauptlieferländer durch Zollsenkungen in anderen Tarifnummern und/oder durch ein grösseres Zollkontingent für Rind- und Kalbfleisch kompensiert werden. Die Aussicht, dass ein Dekonsolidierungsverfahren insgesamt eine bessere Situation für die inländische Schlachtvieh- und Fleischbranche mit sich bringt, ist äusserst gering. Es trifft zu, dass die eingeführte Menge unter der Tarifnummer 1602.5099 im Laufe des Jahres 2010 zugenommen hat. Im Vergleich zum jährlichen gesamtschweizerischen Konsum von verkaufsfertigem Rind- und Kalbfleisch (112 000 Tonnen) erscheint die importierte Menge jedoch eher gering (815 Tonnen bis Ende Juni 2010). Herr Nationalrat, ich bitte Sie um Verzeihung, wenn ich bisweilen einfach nicht verstanden habe, was ich Ihnen vorgelesen habe. (Heiterkeit)\"\n```\n## Possibly relevant queries (extended continuously)\n### All speeches on a specific political business\nIt is also possible to download all speech transcripts for a specific business. However, this requires a small detour. The first step is to extract when the business was discussed in the councils. This information is stored in the *SubjectBusiness* table.\n``` r\nsubject \u003c- swissparl::get_data(\n  table = \"SubjectBusiness\",\n  BusinessShortNumber = \"05.057\",\n  Language = \"DE\"\n  )\n```\nAfterwards all speeches of a specific business can be queried via the IdSubject.\n``` r\nswissparl::get_data(\n  table = \"Transcript\", \n  IdSubject = as.numeric(subject$IdSubject),\n  Language = \"DE\"\n  )\n```\n### All votes of a specific legislative period\nIn a first step, we fetch all sessions of the legislative period of interest. Then we use the session IDs to obtain the associated voting decisions of the individual MPs.\n``` r\nsessions \u003c- get_data(\"Session\", Language = \"DE\")\nsessions51 \u003c- sessions %\u003e% filter(LegislativePeriodNumber == 51)\nvotes51 \u003c- get_data(\"Vote\", Language = \"DE\", IdSession = sessions51$ID)\n```\n\n## Examples\nHere are some examples of use:\n- **Example 1**: [Who with Whom in the Council of States?](https://github.com/zumbov2/swissparl/blob/master/examples/ex1.md) – *A Brief Network Analysis*\n- **Example 2**: [Slow Bernese?](https://github.com/zumbov2/swissparl/blob/master/examples/ex2.md) – *A Cantonal Comparison of Speaking Rates* (by [Benjamin Gföhler](https://www.benjamingfoehler.ch/))\n- **Example 3**: [The Federal Council's To-Do List](https://github.com/zumbov2/swissparl/blob/master/examples/ex3.md) – *A Simple Trend Analysis of Procedural Requests*\n- **Example 4**: [What Are They Talking About?](https://github.com/zumbov2/swissparl/blob/master/examples/ex4.md) – *Application of the Lingusitic Concept of Keyness to Speeches*\n- **Example 5**: [Polarization in the National Council](https://github.com/zumbov2/swissparl/blob/master/examples/ex5.md) – *W-NOMINATE Scores for the 50th Legislative Term*\n\n## Use Cases\n- **NZZ, 16.4.2021**: [Die Grünen machten im Parlament am meisten mit Corona Politik](https://www.nzz.ch/visuals/ld.1606433) | [Code](https://github.com/nzzdev/st-methods/tree/master/2107-parlamentsdebatte-corona)\n\n## swissparl for Python\n[swissparlpy](https://github.com/metaodi/swissparlpy) by [Stefan Oderbolz](https://github.com/metaodi)\n\n## Suggested Citation\nZumbach, David (2020). swissparl: Interface to the Webservices of the Swiss Parliament. R package version 0.2.1. https://CRAN.R-project.org/package=swissparl\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzumbov2%2Fswissparl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzumbov2%2Fswissparl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzumbov2%2Fswissparl/lists"}