Datasets:
id stringlengths 1 36 | content_html stringlengths 58 15.4M |
|---|---|
132934 | <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document Content</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; line-height: 1.6; }
p { margin: 10px 0; }
</style>
</head>
<body>
<... |
131249 | <html>
<head></head>
<body>
<div>
<div style="width: 100%; font-family: 'Times New Roman', serif; font-size: 14px; color: #000;">
<div style="width: 100%; display: table; table-layout: fixed;">
<div style="display: table-cell; width: 50%; text-align: center; vertical-align: top; font-weight: bold; text-... |
130974 | <html>
<head></head>
<body>
<table border="0" style="width: 100%; border-collapse: collapse; table-layout: fixed; margin-top: 20px; border: none;">
<tbody>
<tr>
<td style="vertical-align: top; text-align: center; border: none; padding: 5px; font-family: 'Times New Roman', serif;">
<p><strong>ỦY BA... |
134516 | "<html>\n <head></head>\n <body>\n <div>\n <div style=\"width: 100%; font-family: 'Times New Roma(...TRUNCATED) |
129591 | "<!DOCTYPE html>\n<html>\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=(...TRUNCATED) |
135288 | "<html>\n <head></head>\n <body>\n <div>\n <div style=\"width: 100%; font-family: 'Times New Roma(...TRUNCATED) |
131203 | "<html>\n <head></head>\n <body>\n <table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"(...TRUNCATED) |
135139 | <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
</body>
</html> |
133310 | "<html>\n <head></head>\n <body>\n <table border=\"1\" style=\"border-collapse: collapse; width: 10(...TRUNCATED) |
129509 | "<!DOCTYPE html>\n<html>\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=(...TRUNCATED) |
Vietnamese Legal Documents
A comprehensive collection of Vietnamese legal documents — laws, decrees, circulars, decisions, and other normative acts — sourced from vbpl.vn, the official Government Legal Document Portal operated by the Ministry of Justice. The dataset includes structured metadata for every document, raw HTML full-text content, and a rich graph of cross-document legal relationships (amendments, citations, repeals, etc.).
2026 Portal Refresh
This release migrates the active configs to the current VBPL Next.js catalog and public JSON gateway. It adds UUID and portal-prefixed records, removes duplicate content rows, refreshes document text and relationships, and retains records that disappeared from the live catalog as historical rows.
Migration note: metadata.id, content.id, relationships.doc_id, and
relationships.other_doc_id are now strings. Consumers that previously joined
on integer IDs must cast their keys to string before upgrading. The former
mixed-schema legacy config is now exposed as the loadable legacy_metadata
and legacy_content configs.
See CHANGELOG.md for the complete release summary.
Quick Start
from datasets import load_dataset
# Metadata for 171k documents
meta = load_dataset("th1nhng0/vietnamese-legal-documents", "metadata", split="data")
print(meta.to_pandas().head())
# Cross-document relationships (amendments, citations, repeals, …)
rels = load_dataset("th1nhng0/vietnamese-legal-documents", "relationships", split="data")
print(rels.to_pandas().head())
# Full-text HTML content for 170k documents
content = load_dataset("th1nhng0/vietnamese-legal-documents", "content", split="data")
print(content.to_pandas().head())
Join the two on id (metadata) ↔ doc_id (relationships):
import pandas as pd
df = meta.to_pandas()
rel = rels.to_pandas()
# Find all documents that cite document 10420
citing = rel[rel["other_doc_id"] == "10420"].merge(df, left_on="doc_id", right_on="id")
print(citing[["id", "title", "relationship"]])
Dataset Structure
The dataset has five configs:
| Config | Split | Rows | Description |
|---|---|---|---|
metadata |
data |
171,556 | One row per document — 17 metadata fields |
content |
data |
170,824 | One unique raw HTML body per document |
relationships |
data |
1,033,255 | Unique directed edges between documents |
legacy_metadata |
metadata |
518,601 | Older crawl — English field names, more docs |
legacy_content |
content |
518,235 | Plain-text content for older crawl |
metadata
| Column | Description |
|---|---|
id |
Unique document ID (string; numeric, UUID, or portal-prefixed) |
title |
Full Vietnamese title |
so_ky_hieu |
Official number, e.g. 115/NQ-HĐBCQG |
ngay_ban_hanh |
Issuance date (DD/MM/YYYY) |
loai_van_ban |
Type — Quyết định, Nghị quyết, Thông tư, … |
ngay_co_hieu_luc |
Effective date |
ngay_het_hieu_luc |
Expiry date (empty if still in effect) |
nguon_thu_thap |
Collection source (e.g. Công báo) |
ngay_dang_cong_bao |
Official Gazette publication date |
nganh |
Sector — Tài chính, Y tế, … |
linh_vuc |
Legal field / sub-domain |
co_quan_ban_hanh |
Issuing authority (551 unique bodies) |
chuc_danh |
Signatory title — Chủ tịch, Bộ trưởng, … |
nguoi_ky |
Signatory name |
pham_vi |
Geographical scope |
thong_tin_ap_dung |
Implementation note |
tinh_trang_hieu_luc |
Effect status — Còn hiệu lực, Hết hiệu lực toàn bộ, … |
content
| Column | Description |
|---|---|
id |
Document ID (join key → metadata.id) |
content_html |
Raw HTML body of the document |
Note: 732 metadata rows do not have a corresponding
contentrow. The portal does not expose an HTML body for those records (some are PDF-only).
relationships
| Column | Description |
|---|---|
doc_id |
Source document ID (join key → metadata.id) |
other_doc_id |
Target document ID |
relationship |
Edge label from the current portal; archived old-only pairs retain their historical label |
Every doc_id is present in metadata. Relationship targets may reference
documents outside the live catalog; 17,706 distinct other_doc_id values do
not have a metadata row in this snapshot.
Legacy configs
An older, larger crawl snapshot with ~518 k documents. Field names and enumerated values are in English (unlike the current configs which use Vietnamese originals). Dates are YYYY-MM-DD. Use this config when you need broader coverage at the cost of reduced metadata richness.
legacy / metadata split (518,601 rows):
| Column | Description |
|---|---|
id |
Unique document ID (int) |
document_number |
Official number, e.g. 115/NQ-HĐBCQG |
title |
Full Vietnamese title |
legal_type |
Document type in English — Resolution, Decision, Circular, … |
legal_sectors |
Sector in English — Finance, Education, … |
issuing_authority |
Issuing authority (Vietnamese name) |
issuance_date |
Issuance date (YYYY-MM-DD) |
effect_date |
Effective date (YYYY-MM-DD) |
effectless_date |
Expiry date (empty if still in effect) |
effect_status |
In effect or Not in effect |
signers |
Signatory name and ID, e.g. Trần Thanh Mẫn:2140 |
legacy / content split (518,235 rows):
| Column | Description |
|---|---|
id |
Document ID (join key → legacy/metadata.id) |
content |
Plain-text body of the document |
Note: The
contentcolumn inlegacycontains plain text, not HTML. The currentcontentconfig stores raw HTML (content_html).
from datasets import load_dataset
legacy_meta = load_dataset("th1nhng0/vietnamese-legal-documents", "legacy_metadata", split="metadata")
legacy_content = load_dataset("th1nhng0/vietnamese-legal-documents", "legacy_content", split="content")
Data Collection
All data was scraped from vbpl.vn using the Scrapy crawler under crawler/. The single vbpl spider targets the current Next.js catalog and public JSON detail gateway, collecting metadata, HTML content, signers, fields, and relationships in one pass. IDs are strings because the migrated portal uses numeric IDs, UUIDs, and prefixed identifiers.
The current files were refreshed on 2026-07-23. Refresh rows are authoritative for overlapping IDs; missing refresh fields are filled from the prior dataset, and records no longer exposed by the live catalog are retained as historical rows.
For local rollback, the immediately preceding files are preserved under the
Git-ignored data/archive_pre_refresh_2026-07-23/ directory.
cd crawler
uv sync --extra validation
uv run scrapy crawl vbpl -a seed_file=data/ids.txt
uv run scrapy crawl vbpl -a seed_file=data/ids.txt -a proxy_file=proxies.txt
uv run scrapy crawl vbpl -a seed_file=data/ids.txt -a resume=1 -a resume_from=../data/metadata_raw.jsonl
# Crawl the complete catalog. This one pass includes metadata, relationships,
# and full-text HTML.
uv run scrapy crawl vbpl -a full=1 -a output=../data/metadata_raw.jsonl
# Safely continue an interrupted full crawl.
uv run scrapy crawl vbpl -a full=1 -a resume=1 -a resume_from=../data/metadata_raw.jsonl -a output=../data/metadata_raw.jsonl
# Stream the combined crawl into separate, versioned Parquet files.
uv run python build_full_dataset.py ../data/metadata_raw.jsonl ../data/refresh_YYYY-MM-DD
# Upsert a verified refresh into a staging directory. Refresh values win,
# missing values are recovered from the current data, and old-only rows remain.
uv run python upsert_dataset.py ../data/refresh_YYYY-MM-DD ../data/upsert_YYYY-MM-DD
# Validate card metadata, Parquet schemas/counts, uniqueness, and join integrity.
uv run --extra validation python validate_release.py ..
Both processing commands refuse to overwrite their output directory. Validate
the staged Parquet files before promoting them into data/.
Limitations
- Coverage depends on what vbpl.vn has indexed; older or undigitized documents may be missing.
- The live catalog can change during a long crawl. Use
-a resume=1for a final catalog-only verification pass; zero newly scraped items means every currently listed ID is already present. - Effect status reflects the portal at crawl time and may lag behind real-world changes.
- This is a snapshot, not a live mirror. Always cross-check with the portal for authoritative status.
Privacy
The dataset contains names of document signatories (public officials acting in their official capacity). No private citizen data is included.
Citation
@dataset{ngo_thinh_2026_vietnamese_legal,
title = {Vietnamese Legal Documents},
author = {Thịnh Ngô},
year = {2026},
publisher = {Hugging Face},
url = {https://huggingface.co/datasets/th1nhng0/vietnamese-legal-documents},
}
License
Vietnamese legal documents are public domain under the Law on Access to Information (No. 104/2016/QH13) and the Law on Promulgation of Legal Documents (No. 64/2025/QH15).
The compiled dataset (schema, processing, curation) is released under CC BY 4.0. Not a substitute for legal advice.
- Downloads last month
- 2,462