oda-data 2.1.2__tar.gz → 2.2.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.
Files changed (77) hide show
  1. {oda_data-2.1.2 → oda_data-2.2.0}/PKG-INFO +12 -19
  2. {oda_data-2.1.2 → oda_data-2.2.0}/oda_data/__init__.py +10 -5
  3. oda_data-2.2.0/oda_data.egg-info/PKG-INFO +341 -0
  4. oda_data-2.2.0/oda_data.egg-info/SOURCES.txt +11 -0
  5. oda_data-2.2.0/oda_data.egg-info/dependency_links.txt +1 -0
  6. oda_data-2.2.0/oda_data.egg-info/requires.txt +5 -0
  7. oda_data-2.2.0/oda_data.egg-info/top_level.txt +1 -0
  8. oda_data-2.2.0/pyproject.toml +28 -0
  9. oda_data-2.2.0/setup.cfg +4 -0
  10. oda_data-2.1.2/oda_data/.raw_data/README.md +0 -3
  11. oda_data-2.1.2/oda_data/api/__init__.py +0 -0
  12. oda_data-2.1.2/oda_data/api/constants.py +0 -167
  13. oda_data-2.1.2/oda_data/api/oecd.py +0 -311
  14. oda_data-2.1.2/oda_data/api/representations.py +0 -10
  15. oda_data-2.1.2/oda_data/api/sources.py +0 -648
  16. oda_data-2.1.2/oda_data/clean_data/__init__.py +0 -0
  17. oda_data-2.1.2/oda_data/clean_data/channels.py +0 -635
  18. oda_data-2.1.2/oda_data/clean_data/common.py +0 -182
  19. oda_data-2.1.2/oda_data/clean_data/crs_channel_mapping.csv +0 -306
  20. oda_data-2.1.2/oda_data/clean_data/dtypes.py +0 -167
  21. oda_data-2.1.2/oda_data/clean_data/schema.py +0 -419
  22. oda_data-2.1.2/oda_data/clean_data/validation.py +0 -97
  23. oda_data-2.1.2/oda_data/indicators/__init__.py +0 -0
  24. oda_data-2.1.2/oda_data/indicators/common.py +0 -36
  25. oda_data-2.1.2/oda_data/indicators/crs/__init__.py +0 -0
  26. oda_data-2.1.2/oda_data/indicators/crs/common.py +0 -294
  27. oda_data-2.1.2/oda_data/indicators/crs/crs_functions.py +0 -114
  28. oda_data-2.1.2/oda_data/indicators/crs/crs_indicators.json +0 -98891
  29. oda_data-2.1.2/oda_data/indicators/crs/oecd.py +0 -394
  30. oda_data-2.1.2/oda_data/indicators/crs/one.py +0 -137
  31. oda_data-2.1.2/oda_data/indicators/dac1/__init__.py +0 -0
  32. oda_data-2.1.2/oda_data/indicators/dac1/common.py +0 -38
  33. oda_data-2.1.2/oda_data/indicators/dac1/dac1_functions.py +0 -96
  34. oda_data-2.1.2/oda_data/indicators/dac1/dac1_indicators.json +0 -2560
  35. oda_data-2.1.2/oda_data/indicators/dac1/oecd.py +0 -50
  36. oda_data-2.1.2/oda_data/indicators/dac1/one.py +0 -120
  37. oda_data-2.1.2/oda_data/indicators/dac2a/__init__.py +0 -0
  38. oda_data-2.1.2/oda_data/indicators/dac2a/common.py +0 -10
  39. oda_data-2.1.2/oda_data/indicators/dac2a/dac2a_functions.py +0 -17
  40. oda_data-2.1.2/oda_data/indicators/dac2a/dac2a_indicators.json +0 -423
  41. oda_data-2.1.2/oda_data/indicators/dac2a/oecd.py +0 -40
  42. oda_data-2.1.2/oda_data/indicators/dac2a/one.py +0 -39
  43. oda_data-2.1.2/oda_data/indicators/indicator.py +0 -21
  44. oda_data-2.1.2/oda_data/indicators/research/__init__.py +0 -0
  45. oda_data-2.1.2/oda_data/indicators/research/eu.py +0 -146
  46. oda_data-2.1.2/oda_data/indicators/research/policy_markers.py +0 -124
  47. oda_data-2.1.2/oda_data/indicators/research/sector_imputations.py +0 -377
  48. oda_data-2.1.2/oda_data/settings/crs_flow_types.json +0 -14
  49. oda_data-2.1.2/oda_data/settings/crs_modalities.json +0 -90
  50. oda_data-2.1.2/oda_data/settings/crs_policy_markers.json +0 -14
  51. oda_data-2.1.2/oda_data/settings/crs_purpose.json +0 -182
  52. oda_data-2.1.2/oda_data/settings/crs_type_of_finance.json +0 -94
  53. oda_data-2.1.2/oda_data/settings/dac1_aid_flow_types.json +0 -558
  54. oda_data-2.1.2/oda_data/settings/dac2a_aid_type.json +0 -24
  55. oda_data-2.1.2/oda_data/settings/flow_types.json +0 -11
  56. oda_data-2.1.2/oda_data/settings/indicators.json +0 -1144
  57. oda_data-2.1.2/oda_data/settings/key_columns.json +0 -95
  58. oda_data-2.1.2/oda_data/settings/provider_groupings.json +0 -325
  59. oda_data-2.1.2/oda_data/settings/recipient_groupings.json +0 -677
  60. oda_data-2.1.2/oda_data/settings/v1_indicators_mapping.json +0 -283
  61. oda_data-2.1.2/oda_data/tools/__init__.py +0 -0
  62. oda_data-2.1.2/oda_data/tools/cache.py +0 -81
  63. oda_data-2.1.2/oda_data/tools/compatibility.py +0 -74
  64. oda_data-2.1.2/oda_data/tools/gni.py +0 -94
  65. oda_data-2.1.2/oda_data/tools/groupings.py +0 -30
  66. oda_data-2.1.2/oda_data/tools/names/__init__.py +0 -0
  67. oda_data-2.1.2/oda_data/tools/names/add.py +0 -54
  68. oda_data-2.1.2/oda_data/tools/names/create_mapping.py +0 -207
  69. oda_data-2.1.2/oda_data/tools/names/crs_names.json +0 -1186
  70. oda_data-2.1.2/oda_data/tools/names/dac1_names.json +0 -216
  71. oda_data-2.1.2/oda_data/tools/names/dac2a_names.json +0 -478
  72. oda_data-2.1.2/oda_data/tools/sector_lists.py +0 -292
  73. oda_data-2.1.2/pyproject.toml +0 -35
  74. {oda_data-2.1.2 → oda_data-2.2.0}/LICENSE +0 -0
  75. {oda_data-2.1.2 → oda_data-2.2.0}/README.md +0 -0
  76. {oda_data-2.1.2 → oda_data-2.2.0}/oda_data/config.py +0 -0
  77. {oda_data-2.1.2 → oda_data-2.2.0}/oda_data/logger.py +0 -0
