WTO_Docs / README.md
dean22029's picture
Update
971638e verified
metadata
license: mit
language:
  - en
tags:
  - wto
  - trade
  - legal
  - dispute-settlement
  - international-law
  - rag
pretty_name: WTO Dispute Settlement Body Documents
size_categories:
  - 10K<n<100K
configs:
  - config_name: default
    data_files:
      - split: train
        path: wto_documents_full.jsonl
dataset_info:
  features:
    - name: folder_number
      dtype: string
    - name: case_number
      dtype: string
    - name: original_filename
      dtype: string
    - name: new_filename
      dtype: string
    - name: doc_sequence
      dtype: int32
    - name: doc_type
      dtype: string
    - name: doc_type_raw
      dtype: string
    - name: doc_class
      dtype: string
    - name: variant
      dtype: string
    - name: part_number
      dtype: int32
    - name: case_title
      dtype: string
    - name: date
      dtype: string
    - name: header_codes
      dtype: string
    - name: agreement_indicators
      dtype: string
    - name: complainant
      dtype: string
    - name: respondent
      dtype: string
    - name: third_parties
      dtype: string
    - name: dispute_stage
      dtype: string
    - name: agreements_cited
      dtype: string
    - name: case_summary
      dtype: string
    - name: page_count
      dtype: int32
    - name: clean_text
      dtype: string
    - name: processing_date
      dtype: string
  splits:
    - name: train
      num_examples: 9414

WTO Dispute Settlement Body Documents

Full-text corpus of official WTO Dispute Settlement Body (DSB) documents spanning DS1–DS626, covering January 1995 through early 2026. Sourced from the WTO's public case repository and processed into structured records for retrieval-augmented generation (RAG) and NLP research.

Coverage

Stat Value
Total records 9,414
Unique cases 626 (DS1–DS626)
Date coverage ~95.5% of records
Document types 42 distinct types
Languages processed English
Source WTO Dispute Settlement Gateway

Data Structure

Each line in wto_documents_full.jsonl is a JSON object with the following fields:

Case-level fields (repeated per document within a case)

Field Type Description
folder_number string Source folder number (matches case number in most cases)
case_number string WTO DS case number (e.g. "267" for DS267)
case_title string Official WTO case title in uppercase (e.g. "EC - MEASURES CONCERNING MEAT AND MEAT PRODUCTS")
complainant string JSON-encoded list of complainant country names
respondent string JSON-encoded list of respondent country names
third_parties string JSON-encoded list of third-party country names
dispute_stage string Furthest procedural stage reached (see Dispute Stages)
agreements_cited string WTO agreement articles at issue (raw text from case page)
case_summary string Official WTO case summary (scraped from the WTO website)

Document-level fields

Field Type Description
original_filename string Filename of the source PDF
new_filename string Standardized filename: DS{case}_SEQ{nn}_{DocType}[_Variant][_Part].pdf
doc_sequence integer Sequential document number within the case
doc_type string Consolidated document type (42 categories; see Document Types)
doc_type_raw string Raw document type string extracted from the PDF heading
doc_class string Filename class: NUMBERED, R_FILE, D_FILE, W_FILE, or CROSS_REF
variant string or null Document variant: Add, Corr, Rev, Sup, or null
part_number integer or null Part index for multi-part documents (zero-based), or null
date string or null Document date extracted from PDF heading (e.g. "14 July 2004"); null if not found
header_codes string Official WTO document codes from the heading (e.g. "WT/DS267/1")
agreement_indicators string Agreement/article references found in the heading area
page_count integer Number of pages in the source PDF
clean_text string Full document text cleaned for embedding (headers, boilerplate, and footnotes removed)
processing_date string ISO 8601 timestamp of when this record was processed

Document Types

The 42 consolidated document types, with record counts:

Document Type Count Description
Communication 1,831 Official communications between parties or from the Secretariat
Request_To_Join_Consultations 1,036 Third-party requests to join ongoing consultations
Status_Report 991 Implementation status reports submitted by respondents
Addendum 958 Addenda to previously circulated documents
Report_Of_Panel 816 Panel reports (full text or interim)
Request_For_Consultations 699 Initial consultation requests filed by complainants
Request_For_Establishment_Of_Panel 541 Formal panel establishment requests
Note_By_Secretariat 538 Informational notes issued by the WTO Secretariat
Report_Of_Appellate_Body 327 Appellate Body reports
Agreement_Art_21_3 158 Article 21.3 DSU reasonable period of time determinations
Notification_Of_Appeal 158 Formal notifications of appeal to the Appellate Body
Working_Procedures 152 Panel or Appellate Body working procedures
Appellate_Body_Report_And_Panel_Report 146 Combined circulation of AB + Panel reports
Recourse 141 Recourse proceedings (Arts. 21.5, 22.2, 22.6, 22.7)
Understanding 133 Bilateral understandings and agreed solutions
Notification_Of_Mutually_Agreed_Solution 122 Formal notifications of mutually agreed solutions
Executive_Summary 101 Executive summaries of panel or AB reports
Submission 88 Party submissions (oral statements, first/second written submissions)
Request_For_Arbitration 87 Arbitration requests under DSU Articles 21.3, 22.6, or 25
Arbitration_Award 65 Awards or decisions by arbitrators
(22 additional types) ~528 Panel compositions, procedural rulings, cross-references, etc.

