File size: 10,492 Bytes
869b355
092651d
869b355
9a85c43
869b355
9a85c43
 
 
 
 
 
869b355
 
9a85c43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
869b355
 
 
 
 
 
 
 
 
 
 
 
 
 
971638e
869b355
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9a85c43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
869b355
 
 
 
 
 
 
 
 
 
 
9a85c43
869b355
 
 
 
 
 
 
 
 
 
 
 
 
 
9a85c43
 
 
 
869b355
 
 
9a85c43
 
 
 
 
 
 
 
 
869b355
 
 
 
 
 
 
 
 
 
 
 
9a85c43
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
---
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](#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](#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)

```python
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)

```python
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:**

```python
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:**

```python
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](https://www.wto.org/english/tratop_e/dispu_e/dispu_e.htm) 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).