Title: | API Wrapper for the Natural Gas Transparency Platforms of Gas Infrastructure Europe |
---|---|
Description: | Providing access to the API for Gas Infrastructure Europe's natural gas transparency platforms <https://agsi.gie.eu/> and <https://alsi.gie.eu/>. Lets the user easily download metadata on companies and gas storage units covered by the API as well as the respective data on regional, country, company or facility level. |
Authors: | Yannik Buhl [aut, cre] |
Maintainer: | Yannik Buhl <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.2 |
Built: | 2024-11-19 06:28:50 UTC |
Source: | CRAN |
check_giedata2input
check_giedata2input( countries, companies, facilities, from, to, date, size, timeout, database, verbose, apikey )
check_giedata2input( countries, companies, facilities, from, to, date, size, timeout, database, verbose, apikey )
countries |
Passed from data function for check |
companies |
Passed from data function for check |
facilities |
Passed from data function for check |
from |
Passed from data function for check |
to |
Passed from data function for check |
date |
Passed from data function for check |
size |
Passed from data function for check |
timeout |
Passed from data function for check |
database |
Passed from data function for check |
verbose |
Passed from data function for check |
apikey |
Passed from data function for check |
check_giedatainput
check_giedatainput( country, company, facility, from, to, date, size, timeout, database, verbose, apikey )
check_giedatainput( country, company, facility, from, to, date, size, timeout, database, verbose, apikey )
country |
Passed from data function for check |
company |
Passed from data function for check |
facility |
Passed from data function for check |
from |
Passed from data function for check |
to |
Passed from data function for check |
date |
Passed from data function for check |
size |
Passed from data function for check |
timeout |
Passed from data function for check |
database |
Passed from data function for check |
verbose |
Passed from data function for check |
apikey |
Passed from data function for check |
check_gielistinginput
check_gielistinginput(region, country, facilities, database, apikey)
check_gielistinginput(region, country, facilities, database, apikey)
region |
Passed from listing function for check |
country |
Passed from listing function for check |
facilities |
Passed from listing function for check |
database |
Passed from listing function for check |
apikey |
Passed from listing function for check |
construct_url
construct_url(url, query)
construct_url(url, query)
url |
Base URL |
query |
Query list |
A dataset to help you switch between country name and country code in the usage of 'gie', as gie_listing() and gie_load() work with different modes of the country (name vs. two-character code).
countryinfo
countryinfo
countryinfo
A data frame with 17 rows and 2 columns:
Country name
Two-character country code
https://www.gie.eu/
extract_listelements
extract_listelements(listelement)
extract_listelements(listelement)
listelement |
List element to extract from |
getrequest_general
getrequest_general( database, target, page, size, timeout, pages = NULL, apikey, verbose = FALSE, ... )
getrequest_general( database, target, page, size, timeout, pages = NULL, apikey, verbose = FALSE, ... )
database |
Database name |
target |
The API endpoint to target |
page |
The page to retrieve |
size |
The page size of the request |
timeout |
Seconds to delay the batch request |
pages |
Number of total pages of existing request |
apikey |
API key |
verbose |
Enable verbose mode |
... |
Further valid API parameters |
Raw results
Function to download data from GIE's AGSI+/ALSI+ API in bulk
gie_batchload( countries, companies = NULL, facilities = NULL, from = NULL, to = NULL, date = NULL, size = 30, timeout = 3, database = "agsi", verbose = FALSE, apikey = Sys.getenv("GIE_APIKEY") )
gie_batchload( countries, companies = NULL, facilities = NULL, from = NULL, to = NULL, date = NULL, size = 30, timeout = 3, database = "agsi", verbose = FALSE, apikey = Sys.getenv("GIE_APIKEY") )
countries |
Character. Specify the countries of interest as two-digit |
companies |
A character vector of company EIC codes to get data from. |
facilities |
A character vector of facility EIC codes to get data from. |
from |
Character. Specify the start of the time span you are |
to |
Character. Specify the end of the time span you are |
date |
Character. If you want to have data only for one date. |
size |
Integer. The number of results per page. |
timeout |
Numeric. If the amount of pages of your request exceeds 60, a timeout |
database |
Character. The type of API you want to address ('agsi' or 'alsi'). |
verbose |
Logical. Prints information on function progress to the console (default: FALSE). |
apikey |
Character. Your personal API key. |
A data.frame with results
## Not run: gie_batchload(countries = c("DE", "AT", "FR"), date = "2022-04-01") ## End(Not run)
## Not run: gie_batchload(countries = c("DE", "AT", "FR"), date = "2022-04-01") ## End(Not run)
A function that conveniently outputs all 'News' items published by GIE with regards to AGSI+ or ALSI+ platforms
gie_getnews(database, html_parsed = FALSE, apikey = Sys.getenv("GIE_APIKEY"))
gie_getnews(database, html_parsed = FALSE, apikey = Sys.getenv("GIE_APIKEY"))
database |
Character. The data base for which the 'News' items should be returned ('agsi' or 'alsi'). |
html_parsed |
Logical. Some of the columns in the resulting data.frame might contain HTML |
apikey |
Character. Your personal API key. |
A data.frame with all the news for the respective data base.
## Not run: news <- gie_getnews(database = "alsi", html_parsed = TRUE) ## End(Not run)
## Not run: news <- gie_getnews(database = "alsi", html_parsed = TRUE) ## End(Not run)
Function to download raw or parsed results for the countries,
companies and facilities available from the AGSI+/ALSI+ API of GIE. The EIC codes
of the results can be used in turn to download the actual data
using gie_load()
.
gie_listing( region = NULL, country = NULL, facilities = FALSE, database = "agsi", apikey = Sys.getenv("GIE_APIKEY") )
gie_listing( region = NULL, country = NULL, facilities = FALSE, database = "agsi", apikey = Sys.getenv("GIE_APIKEY") )
region |
Character. The broader region you want results for (can be 'Europe' or 'Non-EU'). |
country |
Character. The country you want the results for (must be the |
facilities |
Logical. If TRUE, facility data will be added to the country or company results. |
database |
Character. The type of API you want to address ('agsi' or 'alsi'). |
apikey |
Character. Your personal API key. |
Data.frame with results
## Not run: gie_listing(region = "Europe", country = "Germany", facilities = TRUE) ## End(Not run)
## Not run: gie_listing(region = "Europe", country = "Germany", facilities = TRUE) ## End(Not run)
gie_listinghierarchy
gie_listinghierarchy(raw_results, region, country, facilities, database)
gie_listinghierarchy(raw_results, region, country, facilities, database)
raw_results |
Raw results from API call |
region |
Region to filter for |
country |
Country to filter for |
facilities |
Should facilties be exported as well |
database |
Database to get info from |
Function to download data from GIE's AGSI+ and ALSI+ API
gie_load( country, company = NULL, facility = NULL, from = NULL, to = NULL, date = NULL, size = 30, timeout = 3, database = "agsi", verbose = FALSE, apikey = Sys.getenv("GIE_APIKEY") )
gie_load( country, company = NULL, facility = NULL, from = NULL, to = NULL, date = NULL, size = 30, timeout = 3, database = "agsi", verbose = FALSE, apikey = Sys.getenv("GIE_APIKEY") )
country |
Character. Specify the country of interest as two-digit country code (e.g., 'DE', 'IE'). |
company |
Character. EIC code for the requested company. |
facility |
Character. EIC code for the requested facility. |
from |
Character. Specify the start of the time span you are |
to |
Character. Specify the end of the time span you are |
date |
Character. If you want to have data only for one date. |
size |
Integer. The number of results per page. |
timeout |
Numeric. If the amount of pages of your request exceeds 60, a timeout |
database |
Character. The type of API you want to address ('agsi' or 'alsi'). |
verbose |
Logical. Prints information on function progress to the console (default: FALSE). |
apikey |
Character. Your personal API key. |
A data.frame or list with the results.
## Not run: gie_load(country = "DE", date = "2022-01-03", database = "alsi") ## End(Not run)
## Not run: gie_load(country = "DE", date = "2022-01-03", database = "alsi") ## End(Not run)
parseresult
parseresult(raw_results, database)
parseresult(raw_results, database)
raw_results |
Raw results from GET request |
database |
The database to be used |
send_getrequest
send_getrequest(url, apikey, ...)
send_getrequest(url, apikey, ...)
url |
URL for GET request |
apikey |
API key |
... |
Further API parameters |
setnull
setnull(data, x)
setnull(data, x)
data |
Data.frame or list element |
x |
Name of element to delete |
A function to HTML decode a character vector of length > 1
strip_html(string)
strip_html(string)
string |
String to strip HTML tags from |
A vector with HTML decoded text
try_GET
try_GET(url, apikey, ...)
try_GET(url, apikey, ...)
url |
URL for API call |
apikey |
API key |
... |
Further parameter for httr::GET |