Dispute Stages

The dispute_stage field reflects the furthest procedural stage reached by each case:

Stage Records Description
Appellate Body 3,211 Case reached the Appellate Body
Panel 2,449 Panel established and reported; no appeal
Mutually Agreed Solution 1,597 Parties settled before or during panel proceedings
Implementation & Compliance 1,121 Post-ruling compliance proceedings (Art. 21.5)
Consultation 862 Consultations requested; case did not proceed to panel
Retaliation & Arbitration 163 Authorization to suspend concessions (Art. 22)

Text Cleaning

The clean_text field has been processed through a 10-step pipeline optimized for embedding quality:

  1. Header-area boilerplate removal (WTO cover page patterns)
  2. Document codes stripped (WT/DS..., G/...)
  3. Language markers removed (anglais/English/français)
  4. Page numbers removed
  5. Footnotes removed (underscore separators + numbered continuations)
  6. Non-English lines removed (French/Spanish detected via function-word threshold)
  7. Repeated case titles deduplicated
  8. Punctuation noise cleaned
  9. Whitespace normalized

OCR (Tesseract) was applied as a fallback for 78 scanned PDFs where PyPDF extraction yielded fewer than 50 characters.

Usage Example

With the HuggingFace datasets library (recommended)

from datasets import load_dataset

# Load full dataset
ds = load_dataset("dean22029/WTO_Docs")
df = ds["train"].to_pandas()

# Filter to a single case
ds267 = ds["train"].filter(lambda x: x["case_number"] == "267")

# Filter by document type
consultations = ds["train"].filter(
    lambda x: x["doc_type"] == "Request_For_Consultations"
)

# Filter by dispute stage
appellate = ds["train"].filter(
    lambda x: x["dispute_stage"] == "Appellate Body"
)

# Access a record
print(ds["train"][0]["case_number"])   # "1"
print(ds["train"][0]["doc_type"])      # "Request_For_Consultations"
print(ds["train"][0]["clean_text"][:300])

With plain Python (no dependencies)

import json

with open("wto_documents_full.jsonl") as f:
    for line in f:
        doc = json.loads(line)
        print(doc["case_number"], doc["doc_type"], doc["date"])
        print(doc["clean_text"][:300])
        break

Load all documents for a specific case:

import json

def get_case_docs(jsonl_path, case_number, doc_type=None):
    docs = []
    with open(jsonl_path) as f:
        for line in f:
            doc = json.loads(line)
            if doc["case_number"] == str(case_number):
                if doc_type is None or doc["doc_type"] == doc_type:
                    docs.append(doc)
    return docs

# All documents for DS267 (EC - Beef Hormones)
all_docs = get_case_docs("wto_documents_full.jsonl", 267)

# Consultation requests only
consultations = get_case_docs("wto_documents_full.jsonl", 267, "Request_For_Consultations")

Parse the third_parties field:

import ast

doc = json.loads(line)
third_parties = ast.literal_eval(doc["third_parties"])  # e.g. ["USA", "Canada"]

Data Source and Processing

Documents were scraped from the WTO Dispute Settlement Gateway using Selenium. PDFs were parsed with PyPDFLoader (text-based) and Tesseract OCR (scanned). Dates were extracted multilingually (English, French, Spanish) from PDF headings.

Case metadata (complainant, respondent, third parties, dispute stage, agreements cited, case summary) was scraped separately from WTO case pages and joined by case number.

Known Limitations

  • third_parties field stores Python list repr strings (e.g. "['USA', 'EU']"); parse with ast.literal_eval().
  • date is null for ~4.5% of records (mostly untitled addenda and cross-reference files).
  • Non-English documents (primarily French/Spanish originals) have reduced clean_text quality after line-level language filtering.
  • Taiwan (Chinese Taipei) has no UN ideal point data in linked panel datasets — expected, as it is not a UN member.
  • DS627+ cases exist in case metadata but have no associated PDFs in this corpus (collection cutoff: DS626).