unicefdata 2.1.0__tar.gz → 2.3.2__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.
- unicefdata-2.3.2/PKG-INFO +874 -0
- unicefdata-2.3.2/README.md +833 -0
- {unicefdata-2.1.0 → unicefdata-2.3.2}/pyproject.toml +3 -3
- {unicefdata-2.1.0 → unicefdata-2.3.2}/tests/test_404_fallback.py +107 -107
- unicefdata-2.3.2/tests/test_deterministic.py +341 -0
- {unicefdata-2.1.0 → unicefdata-2.3.2}/tests/test_dimensions.py +95 -95
- unicefdata-2.3.2/tests/test_direct_metadata.py +53 -0
- unicefdata-2.3.2/tests/test_discovery.py +210 -0
- {unicefdata-2.1.0 → unicefdata-2.3.2}/tests/test_download.py +40 -40
- unicefdata-2.3.2/tests/test_error_conditions.py +205 -0
- {unicefdata-2.1.0 → unicefdata-2.3.2}/tests/test_fallback_fix.py +83 -83
- unicefdata-2.3.2/tests/test_hardcoded_removal_validation.py +226 -0
- {unicefdata-2.1.0 → unicefdata-2.3.2}/tests/test_list_dataflows.py +94 -94
- {unicefdata-2.1.0 → unicefdata-2.3.2}/tests/test_metadata_manager.py +63 -57
- {unicefdata-2.1.0 → unicefdata-2.3.2}/tests/test_pipeline_mocked.py +192 -192
- unicefdata-2.3.2/tests/test_python_integration.py +69 -0
- unicefdata-2.3.2/tests/test_quick_python.py +25 -0
- unicefdata-2.3.2/tests/test_sdmx_client_dataflow.py +114 -0
- unicefdata-2.3.2/tests/test_sync_pipeline.py +230 -0
- unicefdata-2.3.2/tests/test_transformations.py +320 -0
- {unicefdata-2.1.0 → unicefdata-2.3.2}/tests/test_unicef_api.py +114 -114
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/__init__.py +84 -83
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/config.py +156 -156
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/config_loader.py +270 -270
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/flows.py +217 -217
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/indicator_registry.py +776 -775
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/_unicefdata_sync_history.yaml +115 -115
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/_dataflow_fallback_sequences.yaml +278 -278
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/_unicefdata_codelists.yaml +641 -641
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/_unicefdata_countries.yaml +464 -464
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/_unicefdata_dataflows.yaml +639 -639
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/_unicefdata_indicators.yaml +7270 -7270
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/_unicefdata_indicators_metadata.yaml +12860 -12860
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/_unicefdata_regions.yaml +123 -123
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflow_index.yaml +356 -356
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CAUSE_OF_DEATH.yaml +52 -52
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CCRI.yaml +137 -137
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CHILD_RELATED_SDG.yaml +144 -144
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CHLD_PVTY.yaml +77 -77
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME.yaml +142 -142
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_CAUSE_OF_DEATH.yaml +96 -96
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_COUNTRY_PROFILES_DATA.yaml +100 -100
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_DF_2021_WQ.yaml +280 -280
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNATIONAL.yaml +202 -202
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_AGO.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_BDI.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_BEN.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_BGD.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_CMR.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_ETH.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_GHA.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_GIN.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_HTI.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_KEN.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_LAO.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_LBR.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_LSO.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_MDG.yaml +185 -185
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_MLI.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_MMR.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_MRT.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_MWI.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_NAM.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_NGA.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_NPL.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_PAK.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_RWA.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_SEN.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_SLE.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_TCD.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_TGO.yaml +174 -174
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_TZA.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_UGA.yaml +178 -178
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_ZMB.yaml +178 -178
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/CME_SUBNAT_ZWE.yaml +179 -179
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/COVID.yaml +145 -145
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/COVID_CASES.yaml +89 -89
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/DM.yaml +121 -121
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/DM_PROJECTIONS.yaml +118 -118
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/ECD.yaml +272 -272
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/ECONOMIC.yaml +103 -103
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/EDUCATION.yaml +156 -156
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/EDUCATION_FLS.yaml +66 -66
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/EDUCATION_UIS_SDG.yaml +119 -119
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/FUNCTIONAL_DIFF.yaml +250 -250
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/GENDER.yaml +138 -138
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/GLOBAL_DATAFLOW.yaml +550 -550
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/HIV_AIDS.yaml +205 -205
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/IMMUNISATION.yaml +155 -155
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/MG.yaml +147 -147
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/MNCH.yaml +285 -285
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/NUTRITION.yaml +293 -293
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/PT.yaml +320 -320
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/PT_CM.yaml +297 -297
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/PT_CM_SUBNATIONAL.yaml +228 -228
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/PT_CONFLICT.yaml +116 -116
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/PT_FGM.yaml +292 -292
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/SDG_PROG_ASSESSMENT.yaml +124 -124
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/SOC_PROTECTION.yaml +140 -140
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/WASH_HEALTHCARE_FACILITY.yaml +139 -139
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/WASH_HOUSEHOLDS.yaml +146 -146
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/WASH_HOUSEHOLD_MH.yaml +122 -122
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/WASH_HOUSEHOLD_SUBNAT.yaml +219 -219
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/WASH_SCHOOLS.yaml +123 -123
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/dataflows/WT.yaml +237 -237
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/current/unicef_indicators_metadata.yaml +4742 -4419
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/vintages/2025-12-03/codelists.yaml +574 -574
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/vintages/2025-12-03/dataflows.yaml +626 -626
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/vintages/2025-12-03/indicators.yaml +230 -230
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/vintages/2025-12-03/summary.yaml +5 -5
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/vintages/2025-12-05/_unicefdata_codelists.yaml +628 -628
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/vintages/2025-12-05/_unicefdata_countries.yaml +462 -462
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/vintages/2025-12-05/_unicefdata_dataflows.yaml +630 -630
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/vintages/2025-12-05/_unicefdata_indicators.yaml +248 -248
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/vintages/2025-12-05/_unicefdata_regions.yaml +121 -121
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/vintages/2025-12-05/summary.yaml +7 -7
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/vintages/2025-12-07/_unicefdata_codelists.yaml +633 -633
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/vintages/2025-12-07/_unicefdata_countries.yaml +464 -464
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/vintages/2025-12-07/_unicefdata_dataflows.yaml +630 -630
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/vintages/2025-12-07/_unicefdata_indicators.yaml +249 -249
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/vintages/2025-12-07/_unicefdata_regions.yaml +123 -123
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/vintages/2025-12-07/summary.yaml +7 -7
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/vintages/2026-01-21/_unicefdata_codelists.yaml +641 -641
- {unicefdata-2.1.0/unicefdata/metadata/vintages/2026-01-25 → unicefdata-2.3.2/unicefdata/metadata/vintages/2026-01-21}/_unicefdata_countries.yaml +464 -464
- {unicefdata-2.1.0/unicefdata/metadata/vintages/2026-01-25 → unicefdata-2.3.2/unicefdata/metadata/vintages/2026-01-21}/_unicefdata_dataflows.yaml +639 -639
- {unicefdata-2.1.0/unicefdata/metadata/vintages/2026-01-25 → unicefdata-2.3.2/unicefdata/metadata/vintages/2026-01-21}/_unicefdata_indicators.yaml +9674 -9674
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/vintages/2026-01-21/_unicefdata_regions.yaml +123 -123
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/vintages/2026-01-21/summary.yaml +7 -7
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/vintages/2026-01-25/_unicefdata_codelists.yaml +641 -641
- {unicefdata-2.1.0/unicefdata/metadata/vintages/2026-01-21 → unicefdata-2.3.2/unicefdata/metadata/vintages/2026-01-25}/_unicefdata_countries.yaml +464 -464
- {unicefdata-2.1.0/unicefdata/metadata/vintages/2026-01-21 → unicefdata-2.3.2/unicefdata/metadata/vintages/2026-01-25}/_unicefdata_dataflows.yaml +639 -639
- {unicefdata-2.1.0/unicefdata/metadata/vintages/2026-01-21 → unicefdata-2.3.2/unicefdata/metadata/vintages/2026-01-25}/_unicefdata_indicators.yaml +9674 -9674
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/vintages/2026-01-25/_unicefdata_regions.yaml +123 -123
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata/vintages/2026-01-25/summary.yaml +7 -7
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata.py +1084 -1084
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/metadata_manager.py +281 -281
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/run_sync.py +20 -20
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/schema_cache.py +283 -283
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/schema_sync.py +561 -561
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/sdmx.py +214 -166
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/sdmx_client.py +1399 -1388
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/unicefdata.py +1203 -1192
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/utils.py +616 -616
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata/yaml_formatter.py +333 -333
- unicefdata-2.3.2/unicefdata.egg-info/PKG-INFO +874 -0
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata.egg-info/SOURCES.txt +10 -0
- unicefdata-2.1.0/PKG-INFO +0 -358
- unicefdata-2.1.0/README.md +0 -317
- unicefdata-2.1.0/unicefdata.egg-info/PKG-INFO +0 -358
- {unicefdata-2.1.0 → unicefdata-2.3.2}/LICENSE +0 -0
- {unicefdata-2.1.0 → unicefdata-2.3.2}/setup.cfg +0 -0
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata.egg-info/dependency_links.txt +0 -0
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata.egg-info/requires.txt +0 -0
- {unicefdata-2.1.0 → unicefdata-2.3.2}/unicefdata.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,874 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: unicefdata
|
|
3
|
+
Version: 2.3.2
|
|
4
|
+
Summary: Python library for downloading UNICEF indicators via SDMX API
|
|
5
|
+
Author-email: Joao Pedro Azevedo <jpazevedo@unicef.org>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/unicef-drp/unicefData
|
|
8
|
+
Project-URL: Documentation, https://github.com/unicef-drp/unicefData/tree/main/python
|
|
9
|
+
Project-URL: Repository, https://github.com/unicef-drp/unicefData
|
|
10
|
+
Project-URL: Changelog, https://github.com/unicef-drp/unicefData/blob/main/python/CHANGELOG.md
|
|
11
|
+
Project-URL: Bug Tracker, https://github.com/unicef-drp/unicefData/issues
|
|
12
|
+
Keywords: unicef,sdmx,indicators,data,api,statistics,sdg,development
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Natural Language :: English
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Operating System :: OS Independent
|
|
24
|
+
Requires-Python: >=3.9
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: requests>=2.28.0
|
|
28
|
+
Requires-Dist: pandas>=1.5.0
|
|
29
|
+
Requires-Dist: pyyaml>=6.0
|
|
30
|
+
Provides-Extra: excel
|
|
31
|
+
Requires-Dist: openpyxl>=3.0.0; extra == "excel"
|
|
32
|
+
Requires-Dist: xlrd>=2.0.0; extra == "excel"
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
36
|
+
Requires-Dist: responses>=0.23.0; extra == "dev"
|
|
37
|
+
Requires-Dist: black>=22.0.0; extra == "dev"
|
|
38
|
+
Requires-Dist: flake8>=5.0.0; extra == "dev"
|
|
39
|
+
Requires-Dist: mypy>=0.990; extra == "dev"
|
|
40
|
+
Dynamic: license-file
|
|
41
|
+
|
|
42
|
+
# unicefData - Python Package
|
|
43
|
+
|
|
44
|
+
[](https://pypi.org/project/unicefdata/)
|
|
45
|
+
[](https://github.com/unicef-drp/unicefData/actions)
|
|
46
|
+
[](https://www.python.org/downloads/)
|
|
47
|
+
[](https://pepy.tech/project/unicefdata)
|
|
48
|
+
[](https://opensource.org/licenses/MIT)
|
|
49
|
+
|
|
50
|
+
**Python component of the trilingual unicefData library for downloading UNICEF SDG indicators via SDMX API**
|
|
51
|
+
|
|
52
|
+
This is the Python implementation of the **unicefData** package. For other implementations, see the links below.
|
|
53
|
+
|
|
54
|
+
> **Other languages:** [R](../R/README.md) | [Stata](../stata/README.md) | [Main README](../README.md)
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Installation
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install unicefdata
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
For development:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
git clone https://github.com/unicef-drp/unicefData.git
|
|
68
|
+
cd unicefData/python
|
|
69
|
+
pip install -e ".[dev]"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Verify Installation
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
import unicefdata
|
|
76
|
+
print(unicefdata.__version__)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
2.2.2
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## What's New in 2.2.2
|
|
86
|
+
|
|
87
|
+
- **`UNICEFSDMXClient` dataflow resolution fixed**: `fetch_indicator()` now auto-detects the correct dataflow from metadata instead of always defaulting to `GLOBAL_DATAFLOW`, consistent with `unicefData()`
|
|
88
|
+
|
|
89
|
+
## What's New in 2.2.1
|
|
90
|
+
|
|
91
|
+
- **Bundled metadata paths corrected**: Startup warnings about missing fallback sequences and indicators metadata are resolved
|
|
92
|
+
- **Codelists filename fixed**: `MetadataManager` now correctly loads `_unicefdata_codelists.yaml`
|
|
93
|
+
- **Category lookup fixed**: `list_categories()` and `search_indicators(category=...)` now return correct results instead of all `UNKNOWN`
|
|
94
|
+
|
|
95
|
+
See [CHANGELOG.md](CHANGELOG.md) for complete details.
|
|
96
|
+
|
|
97
|
+
## What's New in 2.2.0
|
|
98
|
+
|
|
99
|
+
- **328+ automated tests** across 11 test families with deterministic fixtures
|
|
100
|
+
- **Full CI matrix**: Python 3.9–3.12 on Ubuntu / macOS / Windows
|
|
101
|
+
- **Bug fixes**: Sex filter for full-dataflow, None indicator handling, retry logic
|
|
102
|
+
- **Input validation**: Filters empty/whitespace indicators with helpful error messages
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Quick Start
|
|
107
|
+
|
|
108
|
+
### Search for Indicators
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
from unicefdata import search_indicators, list_categories
|
|
112
|
+
|
|
113
|
+
# List all categories
|
|
114
|
+
list_categories()
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
==================================================
|
|
119
|
+
Available Indicator Categories
|
|
120
|
+
==================================================
|
|
121
|
+
|
|
122
|
+
CATEGORY COUNT
|
|
123
|
+
--------------------------------------------------
|
|
124
|
+
NUTRITION 112
|
|
125
|
+
CAUSE_OF_DEATH 83
|
|
126
|
+
CHILD_RELATED_SDG 77
|
|
127
|
+
WASH_HOUSEHOLDS 64
|
|
128
|
+
EDUCATION_UIS_SDG 62
|
|
129
|
+
PT 52
|
|
130
|
+
GLOBAL_DATAFLOW 50
|
|
131
|
+
CHLD_PVTY 43
|
|
132
|
+
CME 39
|
|
133
|
+
HIV_AIDS 38
|
|
134
|
+
MNCH 38
|
|
135
|
+
DM 31
|
|
136
|
+
MG 26
|
|
137
|
+
IMMUNISATION 18
|
|
138
|
+
GENDER 16
|
|
139
|
+
ECON 13
|
|
140
|
+
FUNCTIONAL_DIFF 12
|
|
141
|
+
SOC_PROTECTION 10
|
|
142
|
+
ECD 8
|
|
143
|
+
--------------------------------------------------
|
|
144
|
+
TOTAL 792
|
|
145
|
+
|
|
146
|
+
Use search_indicators(category='CATEGORY_NAME') to see indicators
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
# Search by keyword
|
|
151
|
+
search_indicators("mortality")
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
====================================================================================================
|
|
156
|
+
UNICEF Indicators matching 'mortality'
|
|
157
|
+
====================================================================================================
|
|
158
|
+
|
|
159
|
+
Found 24 indicator(s)
|
|
160
|
+
----------------------------------------------------------------------------------------------------
|
|
161
|
+
CODE CATEGORY NAME DESCRIPTION
|
|
162
|
+
----------------------------------------------------------------------------------------------------
|
|
163
|
+
CME_MRM0 CME Neonatal mortality rate Probability of d..
|
|
164
|
+
CME_MRY0 CME Infant mortality rate Probability of d..
|
|
165
|
+
CME_MRY0T4 CME Under-five mortality rate Probability of d..
|
|
166
|
+
CME_MRY5T14 CME Mortality rate (children aged 5 t.. Probability of d..
|
|
167
|
+
MNCH_MMR MNCH Maternal mortality ratio (number .. Maternal mortali..
|
|
168
|
+
...
|
|
169
|
+
----------------------------------------------------------------------------------------------------
|
|
170
|
+
Usage tips:
|
|
171
|
+
- unicefData(indicator='CODE') to fetch data for an indicator
|
|
172
|
+
- search_indicators(category='CME') to browse by category
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
```python
|
|
176
|
+
# Search within a category
|
|
177
|
+
search_indicators(category="CME")
|
|
178
|
+
search_indicators("rate", category="CME")
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
### Download Data
|
|
184
|
+
|
|
185
|
+
```python
|
|
186
|
+
from unicefdata import unicefData
|
|
187
|
+
|
|
188
|
+
# Fetch under-5 mortality rate (dataflow auto-detected)
|
|
189
|
+
df = unicefData(
|
|
190
|
+
indicator="CME_MRY0T4",
|
|
191
|
+
countries=["ALB", "USA", "BRA"],
|
|
192
|
+
year="2015:2023" # range, single year, or list
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
print(df.shape)
|
|
196
|
+
print(df[["iso3", "country", "period", "indicator", "value"]].to_string(index=False))
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
(27, 21)
|
|
201
|
+
|
|
202
|
+
iso3 country period indicator value
|
|
203
|
+
ALB Albania 2015.0 CME_MRY0T4 9.586263
|
|
204
|
+
ALB Albania 2016.0 CME_MRY0T4 9.400753
|
|
205
|
+
ALB Albania 2017.0 CME_MRY0T4 9.336307
|
|
206
|
+
ALB Albania 2018.0 CME_MRY0T4 9.344314
|
|
207
|
+
ALB Albania 2019.0 CME_MRY0T4 9.386670
|
|
208
|
+
ALB Albania 2020.0 CME_MRY0T4 9.435272
|
|
209
|
+
ALB Albania 2021.0 CME_MRY0T4 9.456832
|
|
210
|
+
ALB Albania 2022.0 CME_MRY0T4 9.436385
|
|
211
|
+
ALB Albania 2023.0 CME_MRY0T4 9.357239
|
|
212
|
+
BRA Brazil 2015.0 CME_MRY0T4 15.963330
|
|
213
|
+
BRA Brazil 2016.0 CME_MRY0T4 16.771457
|
|
214
|
+
...
|
|
215
|
+
USA United States 2023.0 CME_MRY0T4 6.482592
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
```python
|
|
219
|
+
# Summary statistics
|
|
220
|
+
print(df["value"].describe().round(2))
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
```
|
|
224
|
+
count 27.00
|
|
225
|
+
mean 10.40
|
|
226
|
+
std 3.70
|
|
227
|
+
min 6.46
|
|
228
|
+
25% 6.64
|
|
229
|
+
50% 9.40
|
|
230
|
+
75% 14.66
|
|
231
|
+
max 16.77
|
|
232
|
+
Name: value, dtype: float64
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
```python
|
|
236
|
+
# Cross-country pivot table (countries × years)
|
|
237
|
+
print(df.groupby(["iso3", "period"])["value"].first().unstack().round(1))
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
```
|
|
241
|
+
period 2015.0 2016.0 2017.0 2018.0 2019.0 2020.0 2021.0 2022.0 2023.0
|
|
242
|
+
iso3
|
|
243
|
+
ALB 9.6 9.4 9.3 9.3 9.4 9.4 9.5 9.4 9.4
|
|
244
|
+
BRA 16.0 16.8 15.4 15.2 15.0 14.9 14.7 14.6 14.4
|
|
245
|
+
USA 6.8 6.7 6.6 6.5 6.5 6.5 6.5 6.5 6.5
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
### View Dataflow Schema
|
|
251
|
+
|
|
252
|
+
```python
|
|
253
|
+
from unicefdata import dataflow_schema, print_dataflow_schema
|
|
254
|
+
|
|
255
|
+
print_dataflow_schema(dataflow_schema("CME"))
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
```
|
|
259
|
+
----------------------------------------------------------------------
|
|
260
|
+
Dataflow Schema: CME
|
|
261
|
+
----------------------------------------------------------------------
|
|
262
|
+
|
|
263
|
+
Name: Child Mortality
|
|
264
|
+
Version: 1.0
|
|
265
|
+
Agency: UNICEF
|
|
266
|
+
|
|
267
|
+
Dimensions (4):
|
|
268
|
+
REF_AREA
|
|
269
|
+
INDICATOR
|
|
270
|
+
SEX
|
|
271
|
+
WEALTH_QUINTILE
|
|
272
|
+
|
|
273
|
+
Attributes (7):
|
|
274
|
+
DATA_SOURCE
|
|
275
|
+
COUNTRY_NOTES
|
|
276
|
+
REF_PERIOD
|
|
277
|
+
UNIT_MEASURE
|
|
278
|
+
LOWER_BOUND
|
|
279
|
+
UPPER_BOUND
|
|
280
|
+
OBS_STATUS
|
|
281
|
+
----------------------------------------------------------------------
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## Post-Production Options
|
|
287
|
+
|
|
288
|
+
### Output Formats
|
|
289
|
+
|
|
290
|
+
```python
|
|
291
|
+
# Long format (default) — one row per country × year
|
|
292
|
+
df = unicefData(indicator="CME_MRY0T4", countries=["ALB", "USA", "BRA"],
|
|
293
|
+
year="2020:2022", format="long")
|
|
294
|
+
print(df[["iso3", "country", "period", "value"]].to_string(index=False))
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
```
|
|
298
|
+
iso3 country period value
|
|
299
|
+
ALB Albania 2020.0 9.435272
|
|
300
|
+
ALB Albania 2021.0 9.456832
|
|
301
|
+
ALB Albania 2022.0 9.436385
|
|
302
|
+
BRA Brazil 2020.0 14.873612
|
|
303
|
+
BRA Brazil 2021.0 14.723535
|
|
304
|
+
BRA Brazil 2022.0 14.588250
|
|
305
|
+
USA United States 2020.0 6.469871
|
|
306
|
+
USA United States 2021.0 6.464968
|
|
307
|
+
USA United States 2022.0 6.473319
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
```python
|
|
311
|
+
# Wide format — years as columns
|
|
312
|
+
df = unicefData(indicator="CME_MRY0T4", countries=["ALB", "USA", "BRA"],
|
|
313
|
+
year="2020:2022", format="wide")
|
|
314
|
+
print(df[["iso3", "country", 2020.0, 2021.0, 2022.0]].to_string(index=False))
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
```
|
|
318
|
+
iso3 country 2020.0 2021.0 2022.0
|
|
319
|
+
ALB Albania 9.435272 9.456832 9.436385
|
|
320
|
+
BRA Brazil 14.873612 14.723535 14.588250
|
|
321
|
+
USA United States 6.469871 6.464968 6.473319
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
```python
|
|
325
|
+
# Wide indicators — indicators as columns
|
|
326
|
+
df = unicefData(
|
|
327
|
+
indicator=["CME_MRY0T4", "CME_MRM0"],
|
|
328
|
+
countries=["ALB", "USA", "BRA"],
|
|
329
|
+
year="2020:2022",
|
|
330
|
+
format="wide_indicators"
|
|
331
|
+
)
|
|
332
|
+
print(df[["iso3", "country", "period", "CME_MRY0T4", "CME_MRM0"]].to_string(index=False))
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
```
|
|
336
|
+
iso3 country period CME_MRY0T4 CME_MRM0
|
|
337
|
+
ALB Albania 2020.0 9.435272 7.185830
|
|
338
|
+
ALB Albania 2021.0 9.456832 7.125219
|
|
339
|
+
ALB Albania 2022.0 9.436385 6.998704
|
|
340
|
+
BRA Brazil 2020.0 14.873612 9.163120
|
|
341
|
+
BRA Brazil 2021.0 14.723535 8.893245
|
|
342
|
+
BRA Brazil 2022.0 14.588250 8.281859
|
|
343
|
+
USA United States 2020.0 6.469871 3.642096
|
|
344
|
+
USA United States 2021.0 6.464968 3.520667
|
|
345
|
+
USA United States 2022.0 6.473319 3.477007
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
### Latest Value Per Country
|
|
351
|
+
|
|
352
|
+
```python
|
|
353
|
+
df = unicefData(
|
|
354
|
+
indicator="CME_MRY0T4",
|
|
355
|
+
countries=["ALB", "BRA", "DEU", "IND", "USA"],
|
|
356
|
+
latest=True
|
|
357
|
+
)
|
|
358
|
+
print(df[["iso3", "country", "period", "value"]].to_string(index=False))
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
```
|
|
362
|
+
iso3 country period value
|
|
363
|
+
ALB Albania 2024.0 9.227080
|
|
364
|
+
BRA Brazil 2024.0 14.216972
|
|
365
|
+
DEU Germany 2024.0 3.711222
|
|
366
|
+
IND India 2024.0 26.579900
|
|
367
|
+
USA United States 2024.0 6.472463
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
### Most Recent Values (MRV)
|
|
373
|
+
|
|
374
|
+
```python
|
|
375
|
+
df = unicefData(indicator="CME_MRY0T4", countries=["ALB", "USA", "BRA"], mrv=3)
|
|
376
|
+
print(df[["iso3", "country", "period", "value"]].sort_values(["iso3", "period"]).to_string(index=False))
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
```
|
|
380
|
+
iso3 country period value
|
|
381
|
+
ALB Albania 2022.0 9.436385
|
|
382
|
+
ALB Albania 2023.0 9.357239
|
|
383
|
+
ALB Albania 2024.0 9.227080
|
|
384
|
+
BRA Brazil 2022.0 14.588250
|
|
385
|
+
BRA Brazil 2023.0 14.424723
|
|
386
|
+
BRA Brazil 2024.0 14.216972
|
|
387
|
+
USA United States 2022.0 6.473319
|
|
388
|
+
USA United States 2023.0 6.482592
|
|
389
|
+
USA United States 2024.0 6.472463
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
---
|
|
393
|
+
|
|
394
|
+
### Circa (Nearest Year)
|
|
395
|
+
|
|
396
|
+
```python
|
|
397
|
+
# Returns the closest available observation to the target year
|
|
398
|
+
df = unicefData(
|
|
399
|
+
indicator="CME_MRY0T4",
|
|
400
|
+
countries=["ALB", "USA", "BRA"],
|
|
401
|
+
year=2015,
|
|
402
|
+
circa=True
|
|
403
|
+
)
|
|
404
|
+
print(df[["iso3", "country", "period", "value"]].to_string(index=False))
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
```
|
|
408
|
+
iso3 country period value
|
|
409
|
+
ALB Albania 2015.0 9.586263
|
|
410
|
+
BRA Brazil 2015.0 15.963330
|
|
411
|
+
USA United States 2015.0 6.752855
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
### Add Metadata
|
|
417
|
+
|
|
418
|
+
```python
|
|
419
|
+
df = unicefData(
|
|
420
|
+
indicator="CME_MRY0T4",
|
|
421
|
+
countries=["ALB", "BRA", "IND", "NGA", "USA"],
|
|
422
|
+
latest=True,
|
|
423
|
+
add_metadata=["region", "income_group"]
|
|
424
|
+
)
|
|
425
|
+
print(df[["iso3", "country", "period", "value", "region", "income_group"]].to_string(index=False))
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
```
|
|
429
|
+
iso3 country period value region income_group
|
|
430
|
+
ALB Albania 2024.0 9.227080 Europe and Central Asia Upper middle income
|
|
431
|
+
BRA Brazil 2024.0 14.216972 Latin America and Caribbean Upper middle income
|
|
432
|
+
IND India 2024.0 26.579900 South Asia Lower middle income
|
|
433
|
+
NGA Nigeria 2024.0 115.649434 Sub-Saharan Africa Lower middle income
|
|
434
|
+
USA United States 2024.0 6.472463 North America High income
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
```python
|
|
438
|
+
# Frequency table by income group
|
|
439
|
+
print(df.groupby("income_group")["value"].agg(["count", "mean", "min", "max"]).round(2))
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
```
|
|
443
|
+
count mean min max
|
|
444
|
+
income_group
|
|
445
|
+
High income 1 6.47 6.47 6.47
|
|
446
|
+
Lower middle income 2 71.11 26.58 115.65
|
|
447
|
+
Upper middle income 2 11.72 9.23 14.22
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
---
|
|
451
|
+
|
|
452
|
+
### Combining Options
|
|
453
|
+
|
|
454
|
+
```python
|
|
455
|
+
df = unicefData(
|
|
456
|
+
indicator=["CME_MRY0T4", "CME_MRM0"],
|
|
457
|
+
countries=["ALB", "BRA", "IND", "NGA", "USA"],
|
|
458
|
+
format="wide_indicators",
|
|
459
|
+
latest=True,
|
|
460
|
+
add_metadata=["region", "income_group"],
|
|
461
|
+
dropna=True
|
|
462
|
+
)
|
|
463
|
+
print(df[["iso3", "country", "CME_MRY0T4", "CME_MRM0", "region", "income_group"]].to_string(index=False))
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
```
|
|
467
|
+
iso3 country CME_MRY0T4 CME_MRM0 region income_group
|
|
468
|
+
ALB Albania 9.227080 6.735194 Europe and Central Asia Upper middle income
|
|
469
|
+
BRA Brazil 14.216972 7.124973 Latin America and Caribbean Upper middle income
|
|
470
|
+
IND India 26.579900 16.659252 South Asia Lower middle income
|
|
471
|
+
NGA Nigeria 115.649434 39.045723 Sub-Saharan Africa Lower middle income
|
|
472
|
+
USA United States 6.472463 3.652385 North America High income
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
---
|
|
476
|
+
|
|
477
|
+
## Visualizations
|
|
478
|
+
|
|
479
|
+
The following examples use [matplotlib](https://matplotlib.org/), which is not a required dependency but is commonly available. Install with `pip install matplotlib` if needed.
|
|
480
|
+
|
|
481
|
+
### Time-Series Line Chart
|
|
482
|
+
|
|
483
|
+
```python
|
|
484
|
+
import matplotlib.pyplot as plt
|
|
485
|
+
from unicefdata import unicefData
|
|
486
|
+
|
|
487
|
+
df = unicefData(
|
|
488
|
+
indicator="CME_MRY0T4",
|
|
489
|
+
countries=["ALB", "BRA", "DEU", "IND", "NGA", "USA"],
|
|
490
|
+
year="2000:2024"
|
|
491
|
+
)
|
|
492
|
+
|
|
493
|
+
country_colors = {
|
|
494
|
+
"ALB": "#4CAF50", "BRA": "#FF9800", "DEU": "#2196F3",
|
|
495
|
+
"IND": "#9C27B0", "NGA": "#F44336", "USA": "#00BCD4"
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
fig, ax = plt.subplots(figsize=(10, 5))
|
|
499
|
+
for iso3, grp in df.groupby("iso3"):
|
|
500
|
+
grp_sorted = grp.sort_values("period")
|
|
501
|
+
ax.plot(grp_sorted["period"], grp_sorted["value"],
|
|
502
|
+
marker="o", markersize=3,
|
|
503
|
+
color=country_colors.get(iso3, "#999"),
|
|
504
|
+
label=grp_sorted["country"].iloc[0])
|
|
505
|
+
|
|
506
|
+
ax.set_title("Under-5 Mortality Rate (CME_MRY0T4), 2000–2024", fontweight="bold")
|
|
507
|
+
ax.set_xlabel("Year")
|
|
508
|
+
ax.set_ylabel("Deaths per 1,000 live births")
|
|
509
|
+
ax.legend(loc="upper right", fontsize=9)
|
|
510
|
+
ax.grid(True, alpha=0.3)
|
|
511
|
+
plt.tight_layout()
|
|
512
|
+
plt.show()
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+

|
|
516
|
+
|
|
517
|
+
### Cross-Country Bar Chart (Latest Values)
|
|
518
|
+
|
|
519
|
+
```python
|
|
520
|
+
import matplotlib.pyplot as plt
|
|
521
|
+
from matplotlib.patches import Patch
|
|
522
|
+
from unicefdata import unicefData
|
|
523
|
+
|
|
524
|
+
df = unicefData(
|
|
525
|
+
indicator="CME_MRY0T4",
|
|
526
|
+
countries=["ALB", "BRA", "CHN", "DEU", "ETH", "IND", "MEX", "NGA", "USA", "ZAF"],
|
|
527
|
+
latest=True,
|
|
528
|
+
add_metadata=["income_group"]
|
|
529
|
+
)
|
|
530
|
+
df_sorted = df.sort_values("value", ascending=True)
|
|
531
|
+
|
|
532
|
+
income_colors = {
|
|
533
|
+
"High income": "#2196F3",
|
|
534
|
+
"Upper middle income": "#4CAF50",
|
|
535
|
+
"Lower middle income": "#FF9800",
|
|
536
|
+
"Low income": "#F44336"
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
fig, ax = plt.subplots(figsize=(9, 5))
|
|
540
|
+
bars = ax.barh(
|
|
541
|
+
df_sorted["country"],
|
|
542
|
+
df_sorted["value"],
|
|
543
|
+
color=[income_colors.get(ig, "#999") for ig in df_sorted["income_group"]]
|
|
544
|
+
)
|
|
545
|
+
ax.bar_label(bars, fmt="%.1f", padding=4, fontsize=9)
|
|
546
|
+
handles = [Patch(color=c, label=l) for l, c in income_colors.items()
|
|
547
|
+
if l in df_sorted["income_group"].values]
|
|
548
|
+
ax.legend(handles=handles, title="Income group", fontsize=8)
|
|
549
|
+
ax.set_title("Under-5 Mortality Rate — Latest Available Year", fontweight="bold")
|
|
550
|
+
ax.set_xlabel("Deaths per 1,000 live births")
|
|
551
|
+
ax.grid(axis="x", alpha=0.3)
|
|
552
|
+
plt.tight_layout()
|
|
553
|
+
plt.show()
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+

|
|
557
|
+
|
|
558
|
+
### Scatter Plot: Two Indicators by Country
|
|
559
|
+
|
|
560
|
+
```python
|
|
561
|
+
import numpy as np
|
|
562
|
+
import matplotlib.pyplot as plt
|
|
563
|
+
from unicefdata import unicefData
|
|
564
|
+
|
|
565
|
+
df = unicefData(
|
|
566
|
+
indicator=["CME_MRY0T4", "CME_MRM0"],
|
|
567
|
+
format="wide_indicators",
|
|
568
|
+
latest=True,
|
|
569
|
+
add_metadata=["income_group"],
|
|
570
|
+
dropna=True
|
|
571
|
+
)
|
|
572
|
+
|
|
573
|
+
income_colors = {
|
|
574
|
+
"High income": "#2196F3",
|
|
575
|
+
"Upper middle income": "#4CAF50",
|
|
576
|
+
"Lower middle income": "#FF9800",
|
|
577
|
+
"Low income": "#F44336"
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
fig, ax = plt.subplots(figsize=(8, 6))
|
|
581
|
+
for ig, grp in df.groupby("income_group"):
|
|
582
|
+
ax.scatter(grp["CME_MRM0"], grp["CME_MRY0T4"],
|
|
583
|
+
color=income_colors.get(ig, "#999"), label=ig, alpha=0.7, s=50)
|
|
584
|
+
|
|
585
|
+
x, y = df["CME_MRM0"].values, df["CME_MRY0T4"].values
|
|
586
|
+
m, b = np.polyfit(x, y, 1)
|
|
587
|
+
xline = np.linspace(x.min(), x.max(), 100)
|
|
588
|
+
ax.plot(xline, m * xline + b, color="#333", linewidth=1.2, linestyle="--", alpha=0.6, label="Trend")
|
|
589
|
+
|
|
590
|
+
ax.set_xlabel("Neonatal Mortality Rate (CME_MRM0)")
|
|
591
|
+
ax.set_ylabel("Under-5 Mortality Rate (CME_MRY0T4)")
|
|
592
|
+
ax.set_title("Neonatal vs Under-5 Mortality — All Countries, Latest Values", fontweight="bold")
|
|
593
|
+
ax.legend(title="Income group", fontsize=8)
|
|
594
|
+
ax.grid(True, alpha=0.3)
|
|
595
|
+
plt.tight_layout()
|
|
596
|
+
plt.show()
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+

|
|
600
|
+
|
|
601
|
+
---
|
|
602
|
+
|
|
603
|
+
## Advanced: UNICEFSDMXClient
|
|
604
|
+
|
|
605
|
+
For lower-level access, use `UNICEFSDMXClient` directly.
|
|
606
|
+
|
|
607
|
+
```python
|
|
608
|
+
from unicefdata import UNICEFSDMXClient
|
|
609
|
+
|
|
610
|
+
client = UNICEFSDMXClient()
|
|
611
|
+
|
|
612
|
+
# Fetch a single indicator
|
|
613
|
+
df = client.fetch_indicator(
|
|
614
|
+
"CME_MRY0T4",
|
|
615
|
+
countries=["ALB", "USA"],
|
|
616
|
+
start_year=2020,
|
|
617
|
+
end_year=2023
|
|
618
|
+
)
|
|
619
|
+
print(df[["iso3", "country", "period", "indicator", "value"]].to_string(index=False))
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
```
|
|
623
|
+
iso3 country period indicator value
|
|
624
|
+
ALB Albania 2020.0 CME_MRY0T4 9.435272
|
|
625
|
+
ALB Albania 2021.0 CME_MRY0T4 9.456832
|
|
626
|
+
ALB Albania 2022.0 CME_MRY0T4 9.436385
|
|
627
|
+
ALB Albania 2023.0 CME_MRY0T4 9.357239
|
|
628
|
+
USA United States 2020.0 CME_MRY0T4 6.469871
|
|
629
|
+
USA United States 2021.0 CME_MRY0T4 6.464968
|
|
630
|
+
USA United States 2022.0 CME_MRY0T4 6.473319
|
|
631
|
+
USA United States 2023.0 CME_MRY0T4 6.482592
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
```python
|
|
635
|
+
# Fetch multiple indicators combined into one DataFrame
|
|
636
|
+
df = client.fetch_multiple_indicators(
|
|
637
|
+
["CME_MRY0T4", "CME_MRM0"],
|
|
638
|
+
countries=["ALB", "USA"],
|
|
639
|
+
combine=True
|
|
640
|
+
)
|
|
641
|
+
print(f"Shape: {df.shape}")
|
|
642
|
+
print(df.groupby(["iso3", "indicator"])["value"].agg(["count", "mean"]).round(2))
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
```
|
|
646
|
+
Shape: (226, 21)
|
|
647
|
+
|
|
648
|
+
count mean
|
|
649
|
+
iso3 indicator
|
|
650
|
+
ALB CME_MRM0 72.0 12.89
|
|
651
|
+
CME_MRY0T4 72.0 18.79
|
|
652
|
+
USA CME_MRM0 41.0 5.48
|
|
653
|
+
CME_MRY0T4 41.0 9.15
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
```python
|
|
657
|
+
# Configurable timeout
|
|
658
|
+
client = UNICEFSDMXClient(timeout=120)
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
---
|
|
662
|
+
|
|
663
|
+
## API Reference
|
|
664
|
+
|
|
665
|
+
### unicefData()
|
|
666
|
+
|
|
667
|
+
Main function for fetching UNICEF indicator data.
|
|
668
|
+
|
|
669
|
+
| Parameter | Type | Default | Description |
|
|
670
|
+
|-----------|------|---------|-------------|
|
|
671
|
+
| `indicator` | str/list | required | Indicator code(s) |
|
|
672
|
+
| `dataflow` | str | auto-detect | SDMX dataflow ID |
|
|
673
|
+
| `countries` | list | None (all) | ISO3 country codes |
|
|
674
|
+
| `year` | int/str/list | None (all) | Year(s) |
|
|
675
|
+
| `circa` | bool | False | Find closest year |
|
|
676
|
+
| `sex` | str | `"_T"` | Sex filter |
|
|
677
|
+
| `max_retries` | int | 3 | Retry attempts |
|
|
678
|
+
|
|
679
|
+
#### Post-Production Parameters
|
|
680
|
+
|
|
681
|
+
| Parameter | Type | Default | Description |
|
|
682
|
+
|-----------|------|---------|-------------|
|
|
683
|
+
| `format` | str | `"long"` | `"long"`, `"wide"`, `"wide_indicators"` |
|
|
684
|
+
| `latest` | bool | False | Keep only latest per country |
|
|
685
|
+
| `mrv` | int | None | Keep N most recent values |
|
|
686
|
+
| `add_metadata` | list | None | Metadata to add |
|
|
687
|
+
| `dropna` | bool | False | Remove missing values |
|
|
688
|
+
| `simplify` | bool | False | Keep only essential columns |
|
|
689
|
+
|
|
690
|
+
### Other Functions
|
|
691
|
+
|
|
692
|
+
| Function | Description |
|
|
693
|
+
|----------|-------------|
|
|
694
|
+
| `search_indicators(query, category, limit)` | Search indicators |
|
|
695
|
+
| `list_categories()` | List all categories |
|
|
696
|
+
| `list_dataflows()` | List available dataflows |
|
|
697
|
+
| `dataflow_schema(dataflow)` | Get dataflow schema |
|
|
698
|
+
| `clear_cache()` | Clear all 5 cache layers |
|
|
699
|
+
|
|
700
|
+
---
|
|
701
|
+
|
|
702
|
+
## Time Period Handling
|
|
703
|
+
|
|
704
|
+
Monthly periods are converted to decimal years:
|
|
705
|
+
|
|
706
|
+
| Original | Decimal | Calculation |
|
|
707
|
+
|----------|---------|-------------|
|
|
708
|
+
| `2020` | `2020.0` | Integer year |
|
|
709
|
+
| `2020-01` | `2020.0833` | 2020 + 1/12 |
|
|
710
|
+
| `2020-06` | `2020.5000` | 2020 + 6/12 |
|
|
711
|
+
|
|
712
|
+
---
|
|
713
|
+
|
|
714
|
+
## Common Indicators
|
|
715
|
+
|
|
716
|
+
### Child Mortality (SDG 3.2)
|
|
717
|
+
- `CME_MRM0` - Neonatal mortality rate
|
|
718
|
+
- `CME_MRY0T4` - Under-5 mortality rate
|
|
719
|
+
|
|
720
|
+
### Nutrition (SDG 2.2)
|
|
721
|
+
- `NT_ANT_HAZ_NE2_MOD` - Stunting prevalence
|
|
722
|
+
- `NT_ANT_WHZ_NE2` - Wasting prevalence
|
|
723
|
+
|
|
724
|
+
### Immunization (SDG 3.b)
|
|
725
|
+
- `IM_DTP3` - DTP3 coverage
|
|
726
|
+
- `IM_MCV1` - Measles coverage
|
|
727
|
+
|
|
728
|
+
### WASH (SDG 6)
|
|
729
|
+
- `WS_PPL_W-SM` - Safely managed water
|
|
730
|
+
- `WS_PPL_S-SM` - Safely managed sanitation
|
|
731
|
+
|
|
732
|
+
### Child Protection
|
|
733
|
+
- `PT_CHLD_Y0T4_REG` - Birth registration
|
|
734
|
+
- `PT_F_20-24_MRD_U18_TND` - Child marriage
|
|
735
|
+
|
|
736
|
+
---
|
|
737
|
+
|
|
738
|
+
## Error Handling
|
|
739
|
+
|
|
740
|
+
```python
|
|
741
|
+
from unicefdata import SDMXNotFoundError, SDMXBadRequestError, SDMXTimeoutError
|
|
742
|
+
|
|
743
|
+
try:
|
|
744
|
+
df = unicefData(indicator="INVALID_CODE")
|
|
745
|
+
except SDMXNotFoundError as e:
|
|
746
|
+
print(f"Indicator not found: {e}")
|
|
747
|
+
except SDMXBadRequestError as e:
|
|
748
|
+
print(f"Invalid request: {e}")
|
|
749
|
+
except SDMXTimeoutError as e:
|
|
750
|
+
print(f"Request timed out: {e}")
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
---
|
|
754
|
+
|
|
755
|
+
## Troubleshooting
|
|
756
|
+
|
|
757
|
+
### Connection Errors
|
|
758
|
+
|
|
759
|
+
```python
|
|
760
|
+
# Increase retry attempts
|
|
761
|
+
df = unicefData(indicator="CME_MRY0T4", max_retries=5)
|
|
762
|
+
```
|
|
763
|
+
|
|
764
|
+
### Stale Cache
|
|
765
|
+
|
|
766
|
+
```python
|
|
767
|
+
from unicefdata import clear_cache
|
|
768
|
+
clear_cache() # Clears all 5 cache layers
|
|
769
|
+
```
|
|
770
|
+
|
|
771
|
+
---
|
|
772
|
+
|
|
773
|
+
## Examples
|
|
774
|
+
|
|
775
|
+
See `examples/` folder:
|
|
776
|
+
|
|
777
|
+
- `00_quick_start.py` - Basic usage
|
|
778
|
+
- `01_indicator_discovery.py` - Finding indicators
|
|
779
|
+
- `02_sdg_indicators.py` - SDG queries
|
|
780
|
+
- `03_data_formats.py` - Output formats
|
|
781
|
+
- `04_metadata_options.py` - Metadata enrichment
|
|
782
|
+
- `05_advanced_features.py` - Advanced options
|
|
783
|
+
|
|
784
|
+
---
|
|
785
|
+
|
|
786
|
+
## Version History
|
|
787
|
+
|
|
788
|
+
See [CHANGELOG.md](CHANGELOG.md) for complete changelog.
|
|
789
|
+
|
|
790
|
+
---
|
|
791
|
+
|
|
792
|
+
## Dependencies
|
|
793
|
+
|
|
794
|
+
- pandas
|
|
795
|
+
- requests
|
|
796
|
+
- pyyaml
|
|
797
|
+
|
|
798
|
+
Optional: `pip install "unicefdata[excel]"` for Excel export support.
|
|
799
|
+
|
|
800
|
+
---
|
|
801
|
+
|
|
802
|
+
## Acknowledgments
|
|
803
|
+
|
|
804
|
+
This package was developed at the UNICEF Data and Analytics Section. The author gratefully acknowledges the collaboration of **Lucas Rodrigues**, **Yang Liu**, and **Karen Avanesian**, whose technical contributions and feedback were instrumental in the development of this Python package.
|
|
805
|
+
|
|
806
|
+
Special thanks to **Yves Jaques**, **Alberto Sibileau**, and **Daniele Olivotti** for designing and maintaining the UNICEF SDMX data warehouse infrastructure that makes this package possible.
|
|
807
|
+
|
|
808
|
+
The author also acknowledges the **UNICEF database managers** and technical teams who ensure data quality, as well as the country office staff and National Statistical Offices whose data collection efforts make this work possible.
|
|
809
|
+
|
|
810
|
+
Development of this package was supported by UNICEF institutional funding for data infrastructure and statistical capacity building. The author also acknowledges UNICEF colleagues who provided testing and feedback during development, as well as the broader open-source Python community.
|
|
811
|
+
|
|
812
|
+
Development was assisted by AI coding tools (GitHub Copilot, Claude). All code has been reviewed, tested, and validated by the package maintainers.
|
|
813
|
+
|
|
814
|
+
## Disclaimer
|
|
815
|
+
|
|
816
|
+
**This package is provided for research and analytical purposes.**
|
|
817
|
+
|
|
818
|
+
The `unicefData` package provides programmatic access to UNICEF's public data warehouse. While the author is affiliated with UNICEF, **this package is not an official UNICEF product and the statements in this documentation are the views of the author and do not necessarily reflect the policies or views of UNICEF**.
|
|
819
|
+
|
|
820
|
+
Data accessed through this package comes from the [UNICEF Data Warehouse](https://sdmx.data.unicef.org/). Users should verify critical data points against official UNICEF publications at [data.unicef.org](https://data.unicef.org/).
|
|
821
|
+
|
|
822
|
+
This software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or UNICEF be liable for any claim, damages or other liability arising from the use of this software.
|
|
823
|
+
|
|
824
|
+
The designations employed and the presentation of material in this package do not imply the expression of any opinion whatsoever on the part of UNICEF concerning the legal status of any country, territory, city or area or of its authorities, or concerning the delimitation of its frontiers or boundaries.
|
|
825
|
+
|
|
826
|
+
## Data Citation and Provenance
|
|
827
|
+
|
|
828
|
+
**Important Note on Data Vintages**
|
|
829
|
+
|
|
830
|
+
Official statistics are subject to revisions as new information becomes available and estimation methodologies improve. UNICEF indicators are regularly updated based on new surveys, censuses, and improved modeling techniques. Historical values may be revised retroactively to reflect better information or methodological improvements.
|
|
831
|
+
|
|
832
|
+
**For reproducible research and proper data attribution, users should:**
|
|
833
|
+
|
|
834
|
+
1. **Document the indicator code** - Specify the exact SDMX indicator code(s) used (e.g., `CME_MRY0T4`)
|
|
835
|
+
2. **Record the download date** - Note when data was accessed (e.g., "Data downloaded: 2026-03-20")
|
|
836
|
+
3. **Cite the data source** - Reference both the package and the UNICEF Data Warehouse
|
|
837
|
+
4. **Archive your dataset** - Save a copy of the exact data used in your analysis
|
|
838
|
+
|
|
839
|
+
**Example citation for data used in research:**
|
|
840
|
+
|
|
841
|
+
> Under-5 mortality data (indicator: CME_MRY0T4) accessed from UNICEF Data Warehouse via unicefData Python package (v2.2.2) on 2026-03-20. Data available at: https://sdmx.data.unicef.org/
|
|
842
|
+
|
|
843
|
+
This practice ensures that others can verify your results and understand any differences that may arise from data updates. For official UNICEF statistics in publications, always cross-reference with the current version at [data.unicef.org](https://data.unicef.org/).
|
|
844
|
+
|
|
845
|
+
## Citation
|
|
846
|
+
|
|
847
|
+
If you use this package, please cite:
|
|
848
|
+
|
|
849
|
+
> Azevedo, Joao Pedro (2026). "unicefdata: Unified access to UNICEF indicators across R, Python, and Stata." Mimeo, UNICEF Chief Statistician Office.
|
|
850
|
+
|
|
851
|
+
---
|
|
852
|
+
|
|
853
|
+
## Development
|
|
854
|
+
|
|
855
|
+
Development assisted by AI coding tools (GitHub Copilot, Claude). All code reviewed and validated by maintainers.
|
|
856
|
+
|
|
857
|
+
---
|
|
858
|
+
|
|
859
|
+
## Author
|
|
860
|
+
|
|
861
|
+
**Joao Pedro Azevedo** ([@jpazvd](https://github.com/jpazvd))
|
|
862
|
+
Chief Statistician, UNICEF Data and Analytics Section
|
|
863
|
+
Email: jpazevedo@unicef.org
|
|
864
|
+
Website: [jpazvd.github.io](https://jpazvd.github.io/)
|
|
865
|
+
|
|
866
|
+
---
|
|
867
|
+
|
|
868
|
+
## License
|
|
869
|
+
|
|
870
|
+
MIT License - See [LICENSE](../LICENSE)
|
|
871
|
+
|
|
872
|
+
## Contributing
|
|
873
|
+
|
|
874
|
+
See [CONTRIBUTING.md](../CONTRIBUTING.md) for detailed guidelines.
|