Skip to content
Agentmart
Submit a tool

diarios

Reference for the shared diarios Python module — API lookup, usage patterns, and gotchas.

Skill by hsigstad

IndexedMIT
Write a review

Chalk Labs

Need help deploying diarios?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/hsigstad-diarios

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Reference for the shared diarios Python module — API lookup, usage patterns, and gotchas. Use when writing code that involves court data, legal text parsing, Brazilian administrative data cleaning, or when checking if a utility already exists before writing a new one.

Use cases: backend, data, writing, legal

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/diarios

What's inside

Skill name
diarios
Description
Reference for the shared diarios Python module — API lookup, usage patterns, and gotchas. Use when writing code that involves court data, legal text parsing, Brazilian administrative data cleaning, or when checking if a utility already exists before writing a new one.
License
MIT
Instructions
91 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# diarios Module Reference

The `diarios` package is a shared Python module used across projects for Brazilian court and administrative data processing. **Always check here before writing new utility functions.**

## Quick API reference

The workspace root contains `CLAUDE.md` alongside `projects/`, `pipelines/`, `diarios/`, `research/`. If the current directory is inside a project or pipeline, search upward to find the root.

Read `$ROOT/research-kit/meta/diarios_api.md` for the full module inventory. Key areas:

### Text & Data Cleaning (`diarios.clean.text`)
- `clean_text()` — clean text (character removal, case, accents)
- `map_regex()` / `remove_regexes()` / `extract_series()` — regex utilities
- `add_leads_and_lags()` — panel data lag/lead construction
- `read_csv()` — CSV reader with sensible defaults

### Number & ID Cleaning (`diarios.clean.numbers`)
- `clean_cnj_number()` / `is_cnj_number()` — CNJ case number normalization
- `clean_reais()` / `parse_brl()` — Brazilian currency parsing
- `clean_cpf()` — CPF tax ID cleaning
- `clean_oab()` — OAB lawyer number cleaning
- `get_tribunal()` / `get_filing_year()` — extract metadata from case numbers

### Legal Domain (`diarios.clean.legal`)
- `clean_parte()` / `clean_parte_key()` — party name cleaning
- `clean_classe()` — case class normalization
- `get_procedencia()` / `get_plaintiffwins()` — outcome extraction
- `load_datajud_jsonl()` / `normalize_datajud()` — DataJud data loading

### Geography (`diarios.clean.geo`)
- `TRT` / `TRF` classes — Regional Labor/Federal Court representations
- `clean_municipio()` / `get_municipio_id()` — municipality normalization
- `clean_comarca()` / `clean_vara()` — court jurisdiction cleaning

### Court Parsing (`diarios.parse`)
- `CaseParser` class — parse court cases with customizable regex
- `parse_diario_extract()` — parse diary extracts
- `inspect()` — inspection utility

### Court Docket Parsers (`diarios.consulta`)
- `consulta.TJSP` — `parse_consulta_tjsp_from_zip()`
- `consulta.STF` — `parse_consulta_stf()`
- `consulta.STJ` — `parse_consulta_stj()`
- `consulta.TRF1` — `parse_consulta_trf1()`

### Decision Parsing (`diarios.decision`)
- `DecisionParser` class — parse court rulings into structured components

### Other
- `diarios.database` — `query()`, `insert()`, `connect()`
- `diarios.io` — `read_files()`, `extract_pdf_text()`, `ocr_file()`
- `diarios.politica` — `split_coalition()`, `get_district()`, `get_office_type()`
- `diarios.close_election` — `is_close()` for RDD analysis

## Common patterns

| When you need to... | Use... |
|---|---|
| Parse BRL currency | `diarios.clean.numbers.clean_reais()` |
| Normalize municipality names | `diarios.clean.geo.clean_municipio()` |
| Clean CNJ case numbers | `diarios.clean.numbers.clean_cnj_number()` |
| Clean party names | `diarios.clean.legal.clean_parte()` |
| Parse TJSP docket data | `diarios.consulta.TJSP.parse_consulta_tjsp_from_zip()` |
| Extract text from PDFs | `diarios.io.extract_pdf_text()` |
| Determine plaintiff win | `diarios.clean.legal.get_plaintiffwins()` |
| Add leads/lags to panel | `diarios.clean.text.add_leads_and_lags()` |

## Gotchas

- **Always import from the specific submodule**, not top-level, for non-exported functions. E.g., `from diarios.clean.numbers import clean_reais`, not `from diarios import clean_reais`.
- **Top-level exports are limited to:** `CaseParser, DiarioParser, parse_diario_extract, inspect, Extractor, query, normalize_datajud`. Everything else requires submodule imports.
- **Do NOT duplicate diarios functionality.** If you're about to write a function for cleaning CPFs, parsing case numbers, normalizing municipalities, etc. — check this reference first. The function almost certainly exists.
- **Do NOT modify diarios** unless the user explicitly instructs you to. If you find a bug or need an enhancement, flag it to the user.
- The module has **optional dependencies**: `ocr` (pytesseract, pdf2image) and `db` (SQLAlchemy). Code using these features needs the optional extras installed.
- `map_regex()` returns the **first match** — order patterns most-specific-first.
- `clean_municipio()` and `clean_parte()` handle accent removal internally via Unidecode — don't pre-clean accents before calling them.
- For the full source code, read files in `$ROOT/packages/diarios/diarios/`. For the API summary, read `$ROOT/research-kit/meta/diarios_api.md`.

## When this skill triggers automatically

This skill should be consulted (even without explicit `/diarios` invocation) whenever you're about to:
- Write a new text cleaning function for Brazilian data
- Parse court case numbers or docket data
- Clean party names, CPFs, OAB numbers, or municipality names
- Work with DataJud data
- Extract text from PDFs or perform OCR
- Build panel data with leads/lags

Before writing new code, check if `diarios` already has the function you need.

From hsigstad/research-kit, MIT.

More from hsigstad/research-kit

Signals

Stars
0
Forks
1
Open issues
1
Last commit (this folder)
Jul 5, 2026 (4 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from hsigstad

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get diarios running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying diarios?

CallGet help
Cite this page

diarios skill. Agent Mart. https://agentmart.dev/skills/hsigstad-diarios (last updated 2026-10-24)