iraqdata 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- iraqdata-1.0.0/.gitignore +97 -0
- iraqdata-1.0.0/CHANGELOG.md +69 -0
- iraqdata-1.0.0/CITATION.cff +17 -0
- iraqdata-1.0.0/LICENSE +21 -0
- iraqdata-1.0.0/LICENSE-DATA +23 -0
- iraqdata-1.0.0/PKG-INFO +269 -0
- iraqdata-1.0.0/README.md +231 -0
- iraqdata-1.0.0/pyproject.toml +69 -0
- iraqdata-1.0.0/src/iraqdata/__init__.py +102 -0
- iraqdata-1.0.0/src/iraqdata/catalog.py +601 -0
- iraqdata-1.0.0/src/iraqdata/client.py +428 -0
- iraqdata-1.0.0/src/iraqdata/errors.py +40 -0
- iraqdata-1.0.0/src/iraqdata/schema.py +227 -0
- iraqdata-1.0.0/src/iraqdata/series_catalog.yaml +1648 -0
- iraqdata-1.0.0/src/iraqdata/storage.py +751 -0
- iraqdata-1.0.0/src/iraqdata/vintages.py +70 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# ==============================================================================
|
|
2
|
+
# iraqdata — Standard Python & Data Project .gitignore
|
|
3
|
+
# ==============================================================================
|
|
4
|
+
|
|
5
|
+
# Byte-compiled / optimized / DLL files
|
|
6
|
+
__pycache__/
|
|
7
|
+
*.py[cod]
|
|
8
|
+
*$py.class
|
|
9
|
+
*.so
|
|
10
|
+
*.pyd
|
|
11
|
+
|
|
12
|
+
# Distribution / packaging
|
|
13
|
+
build/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
wheels/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# Virtual environments
|
|
31
|
+
.venv/
|
|
32
|
+
venv/
|
|
33
|
+
ENV/
|
|
34
|
+
env/
|
|
35
|
+
env.bak/
|
|
36
|
+
venv.bak/
|
|
37
|
+
|
|
38
|
+
# Testing, coverage & linters
|
|
39
|
+
.pytest_cache/
|
|
40
|
+
.coverage
|
|
41
|
+
.coverage.*
|
|
42
|
+
htmlcov/
|
|
43
|
+
.tox/
|
|
44
|
+
.nox/
|
|
45
|
+
.hypothesis/
|
|
46
|
+
.mypy_cache/
|
|
47
|
+
.ruff_cache/
|
|
48
|
+
|
|
49
|
+
# Jupyter Notebook checkpoints
|
|
50
|
+
.ipynb_checkpoints
|
|
51
|
+
|
|
52
|
+
# IDEs & code editors
|
|
53
|
+
.idea/
|
|
54
|
+
.vscode/
|
|
55
|
+
*.swp
|
|
56
|
+
*.swo
|
|
57
|
+
*~
|
|
58
|
+
*.sublime-project
|
|
59
|
+
*.sublime-workspace
|
|
60
|
+
|
|
61
|
+
# Operating system files
|
|
62
|
+
.DS_Store
|
|
63
|
+
.DS_Store?
|
|
64
|
+
._*
|
|
65
|
+
.Spotlight-V100
|
|
66
|
+
.Trashes
|
|
67
|
+
ehthumbs.db
|
|
68
|
+
Thumbs.db
|
|
69
|
+
desktop.ini
|
|
70
|
+
|
|
71
|
+
# Temporary logs & local scratch files
|
|
72
|
+
scratch/
|
|
73
|
+
tmp/
|
|
74
|
+
*.log
|
|
75
|
+
*.bak
|
|
76
|
+
|
|
77
|
+
# ==============================================================================
|
|
78
|
+
# Kept on the maintainer's computer only (not published)
|
|
79
|
+
# ==============================================================================
|
|
80
|
+
# AI assistant and Spec Kit tooling, and the design specs
|
|
81
|
+
.claude/
|
|
82
|
+
.specify/
|
|
83
|
+
specs/
|
|
84
|
+
.pytest_cache/
|
|
85
|
+
|
|
86
|
+
# Merge transaction files; they exist only while a merge runs or was interrupted
|
|
87
|
+
*.parquet.new
|
|
88
|
+
*.parquet.old
|
|
89
|
+
.merge_journal.json
|
|
90
|
+
# Atomic parser output; left only by an interrupted write
|
|
91
|
+
*.parquet.part
|
|
92
|
+
|
|
93
|
+
# Internal working documents
|
|
94
|
+
docs/ground_rules.md
|
|
95
|
+
docs/establishing_monorepo_skeleton.md
|
|
96
|
+
docs/implement_client_library_interface.md
|
|
97
|
+
docs/strategic_value_and_benefits.md
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `iraqdata` are documented here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the code uses
|
|
5
|
+
[Semantic Versioning](https://semver.org/). Data releases are dated separately
|
|
6
|
+
(e.g. `data-2026-10`) and record the code version that built them.
|
|
7
|
+
|
|
8
|
+
## [1.0.0] - 2026-10-28
|
|
9
|
+
|
|
10
|
+
First release, with the data release `data-2026-10`.
|
|
11
|
+
|
|
12
|
+
### Data
|
|
13
|
+
|
|
14
|
+
- 62 series in 9 areas (money and banking, exchange rates, prices and inflation, oil, public
|
|
15
|
+
finance, GDP, balance of payments and trade, cross-border banking, development aid), in 10
|
|
16
|
+
single-frequency tables with 23,139 observations. Each table is released as a CSV and a Parquet
|
|
17
|
+
file, with `checksums.sha256`, a Frictionless `datapackage.json` and `release-assets.txt` (the
|
|
18
|
+
GitHub upload name of every file).
|
|
19
|
+
- Every value has a status flag (`A` normal, `P` provisional, `B` break, `E` estimated, `M`
|
|
20
|
+
missing, `U` low reliability), decided in one place (`pipeline/flags.py`) from each series'
|
|
21
|
+
origin and the flag policy.
|
|
22
|
+
- Every series says how each period was produced: read from an archived official file, computed
|
|
23
|
+
from other series, typed in from a publication, or from a source of unknown publisher. The list of
|
|
24
|
+
everything that was not read from an archived official file is in `docs/series.md`.
|
|
25
|
+
- `cpi_headline` and `cpi_core` link the official CPI bases into continuous series, with a break
|
|
26
|
+
flag at each base change (method and sensitivity in `docs/linked_inflation_method.md`).
|
|
27
|
+
`cpi_core` before 2010 does not measure the same thing as after; read the warning there.
|
|
28
|
+
- Every value in this release was first published on 2026-10-28, so the release has no vintage
|
|
29
|
+
history.
|
|
30
|
+
- Known limits: GDP quarters before 2020 and a few later ones are typed in from documents that are
|
|
31
|
+
not archived (flag `U`); the 2004–2023 fiscal values come from a seed of unknown publisher
|
|
32
|
+
(flag `U`); the Basrah crude price has ten typed-in months only.
|
|
33
|
+
|
|
34
|
+
### Python client
|
|
35
|
+
|
|
36
|
+
- `get_series` and `get_table` return one series or table with its date index; several
|
|
37
|
+
frequencies come back as one table per frequency, never mixed. Options: `start`, `end`, `aliases`,
|
|
38
|
+
`wide`, `flags` (a `<label>_flag` column after each value column) and `as_of` (values as
|
|
39
|
+
published on a past date, from a release's vintage history).
|
|
40
|
+
- `search` and `list_series` work in English and Arabic; `get_origin` and `get_series_info` describe
|
|
41
|
+
a series; `list_categories`, `list_tables` and `get_catalog` list what exists.
|
|
42
|
+
- `set_release`, `get_data_source` and `refresh_latest` say and control which data release is read.
|
|
43
|
+
"Latest" is the newest `data-YYYY-MM` release, looked up once and kept until refreshed. A pin is
|
|
44
|
+
always honoured.
|
|
45
|
+
- Every downloaded file is checked against the release's `checksums.sha256` when it is downloaded
|
|
46
|
+
and before every read from the cache; a file that does not match is never used. `clear_cache`
|
|
47
|
+
removes only files iraqdata created.
|
|
48
|
+
- Errors in `iraqdata.errors` say what went wrong and what to do; wide output warns
|
|
49
|
+
(`FlagWarning`) about hidden breaks and provisional values.
|
|
50
|
+
|
|
51
|
+
### Pipeline
|
|
52
|
+
|
|
53
|
+
- Eleven parsers read the archived raw files and stop, naming the file and the sheet, cell or row,
|
|
54
|
+
rather than guess, skip or drop a value. Typed-in values live in transcription records under
|
|
55
|
+
`pipeline/raw/transcribed/` (`docs/transcription_records.md`), never in code.
|
|
56
|
+
- The quality gate (`pipeline/validate.py`) checks schema, plausibility limits derived from each
|
|
57
|
+
series' own data, jumps, accounting identities, cross-source sanity, continuity and freshness.
|
|
58
|
+
`--release` fails on any review notice that has not been acknowledged by a named reviewer.
|
|
59
|
+
- A merge into the published tables keeps every revised or withdrawn value in a vintage history,
|
|
60
|
+
writes all files as one recoverable transaction, and refuses to drop published rows silently.
|
|
61
|
+
- A weekly, report-only update check fetches every automatically fetchable source into a scratch
|
|
62
|
+
folder, rebuilds and gatekeeps there, and keeps one GitHub issue per open problem. Downloads are
|
|
63
|
+
https-only, limited to each source's own hosts, size-capped and content-checked before they are
|
|
64
|
+
saved. A dead-man's switch reports a check that stopped running.
|
|
65
|
+
- `pipeline/export_release.py` runs the gate and the catalog check first and never overwrites an
|
|
66
|
+
existing release; its output is byte-for-byte reproducible.
|
|
67
|
+
- Documentation: `docs/collecting_data_doc.md` (how each source is collected and checked),
|
|
68
|
+
`docs/source_inventory.md` (sources and terms of reuse), `docs/series.md`,
|
|
69
|
+
`docs/transcription_records.md` and `docs/linked_inflation_method.md`.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "If you use this dataset or software in your research, please cite it as below."
|
|
3
|
+
authors:
|
|
4
|
+
- family-names: "Khalid"
|
|
5
|
+
given-names: "Hussein"
|
|
6
|
+
title: "iraqdata: Open, Documented, and Reproducible Iraqi Macroeconomic Data Package"
|
|
7
|
+
version: 1.0.0
|
|
8
|
+
date-released: 2026-10-28
|
|
9
|
+
url: "https://github.com/husseinkh90/iraqdata"
|
|
10
|
+
repository-code: "https://github.com/husseinkh90/iraqdata"
|
|
11
|
+
keywords:
|
|
12
|
+
- iraq
|
|
13
|
+
- macroeconomics
|
|
14
|
+
- time-series
|
|
15
|
+
- econometrics
|
|
16
|
+
- central-bank-of-iraq
|
|
17
|
+
license: MIT
|
iraqdata-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Hussein Khalid
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Creative Commons Attribution 4.0 International (CC-BY 4.0)
|
|
2
|
+
|
|
3
|
+
Compiled, standardized, and derived dataset artifacts produced by the iraqdata project
|
|
4
|
+
are licensed under Creative Commons Attribution 4.0 International.
|
|
5
|
+
|
|
6
|
+
You are free to:
|
|
7
|
+
- Share — copy and redistribute the material in any medium or format
|
|
8
|
+
- Adapt — remix, transform, and build upon the material for any purpose, even commercially.
|
|
9
|
+
|
|
10
|
+
Under the following terms:
|
|
11
|
+
- Attribution — You must give appropriate credit, provide a link to the license,
|
|
12
|
+
and indicate if changes were made. You may do so in any reasonable manner, but
|
|
13
|
+
not in any way that suggests the licensor endorses you or your use.
|
|
14
|
+
|
|
15
|
+
Scope: this licence covers the compiled and derived data only. The source data remain
|
|
16
|
+
subject to the terms of reuse and copyright of each original publisher (Central Bank of
|
|
17
|
+
Iraq, COSIT, Ministry of Finance, OPEC, JODI, EIA, FRED, BIS, World Bank and others).
|
|
18
|
+
Some publishers state no licence; the project does not grant one on their behalf. Each
|
|
19
|
+
source's terms, as recorded and with the date they were checked, are listed in
|
|
20
|
+
docs/source_inventory.md ("Terms of reuse by source") and in the `sources` of each
|
|
21
|
+
release's datapackage.json; every series names the sources it comes from.
|
|
22
|
+
|
|
23
|
+
When you use the data, cite both the iraqdata package and the original publisher.
|
iraqdata-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: iraqdata
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Open, documented, and reproducible macroeconomic data package for Iraq
|
|
5
|
+
Project-URL: Homepage, https://github.com/husseinkh90/iraqdata
|
|
6
|
+
Project-URL: Repository, https://github.com/husseinkh90/iraqdata.git
|
|
7
|
+
Project-URL: Issues, https://github.com/husseinkh90/iraqdata/issues
|
|
8
|
+
Author: Hussein Khalid
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
License-File: LICENSE-DATA
|
|
12
|
+
Keywords: cbi,cosit,data,econometrics,exchange-rates,inflation,iraq,macroeconomics,oil,time-series
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: numpy>=1.24
|
|
25
|
+
Requires-Dist: pandas>=2.0.0
|
|
26
|
+
Requires-Dist: pyarrow>=14.0.0
|
|
27
|
+
Requires-Dist: pyyaml>=6.0
|
|
28
|
+
Requires-Dist: requests>=2.31.0
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: jsonschema>=4.17; extra == 'dev'
|
|
31
|
+
Requires-Dist: packaging>=22; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
33
|
+
Provides-Extra: pipeline
|
|
34
|
+
Requires-Dist: openpyxl>=3.1.0; extra == 'pipeline'
|
|
35
|
+
Requires-Dist: pdfplumber>=0.10.0; extra == 'pipeline'
|
|
36
|
+
Requires-Dist: xlrd>=2.0.1; extra == 'pipeline'
|
|
37
|
+
Description-Content-Type: text/markdown
|
|
38
|
+
|
|
39
|
+
# iraqdata
|
|
40
|
+
|
|
41
|
+
**Iraq's economic statistics: clean, consistent and in one place.**
|
|
42
|
+
|
|
43
|
+
[](https://github.com/husseinkh90/iraqdata/blob/main/LICENSE)
|
|
44
|
+
[](https://github.com/husseinkh90/iraqdata/blob/main/LICENSE-DATA)
|
|
45
|
+
[](https://www.python.org/)
|
|
46
|
+
|
|
47
|
+
`iraqdata` gives you Iraq's main economic numbers (money, prices, exchange rates, oil, public
|
|
48
|
+
finance, GDP, trade and more) as ready-to-use tables, with one line of code or one download.
|
|
49
|
+
|
|
50
|
+
## Why this project matters
|
|
51
|
+
|
|
52
|
+
Anyone who studies Iraq's economy runs into the same problems:
|
|
53
|
+
|
|
54
|
+
- **The numbers are scattered.** They sit on the websites of the Central Bank of Iraq, the
|
|
55
|
+
statistics office (COSIT), the Ministry of Finance, the Ministry of Oil, OPEC and international
|
|
56
|
+
bodies. Pages move or change without notice.
|
|
57
|
+
- **The files are hard to use.** Much of the data comes as multi-sheet Arabic spreadsheets or PDF
|
|
58
|
+
bulletins, not as tables you can analyse.
|
|
59
|
+
- **The series have breaks.** Price indices were rebased several times (1993, 2007, 2012 and 2022),
|
|
60
|
+
and accounting standards changed. Joining the pieces correctly takes care.
|
|
61
|
+
- **Everyone repeats the same work.** Researchers can spend most of a project collecting and
|
|
62
|
+
cleaning data before any analysis begins.
|
|
63
|
+
|
|
64
|
+
`iraqdata` does that work once, carefully and in the open:
|
|
65
|
+
|
|
66
|
+
- Every number names its source and how it was produced. <!-- share:begin -->91%<!-- share:end --> of
|
|
67
|
+
observations are read directly from archived official files; the rest are computed from them,
|
|
68
|
+
typed in from publications, compiled from a seed of unknown publisher, or come from a named
|
|
69
|
+
non-official source. They are listed in
|
|
70
|
+
[docs/series.md](https://github.com/husseinkh90/iraqdata/blob/main/docs/series.md#data-not-observed-from-an-archived-official-file) and flagged.
|
|
71
|
+
- Breaks between series are marked rather than hidden.
|
|
72
|
+
- The data are checked before each release.
|
|
73
|
+
|
|
74
|
+
The result is a shared, free starting point. Studies of Iraq's economy become faster to do and
|
|
75
|
+
easier to reproduce and check.
|
|
76
|
+
|
|
77
|
+
## Who it is for
|
|
78
|
+
|
|
79
|
+
- **Researchers and students:** start your analysis on day one, and let others reproduce your results.
|
|
80
|
+
- **Journalists and the public:** free access to the country's economic record, without paid databases.
|
|
81
|
+
- **Banks, businesses and investors:** reliable benchmarks for inflation, exchange rates, money and the budget.
|
|
82
|
+
- **Policymakers and analysts:** a consistent picture across institutions, in one format.
|
|
83
|
+
|
|
84
|
+
## What data is included
|
|
85
|
+
|
|
86
|
+
Each *series* is one indicator measured over time, such as broad money (M2) month by month.
|
|
87
|
+
There are 62 series in 9 areas:
|
|
88
|
+
|
|
89
|
+
| Area | Examples | Original publisher |
|
|
90
|
+
|---|---|---|
|
|
91
|
+
| Money and banking | broad money `money.m2`, policy rate `money.policy_rate`, official reserves `money.reserves_official` | Central Bank of Iraq |
|
|
92
|
+
| Exchange rates | official rate `fx.official`, Baghdad parallel-market rate `parallel_rate_iraq` | Central Bank of Iraq; Iraq-parallel-exchange-rate project |
|
|
93
|
+
| Prices and inflation | consumer prices `cpi_headline` and `cpi_core` | COSIT, via the Central Bank of Iraq |
|
|
94
|
+
| Oil | Brent price `oil_price_brent`, Basrah price `oil_price_basrah`, crude production `crude_production_direct` | Ministry of Oil and SOMO, OPEC and JODI, U.S. EIA |
|
|
95
|
+
| Public finance | revenue `fiscal.revenue_total`, spending `fiscal.expenditure_total`, balance `fiscal.balance` | Ministry of Finance, via the Central Bank of Iraq |
|
|
96
|
+
| GDP | nominal GDP `gdp.nominal`, real GDP `gdp.real`, non-oil GDP `gdp.nominal_nonoil` | COSIT |
|
|
97
|
+
| Balance of payments and trade | current account `bop.current_account`, exports `trade.exports_total`, imports `trade.imports_total` | Central Bank of Iraq |
|
|
98
|
+
| Cross-border banking | claims `bis.lbs.claims_total`, liabilities `bis.lbs.liabilities_total` | Bank for International Settlements |
|
|
99
|
+
| Development aid | net aid received `oecd.dac.oda_total_net` | OECD / World Bank |
|
|
100
|
+
|
|
101
|
+
See the [full list of all 62 series](https://github.com/husseinkh90/iraqdata/blob/main/docs/series.md).
|
|
102
|
+
|
|
103
|
+
## Install
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
pip install iraqdata
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
You need Python 3.10 or newer. To try the latest development version, run
|
|
110
|
+
`pip install git+https://github.com/husseinkh90/iraqdata` instead.
|
|
111
|
+
|
|
112
|
+
## How to use
|
|
113
|
+
|
|
114
|
+
Import the library:
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
import iraqdata as id
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Get one series as a table indexed by date:
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
df = id.get_series("money.m2")
|
|
124
|
+
print(df.tail())
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Ask for several series at once. Series of different frequencies (monthly, daily) come back as one
|
|
128
|
+
table per frequency, so nothing is mixed or averaged:
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
tables = id.get_series(["money.m2", "fx.official"])
|
|
132
|
+
print(tables["monthly"].tail())
|
|
133
|
+
print(tables["daily"].tail())
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Choose a date range and your own column names:
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
df = id.get_series({"Broad money": "m2", "Narrow money": "m1"}, start="2020-01", end="2024-12")
|
|
140
|
+
print(df.head())
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Use short names for common indicators, such as `m2`, `cpi`, `official_rate`, `parallel_rate`,
|
|
144
|
+
`brent` and `gdp`:
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
df = id.get_series(["m2", "cpi"])
|
|
148
|
+
print(df.tail())
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Search in English or Arabic, or load a whole subject table:
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
print(id.search("inflation"))
|
|
155
|
+
print(id.search("دينار"))
|
|
156
|
+
money = id.get_table("money_banking_monthly")
|
|
157
|
+
print(money.head())
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
The data are downloaded the first time you ask for them and kept on your computer, so later
|
|
161
|
+
requests work offline. Every downloaded file is checked against the checksums published with its
|
|
162
|
+
release; a file that does not match is never used.
|
|
163
|
+
|
|
164
|
+
### Status flags
|
|
165
|
+
|
|
166
|
+
Every value has a status flag: `A` normal, `P` provisional, `B` break (for example a rebased
|
|
167
|
+
index), `E` estimated, `M` missing, `U` low reliability. Ask for them next to the values with
|
|
168
|
+
`flags=True`:
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
df = id.get_series(["cpi", "m2"], flags=True)
|
|
172
|
+
print(df[df["cpi_flag"].isin(["B", "P"])])
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Without `flags=True`, a `FlagWarning` tells you when a table contains breaks or provisional
|
|
176
|
+
values. To hide it: `warnings.filterwarnings("ignore", category=id.FlagWarning)`.
|
|
177
|
+
|
|
178
|
+
### Values as published on a past date
|
|
179
|
+
|
|
180
|
+
Values are revised over time. `as_of` returns them as they were published on a given date, from
|
|
181
|
+
the vintage history that ships with a release. A release has a `history/` folder once a published
|
|
182
|
+
value has been revised or withdrawn. The first release, `data-2026-10`, has none, because every
|
|
183
|
+
value in it was first published on 2026-10-28; asking it for `as_of` raises
|
|
184
|
+
`NoVintageHistoryError`. From the first release that has a history:
|
|
185
|
+
|
|
186
|
+
<!-- not run: needs a release with a history folder -->
|
|
187
|
+
```python
|
|
188
|
+
then = id.get_series("cpi", wide=False, as_of="2026-10-28")
|
|
189
|
+
print(then[["date", "value", "realtime_start"]].tail())
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Which data release you are using
|
|
193
|
+
|
|
194
|
+
By default you get the latest data release. It is looked up the first time you use the library
|
|
195
|
+
and then kept until you ask for a newer one with `id.refresh_latest()`, so your results do not
|
|
196
|
+
change on their own. To make results reproducible, pin a dated release. A pinned release is
|
|
197
|
+
always used, even inside a copy of this repository:
|
|
198
|
+
|
|
199
|
+
```python
|
|
200
|
+
id.set_release("data-2026-10") # or set the environment variable IRAQDATA_RELEASE
|
|
201
|
+
print(id.get_data_source()) # release data-2026-10 (pinned with set_release) from husseinkh90/iraqdata
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
`id.set_release()` takes precedence over `IRAQDATA_RELEASE`; `id.set_release(None)` removes the
|
|
205
|
+
pin. Downloads are kept in `~/.cache/iraqdata/` (or `IRAQDATA_CACHE_DIR`), one folder per release.
|
|
206
|
+
`id.clear_cache()` deletes only the files iraqdata downloaded there; anything else in that folder is
|
|
207
|
+
left alone. Data are downloaded from the GitHub releases of `husseinkh90/iraqdata`; set
|
|
208
|
+
`IRAQDATA_REPO` to use another repository.
|
|
209
|
+
|
|
210
|
+
## Without Python
|
|
211
|
+
|
|
212
|
+
Every table is available as a CSV file on the
|
|
213
|
+
[latest release page](https://github.com/husseinkh90/iraqdata/releases/latest), one file per
|
|
214
|
+
subject area (for example `money_banking_monthly.csv`).
|
|
215
|
+
|
|
216
|
+
- **Excel:** Data → From Web, then paste
|
|
217
|
+
`https://github.com/husseinkh90/iraqdata/releases/latest/download/money_banking_monthly.csv`.
|
|
218
|
+
- **Stata:**
|
|
219
|
+
|
|
220
|
+
```stata
|
|
221
|
+
import delimited "https://github.com/husseinkh90/iraqdata/releases/latest/download/money_banking_monthly.csv", clear
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
- **R:**
|
|
225
|
+
|
|
226
|
+
```r
|
|
227
|
+
money <- read.csv("https://github.com/husseinkh90/iraqdata/releases/latest/download/money_banking_monthly.csv")
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## How to cite
|
|
231
|
+
|
|
232
|
+
If you use `iraqdata`, please cite it:
|
|
233
|
+
|
|
234
|
+
```bibtex
|
|
235
|
+
@software{khalid2026iraqdata,
|
|
236
|
+
author = {Khalid, Hussein},
|
|
237
|
+
title = {iraqdata: Open, Documented, and Reproducible Iraqi Macroeconomic Data Package},
|
|
238
|
+
year = {2026},
|
|
239
|
+
version = {1.0.0},
|
|
240
|
+
url = {https://github.com/husseinkh90/iraqdata}
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
A DOI will be added once the release is archived on Zenodo.
|
|
245
|
+
|
|
246
|
+
Please cite both the package and the original publishers of the series you use (each series'
|
|
247
|
+
sources are in `datapackage.json`, and their terms in
|
|
248
|
+
[Terms of reuse by source](https://github.com/husseinkh90/iraqdata/blob/main/docs/source_inventory.md#terms-of-reuse-by-source)):
|
|
249
|
+
- the Central Bank of Iraq;
|
|
250
|
+
- the Central Organization for Statistics and Information Technology (COSIT);
|
|
251
|
+
- the Ministry of Finance;
|
|
252
|
+
- the Ministry of Oil and SOMO;
|
|
253
|
+
- OPEC and JODI;
|
|
254
|
+
- the U.S. Energy Information Administration and FRED;
|
|
255
|
+
- the Bank for International Settlements;
|
|
256
|
+
- the World Bank;
|
|
257
|
+
- the Iraq-parallel-exchange-rate project (parallel exchange rate from 2023).
|
|
258
|
+
|
|
259
|
+
## Licence
|
|
260
|
+
|
|
261
|
+
- **Code:** [MIT](https://github.com/husseinkh90/iraqdata/blob/main/LICENSE).
|
|
262
|
+
- **Data:** the compiled and derived data are [CC BY 4.0](https://github.com/husseinkh90/iraqdata/blob/main/LICENSE-DATA). The source data keep
|
|
263
|
+
their publishers' own terms, some of which state no licence; see
|
|
264
|
+
[Terms of reuse by source](https://github.com/husseinkh90/iraqdata/blob/main/docs/source_inventory.md#terms-of-reuse-by-source).
|
|
265
|
+
|
|
266
|
+
## Contributing
|
|
267
|
+
|
|
268
|
+
For contributors and maintainers, see [`docs/`](https://github.com/husseinkh90/iraqdata/tree/main/docs); publishing the repository and its data
|
|
269
|
+
releases is described in [docs/publishing.md](https://github.com/husseinkh90/iraqdata/blob/main/docs/publishing.md).
|