{"id":32200043,"url":"https://github.com/skvrnami/hlidacr","last_synced_at":"2026-02-20T16:01:57.603Z","repository":{"id":47033653,"uuid":"311994770","full_name":"skvrnami/hlidacr","owner":"skvrnami","description":"Access Data from the Hlídač státu API in R","archived":false,"fork":false,"pushed_at":"2022-12-07T18:40:15.000Z","size":410,"stargazers_count":9,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-09T19:17:55.979Z","etag":null,"topics":["czech-republic","datasets","open-data","r","rstats","rstats-package"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skvrnami.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-11T14:27:53.000Z","updated_at":"2025-11-05T16:13:18.000Z","dependencies_parsed_at":"2023-01-24T20:15:51.250Z","dependency_job_id":null,"html_url":"https://github.com/skvrnami/hlidacr","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/skvrnami/hlidacr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skvrnami%2Fhlidacr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skvrnami%2Fhlidacr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skvrnami%2Fhlidacr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skvrnami%2Fhlidacr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skvrnami","download_url":"https://codeload.github.com/skvrnami/hlidacr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skvrnami%2Fhlidacr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29656589,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T09:27:29.698Z","status":"ssl_error","status_checked_at":"2026-02-20T09:26:12.373Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["czech-republic","datasets","open-data","r","rstats","rstats-package"],"created_at":"2025-10-22T03:36:30.666Z","updated_at":"2026-02-20T16:01:57.598Z","avatar_url":"https://github.com/skvrnami.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# hlidacr\n\n\u003c!-- badges: start --\u003e\n[![CRAN status](https://www.r-pkg.org/badges/version/hlidacr)](https://CRAN.R-project.org/package=hlidacr)\n[![R build status](https://github.com/skvrnami/hlidacr/workflows/R-CMD-check/badge.svg)](https://github.com/skvrnami/hlidacr/actions)\n[![codecov](https://codecov.io/gh/skvrnami/hlidacr/branch/main/graph/badge.svg?token=FWP73F1DOL)](https://codecov.io/gh/skvrnami/hlidacr)\n[![](https://cranlogs.r-pkg.org/badges/hlidacr)](https://CRAN.R-project.org/package=hlidacr)\n\u003c!-- badges: end --\u003e\n\nThe goal of hlidacr is to provide access to the data published by [Hlídač státu](https://www.hlidacstatu.cz/) provided by their [API](https://www.hlidacstatu.cz/swagger/index.html). \n\n## Installation\n\nYou can install the package from CRAN:\n\n``` r\ninstall.packages(\"hlidacr\")\n```\n\n\nYou can install the development version from [GitHub](https://github.com/) with:\n\n``` r\n# install.packages(\"devtools\")\ndevtools::install_github(\"skvrnami/hlidacr\")\n```\n\nBesides the installation, you need access token for making API requests. \nThe access token is available [here](https://www.hlidacstatu.cz/api/v1/Index) \nafter the registration at the Hlídač státu's website. \n\n## Usage\n\nThe package implements functions for accessing all publicly available API endpoints\nas defined in the [documentation](https://www.hlidacstatu.cz/swagger/index.html)\nof the Hlídač státu API. \n\nThe data available via the API are related to:\n\n- funding of political parties  \n- transcriptions of parliamentary floor debates, municipal council debates and other bodies  \n- contracts between public institutions and private companies  \n- subsidies  \n- availability of websites operated by public institutions  \netc.\n\n## Example\n\nThere are two types of datasets available at the Hlídač státu API.\nFirst, there are various collection of datasets whose list is available\nusing `get_datasets()`.\n\n```{r example, message=FALSE, warning=FALSE}\nlibrary(dplyr)\nlibrary(hlidacr)\n\n# Authorization token\nTOKEN \u003c- Sys.getenv(\"HLIDAC_TOKEN\")\n\ndatasets \u003c- get_datasets(token = TOKEN)\nstr(datasets, max.level = 1)\n\nhead(datasets$results[,1:2], 10)\n```\n\nIn general, the data are usually returned in a list with 3 elements:\n\n- `page`  \n- `total`: total number of records  \n- `results`: data  \n\n(Therefore, to get the data you need to iterate over the pages by specifying\nparticular page of the results you want. However, be aware of the fact that \nthe API returns error if the parameter `page` exceeds 200.)\n\nThe data from these datasets can be obtained by `get_dataset_data` function\nusing dataset's ID. \nFor example:\n\n```{r}\nministers \u003c- get_dataset_data(\"ministri\", page = 1)\nhead(ministers$results %\u003e% select(resort, jmeno, strana, zacatek))\n```\n\nSecond, there are specific datasets that are available via specific routes\nand therefore specific functions. These include datasets related to \ncontracts between public institutions and private companies, subsidies, companies, \npersons and websites. \n\nFor example:\n\n```{r}\ngolf_subsidies \u003c- search_subsidies(\"golf\")\nhead(golf_subsidies$results %\u003e% select(idDotace, nazevProjektu, dotaceCelkem))\n```\n\n```{r}\ngolf_contracts \u003c- search_contracts(\"golf\")\nhead(golf_contracts$results %\u003e% select(predmet, hodnotaBezDph))\n```\n\nIn addition, you can get the text of particular contract using `get_contract_text`\nusing the ID of the contract that is stored in the column `id` in the\ndata.frame returned by `search_contracts`.\n\n```{r}\ncon_text \u003c- get_contract_text(id = \"9934567\")\ncat(substr(con_text[1], 1500, 2000))\n```\n\nSearching for a person is done using `search_person`. For instance:\n\n```{r}\nbabis \u003c- search_person(\"Babiš\")\nhead(babis)\n```\n\n`get_person` function provides data related to a person such as their donations to \npolitical parties, service in public and private institutions and their social\nmedia accounts. \nThe example below shows Andrej Babiš's donations to political parties.\n\n```{r}\nab \u003c- get_person(\"andrej-babis\")\nhead(ab$sponzoring %\u003e% arrange(desc(castka)))\n```\n\nBesides getting social media accounts for a particular person using the \n`get_person` function, you can obtain social media accounts of Czech politicians, \nusing `get_person_social`. \nIt returns a data.frame with a data.frame nested in the `socialniSite` variable.\nFor instance: \n\n```{r}\ntwitter_insta \u003c- get_person_social(types = c(\"Instagram\", \"Twitter\"))\ntwitter_insta$socialniSite[2]\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskvrnami%2Fhlidacr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskvrnami%2Fhlidacr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskvrnami%2Fhlidacr/lists"}