gov-library / README.md
jasontorres's picture
Update README.md
32ab965 verified
# Philippine Legal Documents Dataset
A comprehensive collection of Philippine legal documents from Lawphil.net, extracted from HTML to Markdown and organized for easy querying.
## Overview
This dataset contains **114,340** legal documents spanning from 1900 to 2025, including:
- **Jurisprudence** (68,080 documents) - Supreme Court decisions
- **Statutes** (19,793 documents) - Republic Acts, Commonwealth Acts, Presidential Decrees, etc.
- **Executive Issuances** (26,458 documents) - Administrative Orders, Executive Orders, Memorandum Orders, etc.
- **Constitutions** (9 documents) - Philippine constitutions from different periods
## Categories
| Category | Description | Sources |
|----------|-------------|---------|
| `juris` | Supreme Court decisions and jurisprudence | `juris` |
| `statutes` | Legislative acts and statutes | `acts`, `repacts`, `comacts`, `bataspam`, `presdecs` |
| `executive` | Executive issuances and orders | `ao`, `execord`, `mo`, `mc`, `proc`, `genor` |
| `consti` | Philippine constitutions | `consti` |
### Source Details
| Source | Description | Years | Count |
|--------|-------------|-------|-------|
| `juris` | Jurisprudence / Supreme Court decisions | 1901-2025 | 68,080 |
| `acts` | Acts of the Philippine Commission/Assembly | 1900-1935 | 4,257 |
| `repacts` | Republic Acts | 1946-2025 | 12,071 |
| `comacts` | Commonwealth Acts | 1935-1946 | 733 |
| `bataspam` | Batas Pambansa | 1978-1994 | 887 |
| `presdecs` | Presidential Decrees | 1972-1986 | 1,845 |
| `ao` | Administrative Orders | 1936-2025 | 2,811 |
| `execord` | Executive Orders | 1900s-2020s | 5,750 |
| `mo` | Memorandum Orders | 1900s-2020s | 2,401 |
| `mc` | Memorandum Circulars | 1900s-2020s | 2,220 |
| `proc` | Proclamations | 1901-2020s | 13,195 |
| `genor` | General Orders | 81 | |
| `consti` | Constitutions | 1902, 1916, 1935, 1943, 1973, 1986, 1987 | 9 |
## Usage
### Loading the Dataset
```python
import pandas as pd
# Load the consolidated dataset
df = pd.read_parquet("lawphil_consolidated.parquet")
print(f"Total documents: {len(df):,}")
print(f"Columns: {df.columns.tolist()}")
```
### Filtering by Category
```python
# Get all statutes
statutes = df[df['category'] == 'statutes']
# Get all jurisprudence
jurisprudence = df[df['category'] == 'juris']
# Get all executive issuances
executive = df[df['category'] == 'executive']
```
### Filtering by Source
```python
# Get only Republic Acts
ra = df[df['source'] == 'repacts']
# Get only Executive Orders
eo = df[df['source'] == 'execord']
# Get only Administrative Orders
ao = df[df['source'] == 'ao']
```
### Filtering by Year
```python
# Get documents from a specific year
docs_2020 = df[df['year'] == 2020]
# Get documents from a date range
docs_2000s = df[(df['year'] >= 2000) & (df['year'] < 2010)]
```
### Reading Document Content
```python
# Get a specific document
doc = df.iloc[0]
print(f"Title: {doc['title']}")
print(f"Source: {doc['source']}")
print(f"Year: {doc['year']}")
print(f"Path: {doc['path']}")
print(f"\nContent:\n{doc['content'][:500]}...")
```
### Searching by Keyword
```python
# Search in titles
results = df[df['title'].str.contains('labor', case=False, na=False)]
# Search in content
results = df[df['content'].str.contains('corruption', case=False, na=False)]
```
## Schema
| Column | Type | Description |
|--------|------|-------------|
| `id` | string | Unique identifier (format: `{source}:{path}`) |
| `source` | string | Document source (e.g., `repacts`, `execord`, `juris`) |
| `category` | string | High-level category (`juris`, `statutes`, `executive`, `consti`) |
| `year` | int | Year of the document |
| `month` | int | Month of the document (for jurisprudence only) |
| `path` | string | File path relative to project root |
| `basename` | string | Filename without extension |
| `title` | string | Document title extracted from content |
| `content` | string | Full markdown content |
## Statistics
- **Total Documents:** 115,340
- **Date Range:** 1901-2025
- **File Size:** 753 MB (consolidated parquet)
- **Sources:** 14 different legal document types
## Data Source
Documents were originally sourced from [Lawphil.net](https://lawphil.net), a project of the Arellano Law Foundation.
## License
The original documents from Lawphil.net are licensed under Creative Commons Attribution-NonCommercial 4.0.