Code-of-Virginia / README.md
dcrodriguez's picture
Update README.md
5e010aa verified
metadata
license: cc-by-4.0
dataset_info:
  features:
    - name: section_id
      dtype: string
    - name: section_number
      dtype: string
    - name: section_name
      dtype: string
    - name: section_text
      dtype: string
    - name: section_source_url
      dtype: string
    - name: chapter_id
      dtype: string
    - name: chapter_number
      dtype: string
    - name: chapter_name
      dtype: string
    - name: title_id
      dtype: string
    - name: title_number
      dtype: string
    - name: title_name
      dtype: string
    - name: jurisdiction_id
      dtype: string
    - name: jurisdiction_name
      dtype: string
  splits:
    - name: train
      num_bytes: 78649434
      num_examples: 32615
  download_size: 25142219
  dataset_size: 78649434
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/train-*
task_categories:
  - text-classification
language:
  - en
tags:
  - legal
  - rag
  - virginia
  - statutes
pretty_name: Code of Virginia
size_categories:
  - 10K<n<100K

Code of Virginia

Dataset Summary

This dataset contains 32,615 fully structured sections of the Code of Virginia, organized into titles, chapters, and individual statute sections.
Each entry contains the official section number, a short descriptive heading, the full statute text in HTML, and metadata linking to the canonical public URL.

This dataset is designed for:

  • Legal text retrieval
  • RAG (Retrieval-Augmented Generation) applications
  • Classification, summarization, and legal NLP research
  • Building structured indexes and embeddings of statutory law

Dataset Description

Contents

Each row represents one statute section, including:

  • Full section text (with HTML <p> tags, internal links, sidenotes)
  • Hierarchical metadata: title → chapter → section
  • Canonical source URLs from the Virginia Legislative Information System
  • Consistent jurisdiction and identifier metadata

Why this dataset?

The Code of Virginia is complex and deeply nested.
This dataset normalizes all hierarchy levels and provides a machine-friendly JSONL dataset ideal for:

  • Retrieval engines
  • Embedding pipelines
  • Legal QA systems
  • Agentic legal tools
  • Law-aware LLM finetuning

Languages

  • English (legal statutory domain)

Dataset Structure

Example Instance

{
  "section_id": "VA:1-1",
  "section_number": "1-1",
  "section_name": "Contents and designation of Code",
  "section_text": "<p>The laws embraced in this and the following titles, chapters, articles and sections of this act shall constitute, and be designated and cited as the \"Code of Virginia,\" hereinafter referred to as \"the Code\" or \"this Code.\"</p><p>Code 1919, § 1; R. P. 1948, § 1-1. </p><p class='sidenote'>The chapters of the acts of assembly referenced in the historical citation at the end of this section may not constitute a comprehensive list of such chapters and may exclude chapters whose provisions have expired.</p>",
  "section_source_url": "https://law.lis.virginia.gov/vacode/title1/chapter1/section1-1/",
  "chapter_id": "VA:Title-1-Chapter-1",
  "chapter_number": "1",
  "chapter_name": "CODE OF VIRGINIA",
  "title_id": "VA:Title-1",
  "title_number": "1",
  "title_name": "General Provisions",
  "jurisdiction_id": "VA",
  "jurisdiction_name": "Code of Virginia"
}

Data Creation & Processing

Source & Collection

All statutory text was collected from the Virginia Legislative Information System (LIS), which publishes the official Code of Virginia.
Collection used publicly available endpoints documented at:

API Documentation: https://law.lis.virginia.gov/developers/
Public Website: https://law.lis.virginia.gov/

Fetch Date

All data was fetched and processed in October 2025.
This represents a snapshot of the Code of Virginia as it existed on that date.

Processing Steps

  1. Programmatic extraction of all Titles → Chapters → Sections using the LIS API and HTML pages.
  2. Normalization of identifiers, including:
    • section_id (internal unique key)
    • title_id, chapter_id
    • cleaned numeric fields (section_number, etc.)
  3. Preservation of HTML inside section_text, including:
    • <p> tags
    • sidenotes
    • cross-reference hyperlinks
    • historical citations
  4. Canonical URL mapping: each section includes its LIS URL for reference.

Licensing & Data Rights

The Code of Virginia is public domain, and the statutory text is publicly accessible.
No copyrighted commentary, annotations, or proprietary publisher material is included.
No personal information, case records, or PII appear in this dataset.

Considerations for Use

Limitations

  • The dataset is a snapshot of October 2025; statutes may have changed since then.
  • section_text is stored in HTML format.
    Users may need to strip or parse tags for plain-text NLP tasks.
  • Historical notes, repealed markings, and cross-references are included and may require preprocessing depending on use case.
  • Some sections include internal hyperlinks to other LIS pages which may shift as the LIS site updates.

Ethical & Responsible AI Considerations

  • Models trained on statutes cannot substitute for legal advice.
  • Outputs may be incomplete, outdated, or misinterpreted by the model.
  • Any application built on this dataset should:
    • Provide disclaimers
    • Include human review
    • Avoid suggesting authoritative interpretations of law

Jurisdictional Scope

All text applies to the Commonwealth of Virginia only.
Do not assume applicability to other jurisdictions without verification.

How to Use

Load the Dataset

from datasets import load_dataset

ds = load_dataset("dcrodriguez/Code-of-Virginia") 
train = ds["train"]

train[0]

Citation

If you use this dataset, please cite:

Cuevas Rodriguez, Dalila. (2025). Code of Virginia.
Hugging Face Datasets.
https://huggingface.co/datasets/dcrodriguez/Code-Of-Virginia

BibTeX

@misc{cuevasrodriguez2025virginiacode,
  title        = {Code of Virginia)},
  author       = {Cuevas Rodriguez, Dalila},
  year         = {2025},
  howpublished = {\url{https://huggingface.co/datasets/dcrodriguez/Code-Of-Virginia}},
  note         = {Statutory text fetched from the Virginia Legislative Information System API, October 2025}
}