TJES - Tribunal de Justica do Espirito Santo

Example notebook for the TJES jurisprudence scraper (cjsg).

The TJES scraper queries the public API at sistemas.tjes.jus.br/consulta-jurisprudencia/ and supports five Solr cores:

Core Description
pje1g First instance (PJe)
pje2g Second instance (PJe) — default
pje2g_mono Second instance monocratic decisions (PJe)
legado Legacy second instance
turma_recursal_legado Legacy appellate panels (Projudi)

Using filters

The TJES scraper supports several filters: magistrado, orgao_julgador, classe_judicial, jurisdicao, assunto, date range (data_julgamento_inicio / data_julgamento_fim), busca_exata, and ordenacao.

# Filter by date range and magistrado
dados_filtrados = tjes.cjsg(
    'direito',
    data_julgamento_inicio='2024-01-01',
    data_julgamento_fim='2024-06-30',
    magistrado='HELIMAR PINTO',
    paginas=1,
)

print(dados_filtrados.shape)
dados_filtrados[['nr_processo', 'magistrado', 'classe_judicial', 'dt_juntada']].head(5)
Baixando paginas TJES: 100%|██████████| 1/1 [00:00<00:00, 10.22it/s]
(20, 23)
nr_processo magistrado classe_judicial dt_juntada
0 5005361-74.2024.8.08.0000 HELIMAR PINTO AGRAVO DE EXECUÇÃO PENAL 2024-06-25
1 0001362-38.2023.8.08.0000 HELIMAR PINTO MANDADO DE SEGURANÇA CÍVEL 2024-02-29
2 5003125-52.2024.8.08.0000 HELIMAR PINTO HABEAS CORPUS CRIMINAL 2024-04-18
3 0026004-72.2016.8.08.0048 HELIMAR PINTO APELAÇÃO CRIMINAL 2024-04-25
4 5005989-63.2024.8.08.0000 HELIMAR PINTO HABEAS CORPUS CRIMINAL 2024-06-25

Querying different cores

By default, the scraper queries pje2g (second instance). You can switch cores with the core parameter.

# Search monocratic decisions (2nd instance)
dados_mono = tjes.cjsg('dano moral', core='pje2g_mono', paginas=1)

print(f"Monocratic results: {len(dados_mono)} rows")
dados_mono[['nr_processo', 'magistrado', 'classe_judicial']].head(3)
Baixando paginas TJES: 100%|██████████| 1/1 [00:00<00:00, 10.46it/s]
Monocratic results: 20 rows
nr_processo magistrado classe_judicial
0 5001274-40.2022.8.08.0002 GRECIO NOGUEIRA GREGIO Recurso Inominado Cível
1 5023551-77.2024.8.08.0035 DOUGLAS DEMONER FIGUEIREDO RECURSO INOMINADO CÍVEL
2 5001473-59.2023.8.08.0024 SALOMAO AKHNATON ZOROASTRO SPENCER ELESBON Recurso Inominado Cível

First instance (cjpg)

Use cjpg() to query first-instance decisions (core pje1g). It accepts the same filters as cjsg (except core).

Note: cjsg() does not accept core="pje1g" — use cjpg() instead.

# Search first-instance decisions
dados_1g = tjes.cjpg('dano moral', paginas=1)

print(f"First instance results: {len(dados_1g)} rows")
dados_1g[['nr_processo', 'magistrado', 'classe_judicial', 'dt_juntada']].head(5)
Baixando paginas TJES: 100%|██████████| 1/1 [00:00<00:00,  5.04it/s]
First instance results: 20 rows
nr_processo magistrado classe_judicial dt_juntada
0 5000704-46.2022.8.08.0037 MARCELO MATTAR COUTINHO Procedimento do Juizado Especial Cível 2023-09-28
1 5000057-89.2018.8.08.0005 EVANDRO COELHO DE LIMA Procedimento do Juizado Especial Cível 2019-12-17
2 5004066-91.2024.8.08.0035 INES VELLO CORREA Procedimento do Juizado Especial Cível 2024-11-08
3 5000045-13.2017.8.08.0037 MARCELO MATTAR COUTINHO Procedimento do Juizado Especial Cível 2020-01-04
4 5005643-41.2022.8.08.0014 SALOMAO AKHNATON ZOROASTRO SPENCER ELESBON Procedimento do Juizado Especial Cível 2022-11-01

Download and parse separately

For more control, you can use cjsg_download and cjsg_parse separately. This is useful when you want to cache the raw responses or inspect them before parsing.

# Download raw JSON responses
brutos = tjes.cjsg_download('direito', paginas=1)

# Inspect raw response structure
print(f"Pages downloaded: {len(brutos)}")
print(f"Keys in response: {list(brutos[0].keys())}")
print(f"Total results available: {brutos[0]['total']}")
print(f"Docs in this page: {len(brutos[0]['docs'])}")
Baixando paginas TJES: 100%|██████████| 1/1 [00:00<00:00,  6.54it/s]
Pages downloaded: 1
Keys in response: ['core_used', 'docs', 'facets', 'page', 'per_page', 'total', 'total_pages']
Total results available: 167559
Docs in this page: 20
# Parse into DataFrame
df = tjes.cjsg_parse(brutos)
df.head(3)
nr_processo ementa magistrado orgao_julgador classe_judicial classe_judicial_sigla assunto_principal jurisdicao competencia dt_juntada ... localizacao cargo_julgador cd_assunto_principal cd_classe_judicial id_assunto_principal id_classe_judicial id_jurisdicao id_localizacao id_cargo_julgador id_bin
0 5002933-85.2025.8.08.0000 \nEmenta: DIREITO DAS SUCESSÕES. AGRAVO DE INS... ARTHUR JOSE NEIVA DE ALMEIDA 4ª Câmara Cível AGRAVO DE INSTRUMENTO AI Inventário e Partilha Tribunal de Justiça Cível Isolada 2025-06-13 ... 016 - Gabinete Des. ARTHUR JOSÉ NEIVA DE ALMEIDA Desembargador(a) 7687 202 1636 238 1 36 117 13176473
1 5007013-97.2022.8.08.0000 \nDIREITO PROCESSUAL CIVIL. AGRAVO DE INSTRUME... JOSE PAULO CALMON NOGUEIRA DA GAMA 2ª Câmara Cível AGRAVO DE INSTRUMENTO AI Promessa de Compra e Venda Tribunal de Justiça Cível Isolada 2023-08-24 ... 005 - Gabinete Des. JOSÉ PAULO CALMON NOGUEIRA... Desembargador(a) 10496 202 2087 238 1 21 149 5253374
2 5002710-35.2025.8.08.0000 \nEmenta: DIREITO CIVIL E PROCESSUAL CIVIL. AG... ARTHUR JOSE NEIVA DE ALMEIDA 4ª Câmara Cível AGRAVO DE INSTRUMENTO AI Inventário e Partilha Tribunal de Justiça Cível Isolada 2025-10-03 ... Gabinete Des. ARTHUR JOSÉ NEIVA DE ALMEIDA Desembargador(a) 7687 202 1636 238 1 36 117 14653808

3 rows × 23 columns