@@ -1,27 +1,21 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: oda_data
3
- Version: 2.1.2
3
+ Version: 2.2.0
4
4
  Summary: A python package to work with Official Development Assistance data from the OECD DAC.
5
+ Author-email: Jorge Rivera <jorge.rivera@one.org>, Miguel Haro Ruiz <miguel.haroruiz@one.org>
5
6
  License: MIT
6
- Author: Jorge Rivera
7
- Author-email: jorge.rivera@one.org
8
- Requires-Python: >=3.10,<4.0
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.10
12
- Classifier: Programming Language :: Python :: 3.11
13
- Classifier: Programming Language :: Python :: 3.12
14
- Classifier: Programming Language :: Python :: 3.13
15
- Requires-Dist: cachetools (>=5.5.1,<7.0.0)
16
- Requires-Dist: oda-reader (>=1.2,<2.0)
17
- Requires-Dist: pandas (>=2)
18
- Requires-Dist: pyarrow (>=14,<22)
19
- Requires-Dist: pydeflate (>=2.0.1)
20
- Requires-Dist: thefuzz (>=0.22.1)
21
- Project-URL: Documentation, https://github.com/ONEcampaign/oda_data_package
22
7
  Project-URL: Homepage, https://github.com/ONEcampaign/oda_data_package
