Skip to content

Instantly share code, notes, and snippets.

View jtrecenti's full-sized avatar
🎯
Focusing

Julio Trecenti jtrecenti

🎯
Focusing
View GitHub Profile
library(tidyverse)
link_dados <- "https://github.com/jtrecenti/main-cdad2/releases/download/data/camaras.csv"
camaras <- read_csv(link_dados)
glimpse(camaras)
camaras$ementa[2]
u <- "https://consumidor.gov.br/pages/indicador/relatos/consultar"
parametros <- list(
indicePrimeiroResultado = 0,
palavrasChave = "",
segmentoMercado = 4,
fornecedor = "",
regiao = "",
area = "",
assunto = "",
install.packages("yfR")
da <- yfR::yf_get(
"AMER3.SA",
first_date = "2024-05-15",
last_date = "2024-06-04"
) |>
dplyr::mutate(
price_close = price_close / 100,
# install.packages("remotes")
# remotes::install_github("jjesusfilho/tjsp")
# processo a ser acessado
processo <- "15012667120228260617"
# autenticação: precisa fazer uma vez por sessão, apenas
tjsp::autenticar("CPF", "SENHA")
tibble::tibble()
tribunais <- forosCNJ::da_tribunal |>
dplyr::filter(id_justica == 8) |>
dplyr::pull(sigla) |>
tolower()
endpoints <- glue::glue(
"https://api-publica.datajud.cnj.jus.br/api_publica_{tribunais}/_search"
)
# Endpoint for SOAP requests
endpoint_url <- 'https://www.cnj.jus.br/corregedoria/justica_aberta/ws.php'
# XML payload, replace the method name and parameters as per actual API
# This is a simplified example assuming a SOAP method called 'getServentiaJudicial' that accepts 'seq_orgao' as a parameter
xml_payload <- '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cor="https://www.cnj.jus.br/corregedoria/justica_aberta/ws.php">
<soapenv:Header/>
<soapenv:Body>
<cor:pesquisarServentiasJudiciais>
<!--Optional:-->
# reciclou mas deu um warning porque não é múltiplo
tibble::tibble(x = c('a', 'b', 'c')) |>
dplyr::filter(x == c('a', 'b'))
#> Warning: There was 1 warning in `dplyr::filter()`.
#> ℹ In argument: `x == c("a", "b")`.
#> Caused by warning in `x == c("a", "b")`:
#> ! comprimento do objeto maior não é múltiplo do comprimento do objeto menor
#> # A tibble: 2 × 1
#> x
#> <chr>
# arrumação dos dados para pesquisa
moral_raw <- readxl::read_excel("moral.xlsx")
sexual_raw <- readxl::read_excel("sexual.xlsx")
moral <- moral_raw |>
janitor::clean_names() |>
dplyr::mutate(
no_processo_original = no_processo,
no_processo = abjutils::clean_cnj(no_processo)
pdf_full <- pdftools::pdf_text("pdf_full.pdf")
# 33-36, 38-39, 41-46, 48-49, 52-54, 56-61, 63-72, 74-77, 79-83, 85-91, 93-96, 98-100, 102-105
paginas <- c(
33:36, 38:39, 41:46, 48:49,
52:54, 56:61, 63:72, 74:77,
79:83, 85:91, 93:96, 98:100,
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 2 in line 1.
Category: All categories
Month,deu ruim: (Brazil)
2004-01,0
2004-02,0
2004-03,0
2004-04,0
2004-05,0
2004-06,0
2004-07,0