Title: | Access Data from the 'Hlídač Státu' API |
---|---|
Description: | Provides access to datasets published by 'Hlídač státu' <https://www.hlidacstatu.cz/>, a Czech watchdog, via their API. |
Authors: | Michael Škvrňák [aut, cre] |
Maintainer: | Michael Škvrňák <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.0 |
Built: | 2024-10-31 16:34:08 UTC |
Source: | https://github.com/skvrnami/hlidacr |
Check internet connection
check_connection()
check_connection()
No return value, called for side effects
Check API token
check_token(token)
check_token(token)
token |
API token to Hlidac statu |
No return value, called for side effects
Check if all social media account types are valid
check_types(types)
check_types(types)
types |
Vector with types of social media accounts |
No return value, called for side effects
Create query string for osoby/social API endpoint
create_type(types)
create_type(types)
types |
Vector with types of social media accounts |
String for querying API
Get company details
get_company(company_name, token = Sys.getenv("HLIDAC_TOKEN"))
get_company(company_name, token = Sys.getenv("HLIDAC_TOKEN"))
company_name |
Name of the company |
token |
Access token |
list with 3 elements: - ico: ID number of the company - jmeno: Name of the company - datoveSchranky: Data post box - electronic repository for communication between public institutions and private companies/people
https://www.hlidacstatu.cz/swagger/index.html
https://www.hlidacstatu.cz/api/v1/doc
## Not run: get_company("Agrofert") ## End(Not run)
## Not run: get_company("Agrofert") ## End(Not run)
Get contract details
get_contract(id, token = NULL)
get_contract(id, token = NULL)
id |
ID of contract |
token |
Authorization token |
list with data
https://www.hlidacstatu.cz/swagger/index.html
https://www.hlidacstatu.cz/api/v1/doc
## Not run: get_contract(id = "1086905") ## End(Not run)
## Not run: get_contract(id = "1086905") ## End(Not run)
Get contract text
get_contract_text(id, token = Sys.getenv("HLIDAC_TOKEN"))
get_contract_text(id, token = Sys.getenv("HLIDAC_TOKEN"))
id |
ID of contract |
token |
Authorization token |
Character vector containing text of the contract
https://www.hlidacstatu.cz/swagger/index.html
https://www.hlidacstatu.cz/api/v1/doc
## Not run: get_contract_text(id = "1086905") ## End(Not run)
## Not run: get_contract_text(id = "1086905") ## End(Not run)
Get data from the dataset
get_dataset_data( dataset_id, token = Sys.getenv("HLIDAC_TOKEN"), query = NULL, page = 1, sort = NULL, desc = NULL )
get_dataset_data( dataset_id, token = Sys.getenv("HLIDAC_TOKEN"), query = NULL, page = 1, sort = NULL, desc = NULL )
dataset_id |
ID of dataset |
token |
Authorization token |
query |
Search query |
page |
Number of page (Please note that if the page parameter exceeds 200, the function returns error) |
sort |
Sort by column |
desc |
Descending or ascending sorting |
list containing 3 elements: - total: Total number of datasets available (integer) - page: Page of the result (integer), equal to the 'page' argument of the function - results: Data.frame with data, columns vary depending on the dataset
https://www.hlidacstatu.cz/swagger/index.html
https://www.hlidacstatu.cz/api/v1/doc
Other Datasets:
get_dataset_metadata()
,
get_dataset_record_detail()
,
get_datasets()
## Not run: get_dataset_data("ministri") get_dataset_data("ministri", query = "Zeman", page = 1) ## End(Not run)
## Not run: get_dataset_data("ministri") get_dataset_data("ministri", query = "Zeman", page = 1) ## End(Not run)
Get metadata related to specified dataset.
get_dataset_metadata(dataset_id, token = Sys.getenv("HLIDAC_TOKEN"))
get_dataset_metadata(dataset_id, token = Sys.getenv("HLIDAC_TOKEN"))
dataset_id |
ID of dataset |
token |
Authorization token |
a list containing metadata related to the specified dataset
https://www.hlidacstatu.cz/swagger/index.html
https://www.hlidacstatu.cz/api/v1/doc
Other Datasets:
get_dataset_data()
,
get_dataset_record_detail()
,
get_datasets()
## Not run: get_dataset_metadata("ministri") ## End(Not run)
## Not run: get_dataset_metadata("ministri") ## End(Not run)
Get record detail
get_dataset_record_detail( dataset_id, item_id, token = Sys.getenv("HLIDAC_TOKEN") )
get_dataset_record_detail( dataset_id, item_id, token = Sys.getenv("HLIDAC_TOKEN") )
dataset_id |
ID of dataset |
item_id |
ID of record |
token |
Authorization token |
list of vectors containing data related to the item
get_dataset_data
https://www.hlidacstatu.cz/swagger/index.html
https://www.hlidacstatu.cz/api/v1/doc
Other Datasets:
get_dataset_data()
,
get_dataset_metadata()
,
get_datasets()
## Not run: get_dataset_record_detail("ministri", item_id = 1) ## End(Not run)
## Not run: get_dataset_record_detail("ministri", item_id = 1) ## End(Not run)
Get list of datasets available via 'Hlídač státu' API
get_datasets(token = Sys.getenv("HLIDAC_TOKEN"))
get_datasets(token = Sys.getenv("HLIDAC_TOKEN"))
token |
Authorization token |
Response from the server containing a list of all datasets available. The list contains 3 elements: - total: Total number of datasets available (integer) - page: Page of the result (integer) - results: data concerning the datasets (data.frame)
https://www.hlidacstatu.cz/swagger/index.html
https://www.hlidacstatu.cz/api/v1/doc
Other Datasets:
get_dataset_data()
,
get_dataset_metadata()
,
get_dataset_record_detail()
## Not run: get_datasets() ## End(Not run)
## Not run: get_datasets() ## End(Not run)
Get person details
get_person(person_id, token = Sys.getenv("HLIDAC_TOKEN"))
get_person(person_id, token = Sys.getenv("HLIDAC_TOKEN"))
person_id |
Person's ID |
token |
Access token |
list with the following elements: - titulPred: academic titles written before person's name - jmeno: given name - prijmeni: surname - titulPo: academic titles written after person's name (if applicable) - narozeni: date of birth - nameId: person's id - profile: URL of profile at hlidacstatu.cz - sponzoring: data.frame with data on sponsorship of political parties by the person - udalosti: events related to the person such as party membership and running in election, serving in political bodies and relations to private companies (shareholder, serving on a board) - socialniSite: data.frame with data on social media accounts
https://www.hlidacstatu.cz/swagger/index.html
https://www.hlidacstatu.cz/api/v1/doc
Other Persons:
get_person_social()
,
search_person_by_parameters()
,
search_person()
## Not run: get_person("andrej-babis") ## End(Not run)
## Not run: get_person("andrej-babis") ## End(Not run)
Get person social media accounts
get_person_social(types, token = Sys.getenv("HLIDAC_TOKEN"))
get_person_social(types, token = Sys.getenv("HLIDAC_TOKEN"))
types |
Types of social media accounts, only the following types are allowed: 'Twitter', 'Facebook_page', 'Facebook_profile', 'Instagram', 'WWW', 'Youtube' |
token |
Access token |
data.frame with data on persons' social accounts with the following columns: - titulPred: academic titles written before person's name - jmeno: given name - prijmeni: surname - titulPo: academic titles written after person's name - nameId: person's ID - profile: URL of profile at hlidacstatu.cz - socialniSite: data.frame with data on social accounts (Type of social media, Id of the social media account, URL)
https://www.hlidacstatu.cz/swagger/index.html
https://www.hlidacstatu.cz/api/v1/doc
Other Persons:
get_person()
,
search_person_by_parameters()
,
search_person()
## Not run: get_person_social(types = c("Twitter", "Instagram")) ## End(Not run)
## Not run: get_person_social(types = c("Twitter", "Instagram")) ## End(Not run)
Get subsidy
get_subsidy(id, token = Sys.getenv("HLIDAC_TOKEN"))
get_subsidy(id, token = Sys.getenv("HLIDAC_TOKEN"))
id |
Subsidy ID |
token |
Authorization token |
list with details of the subsidy
https://www.hlidacstatu.cz/swagger/index.html
https://www.hlidacstatu.cz/api/v1/doc
Other Subsidies:
search_subsidies()
## Not run: get_subsidy("deminimis-1000229862") ## End(Not run)
## Not run: get_subsidy("deminimis-1000229862") ## End(Not run)
Get website detail
get_website_detail(id, token = Sys.getenv("HLIDAC_TOKEN"))
get_website_detail(id, token = Sys.getenv("HLIDAC_TOKEN"))
id |
Website id |
token |
Authorization token |
list with 2 elements: - availability: data on availability of the website including response time and HTTP status code every minute - ssl: assessment of the website's SSL server configuration
https://www.hlidacstatu.cz/swagger/index.html
https://www.hlidacstatu.cz/api/v1/doc
## Not run: get_website_detail(id = "10107") ## End(Not run)
## Not run: get_website_detail(id = "10107") ## End(Not run)
Get websites
get_websites(token = Sys.getenv("HLIDAC_TOKEN"))
get_websites(token = Sys.getenv("HLIDAC_TOKEN"))
token |
Authorization token |
data.frame with data on websites run by the state with the following columns: - hostid: ID of website - host: host of website - url: URL of website - opendataUrl: URL to open data on website's availability - pageUrl: URL to website's profile at Hlidac statu - urad: the institution running the website - publicname: name of the website - popis: description of the website - hash
https://www.hlidacstatu.cz/swagger/index.html
https://www.hlidacstatu.cz/api/v1/doc
## Not run: get_websites() ## End(Not run)
## Not run: get_websites() ## End(Not run)
Handle response other than 200
handle_error_response(response)
handle_error_response(response)
response |
Response from the server |
No return value, called for side effects
Search contract
search_contracts(query, token = Sys.getenv("HLIDAC_TOKEN"), page = 1, sort = 0)
search_contracts(query, token = Sys.getenv("HLIDAC_TOKEN"), page = 1, sort = 0)
query |
Full-text search query |
token |
Access token |
page |
Page of results (Please note that if the page parameter exceeds 200, the function returns error) |
sort |
Ordering of the results, the available options are the following: - 0: sort by relevance - 1: recently added contracts first - 2: recently added contracts last - 3: the cheapest contracts first - 4: the most expensive contracts first - 5: recently concluded contracts first - 6: recently concluded contracts last - 7: the most defective contracts first - 8: sort by purchaser - 9: sort by supplier |
list containing 3 elements: - Total: Total number of datasets available (integer) - Page: Page of the result (integer) - Results: Data.frame with data concerning the datasets
https://www.hlidacstatu.cz/swagger/index.html
https://www.hlidacstatu.cz/api/v1/doc
https://www.hlidacstatu.cz/napoveda
## Not run: search_contracts(query = "golf") ## End(Not run)
## Not run: search_contracts(query = "golf") ## End(Not run)
Search person
search_person(query, page = NULL, token = Sys.getenv("HLIDAC_TOKEN"))
search_person(query, page = NULL, token = Sys.getenv("HLIDAC_TOKEN"))
query |
Search query for a person, required parameter |
page |
Page number |
token |
Access token |
data.frame with found persons with the following columns: - jmeno: given name - prijmeni: surname - narozeni: date of birth - nameId: person's ID - profile: URL of profile at hlidacstatu.cz - titulPred: academic titles written before person's name - titulPo: academic titles written after person's name
https://www.hlidacstatu.cz/swagger/index.html
https://www.hlidacstatu.cz/api/v1/doc
Other Persons:
get_person_social()
,
get_person()
,
search_person_by_parameters()
## Not run: search_person(query = "Kalousek") ## End(Not run)
## Not run: search_person(query = "Kalousek") ## End(Not run)
Search person by name and date of birth
search_person_by_parameters( first_name = NULL, last_name = NULL, birth_date = NULL, ignore_diacritics = TRUE, token = Sys.getenv("HLIDAC_TOKEN") )
search_person_by_parameters( first_name = NULL, last_name = NULL, birth_date = NULL, ignore_diacritics = TRUE, token = Sys.getenv("HLIDAC_TOKEN") )
first_name |
Person's first name |
last_name |
Person's last name |
birth_date |
Person's date of birth (in YYYY-MM-DD format) |
ignore_diacritics |
Parameter indicating whether diacritics in names should be ignored (boolean) |
token |
Access token |
data.frame with found persons with the following columns: - jmeno: given name - prijmeni: surname - narozeni: date of birth - nameId: person's ID - profile: URL of profile at hlidacstatu.cz - titulPred: academic titles written before person's name - titulPo: academic titles written after person's name
https://www.hlidacstatu.cz/swagger/index.html
https://www.hlidacstatu.cz/api/v1/doc
Other Persons:
get_person_social()
,
get_person()
,
search_person()
## Not run: search_person_by_parameters(first_name = "Miroslav", last_name = "Kalousek", birth_date = "1960-12-17") ## End(Not run)
## Not run: search_person_by_parameters(first_name = "Miroslav", last_name = "Kalousek", birth_date = "1960-12-17") ## End(Not run)
Search subsidies
search_subsidies( query, page = 1, sort = NULL, token = Sys.getenv("HLIDAC_TOKEN") )
search_subsidies( query, page = 1, sort = NULL, token = Sys.getenv("HLIDAC_TOKEN") )
query |
Search query |
page |
Page number (Please note that if the page parameter exceeds 200, the function returns error) |
sort |
Sorting of results, the available options are the following: - 0: order by relevance - 1: order by the date of signature, the most recent first - 2: order by the date of signature, the most recent last - 3: order by the size of the subsidy, the largest first - 4: order by the size of the subsidy, the largest last - 5: order by ICO in a descending order - 6: order by ICO in an ascending order |
token |
Authorization token |
list containing 3 elements: - total: Total number of datasets available (integer) - page: Page of the result (integer), equal to the 'page' argument of the function - results: Data.frame with data, columns vary depending on the dataset
https://www.hlidacstatu.cz/swagger/index.html
https://www.hlidacstatu.cz/api/v1/doc
Other Subsidies:
get_subsidy()
## Not run: search_subsidies("golf") ## End(Not run)
## Not run: search_subsidies("golf") ## End(Not run)