Skip to content

Commit

Permalink
Correcoes no processo de atualizacao dos datasets e documentacoes
Browse files Browse the repository at this point in the history
  • Loading branch information
AlceuPantoni committed Sep 20, 2022
1 parent 4564b53 commit 4a584ec
Show file tree
Hide file tree
Showing 28 changed files with 114 additions and 127 deletions.
41 changes: 6 additions & 35 deletions .github/workflows/update-data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,60 +4,31 @@ on:
workflow_dispatch:

name: update-data

jobs:
render:
name: update-data
runs-on: ubuntu-latest

runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v1
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}

- uses: r-lib/actions/setup-pandoc@v1

- name: Instalando libs de sistema
run: |
sudo apt update
sudo apt install libudunits2-dev libgdal-dev
sudo apt install libprotobuf-dev protobuf-compiler
sudo apt install libjq-dev
sudo apt install libgit2-dev
sudo apt install libcurl4-openssl-dev
sudo apt install libssl-dev
sudo apt install libxml2-dev
- name: Instalando pacotes
install.packages("remotes")
remotes::install_local(".")
remotes::install_cran("devtools")
remotes::install_cran("usethis")
remotes::install_cran("pkgdown")
remotes::install_cran("rmarkdown")
remotes::install_cran("dplyr")
remotes::install_cran("stringr")
remotes::install_cran("purrr")
remotes::install_cran("tidyr")
remotes::install_cran("stringi")
remotes::install_cran("lubridate")
remotes::install_cran("httr")
remotes::install_cran("jsonlite")
remotes::install_cran("readr")
remotes::install_cran("tibble")
remotes::install_cran("glue")
remotes::install_cran("readxl")
remotes::install_cran("writexl")
remotes::install_cran("janitor")
remotes::install_cran("knitr")

sudo add-apt-repository ppa:cran/libgit2
sudo apt-get install libgit2-dev
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install libssl-dev
sudo apt-get install libxml2-dev
- name: Execute Script
run: |
Rscript data-raw/atualizar_dados.R
- name: Commit results
run: |
git config --local user.email "actions@github.com"
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: loterrrias
Title: Dados das Loterias Brasileira
Version: 0.1.0
Version: 0.1.2
Authors@R:
person("Alceu", "Pantoni Neto", , "alceu.pantoni@gmail.com",role = c("aut", "cre"),
comment = c(ORCID = ""))
Expand Down
56 changes: 28 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ uso de técnicas de Web Scraping.
Caso necessário, é possível fazer download das base de dados em formado
**.xlsx** através dos links abaixo:

- ***Dia de Sorte***
[Dia\_de\_Sorte`.xlsx`](https://raw.githubusercontent.com/AlceuPantoni/loterrrias/main/data-raw/resultados_diadesorte.xlsx)
- ***Lotofácil***
- ***Dia de Sorte***
[Dia_de_Sorte`.xlsx`](https://raw.githubusercontent.com/AlceuPantoni/loterrrias/main/data-raw/resultados_diadesorte.xlsx)
- ***Lotofácil***
[Lotofacil`.xlsx`](https://raw.githubusercontent.com/AlceuPantoni/loterrrias/main/data-raw/resultados_lotofacil.xlsx)
- ***Lotomania***
- ***Lotomania***
[Lotomania`.xlsx`](https://raw.githubusercontent.com/AlceuPantoni/loterrrias/main/data-raw/resultados_lotomania.xlsx)
- ***Mega-Sena***
[Mega\_Sena`.xlsx`](https://raw.githubusercontent.com/AlceuPantoni/loterrrias/main/data-raw/resultados_megasena.xlsx)
- ***Quina***
- ***Mega-Sena***
[Mega_Sena`.xlsx`](https://raw.githubusercontent.com/AlceuPantoni/loterrrias/main/data-raw/resultados_megasena.xlsx)
- ***Quina***
[Quina`.xlsx`](https://raw.githubusercontent.com/AlceuPantoni/loterrrias/main/data-raw/resultados_quina.xlsx)
- ***Super Sete***
[Super\_Sete`.xlsx`](https://raw.githubusercontent.com/AlceuPantoni/loterrrias/main/data-raw/resultados_supersete.xlsx)
- ***Timemania***
- ***Super Sete***
[Super_Sete`.xlsx`](https://raw.githubusercontent.com/AlceuPantoni/loterrrias/main/data-raw/resultados_supersete.xlsx)
- ***Timemania***
[Timemania`.xlsx`](https://raw.githubusercontent.com/AlceuPantoni/loterrrias/main/data-raw/resultados_timemania.xlsx)

## Instalação
Expand All @@ -59,15 +59,15 @@ loterrrias::resultado_todos(produto = 'megasena') |>
knitr::kable()
```

| data\_apuracao | concurso | houve\_ganhador | valor\_premio\_maximo | numeros\_sorteados | num\_1 | num\_2 | num\_3 | num\_4 | num\_5 | num\_6 |
| :------------- | -------: | --------------: | --------------------: | :----------------- | -----: | -----: | -----: | -----: | -----: | -----: |
| 2022-09-17 | 2521 | 0 | 0 | 23;28;33;38;55;59 | 23 | 28 | 33 | 38 | 55 | 59 |
| 2022-09-15 | 2520 | 0 | 0 | 2;17;22;41;58;60 | 2 | 17 | 22 | 41 | 58 | 60 |
| 2022-09-13 | 2519 | 0 | 0 | 3;8;20;36;38;57 | 3 | 8 | 20 | 36 | 38 | 57 |
| 2022-09-10 | 2518 | 0 | 0 | 3;22;23;44;53;60 | 3 | 22 | 23 | 44 | 53 | 60 |
| 2022-09-08 | 2517 | 0 | 0 | 1;5;6;16;22;39 | 1 | 5 | 6 | 16 | 22 | 39 |
| 2022-09-03 | 2516 | 0 | 0 | 8;17;49;51;52;53 | 8 | 17 | 49 | 51 | 52 | 53 |
| 2022-08-31 | 2515 | 0 | 0 | 3;12;19;41;45;54 | 3 | 12 | 19 | 41 | 45 | 54 |
| data_apuracao | concurso | houve_ganhador | valor_premio_maximo | numeros_sorteados | num_1 | num_2 | num_3 | num_4 | num_5 | num_6 |
|:--------------|---------:|---------------:|--------------------:|:------------------|------:|------:|------:|------:|------:|------:|
| 2022-09-17 | 2521 | 0 | 0 | 23;28;33;38;55;59 | 23 | 28 | 33 | 38 | 55 | 59 |
| 2022-09-15 | 2520 | 0 | 0 | 2;17;22;41;58;60 | 2 | 17 | 22 | 41 | 58 | 60 |
| 2022-09-13 | 2519 | 0 | 0 | 3;8;20;36;38;57 | 3 | 8 | 20 | 36 | 38 | 57 |
| 2022-09-10 | 2518 | 0 | 0 | 3;22;23;44;53;60 | 3 | 22 | 23 | 44 | 53 | 60 |
| 2022-09-08 | 2517 | 0 | 0 | 1;5;6;16;22;39 | 1 | 5 | 6 | 16 | 22 | 39 |
| 2022-09-03 | 2516 | 0 | 0 | 8;17;49;51;52;53 | 8 | 17 | 49 | 51 | 52 | 53 |
| 2022-08-31 | 2515 | 0 | 0 | 3;12;19;41;45;54 | 3 | 12 | 19 | 41 | 45 | 54 |

Neste outro caso de uso, temos um resumo histórico de todos os produtos
das Loterias da Caixa disponíveis no pacote.
Expand All @@ -77,12 +77,12 @@ loterrrias::historico_resumido_produtos() |>
knitr::kable()
```

| nome\_produto | data\_primeiro\_concurso | quantidade\_concursos | quantidade\_concursos\_com\_ganhador | percentual\_com\_ganhador | media\_premiacao | maior\_premio | menor\_premio | total\_dezenas\_sorteadas | numero\_mais\_sorteado | numero\_menos\_sorteado |
| :------------ | :----------------------- | --------------------: | -----------------------------------: | ------------------------: | ---------------: | ------------: | ------------: | ------------------------: | ---------------------: | ----------------------: |
| Mega-sena | 1996-03-11 | 2521 | 575 | 0.23 | 22450538.9 | 289420865 | 348732.75 | 15126 | 53 | 26 |
| Lotofácil | 2003-09-29 | 2616 | 2353 | 0.90 | 888209.3 | 8227507 | 10712.22 | 39240 | 20 | 8 |
| Quina | 1994-03-13 | 5952 | 2470 | 0.41 | 3232789.7 | 579215957 | 14230.37 | 29760 | 4 | 47 |
| Lotomania | 1999-10-02 | 2366 | 642 | 0.27 | 2247331.6 | 37261930 | 109348.66 | 47320 | 47 | 96 |
| Timemania | 2008-03-01 | 1836 | 68 | 0.04 | 27234282.4 | 818652938 | 164711.44 | 12852 | 21 | 53 |
| Super Sete | 2020-10-02 | 296 | 18 | 0.06 | 2458611.5 | 7786503 | 124747.77 | 2072 | 9 | 1 |
| Dia de Sorte | 2018-05-19 | 657 | 229 | 0.35 | 817112.2 | 3770060 | 59101.35 | 4599 | 10 | 1 |
| nome_produto | data_primeiro_concurso | quantidade_concursos | quantidade_concursos_com_ganhador | percentual_com_ganhador | media_premiacao | maior_premio | menor_premio | total_dezenas_sorteadas | numero_mais_sorteado | numero_menos_sorteado |
|:-------------|:-----------------------|---------------------:|----------------------------------:|------------------------:|----------------:|-------------:|-------------:|------------------------:|---------------------:|----------------------:|
| Mega-sena | 1996-03-11 | 2521 | 575 | 0.23 | 22450538.9 | 289420865 | 348732.75 | 15126 | 53 | 26 |
| Lotofácil | 2003-09-29 | 2617 | 2354 | 0.90 | 887999.5 | 8227507 | 10712.22 | 39255 | 20 | 8 |
| Quina | 1994-03-13 | 5952 | 2470 | 0.41 | 3232789.7 | 579215957 | 14230.37 | 29760 | 4 | 47 |
| Lotomania | 1999-10-02 | 2366 | 642 | 0.27 | 2247331.6 | 37261930 | 109348.66 | 47320 | 47 | 96 |
| Timemania | 2008-03-01 | 1836 | 68 | 0.04 | 27234282.4 | 818652938 | 164711.44 | 12852 | 21 | 53 |
| Super Sete | 2020-10-02 | 296 | 18 | 0.06 | 2458611.5 | 7786503 | 124747.77 | 2072 | 9 | 1 |
| Dia de Sorte | 2018-05-19 | 657 | 229 | 0.35 | 817112.2 | 3770060 | 59101.35 | 4599 | 10 | 1 |
26 changes: 25 additions & 1 deletion data-raw/atualizar_dados.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
## Preparação das bases de dados de todos os produtos
install.packages(
c("stringr",
"glue",
"httr",
"jsonlite",
"janitor",
"tibble",
"dplyr",
"readr",
"usethis",
"devtools",
"purrr",
"httr",
"lubridate",
"stringi",
"tidyr",
"knitr",
"readxl",
"writexl",
"rmarkdown",
"pkgdown"
),
repos = "https://packagemanager.rstudio.com/all/__linux__/focal/latest"
)

devtools::load_all()

httr::set_config(httr::config(ssl_verifypeer = FALSE))

raw_atualizar_dados <- function(produto){

file <- glue::glue("data-raw/resultados_{produto}.xlsx")

df <- NULL
Expand Down
2 changes: 1 addition & 1 deletion docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/LICENSE-text.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion docs/LICENSE.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions docs/articles/loterrrias.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions docs/authors.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4a584ec

Please sign in to comment.