Aaron Thomas Mathew commited on
Commit
32c748a
·
verified ·
1 Parent(s): 0ad1c0c

Upload data-dictionary.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. data-dictionary.md +402 -0
data-dictionary.md ADDED
@@ -0,0 +1,402 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Project Data Dictionary & Processing Guide
2
+
3
+ ## Overview
4
+ This document describes all datasets for the **Global Commodity Shocks & Production Networks** project. Each team member should process their assigned datasets following the specifications below.
5
+
6
+ ---
7
+
8
+ ## 1. COMMODITY PRICES DATA
9
+
10
+ ### **File:** `CMO-Historical-Data-Monthly.xlsx`
11
+ **Location:** `data/raw/commodity_prices/`
12
+ **Source:** World Bank Pink Sheet
13
+ **Coverage:** Monthly, 1960-2024
14
+
15
+ #### **What It Contains:**
16
+ - **Sheet 1 - Monthly Prices:** Nominal prices (USD) for 70+ commodities
17
+ - Energy: Crude oil (Brent, WTI, Dubai), Natural gas, Coal
18
+ - Agriculture: Wheat, Rice, Maize, Soybeans, Sugar, Coffee
19
+ - Metals: Copper, Aluminum, Iron ore, Gold, Silver
20
+
21
+ - **Sheet 2 - Monthly Indices:** Price indices (2010=100 base year)
22
+ - Aggregate indices by commodity group
23
+ - Useful for comparing relative price movements
24
+
25
+ - **Sheet 3 - Index Weights:** Weights used in index construction
26
+
27
+ #### **Why We Need It:**
28
+ This is our **primary shock variable**. Oil price spikes, wheat price volatility, and metal price crashes are the "shocks" we're studying. Changes in these prices affect India's production network.
29
+
30
+ #### **Processing Tasks:**
31
+ 1. Extract columns: Date, Crude oil (average), Wheat (US HRW), Rice (Thai 5%), Copper, Aluminum
32
+ 2. Filter to 2010-2024 only
33
+ 3. Calculate log returns: `log(Price_t / Price_{t-1})`
34
+ 4. Calculate rolling volatility (3, 6, 12-month windows)
35
+ 5. Create shock indicators: binary variable = 1 if price change > 2 standard deviations
36
+ 6. Save as: `data/processed/commodity_prices_clean.csv`
37
+
38
+ #### **Expected Output Columns:**
39
+ ```
40
+ date, oil_price, wheat_price, rice_price, copper_price, aluminum_price,
41
+ oil_return, wheat_return, rice_return, copper_return, aluminum_return,
42
+ oil_volatility_3m, oil_volatility_6m, oil_volatility_12m,
43
+ oil_shock_binary, wheat_shock_binary, etc.
44
+ ```
45
+
46
+ ---
47
+
48
+ ## 2. CLIMATE DATA (INSTRUMENTAL VARIABLE)
49
+
50
+ ### **File:** `Monthly Oceanic Nino Index (ONI) - Wide.csv`
51
+ **Location:** `data/raw/climate/`
52
+ **Source:** NOAA Climate Prediction Center
53
+ **Coverage:** Monthly, 1950-2024
54
+
55
+ #### **What It Contains:**
56
+ - **Oceanic Niño Index (ONI):** 3-month running mean of sea surface temperature anomalies in the Niño 3.4 region
57
+ - Values range from -2.5°C (strong La Niña) to +2.5°C (strong El Niño)
58
+
59
+ #### **Why We Need It:**
60
+ El Niño/La Niña events affect global weather patterns → agricultural production → wheat/rice prices. We use ONI as an **instrumental variable** (IV) for agricultural commodity prices because:
61
+ - ONI affects crop yields (relevant)
62
+ - ONI doesn't directly affect Indian manufacturing output (excludable)
63
+ - This helps us establish **causal** relationships, not just correlations
64
+
65
+ #### **Processing Tasks:**
66
+ 1. Filter to 2010-2024
67
+ 2. Classify ENSO phases:
68
+ - El Niño: ONI ≥ 0.5
69
+ - La Niña: ONI ≤ -0.5
70
+ - Neutral: -0.5 < ONI < 0.5
71
+ 3. Create lag variables (1, 3, 6 months) - weather affects crops with delay
72
+ 4. Save as: `data/processed/climate_oni_clean.csv`
73
+
74
+ #### **Expected Output Columns:**
75
+ ```
76
+ date, oni_index, enso_phase, oni_lag1, oni_lag3, oni_lag6
77
+ ```
78
+
79
+ ---
80
+
81
+ ## 3. TRADE DATA
82
+
83
+ ### **File:** `dataset_2025-10-22T07_56_33...csv` (3 GB!)
84
+ **Location:** `data/raw/trade/`
85
+ **Source:** IMF International Merchandise Trade Statistics (IMTS)
86
+ **Coverage:** Monthly bilateral trade flows, all countries, 2000-2024
87
+
88
+ #### **What It Contains:**
89
+ - **Bilateral trade flows:** Country A → Country B, by product category
90
+ - **Trade values:** Imports/Exports in USD
91
+ - **Product codes:** HS classification (Harmonized System)
92
+
93
+ #### **Why We Need It:**
94
+ Measures India's trade exposure to different countries and commodities. High dependence on Gulf states for oil = high vulnerability to oil shocks.
95
+
96
+ #### **Processing Tasks:**
97
+ 1. **Filter to India only:** Reporter = India
98
+ 2. **Select 8 key partners:** USA, China, Saudi Arabia, UAE, Qatar, Germany, France, Italy
99
+ 3. **Aggregate by commodity group:**
100
+ - Energy (HS 27): Mineral fuels, oils
101
+ - Food (HS 10, 11): Cereals, grain products
102
+ - Metals (HS 74, 76): Copper, Aluminum
103
+ 4. Calculate trade concentration metrics:
104
+ - **HHI (Herfindahl Index):** Sum of squared trade shares
105
+ - Partner diversification score
106
+ 5. Save as: `data/processed/trade_india_bilateral.csv`
107
+
108
+ #### **Expected Output Columns:**
109
+ ```
110
+ date, partner_country, commodity_group,
111
+ import_value_usd, export_value_usd, trade_balance,
112
+ import_share, export_share
113
+ ```
114
+
115
+ #### **Warning:** This file is HUGE (3GB). Use `pd.read_csv(chunksize=100000)` or filter early with SQL/Dask.
116
+
117
+ ---
118
+
119
+ ### **File:** `WITS-Partner.xlsx`
120
+ **Location:** `data/raw/trade/`
121
+ **Source:** World Bank WITS (World Integrated Trade Solution)
122
+ **Coverage:** Annual trade data with partner country details
123
+
124
+ #### **What It Contains:**
125
+ - Country names, ISO codes, regional classifications
126
+ - Use as a lookup table to map country codes → country names
127
+
128
+ #### **Processing Tasks:**
129
+ 1. Extract mapping: ISO3 code → Country name → Region
130
+ 2. Merge with IMF trade data
131
+ 3. Save as: `data/processed/country_mapping.csv`
132
+
133
+ ---
134
+
135
+ ## 4. MACROECONOMIC DATA
136
+
137
+ ### **File:** `Index of Industrial Production.xlsx`
138
+ **Location:** `data/raw/macroeconomic/`
139
+ **Source:** Reserve Bank of India (RBI)
140
+ **Coverage:** Monthly, 2010-2024, Base year 2011-12
141
+
142
+ #### **What It Contains:**
143
+ - **IIP General Index:** Overall industrial production
144
+ - **Sectoral Indices:**
145
+ - Mining & Quarrying
146
+ - Manufacturing (15+ sub-sectors: Food, Textiles, Chemicals, Metals, Machinery, etc.)
147
+ - Electricity
148
+ - **Use-based Classification:**
149
+ - Basic goods
150
+ - Capital goods
151
+ - Intermediate goods
152
+ - Consumer durables
153
+ - Consumer non-durables
154
+
155
+ #### **Why We Need It:**
156
+ This is our **main outcome variable**. We're predicting: "When oil prices spike, which manufacturing sectors see production decline?" IIP measures exactly that.
157
+
158
+ #### **Processing Tasks:**
159
+ 1. Extract all sectoral indices (rows) across time (columns)
160
+ 2. Convert from wide to long format:
161
+ ```
162
+ date | sector | iip_value
163
+ ```
164
+ 3. Calculate month-over-month growth rates
165
+ 4. Calculate year-over-year growth rates
166
+ 5. Identify energy-intensive sectors (Manufacturing - Chemicals, Basic Metals, etc.)
167
+ 6. Save as: `data/processed/iip_sectoral.csv`
168
+
169
+ #### **Expected Output Columns:**
170
+ ```
171
+ date, sector_name, iip_index,
172
+ iip_mom_growth, iip_yoy_growth,
173
+ is_energy_intensive
174
+ ```
175
+
176
+ ---
177
+
178
+ ### **File:** `Wholesale Price Index - Monthly Data.xlsx`
179
+ **Location:** `data/raw/macroeconomic/`
180
+ **Source:** Office of Economic Adviser, India
181
+ **Coverage:** Monthly, 2010-2024
182
+
183
+ #### **What It Contains:**
184
+ - WPI for different product categories
185
+ - Inflation measure at wholesale level (before goods reach consumers)
186
+
187
+ #### **Why We Need It:**
188
+ Commodity price shocks → input cost inflation → affects production decisions. WPI captures cost pressures on manufacturers.
189
+
190
+ #### **Processing Tasks:**
191
+ 1. Extract WPI for: Fuel & Power, Manufactured Products, Food Articles
192
+ 2. Calculate inflation rate: `(WPI_t - WPI_{t-12}) / WPI_{t-12} * 100`
193
+ 3. Save as: `data/processed/wpi_inflation.csv`
194
+
195
+ ---
196
+
197
+ ### **Files:** GDP Quarterly Estimates (3 files)
198
+ **Location:** `data/raw/macroeconomic/`
199
+ **Source:** MOSPI National Accounts Statistics
200
+
201
+ #### **What They Contain:**
202
+ - Quarterly GDP at constant prices (real GDP)
203
+ - Quarterly GDP at current prices (nominal GDP)
204
+ - Quarterly GVA (Gross Value Added) by sector
205
+
206
+ #### **Why We Need It:**
207
+ Control variables for macroeconomic conditions. GDP growth affects all sectors simultaneously.
208
+
209
+ #### **Processing Tasks:**
210
+ 1. Merge all three files
211
+ 2. Calculate GDP growth rate (YoY)
212
+ 3. Resample to monthly frequency (forward-fill)
213
+ 4. Save as: `data/processed/gdp_quarterly.csv`
214
+
215
+ ---
216
+
217
+ ### **Files:** OECD Data (2 CSV files)
218
+ **Location:** `data/raw/macroeconomic/`
219
+ **Source:** OECD Data Explorer
220
+
221
+ #### **What They Contain:**
222
+ - **File 1:** G20 GDP growth rates (quarterly)
223
+ - **File 2:** G20 price indices (monthly)
224
+
225
+ #### **Why We Need It:**
226
+ Global economic conditions affect India through trade channels. US/China/EU slowdowns reduce demand for Indian exports.
227
+
228
+ #### **Processing Tasks:**
229
+ 1. Extract data for: USA, China, Germany, France, Italy (India's trade partners)
230
+ 2. Calculate average G20 GDP growth
231
+ 3. Merge with India data
232
+ 4. Save as: `data/processed/global_macro.csv`
233
+
234
+ ---
235
+
236
+ ## 5. INPUT-OUTPUT TABLE
237
+
238
+ ### **File:** `Input-Output-Transactions-Table-India-2015-16.pdf`
239
+ **Location:** `data/raw/input_output/`
240
+ **Source:** MOSPI (Ministry of Statistics, India)
241
+ **Coverage:** 139 sectors, year 2015-16
242
+
243
+ #### **What It Contains:**
244
+ - **Use Table:** Shows which sectors use inputs from which other sectors
245
+ - Rows = industries producing inputs
246
+ - Columns = industries using inputs
247
+ - Cell (i,j) = Sector j buys inputs worth ₹X from sector i
248
+
249
+ - **Make Table:** Shows which sectors produce which outputs
250
+ - Rows = industries
251
+ - Columns = products
252
+ - Cell (i,j) = Sector i produces ₹X worth of product j
253
+
254
+ #### **Why We Need It:**
255
+ This is the **CORE** of the project. The I-O table shows the **production network**:
256
+ - Oil refining → Chemicals → Plastics → Manufacturing
257
+ - If oil prices spike → refining costs up → chemicals cost up → plastics cost up → manufacturing slows
258
+
259
+ We model these cascading effects through the network structure.
260
+
261
+ #### **Processing Tasks:**
262
+ **WARNING:** This is a PDF with large tables. Need careful extraction.
263
+
264
+ 1. **Extract Use Table:**
265
+ - Use Tabula or pdfplumber to extract tables
266
+ - Create 139×139 matrix: `A[i,j]` = input from sector i to sector j
267
+
268
+ 2. **Calculate Technical Coefficients:**
269
+ - `a[i,j] = A[i,j] / X[j]` where X[j] = total output of sector j
270
+ - This gives "input per unit of output"
271
+
272
+ 3. **Calculate Leontief Inverse:**
273
+ - `L = (I - a)^(-1)` where I is identity matrix
274
+ - L[i,j] = total output from sector i needed to produce 1 unit of final demand in sector j
275
+ - This captures **direct + indirect** linkages
276
+
277
+ 4. **Calculate Forward & Backward Linkages:**
278
+ - Backward linkage = sum of column in L matrix (how much sector j pulls from others)
279
+ - Forward linkage = sum of row in L matrix (how much sector i pushes to others)
280
+
281
+ 5. **Build Network Graph:**
282
+ - Nodes = 139 sectors
283
+ - Edge (i→j) with weight = a[i,j] (technical coefficient)
284
+ - Save edge list as: `data/processed/production_network_edges.csv`
285
+ - Save node attributes as: `data/processed/production_network_nodes.csv`
286
+
287
+ #### **Expected Outputs:**
288
+ ```
289
+ production_network_edges.csv:
290
+ source_sector, target_sector, input_coefficient, input_value
291
+
292
+ production_network_nodes.csv:
293
+ sector_id, sector_name,
294
+ backward_linkage, forward_linkage,
295
+ total_output, is_key_sector
296
+ ```
297
+
298
+ ---
299
+
300
+ ## 6. NETWORK METRICS TO CALCULATE
301
+
302
+ Once production network is built, calculate these for each sector:
303
+
304
+ ### **Centrality Measures:**
305
+ 1. **Degree Centrality:**
306
+ - In-degree: How many sectors provide inputs to this sector
307
+ - Out-degree: How many sectors does this sector supply to
308
+
309
+ 2. **Betweenness Centrality:**
310
+ - How often this sector lies on shortest paths between other sectors
311
+ - High betweenness = bottleneck sector (e.g., electricity, transport)
312
+
313
+ 3. **Closeness Centrality:**
314
+ - Average distance to all other sectors
315
+ - High closeness = well-connected, quickly affected by shocks
316
+
317
+ 4. **Eigenvector Centrality:**
318
+ - Importance based on importance of neighbors
319
+ - High eigenvector = connected to other important sectors
320
+
321
+ 5. **PageRank:**
322
+ - Google's algorithm applied to production network
323
+ - Measures "influence" in the network
324
+
325
+ ### **Network Topology:**
326
+ 1. **Clustering Coefficient:** How interconnected are neighbors
327
+ 2. **Path Length:** Average steps between any two sectors
328
+ 3. **Network Density:** % of possible connections that exist
329
+ 4. **Community Detection:** Groups of tightly connected sectors
330
+
331
+ **Save as:** `data/processed/network_metrics.csv`
332
+
333
+ ---
334
+
335
+ ## SUMMARY: TEAM TASK ASSIGNMENTS
336
+
337
+ ### **Person 1: Commodity Prices + Climate**
338
+ - Process CMO commodity prices
339
+ - Process NOAA ONI climate data
340
+ - Create shock indicators
341
+ - **Deliverable:** `commodity_prices_clean.csv`, `climate_oni_clean.csv`
342
+
343
+ ### **Person 2: Trade Data**
344
+ - Process IMF IMTS (3GB file - use chunking!)
345
+ - Calculate trade concentration indices
346
+ - Merge with country mapping
347
+ - **Deliverable:** `trade_india_bilateral.csv`, `trade_concentration.csv`
348
+
349
+ ### **Person 3: Macroeconomic Data**
350
+ - Process IIP (most important!)
351
+ - Process WPI, CPI, GDP files
352
+ - Merge OECD global data
353
+ - **Deliverable:** `iip_sectoral.csv`, `macro_controls.csv`
354
+
355
+ ### **Person 4: Input-Output Table + Network**
356
+ - Extract I-O table from PDF (hardest task!)
357
+ - Build production network
358
+ - Calculate Leontief inverse
359
+ - Calculate all network metrics
360
+ - **Deliverable:** `production_network_edges.csv`, `production_network_nodes.csv`, `network_metrics.csv`
361
+
362
+ ---
363
+
364
+ ## FINAL MERGED DATASET
365
+
366
+ Once all processing is complete, merge into master dataset:
367
+
368
+ **File:** `data/processed/master_dataset.csv`
369
+
370
+ **Structure:**
371
+ ```
372
+ date, sector_name,
373
+ oil_price, wheat_price, copper_price, aluminum_price,
374
+ oil_shock, wheat_shock,
375
+ oni_index, enso_phase,
376
+ import_value, export_value, trade_hhi,
377
+ iip_index, iip_growth,
378
+ wpi_inflation, gdp_growth,
379
+ degree_centrality, betweenness_centrality, eigenvector_centrality,
380
+ backward_linkage, forward_linkage,
381
+ is_energy_intensive, is_key_sector
382
+ ```
383
+
384
+ **Dimensions:** ~180 months × 139 sectors × 30+ features = ~750,000 rows
385
+
386
+ This master dataset feeds into:
387
+ - Causal analysis (IV, SCM, VAR)
388
+ - ML models (LSTM, XGBoost, GNN)
389
+ - Scenario simulations
390
+ - Vulnerability index
391
+
392
+ ---
393
+
394
+ ## QUESTIONS?
395
+
396
+ Contact project lead if:
397
+ - Files don't match descriptions above
398
+ - Data extraction fails (especially I-O PDF)
399
+ - Need clarification on calculations
400
+ - Encounter missing data / data quality issues
401
+
402
+ **Target completion:** End of Week 1 (Day 5)