unicefdata 2.1.1__tar.gz → 2.4.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 (155) hide show
  1. unicefdata-2.4.0/PKG-INFO +892 -0
  2. unicefdata-2.4.0/README.md +851 -0
  3. {unicefdata-2.1.1 → unicefdata-2.4.0}/pyproject.toml +21 -3
  4. {unicefdata-2.1.1 → unicefdata-2.4.0}/tests/test_404_fallback.py +107 -107
  5. unicefdata-2.4.0/tests/test_deterministic.py +341 -0
  6. {unicefdata-2.1.1 → unicefdata-2.4.0}/tests/test_dimensions.py +101 -95
  7. unicefdata-2.4.0/tests/test_direct_metadata.py +53 -0
  8. unicefdata-2.4.0/tests/test_discovery.py +210 -0
  9. {unicefdata-2.1.1 → unicefdata-2.4.0}/tests/test_download.py +46 -40
  10. unicefdata-2.4.0/tests/test_error_conditions.py +205 -0
  11. {unicefdata-2.1.1 → unicefdata-2.4.0}/tests/test_fallback_fix.py +91 -83
  12. unicefdata-2.4.0/tests/test_hardcoded_removal_validation.py +226 -0
  13. {unicefdata-2.1.1 → unicefdata-2.4.0}/tests/test_list_dataflows.py +94 -94
  14. {unicefdata-2.1.1 → unicefdata-2.4.0}/tests/test_metadata_manager.py +63 -57
  15. {unicefdata-2.1.1 → unicefdata-2.4.0}/tests/test_pipeline_mocked.py +192 -192
  16. unicefdata-2.4.0/tests/test_python_integration.py +69 -0
  17. unicefdata-2.4.0/tests/test_query_status.py +147 -0
  18. unicefdata-2.4.0/tests/test_quick_python.py +25 -0
  19. unicefdata-2.4.0/tests/test_sdmx_client_dataflow.py +114 -0
  20. unicefdata-2.4.0/tests/test_sync_pipeline.py +230 -0
  21. unicefdata-2.4.0/tests/test_transformations.py +319 -0
  22. {unicefdata-2.1.1 → unicefdata-2.4.0}/tests/test_unicef_api.py +114 -114
  23. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/__init__.py +84 -83
  24. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/config.py +156 -156
  25. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/config_loader.py +270 -270
  26. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/flows.py +217 -217
  27. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/indicator_registry.py +776 -775
  28. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/_unicefdata_sync_history.yaml +115 -115
  29. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/_dataflow_fallback_sequences.yaml +278 -278
  30. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/_unicefdata_codelists.yaml +641 -641
  31. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/_unicefdata_countries.yaml +464 -464
  32. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/_unicefdata_dataflows.yaml +639 -639
  33. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/_unicefdata_indicators.yaml +7270 -7270
  34. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/_unicefdata_indicators_metadata.yaml +12860 -12860
  35. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/_unicefdata_regions.yaml +123 -123
  36. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflow_index.yaml +356 -356
  37. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CAUSE_OF_DEATH.yaml +52 -52
  38. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CCRI.yaml +137 -137
  39. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CHILD_RELATED_SDG.yaml +144 -144
  40. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CHLD_PVTY.yaml +77 -77
  41. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME.yaml +142 -142
  42. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_CAUSE_OF_DEATH.yaml +96 -96
  43. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_COUNTRY_PROFILES_DATA.yaml +100 -100
  44. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_DF_2021_WQ.yaml +280 -280
  45. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNATIONAL.yaml +202 -202
  46. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_AGO.yaml +179 -179
  47. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_BDI.yaml +179 -179
  48. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_BEN.yaml +179 -179
  49. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_BGD.yaml +179 -179
  50. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_CMR.yaml +179 -179
  51. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_ETH.yaml +179 -179
  52. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_GHA.yaml +179 -179
  53. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_GIN.yaml +179 -179
  54. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_HTI.yaml +179 -179
  55. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_KEN.yaml +179 -179
  56. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_LAO.yaml +179 -179
  57. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_LBR.yaml +179 -179
  58. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_LSO.yaml +179 -179
  59. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_MDG.yaml +185 -185
  60. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_MLI.yaml +179 -179
  61. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_MMR.yaml +179 -179
  62. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_MRT.yaml +179 -179
  63. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_MWI.yaml +179 -179
  64. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_NAM.yaml +179 -179
  65. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_NGA.yaml +179 -179
  66. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_NPL.yaml +179 -179
  67. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_PAK.yaml +179 -179
  68. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_RWA.yaml +179 -179
  69. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_SEN.yaml +179 -179
  70. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_SLE.yaml +179 -179
  71. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_TCD.yaml +179 -179
  72. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_TGO.yaml +174 -174
  73. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_TZA.yaml +179 -179
  74. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_UGA.yaml +178 -178
  75. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_ZMB.yaml +178 -178
  76. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/CME_SUBNAT_ZWE.yaml +179 -179
  77. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/COVID.yaml +145 -145
  78. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/COVID_CASES.yaml +89 -89
  79. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/DM.yaml +121 -121
  80. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/DM_PROJECTIONS.yaml +118 -118
  81. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/ECD.yaml +272 -272
  82. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/ECONOMIC.yaml +103 -103
  83. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/EDUCATION.yaml +156 -156
  84. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/EDUCATION_FLS.yaml +66 -66
  85. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/EDUCATION_UIS_SDG.yaml +119 -119
  86. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/FUNCTIONAL_DIFF.yaml +250 -250
  87. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/GENDER.yaml +138 -138
  88. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/GLOBAL_DATAFLOW.yaml +550 -550
  89. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/HIV_AIDS.yaml +205 -205
  90. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/IMMUNISATION.yaml +155 -155
  91. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/MG.yaml +147 -147
  92. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/MNCH.yaml +285 -285
  93. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/NUTRITION.yaml +293 -293
  94. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/PT.yaml +320 -320
  95. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/PT_CM.yaml +297 -297
  96. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/PT_CM_SUBNATIONAL.yaml +228 -228
  97. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/PT_CONFLICT.yaml +116 -116
  98. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/PT_FGM.yaml +292 -292
  99. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/SDG_PROG_ASSESSMENT.yaml +124 -124
  100. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/SOC_PROTECTION.yaml +140 -140
  101. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/WASH_HEALTHCARE_FACILITY.yaml +139 -139
  102. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/WASH_HOUSEHOLDS.yaml +146 -146
  103. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/WASH_HOUSEHOLD_MH.yaml +122 -122
  104. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/WASH_HOUSEHOLD_SUBNAT.yaml +219 -219
  105. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/WASH_SCHOOLS.yaml +123 -123
  106. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/dataflows/WT.yaml +237 -237
  107. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/current/unicef_indicators_metadata.yaml +4742 -4419
  108. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/vintages/2025-12-03/codelists.yaml +574 -574
  109. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/vintages/2025-12-03/dataflows.yaml +626 -626
  110. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/vintages/2025-12-03/indicators.yaml +230 -230
  111. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/vintages/2025-12-03/summary.yaml +5 -5
  112. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/vintages/2025-12-05/_unicefdata_codelists.yaml +628 -628
  113. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/vintages/2025-12-05/_unicefdata_countries.yaml +462 -462
  114. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/vintages/2025-12-05/_unicefdata_dataflows.yaml +630 -630
  115. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/vintages/2025-12-05/_unicefdata_indicators.yaml +248 -248
  116. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/vintages/2025-12-05/_unicefdata_regions.yaml +121 -121
  117. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/vintages/2025-12-05/summary.yaml +7 -7
  118. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/vintages/2025-12-07/_unicefdata_codelists.yaml +633 -633
  119. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/vintages/2025-12-07/_unicefdata_countries.yaml +464 -464
  120. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/vintages/2025-12-07/_unicefdata_dataflows.yaml +630 -630
  121. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/vintages/2025-12-07/_unicefdata_indicators.yaml +249 -249
  122. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/vintages/2025-12-07/_unicefdata_regions.yaml +123 -123
  123. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/vintages/2025-12-07/summary.yaml +7 -7
  124. {unicefdata-2.1.1/unicefdata/metadata/vintages/2026-01-25 → unicefdata-2.4.0/unicefdata/metadata/vintages/2026-01-21}/_unicefdata_codelists.yaml +641 -641
  125. {unicefdata-2.1.1/unicefdata/metadata/vintages/2026-01-25 → unicefdata-2.4.0/unicefdata/metadata/vintages/2026-01-21}/_unicefdata_countries.yaml +464 -464
  126. {unicefdata-2.1.1/unicefdata/metadata/vintages/2026-01-25 → unicefdata-2.4.0/unicefdata/metadata/vintages/2026-01-21}/_unicefdata_dataflows.yaml +639 -639
  127. {unicefdata-2.1.1/unicefdata/metadata/vintages/2026-01-25 → unicefdata-2.4.0/unicefdata/metadata/vintages/2026-01-21}/_unicefdata_indicators.yaml +9674 -9674
  128. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/vintages/2026-01-21/_unicefdata_regions.yaml +123 -123
  129. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/vintages/2026-01-21/summary.yaml +7 -7
  130. {unicefdata-2.1.1/unicefdata/metadata/vintages/2026-01-21 → unicefdata-2.4.0/unicefdata/metadata/vintages/2026-01-25}/_unicefdata_codelists.yaml +641 -641
  131. {unicefdata-2.1.1/unicefdata/metadata/vintages/2026-01-21 → unicefdata-2.4.0/unicefdata/metadata/vintages/2026-01-25}/_unicefdata_countries.yaml +464 -464
  132. {unicefdata-2.1.1/unicefdata/metadata/vintages/2026-01-21 → unicefdata-2.4.0/unicefdata/metadata/vintages/2026-01-25}/_unicefdata_dataflows.yaml +639 -639
  133. {unicefdata-2.1.1/unicefdata/metadata/vintages/2026-01-21 → unicefdata-2.4.0/unicefdata/metadata/vintages/2026-01-25}/_unicefdata_indicators.yaml +9674 -9674
  134. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/vintages/2026-01-25/_unicefdata_regions.yaml +123 -123
  135. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata/vintages/2026-01-25/summary.yaml +7 -7
  136. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata.py +1084 -1084
  137. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/metadata_manager.py +281 -281
  138. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/run_sync.py +20 -20
  139. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/schema_cache.py +283 -283
  140. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/schema_sync.py +561 -561
  141. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/sdmx.py +214 -166
  142. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/sdmx_client.py +1399 -1388
  143. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/unicefdata.py +1343 -1192
  144. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/utils.py +616 -616
  145. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata/yaml_formatter.py +333 -333
  146. unicefdata-2.4.0/unicefdata.egg-info/PKG-INFO +892 -0
  147. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata.egg-info/SOURCES.txt +11 -0
  148. unicefdata-2.1.1/PKG-INFO +0 -423
  149. unicefdata-2.1.1/README.md +0 -382
  150. unicefdata-2.1.1/unicefdata.egg-info/PKG-INFO +0 -423
  151. {unicefdata-2.1.1 → unicefdata-2.4.0}/LICENSE +0 -0
  152. {unicefdata-2.1.1 → unicefdata-2.4.0}/setup.cfg +0 -0
  153. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata.egg-info/dependency_links.txt +0 -0
  154. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata.egg-info/requires.txt +0 -0
  155. {unicefdata-2.1.1 → unicefdata-2.4.0}/unicefdata.egg-info/top_level.txt +0 -0
