-
Notifications
You must be signed in to change notification settings - Fork 20
/
README.Rmd
96 lines (71 loc) · 3.25 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
---
output:
github_document:
html_preview: false
---
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-")
```
# esaj <img src="man/figures/logo.png" align="right" />
[![Made In Brazil](https://img.shields.io/badge/made%20in-brazil-green.svg)](http://www.abj.org.br) [![Travis-CI Build Status](https://travis-ci.org/courtsbr/esaj.svg?branch=master)](https://travis-ci.org/courtsbr/esaj) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/courtsbr/esaj?branch=master&svg=true)](https://ci.appveyor.com/project/courtsbr/esaj)
## Overview
The `esaj` R package is a simple interface that allows you to download multiple
kinds of files from Brazil's e-SAJ (Electronic Justice Automation System)
portals. With this package you can save and parse lawsuits, queries, and
decisions with very simple, tidyverse compliant functions.
To install `esaj`, run the code below:
```{r, eval = FALSE}
# install.packages("devtools")
devtools::install_github("courtsbr/esaj")
```
## Usage
### Lawsuits
Before `esaj` if you wanted to gather information about lawsuits being
processed by Brazil's state-level Judiciary, you would have to go to each
state's e-SAJ portal, manually input each lawsuit's ID, break a capthca, and
only then download an HTML with the information you wanted; now you can simply
run `download_cpopg()` or `download_cposg()`, and spend your valuable time
analysing the data.
```{r, message = FALSE}
# Download first degree lawsuits from multiple states
ids <- c(
"0123479-07.2012.8.26.0100",
"0552486-62.2015.8.05.0001",
"0303349-44.2014.8.24.0020")
esaj::download_cpopg(ids, "~/Desktop/")
# Download second degree lawsuits from São Paulo
ids <- c(
"1001869-51.2017.8.26.0562",
"1001214-07.2016.8.26.0565")
esaj::download_cposg(ids, "~/Desktop/")
```
For more information on how to use these functions and which TJs are
implemented, please see [Downloading Lawsuits](http://courtsbr.github.io/esaj/articles/download_lawsuit.html).
### Queries
Besides downloading lawsuits (see the **Downloading Lawsuits** article), `esaj`
also allows the user to download the results of a query on lawsuits. This kind
of query is very useful for finding out what lawsuits contain certain words,
were filed in a given period, were filed in a given court, etc.
```{r}
# Download results of a simple first degree query
esaj::download_cjpg("recurso", "~/Desktop/")
# Download results of a slightly more complex second degree query
esaj::download_cjsg("recurso", "~/Desktop/", classes = c("1231", "1232"))
```
For more information on how to use these functions and all their auxiliary
methods (like `peek_cj*g()` and `cj*g_table()`), please see
[Downloading Queries](http://courtsbr.github.io/esaj/articles/download_query.html).
### Decisions
Of all functions in the `esaj` package, `download_decision()` is probably the
simplest: it downloads the PDF belonging to a decision and that's it.
```{r}
# Download one decision
esaj::download_decision("10000034", "~/Desktop/")
# Download more than one decision
esaj::download_decision(c("10800758", "10000034"), "~/Desktop/")
```
For more information on how to use this function, please see
[Downloading Decisions](http://courtsbr.github.io/esaj/articles/download_decision.html).