bigdatape
An R package designed to seamlessly access and download data from the BigDataPE platform.
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (18.1%) to scientific vocabulary
Last synced: 10 months ago
·
JSON representation
Repository
An R package designed to seamlessly access and download data from the BigDataPE platform.
Basic Info
- Host: GitHub
- Owner: StrategicProjects
- License: other
- Language: R
- Default Branch: main
- Homepage: https://monitoramento.sepe.pe.gov.br/bigdatape/
- Size: 229 KB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Created over 1 year ago
· Last pushed about 1 year ago
Metadata Files
Readme
Changelog
License
README.Rmd
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# BigDataPE




**BigDataPE** is an R package that provides a secure and intuitive way to access datasets from the BigDataPE platform. The package allows users to fetch data from the API using token-based authentication, manage multiple tokens for different datasets, and retrieve data efficiently using chunking.
> **Note:** To access the **BigDataPE API**, you must be connected to the "PE Conectado" network or use a VPN.
## Installation
You can install the `BigDataPE` package directly from GitHub:
```r
# Install the devtools package if you haven't already
install.packages("devtools")
# Install BigDataPE from GitHub
devtools::install_github("StrategicProjects/bigdatape")
```
After installation, load the package:
```r
library(BigDataPE)
```
## Features
- Securely store and manage API tokens with the environment variables.
- Fetch data from the BigDataPE API using a simple interface.
- Retrieve large datasets iteratively using chunking.
- Easily manage multiple datasets and their associated tokens.
## Functions Overview
### 1. Store Token: `bdpe_store_token`
This function securely stores an authentication token for a specific dataset.
```r
bdpe_store_token(base_name, token)
```
**Parameters**:
- `base_name`: The name of the dataset.
- `token`: The authentication token for the dataset.
**Example**:
```r
bdpe_store_token("education_dataset", "your-token-here")
```
---
### 2. Retrieve Token: `bdpe_get_token`
This function retrieves the securely stored token for a specific dataset.
```r
bdpe_get_token(base_name)
```
**Parameters**:
- `base_name`: The name of the dataset.
**Example**:
```r
token <- bdpe_get_token("education_dataset")
```
---
### 3. Remove Token: `bdpe_remove_token`
This function removes the token associated with a specific dataset.
```r
bdpe_remove_token(base_name)
```
**Parameters**:
- `base_name`: The name of the dataset.
**Example**:
```r
bdpe_remove_token("education_dataset")
```
---
### 4. List Tokens: `bdpe_list_tokens`
This function lists all datasets with stored tokens.
```r
bdpe_list_tokens()
```
**Example**:
```r
datasets <- bdpe_list_tokens()
print(datasets)
```
---
### 5. Fetch Data: `bdpe_fetch_data`
This function retrieves data from the BigDataPE API using securely stored tokens.
```r
bdpe_fetch_data(
base_name,
limit = 100,
offset = 0,
query = list(),
endpoint = "https://www.bigdata.pe.gov.br/api/buscar")
```
**Parameters**:
- `base_name`: The name of the dataset.
- `limit`: Number of records per page. Default is `Inf`
- `offset`: Starting record for the query. Default is 0.
- `query`: Additional query parameters.
- `endpoint`: The API endpoint URL.
**Example**:
```r
data <- bdpe_fetch_data("education_dataset", limit = 50)
```
---
### 6. Fetch Data in Chunks: `bdpe_fetch_chunks`
This function retrieves data from the API iteratively in chunks.
```r
bdpe_fetch_chunks(
base_name,
total_limit = Inf,
chunk_size = 100,
query = list(),
endpoint = "https://www.bigdata.pe.gov.br/api/buscar")
```
**Parameters**:
- `base_name`: The name of the dataset.
- `total_limit`: Maximum number of records to fetch. Default is `Inf` (fetch all available data).
- `chunk_size`: Number of records per chunk. Default is 50.000
- `query`: Additional query parameters.
- `endpoint`: The API endpoint URL.
**Example**:
```r
# Fetch up to 500 records in chunks of 100
data <- bdpe_fetch_chunks(
"education_dataset",
total_limit = 500,
chunk_size = 100)
# Fetch all available data in chunks of 200
all_data <- bdpe_fetch_chunks(
"education_dataset",
chunk_size = 200)
```
---
### 7. Construct URL with Query Parameters: `parse_queries`
This internal function constructs a URL with query parameters.
```r
parse_queries(url, query_list)
```
**Parameters**:
- `url`: The base URL.
- `query_list`: A list of query parameters.
**Example**:
```r
url <- parse_queries(
"https://www.example.com",
list(param1 = "value1", param2 = "value2")
)
print(url)
```
---
## Example Workflow
Here’s a complete example workflow:
```r
# Store a token for a dataset
bdpe_store_token("education_dataset", "your-token-here")
# Fetch 100 records starting from the first record
data <- bdpe_fetch_data("education_dataset", limit = 100, offset = 0)
# Fetch data in chunks
all_data <- bdpe_fetch_chunks(
"education_dataset",
total_limit = 500,
chunk_size = 100)
# List all datasets with stored tokens
datasets <- bdpe_list_tokens()
# Remove a token
bdpe_remove_token("education_dataset")
```
---
## Contributing
If you find any issues or have feature requests, feel free to create an issue or a pull request on [GitHub](https://github.com/StrategicProjects/bigdatape).
---
## License
This package is licensed under the MIT License. See the `LICENSE` file for more details.
Owner
- Name: Secretaria de Projetos Estratégicos
- Login: StrategicProjects
- Kind: organization
- Email: andre.leite@sepe.pe.gov.br
- Location: Brazil
- Website: monitoramento.sepe.pe.gov.br
- Repositories: 1
- Profile: https://github.com/StrategicProjects
GitHub Events
Total
- Push event: 6
- Create event: 2
Last Year
- Push event: 6
- Create event: 2
Packages
- Total packages: 1
-
Total downloads:
- cran 555 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 3
- Total maintainers: 1
cran.r-project.org: BigDataPE
Secure and Intuitive Access to 'BigDataPE' 'API' Datasets
- Homepage: <https://github.com/StrategicProjects/bigdatape>
- Documentation: http://cran.r-project.org/web/packages/BigDataPE/BigDataPE.pdf
- License: MIT + file LICENSE
-
Latest release: 0.0.96
published about 1 year ago
Rankings
Dependent packages count: 27.5%
Forks count: 28.9%
Dependent repos count: 34.0%
Stargazers count: 36.7%
Average: 42.8%
Downloads: 87.0%
Maintainers (1)
Last synced:
10 months ago
Dependencies
DESCRIPTION
cran
- dplyr * imports
- httr2 * imports
- keyring * imports
- tibble * imports