@@ -0,0 +1,892 @@
1
+ Metadata-Version: 2.4
2
+ Name: unicefdata
3
+ Version: 2.4.0
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
+ [![PyPI version](https://badge.fury.io/py/unicefdata.svg)](https://pypi.org/project/unicefdata/)
45
+ [![Python Tests](https://github.com/unicef-drp/unicefData/actions/workflows/python-tests.yaml/badge.svg)](https://github.com/unicef-drp/unicefData/actions)
46
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
47
+ [![Downloads](https://static.pepy.tech/badge/unicefdata)](https://pepy.tech/project/unicefdata)
48
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](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.4.0
86
+
87
+ - **Query status codes**: Empty results now tell you *why* via `df.attrs["query_status"]`:
88
+ - `year_not_found` — country has data, but not for the requested year (gap in time series)
89
+ - `year_beyond_range` — requested year is before the earliest or after the latest data point
90
+ - `country_not_found` — indicator exists but not for this country (includes `available_countries`)
91
+ - `indicator_not_found` — indicator doesn't exist in any dataflow
92
+ - **Client-side year filtering**: Fixes 6 survey-based indicators (NUTRITION, MNCH, EDUCATION) that failed with year filters due to an SDMX API quirk
93
+ - **Smarter fallback logic**: No longer wastes API calls trying non-existent fallback dataflows when data simply doesn't exist for the requested country/year
94
+
95
+ ```python
96
+ df = unicefData("MNCH_CSEC", countries=["BRA"], year=2020)
97
+ # len(df) == 0
98
+ print(df.attrs["query_status"]) # "year_not_found"
99
+ print(df.attrs["available_years"]) # [2000, 2001, ..., 2019]
100
+ print(df.attrs["nearest_year"]) # 2019
101
+ ```
102
+
103
+ ## What's New in 2.2.2
104
+
105
+ - **`UNICEFSDMXClient` dataflow resolution fixed**: `fetch_indicator()` now auto-detects the correct dataflow from metadata instead of always defaulting to `GLOBAL_DATAFLOW`, consistent with `unicefData()`
106
+
107
+ ## What's New in 2.2.1
108
+
109
+ - **Bundled metadata paths corrected**: Startup warnings about missing fallback sequences and indicators metadata are resolved
110
+ - **Codelists filename fixed**: `MetadataManager` now correctly loads `_unicefdata_codelists.yaml`
111
+ - **Category lookup fixed**: `list_categories()` and `search_indicators(category=...)` now return correct results instead of all `UNKNOWN`
112
+
113
+ See [CHANGELOG.md](CHANGELOG.md) for complete details.
114
+
115
+ ## What's New in 2.2.0
116
+
117
+ - **328+ automated tests** across 11 test families with deterministic fixtures
118
+ - **Full CI matrix**: Python 3.9–3.12 on Ubuntu / macOS / Windows
119
+ - **Bug fixes**: Sex filter for full-dataflow, None indicator handling, retry logic
120
+ - **Input validation**: Filters empty/whitespace indicators with helpful error messages
121
+
122
+ ---
123
+
124
+ ## Quick Start
125
+
126
+ ### Search for Indicators
127
+
128
+ ```python
129
+ from unicefdata import search_indicators, list_categories
130
+
131
+ # List all categories
132
+ list_categories()
133
+ ```
134
+
135
+ ```
136
+ ==================================================
137
+ Available Indicator Categories
138
+ ==================================================
139
+
140
+ CATEGORY COUNT
141
+ --------------------------------------------------
142
+ NUTRITION 112
143
+ CAUSE_OF_DEATH 83
144
+ CHILD_RELATED_SDG 77
145
+ WASH_HOUSEHOLDS 64
146
+ EDUCATION_UIS_SDG 62
147
+ PT 52
148
+ GLOBAL_DATAFLOW 50
149
+ CHLD_PVTY 43
150
+ CME 39
151
+ HIV_AIDS 38
152
+ MNCH 38
153
+ DM 31
154
+ MG 26
155
+ IMMUNISATION 18
156
+ GENDER 16
157
+ ECON 13
158
+ FUNCTIONAL_DIFF 12
159
+ SOC_PROTECTION 10
160
+ ECD 8
161
+ --------------------------------------------------
162
+ TOTAL 792
163
+
164
+ Use search_indicators(category='CATEGORY_NAME') to see indicators
165
+ ```
166
+
167
+ ```python
168
+ # Search by keyword
169
+ search_indicators("mortality")
170
+ ```
171
+
172
+ ```
173
+ ====================================================================================================
174
+ UNICEF Indicators matching 'mortality'
175
+ ====================================================================================================
176
+
177
+ Found 24 indicator(s)
178
+ ----------------------------------------------------------------------------------------------------
179
+ CODE CATEGORY NAME DESCRIPTION
180
+ ----------------------------------------------------------------------------------------------------
181
+ CME_MRM0 CME Neonatal mortality rate Probability of d..
182
+ CME_MRY0 CME Infant mortality rate Probability of d..
183
+ CME_MRY0T4 CME Under-five mortality rate Probability of d..
184
+ CME_MRY5T14 CME Mortality rate (children aged 5 t.. Probability of d..
185
+ MNCH_MMR MNCH Maternal mortality ratio (number .. Maternal mortali..
186
+ ...
187
+ ----------------------------------------------------------------------------------------------------
188
+ Usage tips:
189
+ - unicefData(indicator='CODE') to fetch data for an indicator
190
+ - search_indicators(category='CME') to browse by category
191
+ ```
192
+
193
+ ```python
194
+ # Search within a category
195
+ search_indicators(category="CME")
196
+ search_indicators("rate", category="CME")
197
+ ```
198
+
199
+ ---
200
+
201
+ ### Download Data
202
+
203
+ ```python
204
+ from unicefdata import unicefData
205
+
206
+ # Fetch under-5 mortality rate (dataflow auto-detected)
207
+ df = unicefData(
208
+ indicator="CME_MRY0T4",
209
+ countries=["ALB", "USA", "BRA"],
210
+ year="2015:2023" # range, single year, or list
211
+ )
212
+
213
+ print(df.shape)
214
+ print(df[["iso3", "country", "period", "indicator", "value"]].to_string(index=False))
215
+ ```
216
+
217
+ ```
218
+ (27, 21)
219
+
220
+ iso3 country period indicator value
221
+ ALB Albania 2015.0 CME_MRY0T4 9.586263
222
+ ALB Albania 2016.0 CME_MRY0T4 9.400753
223
+ ALB Albania 2017.0 CME_MRY0T4 9.336307
224
+ ALB Albania 2018.0 CME_MRY0T4 9.344314
225
+ ALB Albania 2019.0 CME_MRY0T4 9.386670
226
+ ALB Albania 2020.0 CME_MRY0T4 9.435272
227
+ ALB Albania 2021.0 CME_MRY0T4 9.456832
228
+ ALB Albania 2022.0 CME_MRY0T4 9.436385
229
+ ALB Albania 2023.0 CME_MRY0T4 9.357239
230
+ BRA Brazil 2015.0 CME_MRY0T4 15.963330
231
+ BRA Brazil 2016.0 CME_MRY0T4 16.771457
232
+ ...
233
+ USA United States 2023.0 CME_MRY0T4 6.482592
234
+ ```
235
+
236
+ ```python
237
+ # Summary statistics
238
+ print(df["value"].describe().round(2))
239
+ ```
240
+
241
+ ```
242
+ count 27.00
243
+ mean 10.40
244
+ std 3.70
245
+ min 6.46
246
+ 25% 6.64
247
+ 50% 9.40
248
+ 75% 14.66
249
+ max 16.77
250
+ Name: value, dtype: float64
251
+ ```
252
+
253
+ ```python
254
+ # Cross-country pivot table (countries × years)
255
+ print(df.groupby(["iso3", "period"])["value"].first().unstack().round(1))
256
+ ```
257
+
258
+ ```
259
+ period 2015.0 2016.0 2017.0 2018.0 2019.0 2020.0 2021.0 2022.0 2023.0
260
+ iso3
261
+ ALB 9.6 9.4 9.3 9.3 9.4 9.4 9.5 9.4 9.4
262
+ BRA 16.0 16.8 15.4 15.2 15.0 14.9 14.7 14.6 14.4
263
+ USA 6.8 6.7 6.6 6.5 6.5 6.5 6.5 6.5 6.5
264
+ ```
265
+
266
+ ---
267
+
268
+ ### View Dataflow Schema
269
+
270
+ ```python
271
+ from unicefdata import dataflow_schema, print_dataflow_schema
272
+
273
+ print_dataflow_schema(dataflow_schema("CME"))
274
+ ```
275
+
276
+ ```
277
+ ----------------------------------------------------------------------
278
+ Dataflow Schema: CME
279
+ ----------------------------------------------------------------------
280
+
281
+ Name: Child Mortality
282
+ Version: 1.0
283
+ Agency: UNICEF
284
+
285
+ Dimensions (4):
286
+ REF_AREA
287
+ INDICATOR
288
+ SEX
289
+ WEALTH_QUINTILE
290
+
291
+ Attributes (7):
292
+ DATA_SOURCE
293
+ COUNTRY_NOTES
294
+ REF_PERIOD
295
+ UNIT_MEASURE
296
+ LOWER_BOUND
297
+ UPPER_BOUND
298
+ OBS_STATUS
299
+ ----------------------------------------------------------------------
300
+ ```
301
+
302
+ ---
303
+
304
+ ## Post-Production Options
305
+
306
+ ### Output Formats
307
+
308
+ ```python
309
+ # Long format (default) — one row per country × year
310
+ df = unicefData(indicator="CME_MRY0T4", countries=["ALB", "USA", "BRA"],
311
+ year="2020:2022", format="long")
312
+ print(df[["iso3", "country", "period", "value"]].to_string(index=False))
313
+ ```
314
+
315
+ ```
316
+ iso3 country period value
317
+ ALB Albania 2020.0 9.435272
318
+ ALB Albania 2021.0 9.456832
319
+ ALB Albania 2022.0 9.436385
320
+ BRA Brazil 2020.0 14.873612
321
+ BRA Brazil 2021.0 14.723535
322
+ BRA Brazil 2022.0 14.588250
323
+ USA United States 2020.0 6.469871
324
+ USA United States 2021.0 6.464968
325
+ USA United States 2022.0 6.473319
326
+ ```
327
+
328
+ ```python
329
+ # Wide format — years as columns
330
+ df = unicefData(indicator="CME_MRY0T4", countries=["ALB", "USA", "BRA"],
331
+ year="2020:2022", format="wide")
332
+ print(df[["iso3", "country", 2020.0, 2021.0, 2022.0]].to_string(index=False))
333
+ ```
334
+
335
+ ```
336
+ iso3 country 2020.0 2021.0 2022.0
337
+ ALB Albania 9.435272 9.456832 9.436385
338
+ BRA Brazil 14.873612 14.723535 14.588250
339
+ USA United States 6.469871 6.464968 6.473319
340
+ ```
341
+
342
+ ```python
343
+ # Wide indicators — indicators as columns
344
+ df = unicefData(
345
+ indicator=["CME_MRY0T4", "CME_MRM0"],
346
+ countries=["ALB", "USA", "BRA"],
347
+ year="2020:2022",
348
+ format="wide_indicators"
349
+ )
350
+ print(df[["iso3", "country", "period", "CME_MRY0T4", "CME_MRM0"]].to_string(index=False))
351
+ ```
352
+
353
+ ```
354
+ iso3 country period CME_MRY0T4 CME_MRM0
355
+ ALB Albania 2020.0 9.435272 7.185830
356
+ ALB Albania 2021.0 9.456832 7.125219
357
+ ALB Albania 2022.0 9.436385 6.998704
358
+ BRA Brazil 2020.0 14.873612 9.163120
359
+ BRA Brazil 2021.0 14.723535 8.893245
360
+ BRA Brazil 2022.0 14.588250 8.281859
361
+ USA United States 2020.0 6.469871 3.642096
362
+ USA United States 2021.0 6.464968 3.520667
363
+ USA United States 2022.0 6.473319 3.477007
364
+ ```
365
+
366
+ ---
367
+
368
+ ### Latest Value Per Country
369
+
370
+ ```python
371
+ df = unicefData(
372
+ indicator="CME_MRY0T4",
373
+ countries=["ALB", "BRA", "DEU", "IND", "USA"],
374
+ latest=True
375
+ )
376
+ print(df[["iso3", "country", "period", "value"]].to_string(index=False))
377
+ ```
378
+
379
+ ```
380
+ iso3 country period value
381
+ ALB Albania 2024.0 9.227080
382
+ BRA Brazil 2024.0 14.216972
383
+ DEU Germany 2024.0 3.711222
384
+ IND India 2024.0 26.579900
385
+ USA United States 2024.0 6.472463
386
+ ```
387
+
388
+ ---
389
+
390
+ ### Most Recent Values (MRV)
391
+
392
+ ```python
393
+ df = unicefData(indicator="CME_MRY0T4", countries=["ALB", "USA", "BRA"], mrv=3)
394
+ print(df[["iso3", "country", "period", "value"]].sort_values(["iso3", "period"]).to_string(index=False))
395
+ ```
396
+
397
+ ```
398
+ iso3 country period value
399
+ ALB Albania 2022.0 9.436385
400
+ ALB Albania 2023.0 9.357239
401
+ ALB Albania 2024.0 9.227080
402
+ BRA Brazil 2022.0 14.588250
403
+ BRA Brazil 2023.0 14.424723
404
+ BRA Brazil 2024.0 14.216972
405
+ USA United States 2022.0 6.473319
406
+ USA United States 2023.0 6.482592
407
+ USA United States 2024.0 6.472463
408
+ ```
409
+
410
+ ---
411
+
412
+ ### Circa (Nearest Year)
413
+
414
+ ```python
415
+ # Returns the closest available observation to the target year
416
+ df = unicefData(
417
+ indicator="CME_MRY0T4",
418
+ countries=["ALB", "USA", "BRA"],
419
+ year=2015,
420
+ circa=True
421
+ )
422
+ print(df[["iso3", "country", "period", "value"]].to_string(index=False))
423
+ ```
424
+
425
+ ```
426
+ iso3 country period value
427
+ ALB Albania 2015.0 9.586263
428
+ BRA Brazil 2015.0 15.963330
429
+ USA United States 2015.0 6.752855
430
+ ```
431
+
432
+ ---
433
+
434
+ ### Add Metadata
435
+
436
+ ```python
437
+ df = unicefData(
438
+ indicator="CME_MRY0T4",
439
+ countries=["ALB", "BRA", "IND", "NGA", "USA"],
440
+ latest=True,
441
+ add_metadata=["region", "income_group"]
442
+ )
443
+ print(df[["iso3", "country", "period", "value", "region", "income_group"]].to_string(index=False))
444
+ ```
445
+
446
+ ```
447
+ iso3 country period value region income_group
448
+ ALB Albania 2024.0 9.227080 Europe and Central Asia Upper middle income
449
+ BRA Brazil 2024.0 14.216972 Latin America and Caribbean Upper middle income
450
+ IND India 2024.0 26.579900 South Asia Lower middle income
451
+ NGA Nigeria 2024.0 115.649434 Sub-Saharan Africa Lower middle income
452
+ USA United States 2024.0 6.472463 North America High income
453
+ ```
454
+
455
+ ```python
456
+ # Frequency table by income group
457
+ print(df.groupby("income_group")["value"].agg(["count", "mean", "min", "max"]).round(2))
458
+ ```
459
+
460
+ ```
461
+ count mean min max
462
+ income_group
463
+ High income 1 6.47 6.47 6.47
464
+ Lower middle income 2 71.11 26.58 115.65
465
+ Upper middle income 2 11.72 9.23 14.22
466
+ ```
467
+
468
+ ---
469
+
470
+ ### Combining Options
471
+
472
+ ```python
473
+ df = unicefData(
474
+ indicator=["CME_MRY0T4", "CME_MRM0"],
475
+ countries=["ALB", "BRA", "IND", "NGA", "USA"],
476
+ format="wide_indicators",
477
+ latest=True,
478
+ add_metadata=["region", "income_group"],
479
+ dropna=True
480
+ )
481
+ print(df[["iso3", "country", "CME_MRY0T4", "CME_MRM0", "region", "income_group"]].to_string(index=False))
482
+ ```
483
+
484
+ ```
485
+ iso3 country CME_MRY0T4 CME_MRM0 region income_group
486
+ ALB Albania 9.227080 6.735194 Europe and Central Asia Upper middle income
487
+ BRA Brazil 14.216972 7.124973 Latin America and Caribbean Upper middle income
488
+ IND India 26.579900 16.659252 South Asia Lower middle income
489
+ NGA Nigeria 115.649434 39.045723 Sub-Saharan Africa Lower middle income
490
+ USA United States 6.472463 3.652385 North America High income
491
+ ```
492
+
493
+ ---
494
+
495
+ ## Visualizations
496
+
497
+ 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.
498
+
499
+ ### Time-Series Line Chart
500
+
501
+ ```python
502
+ import matplotlib.pyplot as plt
503
+ from unicefdata import unicefData
504
+
505
+ df = unicefData(
506
+ indicator="CME_MRY0T4",
507
+ countries=["ALB", "BRA", "DEU", "IND", "NGA", "USA"],
508
+ year="2000:2024"
509
+ )
510
+
511
+ country_colors = {
512
+ "ALB": "#4CAF50", "BRA": "#FF9800", "DEU": "#2196F3",
513
+ "IND": "#9C27B0", "NGA": "#F44336", "USA": "#00BCD4"
514
+ }
515
+
516
+ fig, ax = plt.subplots(figsize=(10, 5))
517
+ for iso3, grp in df.groupby("iso3"):
518
+ grp_sorted = grp.sort_values("period")
519
+ ax.plot(grp_sorted["period"], grp_sorted["value"],
520
+ marker="o", markersize=3,
521
+ color=country_colors.get(iso3, "#999"),
522
+ label=grp_sorted["country"].iloc[0])
523
+
524
+ ax.set_title("Under-5 Mortality Rate (CME_MRY0T4), 2000–2024", fontweight="bold")
525
+ ax.set_xlabel("Year")
526
+ ax.set_ylabel("Deaths per 1,000 live births")
527
+ ax.legend(loc="upper right", fontsize=9)
528
+ ax.grid(True, alpha=0.3)
529
+ plt.tight_layout()
530
+ plt.show()
531
+ ```
532
+
533
+ ![Time-series line chart: under-5 mortality rate 2000–2024](https://raw.githubusercontent.com/unicef-drp/unicefData/main/python/examples/fig01_timeseries.png)
534
+
535
+ ### Cross-Country Bar Chart (Latest Values)
536
+
537
+ ```python
538
+ import matplotlib.pyplot as plt
539
+ from matplotlib.patches import Patch
540
+ from unicefdata import unicefData
541
+
542
+ df = unicefData(
543
+ indicator="CME_MRY0T4",
544
+ countries=["ALB", "BRA", "CHN", "DEU", "ETH", "IND", "MEX", "NGA", "USA", "ZAF"],
545
+ latest=True,
546
+ add_metadata=["income_group"]
547
+ )
548
+ df_sorted = df.sort_values("value", ascending=True)
549
+
550
+ income_colors = {
551
+ "High income": "#2196F3",
552
+ "Upper middle income": "#4CAF50",
553
+ "Lower middle income": "#FF9800",
554
+ "Low income": "#F44336"
555
+ }
556
+
557
+ fig, ax = plt.subplots(figsize=(9, 5))
558
+ bars = ax.barh(
559
+ df_sorted["country"],
560
+ df_sorted["value"],
561
+ color=[income_colors.get(ig, "#999") for ig in df_sorted["income_group"]]
562
+ )
563
+ ax.bar_label(bars, fmt="%.1f", padding=4, fontsize=9)
564
+ handles = [Patch(color=c, label=l) for l, c in income_colors.items()
565
+ if l in df_sorted["income_group"].values]
566
+ ax.legend(handles=handles, title="Income group", fontsize=8)
567
+ ax.set_title("Under-5 Mortality Rate — Latest Available Year", fontweight="bold")
568
+ ax.set_xlabel("Deaths per 1,000 live births")
569
+ ax.grid(axis="x", alpha=0.3)
570
+ plt.tight_layout()
571
+ plt.show()
572
+ ```
573
+
574
+ ![Bar chart: under-5 mortality rate by country, coloured by income group](https://raw.githubusercontent.com/unicef-drp/unicefData/main/python/examples/fig02_barchart.png)
575
+
576
+ ### Scatter Plot: Two Indicators by Country
577
+
578
+ ```python
579
+ import numpy as np
580
+ import matplotlib.pyplot as plt
581
+ from unicefdata import unicefData
582
+
583
+ df = unicefData(
584
+ indicator=["CME_MRY0T4", "CME_MRM0"],
585
+ format="wide_indicators",
586
+ latest=True,
587
+ add_metadata=["income_group"],
588
+ dropna=True
589
+ )
590
+
591
+ income_colors = {
592
+ "High income": "#2196F3",
593
+ "Upper middle income": "#4CAF50",
594
+ "Lower middle income": "#FF9800",
595
+ "Low income": "#F44336"
596
+ }
597
+
598
+ fig, ax = plt.subplots(figsize=(8, 6))
599
+ for ig, grp in df.groupby("income_group"):
600
+ ax.scatter(grp["CME_MRM0"], grp["CME_MRY0T4"],
601
+ color=income_colors.get(ig, "#999"), label=ig, alpha=0.7, s=50)
602
+
603
+ x, y = df["CME_MRM0"].values, df["CME_MRY0T4"].values
604
+ m, b = np.polyfit(x, y, 1)
605
+ xline = np.linspace(x.min(), x.max(), 100)
606
+ ax.plot(xline, m * xline + b, color="#333", linewidth=1.2, linestyle="--", alpha=0.6, label="Trend")
607
+
608
+ ax.set_xlabel("Neonatal Mortality Rate (CME_MRM0)")
609
+ ax.set_ylabel("Under-5 Mortality Rate (CME_MRY0T4)")
610
+ ax.set_title("Neonatal vs Under-5 Mortality — All Countries, Latest Values", fontweight="bold")
611
+ ax.legend(title="Income group", fontsize=8)
612
+ ax.grid(True, alpha=0.3)
613
+ plt.tight_layout()
614
+ plt.show()
615
+ ```
616
+
617
+ ![Scatter plot: neonatal vs under-5 mortality, all countries, coloured by income group](https://raw.githubusercontent.com/unicef-drp/unicefData/main/python/examples/fig03_scatter.png)
618
+
619
+ ---
620
+
621
+ ## Advanced: UNICEFSDMXClient
622
+
623
+ For lower-level access, use `UNICEFSDMXClient` directly.
624
+
625
+ ```python
626
+ from unicefdata import UNICEFSDMXClient
627
+
628
+ client = UNICEFSDMXClient()
629
+
630
+ # Fetch a single indicator
631
+ df = client.fetch_indicator(
632
+ "CME_MRY0T4",
633
+ countries=["ALB", "USA"],
634
+ start_year=2020,
635
+ end_year=2023
636
+ )
637
+ print(df[["iso3", "country", "period", "indicator", "value"]].to_string(index=False))
638
+ ```
639
+
640
+ ```
641
+ iso3 country period indicator value
642
+ ALB Albania 2020.0 CME_MRY0T4 9.435272
643
+ ALB Albania 2021.0 CME_MRY0T4 9.456832
644
+ ALB Albania 2022.0 CME_MRY0T4 9.436385
645
+ ALB Albania 2023.0 CME_MRY0T4 9.357239
646
+ USA United States 2020.0 CME_MRY0T4 6.469871
647
+ USA United States 2021.0 CME_MRY0T4 6.464968
648
+ USA United States 2022.0 CME_MRY0T4 6.473319
649
+ USA United States 2023.0 CME_MRY0T4 6.482592
650
+ ```
651
+
652
+ ```python
653
+ # Fetch multiple indicators combined into one DataFrame
654
+ df = client.fetch_multiple_indicators(
655
+ ["CME_MRY0T4", "CME_MRM0"],
656
+ countries=["ALB", "USA"],
657
+ combine=True
658
+ )
659
+ print(f"Shape: {df.shape}")
660
+ print(df.groupby(["iso3", "indicator"])["value"].agg(["count", "mean"]).round(2))
661
+ ```
662
+
663
+ ```
664
+ Shape: (226, 21)
665
+
666
+ count mean
667
+ iso3 indicator
668
+ ALB CME_MRM0 72.0 12.89
669
+ CME_MRY0T4 72.0 18.79
670
+ USA CME_MRM0 41.0 5.48
671
+ CME_MRY0T4 41.0 9.15
672
+ ```
673
+
674
+ ```python
675
+ # Configurable timeout
676
+ client = UNICEFSDMXClient(timeout=120)
677
+ ```
678
+
679
+ ---
680
+
681
+ ## API Reference
682
+
683
+ ### unicefData()
684
+
685
+ Main function for fetching UNICEF indicator data.
686
+
687
+ | Parameter | Type | Default | Description |
688
+ |-----------|------|---------|-------------|
689
+ | `indicator` | str/list | required | Indicator code(s) |
690
+ | `dataflow` | str | auto-detect | SDMX dataflow ID |
691
+ | `countries` | list | None (all) | ISO3 country codes |
692
+ | `year` | int/str/list | None (all) | Year(s) |
693
+ | `circa` | bool | False | Find closest year |
694
+ | `sex` | str | `"_T"` | Sex filter |
695
+ | `max_retries` | int | 3 | Retry attempts |
696
+
697
+ #### Post-Production Parameters
698
+
699
+ | Parameter | Type | Default | Description |
700
+ |-----------|------|---------|-------------|
701
+ | `format` | str | `"long"` | `"long"`, `"wide"`, `"wide_indicators"` |
702
+ | `latest` | bool | False | Keep only latest per country |
703
+ | `mrv` | int | None | Keep N most recent values |
704
+ | `add_metadata` | list | None | Metadata to add |
705
+ | `dropna` | bool | False | Remove missing values |
706
+ | `simplify` | bool | False | Keep only essential columns |
707
+
708
+ ### Other Functions
709
+
710
+ | Function | Description |
711
+ |----------|-------------|
712
+ | `search_indicators(query, category, limit)` | Search indicators |
713
+ | `list_categories()` | List all categories |
714
+ | `list_dataflows()` | List available dataflows |
715
+ | `dataflow_schema(dataflow)` | Get dataflow schema |
716
+ | `clear_cache()` | Clear all 5 cache layers |
717
+
718
+ ---
719
+
720
+ ## Time Period Handling
721
+
722
+ Monthly periods are converted to decimal years:
723
+
724
+ | Original | Decimal | Calculation |
725
+ |----------|---------|-------------|
726
+ | `2020` | `2020.0` | Integer year |
727
+ | `2020-01` | `2020.0833` | 2020 + 1/12 |
728
+ | `2020-06` | `2020.5000` | 2020 + 6/12 |
729
+
730
+ ---
731
+
732
+ ## Common Indicators
733
+
734
+ ### Child Mortality (SDG 3.2)
735
+ - `CME_MRM0` - Neonatal mortality rate
736
+ - `CME_MRY0T4` - Under-5 mortality rate
737
+
738
+ ### Nutrition (SDG 2.2)
739
+ - `NT_ANT_HAZ_NE2_MOD` - Stunting prevalence
740
+ - `NT_ANT_WHZ_NE2` - Wasting prevalence
741
+
742
+ ### Immunization (SDG 3.b)
743
+ - `IM_DTP3` - DTP3 coverage
744
+ - `IM_MCV1` - Measles coverage
745
+
746
+ ### WASH (SDG 6)
747
+ - `WS_PPL_W-SM` - Safely managed water
748
+ - `WS_PPL_S-SM` - Safely managed sanitation
749
+
750
+ ### Child Protection
751
+ - `PT_CHLD_Y0T4_REG` - Birth registration
752
+ - `PT_F_20-24_MRD_U18_TND` - Child marriage
753
+
754
+ ---
755
+
756
+ ## Error Handling
757
+
758
+ ```python
759
+ from unicefdata import SDMXNotFoundError, SDMXBadRequestError, SDMXTimeoutError
760
+
761
+ try:
762
+ df = unicefData(indicator="INVALID_CODE")
763
+ except SDMXNotFoundError as e:
764
+ print(f"Indicator not found: {e}")
765
+ except SDMXBadRequestError as e:
766
+ print(f"Invalid request: {e}")
767
+ except SDMXTimeoutError as e:
768
+ print(f"Request timed out: {e}")
769
+ ```
770
+
771
+ ---
772
+
773
+ ## Troubleshooting
774
+
775
+ ### Connection Errors
776
+
777
+ ```python
778
+ # Increase retry attempts
779
+ df = unicefData(indicator="CME_MRY0T4", max_retries=5)
780
+ ```
781
+
782
+ ### Stale Cache
783
+
784
+ ```python
785
+ from unicefdata import clear_cache
786
+ clear_cache() # Clears all 5 cache layers
787
+ ```
788
+
789
+ ---
790
+
791
+ ## Examples
792
+
793
+ See `examples/` folder:
794
+
795
+ - `00_quick_start.py` - Basic usage
796
+ - `01_indicator_discovery.py` - Finding indicators
797
+ - `02_sdg_indicators.py` - SDG queries
798
+ - `03_data_formats.py` - Output formats
799
+ - `04_metadata_options.py` - Metadata enrichment
800
+ - `05_advanced_features.py` - Advanced options
801
+
802
+ ---
803
+
804
+ ## Version History
805
+
806
+ See [CHANGELOG.md](CHANGELOG.md) for complete changelog.
807
+
808
+ ---
809
+
810
+ ## Dependencies
811
+
812
+ - pandas
813
+ - requests
814
+ - pyyaml
815
+
816
+ Optional: `pip install "unicefdata[excel]"` for Excel export support.
817
+
818
+ ---
819
+
820
+ ## Acknowledgments
821
+
822
+ 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.
823
+
824
+ 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.
825
+
826
+ 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.
827
+
828
+ 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.
829
+
830
+ Development was assisted by AI coding tools (GitHub Copilot, Claude). All code has been reviewed, tested, and validated by the package maintainers.
831
+
832
+ ## Disclaimer
833
+
834
+ **This package is provided for research and analytical purposes.**
835
+
836
+ 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**.
837
+
838
+ 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/).
839
+
840
+ 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.
841
+
842
+ 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.
843
+
844
+ ## Data Citation and Provenance
845
+
846
+ **Important Note on Data Vintages**
847
+
848
+ 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.
849
+
850
+ **For reproducible research and proper data attribution, users should:**
851
+
852
+ 1. **Document the indicator code** - Specify the exact SDMX indicator code(s) used (e.g., `CME_MRY0T4`)
853
+ 2. **Record the download date** - Note when data was accessed (e.g., "Data downloaded: 2026-03-20")
854
+ 3. **Cite the data source** - Reference both the package and the UNICEF Data Warehouse
855
+ 4. **Archive your dataset** - Save a copy of the exact data used in your analysis
856
+
857
+ **Example citation for data used in research:**
858
+
859
+ > 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/
860
+
861
+ 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/).
862
+
863
+ ## Citation
864
+
865
+ If you use this package, please cite:
866
+
867
+ > Azevedo, Joao Pedro (2026). "unicefdata: Unified access to UNICEF indicators across R, Python, and Stata." Mimeo, UNICEF Chief Statistician Office.
868
+
869
+ ---
870
+
871
+ ## Development
872
+
873
+ Development assisted by AI coding tools (GitHub Copilot, Claude). All code reviewed and validated by maintainers.
874
+
875
+ ---
876
+
877
+ ## Author
878
+
879
+ **Joao Pedro Azevedo** ([@jpazvd](https://github.com/jpazvd))
880
+ Chief Statistician, UNICEF Data and Analytics Section
881
+ Email: jpazevedo@unicef.org
882
+ Website: [jpazvd.github.io](https://jpazvd.github.io/)
883
+
884
+ ---
885
+
886
+ ## License
887
+
888
+ MIT License - See [LICENSE](../LICENSE)
889
+
890
+ ## Contributing
891
+
892
+ See [CONTRIBUTING.md](../CONTRIBUTING.md) for detailed guidelines.