23
8
  Project-URL: Repository, https://github.com/ONEcampaign/oda_data_package
9
+ Project-URL: Documentation, https://github.com/ONEcampaign/oda_data_package
10
+ Requires-Python: >=3.10
24
11
  Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: cachetools>=6.2.0
14
+ Requires-Dist: pandas[excel,parquet,performance]>=2.3.2
15
+ Requires-Dist: pydeflate>=2.1.3
16
+ Requires-Dist: reader>=3.18
17
+ Requires-Dist: thefuzz>=0.22.1
18
+ Dynamic: license-file
25
19
 
26
20
  [![pypi](https://img.shields.io/pypi/v/oda_data.svg)](https://pypi.org/project/oda_data/)
27
21
  [![python](https://img.shields.io/pypi/pyversions/oda_data.svg)](https://pypi.org/project/oda_data/)
@@ -345,4 +339,3 @@ request it via the [issues page](https://github.com/ONEcampaign/oda_data_package
345
339
 
346
340
  ## Contributing
347
341
  Interested in contributing to the package? Please reach out.
348
-
@@ -2,29 +2,33 @@ from importlib.metadata import version
2
2
 
3
3
  __version__ = version("oda_data")
4
4
 
5
+ from oda_reader import clear_cache, disable_cache, enable_cache, set_cache_dir
6
+
5
7
  from oda_data import tools
6
- from oda_reader import set_cache_dir, disable_cache, enable_cache, clear_cache
7
8
  from oda_data.api.oecd import OECDClient
8
9
  from oda_data.api.sources import (
10
+ AidDataData,
11
+ CRSData,
9
12
  DAC1Data,
10
13
  DAC2AData,
11
14
  MultiSystemData,
12
- CRSData,
13
- AidDataData,
14
15
  )
15
16
  from oda_data.indicators.research.policy_markers import bilateral_policy_marker
16
17
  from oda_data.tools.compatibility import ODAData
17
18
  from oda_data.tools.gni import add_gni_share_column
18
19
  from oda_data.tools.groupings import provider_groupings, recipient_groupings
19
20
  from oda_data.tools.names.add import add_names_columns
20
- from oda_data.tools.sector_lists import add_sectors, add_broad_sectors
21
+ from oda_data.tools.sector_lists import add_broad_sectors, add_sectors
22
+ from oda_data.indicators.research import sector_imputations
21
23
 
22
24
 
23
25
  def set_data_path(path):
24
26
  from pathlib import Path
25
- from oda_data.config import ODAPaths
27
+
26
28
  from pydeflate import set_pydeflate_path
27
29
 
30
+ from oda_data.config import ODAPaths
31
+
28
32
  """Set the path to the data folder."""
29
33
  global ODAPaths
30
34
 
@@ -56,4 +60,5 @@ __all__ = [
56
60
  "disable_cache",
57
61
  "enable_cache",
58
62
  "clear_cache",
63
+ "sector_imputations",
59
64
  ]
@@ -0,0 +1,341 @@
1
+ Metadata-Version: 2.4
2
+ Name: oda_data
3
+ Version: 2.2.0
4
+ Summary: A python package to work with Official Development Assistance data from the OECD DAC.
5
+ Author-email: Jorge Rivera <jorge.rivera@one.org>, Miguel Haro Ruiz <miguel.haroruiz@one.org>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/ONEcampaign/oda_data_package
8
+ Project-URL: Repository, https://github.com/ONEcampaign/oda_data_package
9
+ Project-URL: Documentation, https://github.com/ONEcampaign/oda_data_package
10
+ Requires-Python: >=3.10
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: cachetools>=6.2.0
14
+ Requires-Dist: pandas[excel,parquet,performance]>=2.3.2
15
+ Requires-Dist: pydeflate>=2.1.3
16
+ Requires-Dist: reader>=3.18
17
+ Requires-Dist: thefuzz>=0.22.1
18
+ Dynamic: license-file
19
+
20
+ [![pypi](https://img.shields.io/pypi/v/oda_data.svg)](https://pypi.org/project/oda_data/)
21
+ [![python](https://img.shields.io/pypi/pyversions/oda_data.svg)](https://pypi.org/project/oda_data/)
22
+ [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
23
+
24
+ # The ODA Data Package
25
+ 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
+
27
+ **Note: This is the new version of the package (V2). This release includes many breaking changes and previous workflows
28
+ will not work. The previous 1.5.x version remains available on PyPI and we will continue to support it at least until
29
+ August 2025.**
30
+
31
+ Interacting with the DAC databases can be a complex task. There are many databases, tables, and web interfaces which
32
+ can be used to get the data you need. This means that getting the right ODA data can require expert knowledge not only
33
+ of ODA, but also of how the DAC databases and tools are organised.
34
+
35
+ This package aims to simplify this process and make it easier for users to get the data they need.
36
+
37
+ Please submit questions, feedback or requests via
38
+ the [issues page](https://github.com/ONEcampaign/oda_data_package/issues).
39
+
40
+ ## Getting started
41
+
42
+ ### Installation
43
+
44
+ The latest version of the package can be installed using pip:
45
+
46
+ ```bash
47
+ pip install oda-data --upgrade
48
+ ```
49
+
50
+ The package is compatible with Python 3.10 and above.
51
+
52
+ ## Basic usage
53
+
54
+ Most users can get the data they need by using the `OECDClient` class.
55
+
56
+ An object of this class can handle:
57
+ - getting data for specific indicators (one or more)
58
+ - filtering the data for specific donors, recipients(if relevant), years.
59
+ - returning the data in a variety of currency/prices combinations.
60
+
61
+ At a minimum, the class expects users to specify years. By default it would then get
62
+ data for all providers, for all recipients (if applicable), as net disbursements in USD, in current prices,
63
+ using the OECD data-explorer API.
64
+
65
+ In the example below, we get all data for Total ODA (net disbursements), for 2012 to 2022.
66
+
67
+ ```python
68
+ from oda_data import OECDClient, set_data_path
69
+
70
+ # set the path to the folder where the raw data should be cached
71
+ set_data_path("path/to/data/folder")
72
+
73
+ # create object, specifying key details of the desired output
74
+ indicator = OECDClient(years=range(2012, 2023))
75
+
76
+ # Get the desired indicator
77
+ data = indicator.get_indicators("DAC1.10.1010")
78
+ ```
79
+
80
+ Here's an example to get Bilateral ODA for France and the US, for 2020 and 2021. The data will be in grant equivalents, in constant 2019 Euros.
81
+
82
+ ```python
83
+ from oda_data import OECDClient, set_data_path
84
+
85
+ # set the path to the folder where the data should be stored
86
+ set_data_path("path/to/data/folder")
87
+
88
+ # create object, specifying key details of the desired output
89
+ client = OECDClient(
90
+ years=[2020, 2021],
91
+ providers=[4, 302], # Example provider codes
92
+ measure="grant_equivalent", # Options: "commitment", "grant_equivalent", etc.
93
+ currency="EUR", # Default is USD; others include EUR, GBP, CAD, LCU
94
+ base_year=2019, # Adjust data to constant prices of the specified year
95
+ )
96
+
97
+ # Get the desired indicator
98
+ data = client.get_indicators("DAC1.10.11015")
99
+ ```
100
+
101
+ If you intend to download many indicators, we recommend using the Bulk download file instead. The OECD data-explorer
102
+ API has pretty low usage limits, and you could get a temporary block if you make too many repeated calls. While downloading a particular bulk file may time a few minutes, subsequently getting indicator data is much faster.
103
+
104
+ ```python
105
+ from oda_data import OECDClient, set_data_path
106
+
107
+ # set the path to the folder where the data should be stored
108
+ set_data_path("path/to/data/folder")
109
+
110
+ # define a list of indicators to get
111
+ research_indicators = ["DAC1.10.1100", "DAC1.10.1410", "DAC1.10.2102", "DAC1.10.1500"]
112
+
113
+ # create object, specifying key details of the desired output
114
+ client = OECDClient(
115
+ years=[2019, 2020, 2021],
116
+ measure="net_disbursement", # Options: "commitment", "grant_equivalent", etc.
117
+ currency="LCU", # To get the data in providers' own currencies
118
+ use_bulk_download=True
119
+ )
120
+
121
+ # Get the desired indicators
122
+ data = client.get_indicators(research_indicators)
123
+ ```
124
+
125
+ ### OECDClient
126
+
127
+ Over three thousand indicators are currently supported. They are mostly produced by filtering (and sometimes aggregating) data from the different DAC Tables and databases.
128
+
129
+ You can get a dictionary with all supported indicators, with their code, name, description and source by using the `.available_indicators()` method:
130
+
131
+ ```python
132
+ from oda_data import OECDClient
133
+
134
+ all_indicators = OECDClient.available_indicators()
135
+ ```
136
+
137
+ Alternatively, you can export the indicators to a CSV by using the `.export_available_indicators()` method.
138
+
139
+ ```python
140
+ from oda_data import OECDClient
141
+
142
+ OECDClient.export_available_indicators(export_folder="path/to/folder/")
143
+ ```
144
+
145
+ ### Providers
146
+ You can get a dictionary with all available providers, with their code and name, by using the `.available_providers()` method:
147
+
148
+ ```python
149
+ from oda_data import OECDClient
150
+
151
+ providers = OECDClient.available_providers()
152
+ ```
153
+
154
+ ### Recipients
155
+ You can get a dictionary with all available recipients, with their code and name, by using the `.available_recipients()` method:
156
+
157
+ ```python
158
+ from oda_data import OECDClient
159
+
160
+ recipients = OECDClient.available_recipients()
161
+ ```
162
+
163
+ ### Currencies
164
+ You can get a dictionary with all available currencies, with their code and name, by using the `.available_currencies()` method:
165
+
166
+ ```python
167
+ from oda_data import OECDClient
168
+
169
+ currencies = OECDClient.available_currencies()
170
+ ```
171
+
172
+ ## Accessing the data
173
+ For more advanced users, you can use this package to get and work with different tables and databases from the OECD DAC.
174
+
175
+ ### DAC 1
176
+ The `DAC1Data` class can retrieve and return DAC 1 data.
177
+
178
+ You can optionally specify:
179
+ - years: to filter the data for specific years
180
+ - providers: to filter the data for specific providers (based on their code).
181
+ - indicators: to filter the data for a specific indicator (for DAC1 this means AIDTYPE_CODE)
182
+
183
+ Not specifying any or all of these parameters will return all the available data.
184
+
185
+ After instantiating the object, you can call:
186
+ - `download`: to download the data from the data-explorer API or the bulk download service. This method returns a DataFrame.
187
+ - `read`: to read data as stored in the specified folder. If the data is not available, it will be downloaded.
188
+
189
+ ```python
190
+ from oda_data import DAC1Data, set_data_path
191
+
192
+ # set the path to the folder where the data should be stored
193
+ set_data_path("path/to/data/folder")
194
+
195
+ # instantiate a DAC1Data object
196
+ dac1 = DAC1Data()
197
+
198
+ # Perform a bulk download
199
+ dac1.download(bulk=True)
200
+
201
+ # Read the stored data in full
202
+ data = dac1.read(using_bulk_download=True)
203
+ ```
204
+
205
+ Use cases can be quite elaborate. For example, here we will download data for France for 2022 only, for total ODA (net flows).
206
+
207
+ When reading, we will also filter to get only current prices, and to only read a few columns.
208
+
209
+ ```python
210
+ from oda_data import DAC1Data, set_data_path
211
+
212
+ # set the path to the folder where the data should be stored
213
+ set_data_path("path/to/data/folder")
214
+
215
+ # instantiate a DAC1Data object
216
+ dac1 = DAC1Data(years=2022, providers=4, indicators=1010)
217
+
218
+ # Get the data by calling on read. It will be downloaded since it isn't already available.
219
+ data = dac1.read(
220
+ additional_filters=[("amount_type", "==", "Current prices")],
221
+ columns=["donor_name", "aid_type", "fund_flows", "amount_type", "year", "value"],
222
+ )
223
+ ```
224
+
225
+
226
+ ### DAC 2A
227
+ The `DAC2AData` class can retrieve and return DAC2a data.
228
+
229
+ You can optionally specify:
230
+ - years: to filter the data for specific years
231
+ - providers: to filter the data for specific providers (based on their code).
232
+ - recipients: to filter the data for specific recipients (based on their code).
233
+ - indicators: to filter the data for a specific indicator (for DAC2a this means AIDTYPE_CODE)
234
+
235
+ Not specifying any or all of these parameters will return all the available data.
236
+
237
+ After instantiating the object, you can call:
238
+ - `download`: to download the data from the data-explorer API or the bulk download service. This method returns a DataFrame.
239
+ - `read`: to read data as stored in the specified folder. If the data is not available, it will be downloaded.
240
+
241
+ ```python
242
+ from oda_data import DAC2AData, set_data_path
243
+
244
+ # set the path to the folder where the data should be stored
245
+ set_data_path("path/to/data/folder")
246
+
247
+ # instantiate a DAC1Data object
248
+ dac2a = DAC2AData()
249
+
250
+ # Perform a bulk download
251
+ dac2a.download(bulk=True)
252
+
253
+ # Read the stored data in full
254
+ data = dac2a.read(using_bulk_download=True)
255
+ ```
256
+
257
+ Use cases can be quite elaborate. For example, here we will download data for France - Togo for 2023 only, for imputed
258
+ multilateral aid.
259
+
260
+ When reading, we will also filter to get only current prices, and to only read a few columns.
261
+
262
+ ```python
263
+ from oda_data import DAC2AData, set_data_path
264
+
265
+ # set the path to the folder where the data should be stored
266
+ set_data_path("path/to/data/folder")
267
+
268
+ # instantiate a DAC2aData object
269
+ dac2a = DAC2AData(years=2022, providers=4, recipients=283, indicators=106)
270
+
271
+ # Get the data by calling on read. It will be downloaded since it isn't already available.
272
+ data = dac2a.read(
273
+ additional_filters=[("amount_type", "==", "Current prices")],
274
+ columns=[
275
+ "donor_name",
276
+ "recipient_name",
277
+ "aid_type",
278
+ "flow_type_name",
279
+ "amount_type",
280
+ "year",
281
+ "value",
282
+ ],
283
+ )
284
+ ```
285
+
286
+ ### CRS
287
+ The `CRSData` class can retrieve and return CRS data.
288
+
289
+ You can optionally specify:
290
+ - years: to filter the data for specific years
291
+ - providers: to filter the data for specific providers (based on their code).
292
+ - recipients: to filter the data for specific recipients (based on their code).
293
+
294
+ Not specifying any or all of these parameters will return all the available data.
295
+
296
+ 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
298
+ bulk option when using the CRS class.
299
+
300
+ ```python
301
+ from oda_data import CRSData, set_data_path
302
+
303
+ # set the path to the folder where the data should be stored
304
+ set_data_path("path/to/data/folder")
305
+
306
+ # instantiate a CRSData object
307
+ crs = CRSData(years=range(2010, 2024))
308
+
309
+ # Get the data by calling on read. It will be downloaded since it isn't already available.
310
+ data = crs.read(using_bulk_download=True)
311
+ ```
312
+
313
+
314
+ ### MultiSystem
315
+ The `MultiSystemData` class can retrieve and return Providers Total Use of the Multilateral System data.
316
+
317
+ You can optionally specify:
318
+ - years: to filter the data for specific years
319
+ - providers: to filter the data for specific providers (based on their code).
320
+ - recipients: to filter the data for specific recipients (based on their code).
321
+ - indicators: to filter for specific indicators (aid_to_or_thru in this case)
322
+ - sectors: to filter for specific sectors (if its aid through the multilateral system only)
323
+
324
+ Not specifying any or all of these parameters will return all the available data.
325
+
326
+ You can refer to the examples above for DAC1 and DAC2a to understand the usage of these classes.
327
+ **Note**: given the speed and rate-limiting of the dac-explorer APIs, consider using the bulk option
328
+ unless you're looking for something very specific.
329
+
330
+
331
+ ## Key features
332
+
333
+ - **Speed up analysis** - The package handles downloading, cleaning and loading all the data, so you can focus on the
334
+ analysis.
335
+ - **Get data in the currency and prices you need** - ODA data is only available in US dollars (current or constant
336
+ prices) and local currency units (current prices). The package allows you to view the data in US dollars, Euros,
337
+ British Pounds and Canadian dollars, in both current and constant prices. We can add any other DAC currency if you
338
+ request it via the [issues page](https://github.com/ONEcampaign/oda_data_package/issues)
339
+
340
+ ## Contributing
341
+ Interested in contributing to the package? Please reach out.
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ oda_data/__init__.py
5
+ oda_data/config.py
6
+ oda_data/logger.py
7
+ oda_data.egg-info/PKG-INFO
8
+ oda_data.egg-info/SOURCES.txt
9
+ oda_data.egg-info/dependency_links.txt
10
+ oda_data.egg-info/requires.txt
11
+ oda_data.egg-info/top_level.txt
@@ -0,0 +1,5 @@
1
+ cachetools>=6.2.0
2
+ pandas[excel,parquet,performance]>=2.3.2
3
+ pydeflate>=2.1.3
4
+ reader>=3.18
5
+ thefuzz>=0.22.1
@@ -0,0 +1 @@
1
+ oda_data
@@ -0,0 +1,28 @@
1
+ [project]
2
+ name = "oda_data"
3
+ version = "2.2.0"
4
+ description = "A python package to work with Official Development Assistance data from the OECD DAC."
5
+ requires-python = ">=3.10"
6
+
7
+ license = {text = "MIT"}
8
+ readme = "README.md"
9
+ authors = [
10
+ {name = "Jorge Rivera", email = "jorge.rivera@one.org"},
11
+ {name = "Miguel Haro Ruiz", email = "miguel.haroruiz@one.org"}
12
+ ]
13
+
14
+ dependencies = [
15
+ "cachetools>=6.2.0",
16
+ "pandas[excel,parquet,performance]>=2.3.2",
17
+ "pydeflate>=2.1.3",
18
+ "reader>=3.18",
19
+ "thefuzz>=0.22.1",
20
+ ]
21
+
22
+ [project.urls]
23
+ Homepage = "https://github.com/ONEcampaign/oda_data_package"
24
+ Repository = "https://github.com/ONEcampaign/oda_data_package"
25
+ Documentation = "https://github.com/ONEcampaign/oda_data_package"
26
+
27
+ [tool.setuptools.packages.find]
28
+ include = ["oda_data"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -1,3 +0,0 @@
1
- # Raw Data
2
- This directory is used to store the raw data, as downloaded from the OECD website, if the user does not provide
3
- a path when importing the package.
File without changes
@@ -1,167 +0,0 @@
1
- # Constants
2
- from typing import Literal
3
-
4
- from oda_data.clean_data.schema import ODASchema
5
-
6
- MarkerScore = Literal[
7
- "significant",
8
- "principal",
9
- "not_targeted",
10
- "not_screened",
11
- "total_targeted",
12
- "total_allocable",
13
- ]
14
-
15
- PolicyMarker = Literal[
16
- "gender", "environment", "nutrition", "disability", "biodiversity"
17
- ]
18
-
19
- CURRENCIES: dict[str, str] = {
20
- "USD": "USA",
21
- "EUR": "EUI",
22
- "GBP": "GBR",
23
- "CAD": "CAN",
24
- "LCU": "LCU",
25
- }
26
-
27
- PRICES = {
28
- "DAC1": {"column": "amounttype_code"},
29
- "DAC2A": {"column": "data_type_code"},
30
- }
31
-
32
- MEASURES: dict[str, dict] = {
33
- "DAC1": {
34
- "commitment": {
35
- "column": "flows_code",
36
- "filter": 1150,
37
- },
38
- "commitment_grant": {
39
- "column": "flows_code",
40
- "filter": 1151,
41
- },
42
- "commitment_non_grant": {
43
- "column": "flows_code",
44
- "filter": 1152,
45
- },
46
- "grant_equivalent": {
47
- "column": "flows_code",
48
- "filter": 1160,
49
- },
50
- "net_disbursement": {
51
- "column": "flows_code",
52
- "filter": 1140,
53
- },
54
- "net_disbursement_grant": {
55
- "column": "flows_code",
56
- "filter": 1121,
57
- },
58
- "gross_disbursement": {
59
- "column": "flows_code",
60
- "filter": 1120,
61
- },
62
- "gross_disbursement_non_grant": {
63
- "column": "flows_code",
64
- "filter": 1122,
65
- },
66
- "received": {
67
- "column": "flows_code",
68
- "filter": 1130,
69
- },
70
- },
71
- "DAC2A": {
72
- "net_disbursement": {
73
- "column": "flow_type_code",
74
- "filter": "D",
75
- },
76
- "gross_disbursement": {
77
- "column": "flow_type_code",
78
- "filter": "D",
79
- },
80
- },
81
- "CRS": {
82
- "commitment": {"column": "usd_commitment", "filter": None},
83
- "grant_equivalent": {"column": "usd_grant_equiv", "filter": None},
84
- "gross_disbursement": {"column": "usd_disbursement", "filter": None},
85
- "received": {"column": "usd_received", "filter": None},
86
- "expert_commitment": {"column": "usd_expert_commitment", "filter": None},
87
- "expert_extended": {"column": "usd_expert_extended", "filter": None},
88
- "export_credit": {"column": "usd_export_credit", "filter": None},
89
- },
90
- "Multisystem": {
91
- "commitment": {
92
- "column": "flow_type",
93
- "filter": "Commitments",
94
- },
95
- "gross_disbursement": {
96
- "column": "flow_type",
97
- "filter": "Disbursements",
98
- },
99
- },
100
- }
101
-
102
- Measure = Literal[
103
- "commitment",
104
- "commitment_grant",
105
- "commitment_non_grant",
106
- "expert_commitment",
107
- "expert_extended",
108
- "export_credit",
109
- "grant_equivalent",
110
- "gross_disbursement",
111
- "gross_disbursement_non_grant",
112
- "net_disbursement",
113
- "net_disbursement_grant",
114
- "received",
115
- ]
116
-
117
-
118
- _EXCLUDE = [
119
- "amounttype_code",
120
- "amount_type",
121
- "base_period",
122
- "data_type_code",
123
- "unit_measure_name",
124
- "unit_measure_code",
125
- ]
126
-
127
- EXTENDED_PROVIDER_PURPOSE_GROUPER = [
128
- ODASchema.PROVIDER_CODE,
129
- ODASchema.PROVIDER_NAME,
130
- ODASchema.AGENCY_CODE,
131
- ODASchema.AGENCY_NAME,
132
- ODASchema.RECIPIENT_CODE,
133
- ODASchema.FLOW_MODALITY,
134
- ODASchema.FINANCE_TYPE,
135
- ODASchema.PURPOSE_CODE,
136
- ODASchema.YEAR,
137
- ODASchema.CURRENCY,
138
- ODASchema.PRICES,
139
- ]
140
-
141
- PROVIDER_PURPOSE_GROUPER = [
142
- ODASchema.PROVIDER_CODE,
143
- ODASchema.PROVIDER_NAME,
144
- ODASchema.AGENCY_CODE,
145
- ODASchema.AGENCY_NAME,
146
- ODASchema.PURPOSE_CODE,
147
- ODASchema.RECIPIENT_CODE,
148
- ODASchema.YEAR,
149
- ODASchema.CURRENCY,
150
- ODASchema.PRICES,
151
- ]
152
-
153
- CHANNEL_PURPOSE_GROUPER = [
154
- ODASchema.CHANNEL_CODE,
155
- ODASchema.PURPOSE_CODE,
156
- ODASchema.RECIPIENT_CODE,
157
- ODASchema.YEAR,
158
- ODASchema.CURRENCY,
159
- ODASchema.PRICES,
160
- ]
161
-
162
- CHANNEL_PURPOSE_SHARE_GROUPER = [
163
- ODASchema.YEAR,
164
- ODASchema.CURRENCY,
165
- ODASchema.PRICES,
166
- ODASchema.CHANNEL_CODE,
167
- ]