Metadata-Version: 2.3
Name: prelawsql
Version: 1.0.0
Summary: Evidence-preserving validation and indexing for Philippine legal sources.
Requires-Dist: click>=8.3
Requires-Dist: citation-utils>=1.0.0
Requires-Dist: citation-title>=1.0.0
Requires-Dist: corpus-judge>=1.0.0
Requires-Dist: sqlite-utils>=4.1
Requires-Dist: rich>=15.0
Requires-Dist: html-sanitizer>=2.6.0
Requires-Dist: pyyaml>=6.0.3
Requires-Dist: beautifulsoup4>=4.15
Requires-Dist: lxml>=6.1
Requires-Dist: markdown>=3.10
Requires-Dist: markupsafe>=3.0
Requires-Dist: httpx>=0.28.1
Requires-Dist: truststore>=0.10
Requires-Dist: python-frontmatter>=1.3.0
Requires-Dist: python-dateutil>=2.9
Requires-Dist: python-slugify>=8.0
Requires-Python: >=3.14
Description-Content-Type: text/markdown

# prelawsql

![Github CI](https://github.com/justmars/prelawsql/actions/workflows/ci.yml/badge.svg)

`prelawsql` validates and indexes Philippine legal-source material. It is built
for two kinds of readers:

- lawyers and legal researchers who need to trace a database record back to
  the exact source material; and
- developers who need deterministic parsing, reviewable failures, and safe
  rebuilds.

The package does not silently repair the source corpus. Raw source bytes are
kept as evidence, normalized fields are stored separately, and records that
cannot be interpreted safely are placed in quarantine for review.

## Quick start

```sh
# Validate statute routes and atomically publish data/stats.db.
pre build-statute-index --replace

# Create data/cases.db with the decision and justice schemas.
pre init-decision-index --replace

# Ingest Supreme Court monthly decision listings for calendar year 2024.
# --end is exclusive.
pre ingest-decision-listings --start 2024 --end 2025
```

These commands create derived SQLite databases. They do not edit the decision,
statute, or codification repositories.

## Important classification rule

The word `Opinion` is not classified without knowing the document's role:

- a ponencia headed `Opinion` is a `Decision`;
- a separate opinion headed `Opinion` is a `Separate Opinion`; and
- an unqualified `Opinion` with no reliable role remains unclassified.

Explicit `Concurring Opinion`, `Dissenting Opinion`, and `Separate Opinion`
labels are always treated as separate opinions. `Kapasyahan` is treated as a
resolution, while the observed defective label `Ecision` is treated as a
decision.

## Command outcomes

| Exit code | Meaning |
| ---: | --- |
| `0` | Clean completion, or reviewed policy explicitly allowed quarantine |
| `1` | System failure or an incomplete monthly retrieval |
| `2` | Invalid command usage |
| `3` | Processing completed, but one or more records were quarantined |

`--allow-quarantine` changes only code `3` to `0`. It cannot hide a failed or
incomplete run.

Start with the [documentation overview](docs/index.md). The
[evidence and review guide](docs/evidence-review.md) explains what the database
can establish—and what it cannot establish—before the data is relied upon in
legal work. See [Releases](docs/releases.md) for the version-by-version change
boundary and migration examples.
