oda-data 2.2.2.post1__tar.gz → 2.3.0.post1__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.
- oda_data-2.2.2.post1/README.md → oda_data-2.3.0.post1/PKG-INFO +232 -8
- oda_data-2.2.2.post1/PKG-INFO → oda_data-2.3.0.post1/README.md +201 -27
- oda_data-2.3.0.post1/pyproject.toml +133 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/api/oecd.py +15 -14
- oda_data-2.3.0.post1/src/oda_data/api/sources.py +852 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/clean_data/channels.py +14 -12
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/clean_data/common.py +93 -9
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/clean_data/crs_channel_mapping.csv +127 -127
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/clean_data/validation.py +1 -5
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/indicators/common.py +2 -5
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/indicators/crs/common.py +15 -16
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/indicators/crs/crs_functions.py +22 -8
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/indicators/crs/crs_indicators.json +1 -1
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/indicators/crs/oecd.py +4 -2
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/indicators/dac1/dac1_indicators.json +1 -1
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/indicators/dac2a/common.py +1 -1
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/indicators/dac2a/dac2a_indicators.json +1 -1
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/indicators/indicator.py +2 -2
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/indicators/research/eu.py +2 -2
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/indicators/research/policy_markers.py +4 -4
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/indicators/research/sector_imputations.py +11 -12
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/settings/crs_flow_types.json +1 -1
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/settings/crs_modalities.json +1 -1
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/settings/crs_policy_markers.json +1 -1
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/settings/crs_purpose.json +1 -1
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/settings/crs_type_of_finance.json +1 -1
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/settings/dac1_aid_flow_types.json +1 -1
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/settings/dac2a_aid_type.json +1 -1
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/settings/flow_types.json +1 -1
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/settings/indicators.json +1 -2
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/settings/key_columns.json +1 -2
- oda_data-2.3.0.post1/src/oda_data/settings/provider_groupings.json +325 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/settings/recipient_groupings.json +1 -2
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/settings/v1_indicators_mapping.json +5 -3
- oda_data-2.3.0.post1/src/oda_data/tools/cache.py +685 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/tools/compatibility.py +1 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/tools/gni.py +2 -1
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/tools/groupings.py +1 -1
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/tools/names/create_mapping.py +1 -1
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/tools/names/crs_names.json +1 -1
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/tools/names/dac1_names.json +1 -1
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/tools/names/dac2a_names.json +1 -1
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/tools/sector_lists.py +36 -36
- oda_data-2.2.2.post1/pyproject.toml +0 -35
- oda_data-2.2.2.post1/src/oda_data/.raw_data/README.md +0 -3
- oda_data-2.2.2.post1/src/oda_data/api/sources.py +0 -663
- oda_data-2.2.2.post1/src/oda_data/settings/provider_groupings.json +0 -325
- oda_data-2.2.2.post1/src/oda_data/tools/cache.py +0 -81
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/__init__.py +13 -13
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/api/__init__.py +0 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/api/constants.py +0 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/api/representations.py +0 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/clean_data/__init__.py +0 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/clean_data/dtypes.py +0 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/clean_data/schema.py +0 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/config.py +0 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/indicators/__init__.py +0 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/indicators/crs/__init__.py +0 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/indicators/crs/one.py +0 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/indicators/dac1/__init__.py +0 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/indicators/dac1/common.py +0 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/indicators/dac1/dac1_functions.py +0 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/indicators/dac1/oecd.py +0 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/indicators/dac1/one.py +0 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/indicators/dac2a/__init__.py +0 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/indicators/dac2a/dac2a_functions.py +0 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/indicators/dac2a/oecd.py +0 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/indicators/dac2a/one.py +0 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/indicators/research/__init__.py +0 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/logger.py +0 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/tools/__init__.py +0 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/tools/names/__init__.py +0 -0
- {oda_data-2.2.2.post1 → oda_data-2.3.0.post1}/src/oda_data/tools/names/add.py +0 -0
|
@@ -1,10 +1,47 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: oda-data
|
|
3
|
+
Version: 2.3.0.post1
|
|
4
|
+
Summary: A python package to work with Official Development Assistance data from the OECD DAC.
|
|
5
|
+
Author: Jorge Rivera, Miguel Haro Ruiz
|
|
6
|
+
Author-email: Jorge Rivera <jorge.rivera@one.org>, Miguel Haro Ruiz <miguel.haroruiz@one.org>
|
|
7
|
+
License: MIT
|
|
8
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
19
|
+
Requires-Dist: cachetools>=6.2.0
|
|
20
|
+
Requires-Dist: filelock>=3.20.0
|
|
21
|
+
Requires-Dist: oda-reader>=1.3.0
|
|
22
|
+
Requires-Dist: pandas[excel,parquet,performance]>=2.2.0
|
|
23
|
+
Requires-Dist: pydeflate>=2.1.3
|
|
24
|
+
Requires-Dist: reader>=3.18
|
|
25
|
+
Requires-Dist: thefuzz>=0.22.1
|
|
26
|
+
Requires-Python: >=3.11
|
|
27
|
+
Project-URL: Documentation, https://github.com/ONEcampaign/oda_data_package
|
|
28
|
+
Project-URL: Homepage, https://github.com/ONEcampaign/oda_data_package
|
|
29
|
+
Project-URL: Repository, https://github.com/ONEcampaign/oda_data_package
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
1
32
|
[](https://pypi.org/project/oda_data/)
|
|
2
33
|
[](https://pypi.org/project/oda_data/)
|
|
3
|
-
[](https://github.com/astral-sh/ruff)
|
|
35
|
+
[](https://github.com/ONEcampaign/oda_data_package/actions/workflows/test.yml)
|
|
36
|
+
[](https://codecov.io/gh/ONEcampaign/oda_data_package)
|
|
37
|
+
[](https://opensource.org/licenses/MIT)
|
|
38
|
+
[](https://pepy.tech/project/oda-data)
|
|
4
39
|
|
|
5
40
|
# The ODA Data Package
|
|
6
41
|
This is a Python package designed for accessing, processing, and analyzing Official Development Assistance (ODA) data from OECD DAC. With an intuitive API, it simplifies common tasks like retrieving ODA indicators, converting currencies, filtering data, and handling bulk downloads.
|
|
7
42
|
|
|
43
|
+
**Current Version: 2.3.0**
|
|
44
|
+
|
|
8
45
|
**Note: This is the new version of the package (V2). This release includes many breaking changes and previous workflows
|
|
9
46
|
will not work. The previous 1.5.x version remains available on PyPI and we will continue to support it at least until
|
|
10
47
|
August 2025.**
|
|
@@ -15,7 +52,7 @@ of ODA, but also of how the DAC databases and tools are organised.
|
|
|
15
52
|
|
|
16
53
|
This package aims to simplify this process and make it easier for users to get the data they need.
|
|
17
54
|
|
|
18
|
-
Please submit questions, feedback or requests via
|
|
55
|
+
Please submit questions, feedback or requests via
|
|
19
56
|
the [issues page](https://github.com/ONEcampaign/oda_data_package/issues).
|
|
20
57
|
|
|
21
58
|
## Getting started
|
|
@@ -28,7 +65,7 @@ The latest version of the package can be installed using pip:
|
|
|
28
65
|
pip install oda-data --upgrade
|
|
29
66
|
```
|
|
30
67
|
|
|
31
|
-
The package is compatible with Python 3.
|
|
68
|
+
The package is compatible with Python 3.11 and above.
|
|
32
69
|
|
|
33
70
|
## Basic usage
|
|
34
71
|
|
|
@@ -39,7 +76,7 @@ An object of this class can handle:
|
|
|
39
76
|
- filtering the data for specific donors, recipients(if relevant), years.
|
|
40
77
|
- returning the data in a variety of currency/prices combinations.
|
|
41
78
|
|
|
42
|
-
At a minimum, the class expects users to specify years. By default it would then get
|
|
79
|
+
At a minimum, the class expects users to specify years. By default it would then get
|
|
43
80
|
data for all providers, for all recipients (if applicable), as net disbursements in USD, in current prices,
|
|
44
81
|
using the OECD data-explorer API.
|
|
45
82
|
|
|
@@ -105,7 +142,7 @@ data = client.get_indicators(research_indicators)
|
|
|
105
142
|
|
|
106
143
|
### OECDClient
|
|
107
144
|
|
|
108
|
-
|
|
145
|
+
Thousands of indicators are currently supported across DAC1, DAC2A, and CRS databases. These indicators are produced by filtering and sometimes aggregating data from the different DAC Tables and databases.
|
|
109
146
|
|
|
110
147
|
You can get a dictionary with all supported indicators, with their code, name, description and source by using the `.available_indicators()` method:
|
|
111
148
|
|
|
@@ -150,6 +187,38 @@ from oda_data import OECDClient
|
|
|
150
187
|
currencies = OECDClient.available_currencies()
|
|
151
188
|
```
|
|
152
189
|
|
|
190
|
+
### Measures
|
|
191
|
+
|
|
192
|
+
Different measures are available depending on the data source. Here's what each source supports:
|
|
193
|
+
|
|
194
|
+
**DAC1 Measures:**
|
|
195
|
+
- `commitment` - Total commitments
|
|
196
|
+
- `commitment_grant` - Grant commitments only
|
|
197
|
+
- `commitment_non_grant` - Non-grant commitments
|
|
198
|
+
- `grant_equivalent` - Grant equivalent values
|
|
199
|
+
- `net_disbursement` - Net disbursements (default)
|
|
200
|
+
- `net_disbursement_grant` - Net grant disbursements
|
|
201
|
+
- `gross_disbursement` - Gross disbursements
|
|
202
|
+
- `gross_disbursement_non_grant` - Gross non-grant disbursements
|
|
203
|
+
- `received` - Amounts received
|
|
204
|
+
|
|
205
|
+
**DAC2A Measures:**
|
|
206
|
+
- `net_disbursement` - Net disbursements (default)
|
|
207
|
+
- `gross_disbursement` - Gross disbursements
|
|
208
|
+
|
|
209
|
+
**CRS Measures:**
|
|
210
|
+
- `commitment` - Commitment amounts
|
|
211
|
+
- `grant_equivalent` - Grant equivalent values
|
|
212
|
+
- `gross_disbursement` - Gross disbursement amounts
|
|
213
|
+
- `received` - Amounts received
|
|
214
|
+
- `expert_commitment` - Expert commitments
|
|
215
|
+
- `expert_extended` - Expert extended
|
|
216
|
+
- `export_credit` - Export credits
|
|
217
|
+
|
|
218
|
+
**MultiSystem Measures:**
|
|
219
|
+
- `commitment` - Commitments
|
|
220
|
+
- `gross_disbursement` - Gross disbursements
|
|
221
|
+
|
|
153
222
|
## Accessing the data
|
|
154
223
|
For more advanced users, you can use this package to get and work with different tables and databases from the OECD DAC.
|
|
155
224
|
|
|
@@ -275,7 +344,7 @@ You can optionally specify:
|
|
|
275
344
|
Not specifying any or all of these parameters will return all the available data.
|
|
276
345
|
|
|
277
346
|
You can refer to the examples above for DAC1 and DAC2a to understand the usage of these classes.
|
|
278
|
-
**Note**: given the speed and rate-limiting of the dac-explorer APIs, it's recommended to always use the
|
|
347
|
+
**Note**: given the speed and rate-limiting of the dac-explorer APIs, it's recommended to always use the
|
|
279
348
|
bulk option when using the CRS class.
|
|
280
349
|
|
|
281
350
|
```python
|
|
@@ -309,11 +378,166 @@ You can refer to the examples above for DAC1 and DAC2a to understand the usage o
|
|
|
309
378
|
unless you're looking for something very specific.
|
|
310
379
|
|
|
311
380
|
|
|
381
|
+
## Utility Functions
|
|
382
|
+
|
|
383
|
+
The package provides several utility functions to enhance and enrich your ODA data analysis:
|
|
384
|
+
|
|
385
|
+
### Adding Human-Readable Names
|
|
386
|
+
|
|
387
|
+
Convert code columns to human-readable names:
|
|
388
|
+
|
|
389
|
+
```python
|
|
390
|
+
from oda_data import OECDClient, add_names_columns
|
|
391
|
+
|
|
392
|
+
# Get indicator data
|
|
393
|
+
client = OECDClient(years=range(2020, 2023))
|
|
394
|
+
data = client.get_indicators("DAC2A.10.1010")
|
|
395
|
+
|
|
396
|
+
# Add human-readable names for code columns
|
|
397
|
+
data = add_names_columns(data, ["recipient_code", "provider_code"])
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
### Adding GNI Share
|
|
401
|
+
|
|
402
|
+
Calculate ODA as a percentage of Gross National Income:
|
|
403
|
+
|
|
404
|
+
```python
|
|
405
|
+
from oda_data import OECDClient, add_gni_share_column
|
|
406
|
+
|
|
407
|
+
# Create client with specific configuration
|
|
408
|
+
client = OECDClient(
|
|
409
|
+
years=range(2018, 2023),
|
|
410
|
+
providers=[4, 302], # France and USA
|
|
411
|
+
currency="USD",
|
|
412
|
+
base_year=2021
|
|
413
|
+
)
|
|
414
|
+
|
|
415
|
+
# Get data with GNI share column
|
|
416
|
+
data = add_gni_share_column(client, "DAC1.10.1010")
|
|
417
|
+
# Returns dataframe with 'gni_share_pct' column
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
### Sector Classification
|
|
421
|
+
|
|
422
|
+
Add sector classifications to your data:
|
|
423
|
+
|
|
424
|
+
```python
|
|
425
|
+
from oda_data import add_sectors, add_broad_sectors
|
|
426
|
+
|
|
427
|
+
# Add detailed sector information
|
|
428
|
+
data = add_sectors(data)
|
|
429
|
+
|
|
430
|
+
# Or add broad sector categories
|
|
431
|
+
data = add_broad_sectors(data)
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
### Provider and Recipient Groupings
|
|
435
|
+
|
|
436
|
+
Access predefined groupings of providers and recipients:
|
|
437
|
+
|
|
438
|
+
```python
|
|
439
|
+
from oda_data import provider_groupings, recipient_groupings
|
|
440
|
+
|
|
441
|
+
# Get all provider groupings (DAC members, EU27, etc.)
|
|
442
|
+
providers = provider_groupings()
|
|
443
|
+
|
|
444
|
+
# Get all recipient groupings (LDCs, regions, income groups, etc.)
|
|
445
|
+
recipients = recipient_groupings()
|
|
446
|
+
|
|
447
|
+
# Example: Get all DAC members
|
|
448
|
+
dac_members = providers["dac_members"]
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
### Cache Management
|
|
452
|
+
|
|
453
|
+
Control the package's caching behavior:
|
|
454
|
+
|
|
455
|
+
```python
|
|
456
|
+
from oda_data import clear_cache, disable_cache, enable_cache
|
|
457
|
+
|
|
458
|
+
# Clear all cached data
|
|
459
|
+
clear_cache()
|
|
460
|
+
|
|
461
|
+
# Temporarily disable caching (for development/testing)
|
|
462
|
+
disable_cache()
|
|
463
|
+
|
|
464
|
+
# Re-enable caching
|
|
465
|
+
enable_cache()
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
### Compatibility with Version 1.x
|
|
469
|
+
|
|
470
|
+
For users migrating from v1.x, a compatibility layer is available:
|
|
471
|
+
|
|
472
|
+
```python
|
|
473
|
+
from oda_data import ODAData
|
|
474
|
+
|
|
475
|
+
# Use the v1.x style interface
|
|
476
|
+
oda = ODAData(years=range(2018, 2022), donors=[4, 302])
|
|
477
|
+
data = oda.load_indicator("total_oda_flow_net")
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
## Advanced Features
|
|
481
|
+
|
|
482
|
+
### Policy Marker Analysis
|
|
483
|
+
|
|
484
|
+
Extract bilateral ODA by policy marker (gender, climate, etc.):
|
|
485
|
+
|
|
486
|
+
```python
|
|
487
|
+
from oda_data import bilateral_policy_marker
|
|
488
|
+
|
|
489
|
+
# Get gender-focused ODA (principal objective)
|
|
490
|
+
gender_data = bilateral_policy_marker(
|
|
491
|
+
years=range(2015, 2023),
|
|
492
|
+
providers=[4, 302],
|
|
493
|
+
marker="gender",
|
|
494
|
+
marker_score="principal",
|
|
495
|
+
measure="gross_disbursement",
|
|
496
|
+
currency="USD",
|
|
497
|
+
base_year=2021
|
|
498
|
+
)
|
|
499
|
+
|
|
500
|
+
# Available markers: "gender", "environment", "nutrition", "disability", "biodiversity"
|
|
501
|
+
# Available scores: "significant", "principal", "not_targeted", "not_screened",
|
|
502
|
+
# "total_targeted", "total_allocable"
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
### Sector Imputations
|
|
506
|
+
|
|
507
|
+
Access sector imputation functions for multilateral aid analysis:
|
|
508
|
+
|
|
509
|
+
```python
|
|
510
|
+
from oda_data.indicators.research import sector_imputations
|
|
511
|
+
|
|
512
|
+
# Use specialized sector imputation functions
|
|
513
|
+
# (See module documentation for available functions)
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
### AidData Integration
|
|
517
|
+
|
|
518
|
+
Access project-level data from AidData's dataset:
|
|
519
|
+
|
|
520
|
+
```python
|
|
521
|
+
from oda_data import AidDataData, set_data_path
|
|
522
|
+
|
|
523
|
+
set_data_path("path/to/data/folder")
|
|
524
|
+
|
|
525
|
+
# Initialize AidData source
|
|
526
|
+
aiddata = AidDataData(
|
|
527
|
+
years=range(2010, 2020),
|
|
528
|
+
recipients=["Kenya", "Tanzania"],
|
|
529
|
+
sectors=[110, 120] # Sector codes
|
|
530
|
+
)
|
|
531
|
+
|
|
532
|
+
# Read the data (automatically uses bulk download)
|
|
533
|
+
data = aiddata.read()
|
|
534
|
+
```
|
|
535
|
+
|
|
312
536
|
## Key features
|
|
313
537
|
|
|
314
|
-
- **Speed up analysis** - The package handles downloading, cleaning and loading all the data, so you can focus on the
|
|
538
|
+
- **Speed up analysis** - The package handles downloading, cleaning and loading all the data, so you can focus on the
|
|
315
539
|
analysis.
|
|
316
|
-
- **Get data in the currency and prices you need** - ODA data is only available in US dollars (current or constant
|
|
540
|
+
- **Get data in the currency and prices you need** - ODA data is only available in US dollars (current or constant
|
|
317
541
|
prices) and local currency units (current prices). The package allows you to view the data in US dollars, Euros,
|
|
318
542
|
British Pounds and Canadian dollars, in both current and constant prices. We can add any other DAC currency if you
|
|
319
543
|
request it via the [issues page](https://github.com/ONEcampaign/oda_data_package/issues)
|
|
@@ -1,29 +1,16 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: oda-data
|
|
3
|
-
Version: 2.2.2.post1
|
|
4
|
-
Summary: A python package to work with Official Development Assistance data from the OECD DAC.
|
|
5
|
-
Author: Jorge Rivera, Miguel Haro Ruiz
|
|
6
|
-
Author-email: Jorge Rivera <jorge.rivera@one.org>, Miguel Haro Ruiz <miguel.haroruiz@one.org>
|
|
7
|
-
License: MIT
|
|
8
|
-
Requires-Dist: cachetools>=6.2.0
|
|
9
|
-
Requires-Dist: oda-reader>=1.2.2
|
|
10
|
-
Requires-Dist: pandas[excel,parquet,performance]>=2.3.2
|
|
11
|
-
Requires-Dist: pydeflate>=2.1.3
|
|
12
|
-
Requires-Dist: reader>=3.18
|
|
13
|
-
Requires-Dist: thefuzz>=0.22.1
|
|
14
|
-
Requires-Python: >=3.11
|
|
15
|
-
Project-URL: Documentation, https://github.com/ONEcampaign/oda_data_package
|
|
16
|
-
Project-URL: Homepage, https://github.com/ONEcampaign/oda_data_package
|
|
17
|
-
Project-URL: Repository, https://github.com/ONEcampaign/oda_data_package
|
|
18
|
-
Description-Content-Type: text/markdown
|
|
19
|
-
|
|
20
1
|
[](https://pypi.org/project/oda_data/)
|
|
21
2
|
[](https://pypi.org/project/oda_data/)
|
|
22
|
-
[](https://github.com/astral-sh/ruff)
|
|
4
|
+
[](https://github.com/ONEcampaign/oda_data_package/actions/workflows/test.yml)
|
|
5
|
+
[](https://codecov.io/gh/ONEcampaign/oda_data_package)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[](https://pepy.tech/project/oda-data)
|
|
23
8
|
|
|
24
9
|
# The ODA Data Package
|
|
25
10
|
This is a Python package designed for accessing, processing, and analyzing Official Development Assistance (ODA) data from OECD DAC. With an intuitive API, it simplifies common tasks like retrieving ODA indicators, converting currencies, filtering data, and handling bulk downloads.
|
|
26
11
|
|
|
12
|
+
**Current Version: 2.3.0**
|
|
13
|
+
|
|
27
14
|
**Note: This is the new version of the package (V2). This release includes many breaking changes and previous workflows
|
|
28
15
|
will not work. The previous 1.5.x version remains available on PyPI and we will continue to support it at least until
|
|
29
16
|
August 2025.**
|
|
@@ -34,7 +21,7 @@ of ODA, but also of how the DAC databases and tools are organised.
|
|
|
34
21
|
|
|
35
22
|
This package aims to simplify this process and make it easier for users to get the data they need.
|
|
36
23
|
|
|
37
|
-
Please submit questions, feedback or requests via
|
|
24
|
+
Please submit questions, feedback or requests via
|
|
38
25
|
the [issues page](https://github.com/ONEcampaign/oda_data_package/issues).
|
|
39
26
|
|
|
40
27
|
## Getting started
|
|
@@ -47,7 +34,7 @@ The latest version of the package can be installed using pip:
|
|
|
47
34
|
pip install oda-data --upgrade
|
|
48
35
|
```
|
|
49
36
|
|
|
50
|
-
The package is compatible with Python 3.
|
|
37
|
+
The package is compatible with Python 3.11 and above.
|
|
51
38
|
|
|
52
39
|
## Basic usage
|
|
53
40
|
|
|
@@ -58,7 +45,7 @@ An object of this class can handle:
|
|
|
58
45
|
- filtering the data for specific donors, recipients(if relevant), years.
|
|
59
46
|
- returning the data in a variety of currency/prices combinations.
|
|
60
47
|
|
|
61
|
-
At a minimum, the class expects users to specify years. By default it would then get
|
|
48
|
+
At a minimum, the class expects users to specify years. By default it would then get
|
|
62
49
|
data for all providers, for all recipients (if applicable), as net disbursements in USD, in current prices,
|
|
63
50
|
using the OECD data-explorer API.
|
|
64
51
|
|
|
@@ -124,7 +111,7 @@ data = client.get_indicators(research_indicators)
|
|
|
124
111
|
|
|
125
112
|
### OECDClient
|
|
126
113
|
|
|
127
|
-
|
|
114
|
+
Thousands of indicators are currently supported across DAC1, DAC2A, and CRS databases. These indicators are produced by filtering and sometimes aggregating data from the different DAC Tables and databases.
|
|
128
115
|
|
|
129
116
|
You can get a dictionary with all supported indicators, with their code, name, description and source by using the `.available_indicators()` method:
|
|
130
117
|
|
|
@@ -169,6 +156,38 @@ from oda_data import OECDClient
|
|
|
169
156
|
currencies = OECDClient.available_currencies()
|
|
170
157
|
```
|
|
171
158
|
|
|
159
|
+
### Measures
|
|
160
|
+
|
|
161
|
+
Different measures are available depending on the data source. Here's what each source supports:
|
|
162
|
+
|
|
163
|
+
**DAC1 Measures:**
|
|
164
|
+
- `commitment` - Total commitments
|
|
165
|
+
- `commitment_grant` - Grant commitments only
|
|
166
|
+
- `commitment_non_grant` - Non-grant commitments
|
|
167
|
+
- `grant_equivalent` - Grant equivalent values
|
|
168
|
+
- `net_disbursement` - Net disbursements (default)
|
|
169
|
+
- `net_disbursement_grant` - Net grant disbursements
|
|
170
|
+
- `gross_disbursement` - Gross disbursements
|
|
171
|
+
- `gross_disbursement_non_grant` - Gross non-grant disbursements
|
|
172
|
+
- `received` - Amounts received
|
|
173
|
+
|
|
174
|
+
**DAC2A Measures:**
|
|
175
|
+
- `net_disbursement` - Net disbursements (default)
|
|
176
|
+
- `gross_disbursement` - Gross disbursements
|
|
177
|
+
|
|
178
|
+
**CRS Measures:**
|
|
179
|
+
- `commitment` - Commitment amounts
|
|
180
|
+
- `grant_equivalent` - Grant equivalent values
|
|
181
|
+
- `gross_disbursement` - Gross disbursement amounts
|
|
182
|
+
- `received` - Amounts received
|
|
183
|
+
- `expert_commitment` - Expert commitments
|
|
184
|
+
- `expert_extended` - Expert extended
|
|
185
|
+
- `export_credit` - Export credits
|
|
186
|
+
|
|
187
|
+
**MultiSystem Measures:**
|
|
188
|
+
- `commitment` - Commitments
|
|
189
|
+
- `gross_disbursement` - Gross disbursements
|
|
190
|
+
|
|
172
191
|
## Accessing the data
|
|
173
192
|
For more advanced users, you can use this package to get and work with different tables and databases from the OECD DAC.
|
|
174
193
|
|
|
@@ -294,7 +313,7 @@ You can optionally specify:
|
|
|
294
313
|
Not specifying any or all of these parameters will return all the available data.
|
|
295
314
|
|
|
296
315
|
You can refer to the examples above for DAC1 and DAC2a to understand the usage of these classes.
|
|
297
|
-
**Note**: given the speed and rate-limiting of the dac-explorer APIs, it's recommended to always use the
|
|
316
|
+
**Note**: given the speed and rate-limiting of the dac-explorer APIs, it's recommended to always use the
|
|
298
317
|
bulk option when using the CRS class.
|
|
299
318
|
|
|
300
319
|
```python
|
|
@@ -328,11 +347,166 @@ You can refer to the examples above for DAC1 and DAC2a to understand the usage o
|
|
|
328
347
|
unless you're looking for something very specific.
|
|
329
348
|
|
|
330
349
|
|
|
350
|
+
## Utility Functions
|
|
351
|
+
|
|
352
|
+
The package provides several utility functions to enhance and enrich your ODA data analysis:
|
|
353
|
+
|
|
354
|
+
### Adding Human-Readable Names
|
|
355
|
+
|
|
356
|
+
Convert code columns to human-readable names:
|
|
357
|
+
|
|
358
|
+
```python
|
|
359
|
+
from oda_data import OECDClient, add_names_columns
|
|
360
|
+
|
|
361
|
+
# Get indicator data
|
|
362
|
+
client = OECDClient(years=range(2020, 2023))
|
|
363
|
+
data = client.get_indicators("DAC2A.10.1010")
|
|
364
|
+
|
|
365
|
+
# Add human-readable names for code columns
|
|
366
|
+
data = add_names_columns(data, ["recipient_code", "provider_code"])
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
### Adding GNI Share
|
|
370
|
+
|
|
371
|
+
Calculate ODA as a percentage of Gross National Income:
|
|
372
|
+
|
|
373
|
+
```python
|
|
374
|
+
from oda_data import OECDClient, add_gni_share_column
|
|
375
|
+
|
|
376
|
+
# Create client with specific configuration
|
|
377
|
+
client = OECDClient(
|
|
378
|
+
years=range(2018, 2023),
|
|
379
|
+
providers=[4, 302], # France and USA
|
|
380
|
+
currency="USD",
|
|
381
|
+
base_year=2021
|
|
382
|
+
)
|
|
383
|
+
|
|
384
|
+
# Get data with GNI share column
|
|
385
|
+
data = add_gni_share_column(client, "DAC1.10.1010")
|
|
386
|
+
# Returns dataframe with 'gni_share_pct' column
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### Sector Classification
|
|
390
|
+
|
|
391
|
+
Add sector classifications to your data:
|
|
392
|
+
|
|
393
|
+
```python
|
|
394
|
+
from oda_data import add_sectors, add_broad_sectors
|
|
395
|
+
|
|
396
|
+
# Add detailed sector information
|
|
397
|
+
data = add_sectors(data)
|
|
398
|
+
|
|
399
|
+
# Or add broad sector categories
|
|
400
|
+
data = add_broad_sectors(data)
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### Provider and Recipient Groupings
|
|
404
|
+
|
|
405
|
+
Access predefined groupings of providers and recipients:
|
|
406
|
+
|
|
407
|
+
```python
|
|
408
|
+
from oda_data import provider_groupings, recipient_groupings
|
|
409
|
+
|
|
410
|
+
# Get all provider groupings (DAC members, EU27, etc.)
|
|
411
|
+
providers = provider_groupings()
|
|
412
|
+
|
|
413
|
+
# Get all recipient groupings (LDCs, regions, income groups, etc.)
|
|
414
|
+
recipients = recipient_groupings()
|
|
415
|
+
|
|
416
|
+
# Example: Get all DAC members
|
|
417
|
+
dac_members = providers["dac_members"]
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
### Cache Management
|
|
421
|
+
|
|
422
|
+
Control the package's caching behavior:
|
|
423
|
+
|
|
424
|
+
```python
|
|
425
|
+
from oda_data import clear_cache, disable_cache, enable_cache
|
|
426
|
+
|
|
427
|
+
# Clear all cached data
|
|
428
|
+
clear_cache()
|
|
429
|
+
|
|
430
|
+
# Temporarily disable caching (for development/testing)
|
|
431
|
+
disable_cache()
|
|
432
|
+
|
|
433
|
+
# Re-enable caching
|
|
434
|
+
enable_cache()
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
### Compatibility with Version 1.x
|
|
438
|
+
|
|
439
|
+
For users migrating from v1.x, a compatibility layer is available:
|
|
440
|
+
|
|
441
|
+
```python
|
|
442
|
+
from oda_data import ODAData
|
|
443
|
+
|
|
444
|
+
# Use the v1.x style interface
|
|
445
|
+
oda = ODAData(years=range(2018, 2022), donors=[4, 302])
|
|
446
|
+
data = oda.load_indicator("total_oda_flow_net")
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
## Advanced Features
|
|
450
|
+
|
|
451
|
+
### Policy Marker Analysis
|
|
452
|
+
|
|
453
|
+
Extract bilateral ODA by policy marker (gender, climate, etc.):
|
|
454
|
+
|
|
455
|
+
```python
|
|
456
|
+
from oda_data import bilateral_policy_marker
|
|
457
|
+
|
|
458
|
+
# Get gender-focused ODA (principal objective)
|
|
459
|
+
gender_data = bilateral_policy_marker(
|
|
460
|
+
years=range(2015, 2023),
|
|
461
|
+
providers=[4, 302],
|
|
462
|
+
marker="gender",
|
|
463
|
+
marker_score="principal",
|
|
464
|
+
measure="gross_disbursement",
|
|
465
|
+
currency="USD",
|
|
466
|
+
base_year=2021
|
|
467
|
+
)
|
|
468
|
+
|
|
469
|
+
# Available markers: "gender", "environment", "nutrition", "disability", "biodiversity"
|
|
470
|
+
# Available scores: "significant", "principal", "not_targeted", "not_screened",
|
|
471
|
+
# "total_targeted", "total_allocable"
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
### Sector Imputations
|
|
475
|
+
|
|
476
|
+
Access sector imputation functions for multilateral aid analysis:
|
|
477
|
+
|
|
478
|
+
```python
|
|
479
|
+
from oda_data.indicators.research import sector_imputations
|
|
480
|
+
|
|
481
|
+
# Use specialized sector imputation functions
|
|
482
|
+
# (See module documentation for available functions)
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
### AidData Integration
|
|
486
|
+
|
|
487
|
+
Access project-level data from AidData's dataset:
|
|
488
|
+
|
|
489
|
+
```python
|
|
490
|
+
from oda_data import AidDataData, set_data_path
|
|
491
|
+
|
|
492
|
+
set_data_path("path/to/data/folder")
|
|
493
|
+
|
|
494
|
+
# Initialize AidData source
|
|
495
|
+
aiddata = AidDataData(
|
|
496
|
+
years=range(2010, 2020),
|
|
497
|
+
recipients=["Kenya", "Tanzania"],
|
|
498
|
+
sectors=[110, 120] # Sector codes
|
|
499
|
+
)
|
|
500
|
+
|
|
501
|
+
# Read the data (automatically uses bulk download)
|
|
502
|
+
data = aiddata.read()
|
|
503
|
+
```
|
|
504
|
+
|
|
331
505
|
## Key features
|
|
332
506
|
|
|
333
|
-
- **Speed up analysis** - The package handles downloading, cleaning and loading all the data, so you can focus on the
|
|
507
|
+
- **Speed up analysis** - The package handles downloading, cleaning and loading all the data, so you can focus on the
|
|
334
508
|
analysis.
|
|
335
|
-
- **Get data in the currency and prices you need** - ODA data is only available in US dollars (current or constant
|
|
509
|
+
- **Get data in the currency and prices you need** - ODA data is only available in US dollars (current or constant
|
|
336
510
|
prices) and local currency units (current prices). The package allows you to view the data in US dollars, Euros,
|
|
337
511
|
British Pounds and Canadian dollars, in both current and constant prices. We can add any other DAC currency if you
|
|
338
512
|
request it via the [issues page](https://github.com/ONEcampaign/oda_data_package/issues)
|