hapi-schema 0.9.5__tar.gz → 0.9.7__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 (104) hide show
  1. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/.config/pre-commit-config.yaml +2 -2
  2. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/PKG-INFO +4 -3
  3. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/changelog.md +15 -0
  4. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/pyproject.toml +2 -2
  5. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/requirements.txt +10 -10
  6. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/_version.py +2 -2
  7. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/db_conflict_event.py +3 -2
  8. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/db_food_price.py +3 -2
  9. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/db_food_security.py +3 -2
  10. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/db_funding.py +3 -2
  11. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/db_humanitarian_needs.py +5 -2
  12. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/db_idps.py +3 -2
  13. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/db_national_risk.py +3 -2
  14. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/db_operational_presence.py +5 -2
  15. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/db_population.py +3 -2
  16. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/db_poverty_rate.py +3 -2
  17. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/db_refugees.py +5 -3
  18. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/db_returnees.py +5 -3
  19. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/db_views_as_tables.py +21 -17
  20. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/db_wfp_market.py +2 -0
  21. hapi_schema-0.9.7/src/hapi_schema/utils/endpoint_constants.py +35 -0
  22. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/test_conflict_event.py +1 -1
  23. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/test_food_price.py +2 -2
  24. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/test_food_security.py +1 -1
  25. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/test_population.py +2 -2
  26. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/test_poverty_rate.py +1 -1
  27. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/test_refugees.py +2 -3
  28. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/test_returnees.py +1 -2
  29. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/test_views_as_tables.py +13 -2
  30. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/.config/coveragerc +0 -0
  31. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/.config/pytest.ini +0 -0
  32. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/.config/ruff.toml +0 -0
  33. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/.github/workflows/publish.yaml +0 -0
  34. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/.github/workflows/run-python-tests.yaml +0 -0
  35. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/.gitignore +0 -0
  36. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/LICENSE +0 -0
  37. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/README.md +0 -0
  38. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/contributing.md +0 -0
  39. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/docker/docker-compose.yml +0 -0
  40. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/initialize_test_db.sh +0 -0
  41. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/__init__.py +0 -0
  42. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/db_admin1.py +0 -0
  43. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/db_admin2.py +0 -0
  44. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/db_currency.py +0 -0
  45. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/db_dataset.py +0 -0
  46. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/db_location.py +0 -0
  47. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/db_org.py +0 -0
  48. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/db_org_type.py +0 -0
  49. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/db_patch.py +0 -0
  50. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/db_resource.py +0 -0
  51. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/db_sector.py +0 -0
  52. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/db_wfp_commodity.py +0 -0
  53. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/utils/__init__.py +0 -0
  54. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/utils/base.py +0 -0
  55. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/utils/constraints.py +0 -0
  56. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/utils/enums.py +0 -0
  57. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/utils/hapi_views_code_generator.py +0 -0
  58. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/utils/view_as_table_code_generator.py +0 -0
  59. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/utils/view_as_table_definitions.toml +0 -0
  60. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/utils/view_params.py +0 -0
  61. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/src/hapi_schema/views.py +0 -0
  62. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/conftest.py +0 -0
  63. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/sample_data/__init__.py +0 -0
  64. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/sample_data/data_admin1.py +0 -0
  65. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/sample_data/data_admin2.py +0 -0
  66. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/sample_data/data_conflict_event.py +0 -0
  67. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/sample_data/data_currency.py +0 -0
  68. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/sample_data/data_dataset.py +0 -0
  69. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/sample_data/data_food_price.py +0 -0
  70. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/sample_data/data_food_security.py +0 -0
  71. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/sample_data/data_funding.py +0 -0
  72. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/sample_data/data_humanitarian_needs.py +0 -0
  73. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/sample_data/data_idps.py +0 -0
  74. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/sample_data/data_location.py +0 -0
  75. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/sample_data/data_national_risk.py +0 -0
  76. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/sample_data/data_operational_presence.py +0 -0
  77. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/sample_data/data_org.py +0 -0
  78. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/sample_data/data_org_type.py +0 -0
  79. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/sample_data/data_patch.py +0 -0
  80. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/sample_data/data_population.py +0 -0
  81. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/sample_data/data_poverty_rate.py +0 -0
  82. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/sample_data/data_refugees.py +0 -0
  83. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/sample_data/data_resource.py +0 -0
  84. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/sample_data/data_returnees.py +0 -0
  85. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/sample_data/data_sector.py +0 -0
  86. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/sample_data/data_wfp_commodity.py +0 -0
  87. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/sample_data/data_wfp_market.py +0 -0
  88. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/test_admin1.py +0 -0
  89. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/test_admin2.py +0 -0
  90. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/test_currency.py +0 -0
  91. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/test_dataset.py +0 -0
  92. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/test_funding.py +0 -0
  93. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/test_humanitarian_needs.py +0 -0
  94. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/test_idps.py +0 -0
  95. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/test_location.py +0 -0
  96. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/test_national_risk.py +0 -0
  97. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/test_operational_presence.py +0 -0
  98. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/test_org.py +0 -0
  99. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/test_org_type.py +0 -0
  100. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/test_patch.py +0 -0
  101. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/test_resource.py +0 -0
  102. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/test_sector.py +0 -0
  103. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/test_wfp_commodity.py +0 -0
  104. {hapi_schema-0.9.5 → hapi_schema-0.9.7}/tests/test_wfp_market.py +0 -0
@@ -8,7 +8,7 @@ repos:
8
8
  - id: end-of-file-fixer
9
9
  - id: check-ast
10
10
  - repo: https://github.com/astral-sh/ruff-pre-commit
11
- rev: v0.7.0
11
+ rev: v0.9.4
12
12
  hooks:
13
13
  # Run the linter.
14
14
  - id: ruff
@@ -17,7 +17,7 @@ repos:
17
17
  - id: ruff-format
18
18
  args: [--config, .config/ruff.toml]
19
19
  - repo: https://github.com/astral-sh/uv-pre-commit
20
- rev: 0.4.24
20
+ rev: 0.5.28
21
21
  hooks:
22
22
  # Run the pip compile
23
23
  - id: pip-compile
@@ -1,10 +1,11 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: hapi-schema
3
- Version: 0.9.5
3
+ Version: 0.9.7
4
4
  Summary: HAPI database schema specified in SQLAlchemy
5
5
  Project-URL: Homepage, https://github.com/OCHA-DAP/hapi-schemas
6
6
  Author-email: Simon Johnson <simon.johnson@un.org>
7
7
  License: MIT
8
+ License-File: LICENSE
8
9
  Keywords: HDX,hapi,schema
9
10
  Classifier: Intended Audience :: Developers
10
11
  Classifier: License :: OSI Approved :: MIT License
@@ -25,7 +26,7 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
26
  Requires-Python: >=3.8
26
27
  Requires-Dist: sqlalchemy
27
28
  Provides-Extra: database
28
- Requires-Dist: hdx-python-database>=1.3.4; extra == 'database'
29
+ Requires-Dist: hdx-python-database>=1.3.5; extra == 'database'
29
30
  Provides-Extra: dev
30
31
  Requires-Dist: pre-commit; extra == 'dev'
31
32
  Provides-Extra: test
@@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## 0.9.7
9
+
10
+ ### Changed
11
+
12
+ - Changed endpoint names for conflict event, food price, food security, population, poverty rate, and refugees tables
13
+ - Include origin and asylum in data availability for refugees and returnees
14
+ - Added admin level to WFP Market table
15
+
16
+ ## 0.9.6
17
+
18
+ ### Fixed
19
+
20
+ - Fixed data_availability_vat primary key and indices
21
+ - Added indices for each new admin_level column in other tables
22
+
8
23
  ## 0.9.5
9
24
 
10
25
  ### Changed
@@ -42,7 +42,7 @@ content-type = "text/markdown"
42
42
  Homepage = "https://github.com/OCHA-DAP/hapi-schemas"
43
43
 
44
44
  [project.optional-dependencies]
45
- database = ["hdx-python-database>=1.3.4"]
45
+ database = ["hdx-python-database>=1.3.5"]
46
46
  dev = ["pre-commit"]
47
47
  test = ["hdx-python-database>=1.3.4", "psycopg[binary]", "pytest", "pytest-cov"]
48
48
 
@@ -86,7 +86,7 @@ run = """
86
86
  """
87
87
 
88
88
  [tool.hatch.envs.hatch-static-analysis]
89
- dependencies = ["ruff==0.7.0"]
89
+ dependencies = ["ruff==0.9.4"]
90
90
 
91
91
  [tool.hatch.envs.hatch-static-analysis.scripts]
92
92
  format-check = ["ruff format --config .config/ruff.toml --check --diff {args:.}",]
@@ -2,17 +2,17 @@
2
2
  # uv pip compile pyproject.toml --resolver=backtracking --all-extras -o requirements.txt
3
3
  cfgv==3.4.0
4
4
  # via pre-commit
5
- coverage==7.6.8
5
+ coverage==7.6.11
6
6
  # via pytest-cov
7
7
  distlib==0.3.9
8
8
  # via virtualenv
9
- filelock==3.16.1
9
+ filelock==3.17.0
10
10
  # via virtualenv
11
11
  greenlet==3.1.1
12
12
  # via sqlalchemy
13
- hdx-python-database==1.3.4
13
+ hdx-python-database==1.3.5
14
14
  # via hapi-schema (pyproject.toml)
15
- identify==2.6.3
15
+ identify==2.6.7
16
16
  # via pre-commit
17
17
  iniconfig==2.0.0
18
18
  # via pytest
@@ -24,13 +24,13 @@ platformdirs==4.3.6
24
24
  # via virtualenv
25
25
  pluggy==1.5.0
26
26
  # via pytest
27
- pre-commit==4.0.1
27
+ pre-commit==4.1.0
28
28
  # via hapi-schema (pyproject.toml)
29
- psycopg==3.2.3
29
+ psycopg==3.2.4
30
30
  # via hapi-schema (pyproject.toml)
31
- psycopg-binary==3.2.3
31
+ psycopg-binary==3.2.4
32
32
  # via psycopg
33
- pytest==8.3.3
33
+ pytest==8.3.4
34
34
  # via
35
35
  # hapi-schema (pyproject.toml)
36
36
  # pytest-cov
@@ -38,7 +38,7 @@ pytest-cov==6.0.0
38
38
  # via hapi-schema (pyproject.toml)
39
39
  pyyaml==6.0.2
40
40
  # via pre-commit
41
- sqlalchemy==2.0.36
41
+ sqlalchemy==2.0.38
42
42
  # via
43
43
  # hapi-schema (pyproject.toml)
44
44
  # hdx-python-database
@@ -46,5 +46,5 @@ typing-extensions==4.12.2
46
46
  # via
47
47
  # psycopg
48
48
  # sqlalchemy
49
- virtualenv==20.28.0
49
+ virtualenv==20.29.2
50
50
  # via pre-commit
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.9.5'
16
- __version_tuple__ = version_tuple = (0, 9, 5)
15
+ __version__ = version = '0.9.7'
16
+ __version_tuple__ = version_tuple = (0, 9, 7)
@@ -14,6 +14,7 @@ from sqlalchemy.sql.expression import literal
14
14
  from hapi_schema.db_admin1 import DBAdmin1, DBLocation
15
15
  from hapi_schema.db_admin2 import DBAdmin2
16
16
  from hapi_schema.db_resource import DBResource
17
+ from hapi_schema.utils import endpoint_constants
17
18
  from hapi_schema.utils.base import Base
18
19
  from hapi_schema.utils.constraints import (
19
20
  population_constraint,
@@ -102,8 +103,8 @@ view_params_conflict_event = ViewParams(
102
103
  # Results format: category, subcategory, location_name, location_code, admin1_name, admin1_code, admin2_name, admin2_code, hapi_updated_date
103
104
  availability_stmt_conflict_event = (
104
105
  select(
105
- literal("coordination-context").label("category"),
106
- literal("conflict-event").label("subcategory"),
106
+ literal(endpoint_constants.CONFLICT_EVENT_CAT).label("category"),
107
+ literal(endpoint_constants.CONFLICT_EVENT_SUBCAT).label("subcategory"),
107
108
  DBLocation.name.label("location_name"),
108
109
  DBLocation.code.label("location_code"),
109
110
  DBAdmin1.name.label("admin1_name"),
@@ -16,6 +16,7 @@ from hapi_schema.db_currency import DBCurrency
16
16
  from hapi_schema.db_resource import DBResource
17
17
  from hapi_schema.db_wfp_commodity import DBWFPCommodity
18
18
  from hapi_schema.db_wfp_market import DBWFPMarket
19
+ from hapi_schema.utils import endpoint_constants
19
20
  from hapi_schema.utils.base import Base
20
21
  from hapi_schema.utils.constraints import (
21
22
  non_negative_constraint,
@@ -136,8 +137,8 @@ view_params_food_price = ViewParams(
136
137
  # Results format: category, subcategory, location_name, location_code, admin1_name, admin1_code, admin2_name, admin2_code, hapi_updated_date
137
138
  availability_stmt_food_price = (
138
139
  select(
139
- literal("food").label("category"),
140
- literal("food-price").label("subcategory"),
140
+ literal(endpoint_constants.FOOD_PRICE_CAT).label("category"),
141
+ literal(endpoint_constants.FOOD_PRICE_SUBCAT).label("subcategory"),
141
142
  DBLocation.name.label("location_name"),
142
143
  DBLocation.code.label("location_code"),
143
144
  DBAdmin1.name.label("admin1_name"),
@@ -17,6 +17,7 @@ from hapi_schema.db_admin1 import DBAdmin1
17
17
  from hapi_schema.db_admin2 import DBAdmin2
18
18
  from hapi_schema.db_location import DBLocation
19
19
  from hapi_schema.db_resource import DBResource
20
+ from hapi_schema.utils import endpoint_constants
20
21
  from hapi_schema.utils.base import Base
21
22
  from hapi_schema.utils.constraints import (
22
23
  population_constraint,
@@ -106,8 +107,8 @@ view_params_food_security = ViewParams(
106
107
  # Results format: category, subcategory, location_name, location_code, admin1_name, admin1_code, admin2_name, admin2_code, hapi_updated_date
107
108
  availability_stmt_food_security = (
108
109
  select(
109
- literal("food").label("category"),
110
- literal("food-security").label("subcategory"),
110
+ literal(endpoint_constants.FOOD_SECURITY_CAT).label("category"),
111
+ literal(endpoint_constants.FOOD_SECURITY_SUBCAT).label("subcategory"),
111
112
  DBLocation.name.label("location_name"),
112
113
  DBLocation.code.label("location_code"),
113
114
  DBAdmin1.name.label("admin1_name"),
@@ -15,6 +15,7 @@ from sqlalchemy.sql.expression import literal
15
15
 
16
16
  from hapi_schema.db_location import DBLocation
17
17
  from hapi_schema.db_resource import DBResource
18
+ from hapi_schema.utils import endpoint_constants
18
19
  from hapi_schema.utils.base import Base
19
20
  from hapi_schema.utils.constraints import reference_period_constraint
20
21
  from hapi_schema.utils.view_params import ViewParams
@@ -99,8 +100,8 @@ view_params_funding = ViewParams(
99
100
  # Results format: category, subcategory, location_name, location_code, admin1_name, admin1_code, admin2_name, admin2_code, hapi_updated_date
100
101
  availability_stmt_funding = (
101
102
  select(
102
- literal("coordination-context").label("category"),
103
- literal("funding").label("subcategory"),
103
+ literal(endpoint_constants.FUNDING_CAT).label("category"),
104
+ literal(endpoint_constants.FUNDING_SUBCAT).label("subcategory"),
104
105
  DBLocation.name.label("location_name"),
105
106
  DBLocation.code.label("location_code"),
106
107
  literal("").label("admin1_name"),
@@ -16,6 +16,7 @@ from hapi_schema.db_admin2 import DBAdmin2
16
16
  from hapi_schema.db_location import DBLocation
17
17
  from hapi_schema.db_resource import DBResource
18
18
  from hapi_schema.db_sector import DBSector
19
+ from hapi_schema.utils import endpoint_constants
19
20
  from hapi_schema.utils.base import Base
20
21
  from hapi_schema.utils.constraints import (
21
22
  population_constraint,
@@ -116,8 +117,10 @@ view_params_humanitarian_needs = ViewParams(
116
117
  # Results format: category, subcategory, location_name, location_code, admin1_name, admin1_code, admin2_name, admin2_code, hapi_updated_date
117
118
  availability_stmt_humanitarian_needs = (
118
119
  select(
119
- literal("affected-people").label("category"),
120
- literal("humanitarian-needs").label("subcategory"),
120
+ literal(endpoint_constants.HUMANITARIAN_NEEDS_CAT).label("category"),
121
+ literal(endpoint_constants.HUMANITARIAN_NEEDS_SUBCAT).label(
122
+ "subcategory"
123
+ ),
121
124
  DBLocation.name.label("location_name"),
122
125
  DBLocation.code.label("location_code"),
123
126
  DBAdmin1.name.label("admin1_name"),
@@ -15,6 +15,7 @@ from hapi_schema.db_admin1 import DBAdmin1
15
15
  from hapi_schema.db_admin2 import DBAdmin2
16
16
  from hapi_schema.db_location import DBLocation
17
17
  from hapi_schema.db_resource import DBResource
18
+ from hapi_schema.utils import endpoint_constants
18
19
  from hapi_schema.utils.base import Base
19
20
  from hapi_schema.utils.constraints import (
20
21
  greater_than_constraint,
@@ -106,8 +107,8 @@ view_params_idps = ViewParams(
106
107
  # Results format: category, subcategory, location_name, location_code, admin1_name, admin1_code, admin2_name, admin2_code, hapi_updated_date
107
108
  availability_stmt_idps = (
108
109
  select(
109
- literal("affected-people").label("category"),
110
- literal("idps").label("subcategory"),
110
+ literal(endpoint_constants.IDPS_CAT).label("category"),
111
+ literal(endpoint_constants.IDPS_SUBCAT).label("subcategory"),
111
112
  DBLocation.name.label("location_name"),
112
113
  DBLocation.code.label("location_code"),
113
114
  DBAdmin1.name.label("admin1_name"),
@@ -15,6 +15,7 @@ from sqlalchemy.sql.expression import literal
15
15
 
16
16
  from hapi_schema.db_location import DBLocation
17
17
  from hapi_schema.db_resource import DBResource
18
+ from hapi_schema.utils import endpoint_constants
18
19
  from hapi_schema.utils.base import Base
19
20
  from hapi_schema.utils.constraints import (
20
21
  general_risk_constraint,
@@ -102,8 +103,8 @@ view_params_national_risk = ViewParams(
102
103
  # Results format: category, subcategory, location_name, location_code, admin1_name, admin1_code, admin2_name, admin2_code, hapi_updated_date
103
104
  availability_stmt_national_risk = (
104
105
  select(
105
- literal("coordination-context").label("category"),
106
- literal("national-risk").label("subcategory"),
106
+ literal(endpoint_constants.NATIONAL_RISK_CAT).label("category"),
107
+ literal(endpoint_constants.NATIONA_RISK_SUBCAT).label("subcategory"),
107
108
  DBLocation.name.label("location_name"),
108
109
  DBLocation.code.label("location_code"),
109
110
  literal("").label("admin1_name"),
@@ -18,6 +18,7 @@ from hapi_schema.db_location import DBLocation
18
18
  from hapi_schema.db_org import DBOrg, DBOrgType
19
19
  from hapi_schema.db_resource import DBResource
20
20
  from hapi_schema.db_sector import DBSector
21
+ from hapi_schema.utils import endpoint_constants
21
22
  from hapi_schema.utils.base import Base
22
23
  from hapi_schema.utils.constraints import reference_period_constraint
23
24
  from hapi_schema.utils.view_params import ViewParams
@@ -125,8 +126,10 @@ view_params_operational_presence = ViewParams(
125
126
  # Results format: category, subcategory, location_name, location_code, admin1_name, admin1_code, admin2_name, admin2_code, hapi_updated_date
126
127
  availability_stmt_operational_presence = (
127
128
  select(
128
- literal("coordination-context").label("category"),
129
- literal("operational-presence").label("subcategory"),
129
+ literal(endpoint_constants.OPERATIONAL_PRESENCE_CAT).label("category"),
130
+ literal(endpoint_constants.OPERATIONAL_PRESENCE_SUBCAT).label(
131
+ "subcategory"
132
+ ),
130
133
  DBLocation.name.label("location_name"),
131
134
  DBLocation.code.label("location_code"),
132
135
  DBAdmin1.name.label("admin1_name"),
@@ -15,6 +15,7 @@ from hapi_schema.db_admin1 import DBAdmin1
15
15
  from hapi_schema.db_admin2 import DBAdmin2
16
16
  from hapi_schema.db_location import DBLocation
17
17
  from hapi_schema.db_resource import DBResource
18
+ from hapi_schema.utils import endpoint_constants
18
19
  from hapi_schema.utils.base import Base
19
20
  from hapi_schema.utils.constraints import (
20
21
  max_age_constraint,
@@ -107,8 +108,8 @@ view_params_population = ViewParams(
107
108
  # Results format: category, subcategory, location_name, location_code, admin1_name, admin1_code, admin2_name, admin2_code, hapi_updated_date
108
109
  availability_stmt_population = (
109
110
  select(
110
- literal("population-social").label("category"),
111
- literal("population").label("subcategory"),
111
+ literal(endpoint_constants.POPULATION_CAT).label("category"),
112
+ literal(endpoint_constants.POPULATION_SUBCAT).label("subcategory"),
112
113
  DBLocation.name.label("location_name"),
113
114
  DBLocation.code.label("location_code"),
114
115
  DBAdmin1.name.label("admin1_name"),
@@ -15,6 +15,7 @@ from sqlalchemy.sql.expression import literal
15
15
  from hapi_schema.db_admin1 import DBAdmin1
16
16
  from hapi_schema.db_location import DBLocation
17
17
  from hapi_schema.db_resource import DBResource
18
+ from hapi_schema.utils import endpoint_constants
18
19
  from hapi_schema.utils.base import Base
19
20
  from hapi_schema.utils.constraints import (
20
21
  percentage_constraint,
@@ -105,8 +106,8 @@ view_params_poverty_rate = ViewParams(
105
106
  # Results format: category, subcategory, location_name, location_code, admin1_name, admin1_code, admin2_name, admin2_code, hapi_updated_date
106
107
  availability_stmt_poverty_rate = (
107
108
  select(
108
- literal("population-social").label("category"),
109
- literal("poverty-rate").label("subcategory"),
109
+ literal(endpoint_constants.POVERTY_RATE_CAT).label("category"),
110
+ literal(endpoint_constants.POVERTY_RATE_SUBCAT).label("subcategory"),
110
111
  DBLocation.name.label("location_name"),
111
112
  DBLocation.code.label("location_code"),
112
113
  DBAdmin1.name.label("admin1_name"),
@@ -16,6 +16,7 @@ from sqlalchemy.sql.expression import literal
16
16
 
17
17
  from hapi_schema.db_location import DBLocation
18
18
  from hapi_schema.db_resource import DBResource
19
+ from hapi_schema.utils import endpoint_constants
19
20
  from hapi_schema.utils.base import Base
20
21
  from hapi_schema.utils.constraints import (
21
22
  max_age_constraint,
@@ -112,8 +113,8 @@ view_params_refugees = ViewParams(
112
113
  # Results format: category, subcategory, location_name, location_code, admin1_name, admin1_code, admin2_name, admin2_code, hapi_updated_date
113
114
  availability_stmt_refugees = (
114
115
  select(
115
- literal("affected-people").label("category"),
116
- literal("refugees").label("subcategory"),
116
+ literal(endpoint_constants.REFUGEES_CAT).label("category"),
117
+ literal(endpoint_constants.REFUGEES_SUBCAT).label("subcategory"),
117
118
  DBLocation.name.label("location_name"),
118
119
  DBLocation.code.label("location_code"),
119
120
  literal("").label("admin1_name"),
@@ -126,7 +127,8 @@ availability_stmt_refugees = (
126
127
  .select_from(
127
128
  DBRefugees.__table__.join(
128
129
  DBLocation.__table__,
129
- DBRefugees.asylum_location_ref == DBLocation.id,
130
+ (DBRefugees.asylum_location_ref == DBLocation.id)
131
+ | (DBRefugees.origin_location_ref == DBLocation.id),
130
132
  isouter=True,
131
133
  ).join(
132
134
  DBResource.__table__,
@@ -16,6 +16,7 @@ from sqlalchemy.sql.expression import literal
16
16
 
17
17
  from hapi_schema.db_location import DBLocation
18
18
  from hapi_schema.db_resource import DBResource
19
+ from hapi_schema.utils import endpoint_constants
19
20
  from hapi_schema.utils.base import Base
20
21
  from hapi_schema.utils.constraints import (
21
22
  max_age_constraint,
@@ -112,8 +113,8 @@ view_params_returnees = ViewParams(
112
113
  # Results format: category, subcategory, location_name, location_code, admin1_name, admin1_code, admin2_name, admin2_code, hapi_updated_date
113
114
  availability_stmt_returnees = (
114
115
  select(
115
- literal("affected-people").label("category"),
116
- literal("returnees").label("subcategory"),
116
+ literal(endpoint_constants.RETURNEES_CAT).label("category"),
117
+ literal(endpoint_constants.RETURNEES_SUBCAT).label("subcategory"),
117
118
  DBLocation.name.label("location_name"),
118
119
  DBLocation.code.label("location_code"),
119
120
  literal("").label("admin1_name"),
@@ -126,7 +127,8 @@ availability_stmt_returnees = (
126
127
  .select_from(
127
128
  DBReturnees.__table__.join(
128
129
  DBLocation.__table__,
129
- DBReturnees.asylum_location_ref == DBLocation.id,
130
+ (DBReturnees.asylum_location_ref == DBLocation.id)
131
+ | (DBReturnees.origin_location_ref == DBLocation.id),
130
132
  isouter=True,
131
133
  ).join(
132
134
  DBResource.__table__,
@@ -109,7 +109,7 @@ class DBConflictEventVAT(Base):
109
109
  admin2_name: Mapped[str] = mapped_column(String(512), index=True)
110
110
  admin2_is_unspecified: Mapped[bool] = mapped_column(Boolean)
111
111
  admin1_ref: Mapped[int] = mapped_column(Integer)
112
- admin_level: Mapped[int] = mapped_column(Integer)
112
+ admin_level: Mapped[int] = mapped_column(Integer, index=True)
113
113
 
114
114
 
115
115
  class DBCurrencyVAT(Base):
@@ -175,7 +175,7 @@ class DBFoodPriceVAT(Base):
175
175
  admin2_code: Mapped[str] = mapped_column(String(128), index=True)
176
176
  admin2_name: Mapped[str] = mapped_column(String(512), index=True)
177
177
  admin2_is_unspecified: Mapped[bool] = mapped_column(Boolean)
178
- admin_level: Mapped[int] = mapped_column(Integer)
178
+ admin_level: Mapped[int] = mapped_column(Integer, index=True)
179
179
 
180
180
 
181
181
  class DBFoodSecurityVAT(Base):
@@ -216,7 +216,7 @@ class DBFoodSecurityVAT(Base):
216
216
  admin2_name: Mapped[str] = mapped_column(String(512), index=True)
217
217
  admin2_is_unspecified: Mapped[bool] = mapped_column(Boolean)
218
218
  admin1_ref: Mapped[int] = mapped_column(Integer)
219
- admin_level: Mapped[int] = mapped_column(Integer)
219
+ admin_level: Mapped[int] = mapped_column(Integer, index=True)
220
220
 
221
221
 
222
222
  class DBFundingVAT(Base):
@@ -279,7 +279,7 @@ class DBHumanitarianNeedsVAT(Base):
279
279
  admin2_name: Mapped[str] = mapped_column(String(512), index=True)
280
280
  admin2_is_unspecified: Mapped[bool] = mapped_column(Boolean)
281
281
  admin1_ref: Mapped[int] = mapped_column(Integer)
282
- admin_level: Mapped[int] = mapped_column(Integer)
282
+ admin_level: Mapped[int] = mapped_column(Integer, index=True)
283
283
 
284
284
 
285
285
  class DBIDPsVAT(Base):
@@ -316,7 +316,7 @@ class DBIDPsVAT(Base):
316
316
  admin2_name: Mapped[str] = mapped_column(String(512), index=True)
317
317
  admin2_is_unspecified: Mapped[bool] = mapped_column(Boolean)
318
318
  admin1_ref: Mapped[int] = mapped_column(Integer)
319
- admin_level: Mapped[int] = mapped_column(Integer)
319
+ admin_level: Mapped[int] = mapped_column(Integer, index=True)
320
320
 
321
321
 
322
322
  class DBLocationVAT(Base):
@@ -401,7 +401,7 @@ class DBOperationalPresenceVAT(Base):
401
401
  admin2_name: Mapped[str] = mapped_column(String(512), index=True)
402
402
  admin2_is_unspecified: Mapped[bool] = mapped_column(Boolean)
403
403
  admin1_ref: Mapped[int] = mapped_column(Integer)
404
- admin_level: Mapped[int] = mapped_column(Integer)
404
+ admin_level: Mapped[int] = mapped_column(Integer, index=True)
405
405
 
406
406
 
407
407
  class DBOrgTypeVAT(Base):
@@ -457,7 +457,7 @@ class DBPopulationVAT(Base):
457
457
  admin2_name: Mapped[str] = mapped_column(String(512), index=True)
458
458
  admin2_is_unspecified: Mapped[bool] = mapped_column(Boolean)
459
459
  admin1_ref: Mapped[int] = mapped_column(Integer)
460
- admin_level: Mapped[int] = mapped_column(Integer)
460
+ admin_level: Mapped[int] = mapped_column(Integer, index=True)
461
461
 
462
462
 
463
463
  class DBPovertyRateVAT(Base):
@@ -489,7 +489,7 @@ class DBPovertyRateVAT(Base):
489
489
  admin1_code: Mapped[str] = mapped_column(String(128))
490
490
  admin1_is_unspecified: Mapped[bool] = mapped_column(Boolean)
491
491
  location_ref: Mapped[int] = mapped_column(Integer, index=True)
492
- admin_level: Mapped[int] = mapped_column(Integer)
492
+ admin_level: Mapped[int] = mapped_column(Integer, index=True)
493
493
 
494
494
 
495
495
  class DBRefugeesVAT(Base):
@@ -618,17 +618,21 @@ class DBWfpMarketVAT(Base):
618
618
  admin2_name: Mapped[str] = mapped_column(String(512), index=True)
619
619
  admin2_is_unspecified: Mapped[bool] = mapped_column(Boolean)
620
620
  admin1_ref: Mapped[int] = mapped_column(Integer)
621
+ admin_level: Mapped[int] = mapped_column(Integer, index=True)
621
622
 
622
623
 
623
624
  class DBAvailabilityVAT(Base):
624
625
  __tablename__ = "data_availability_vat"
625
- category: Mapped[str] = mapped_column(String(128), primary_key=True)
626
- subcategory: Mapped[str] = mapped_column(String(128), primary_key=True)
627
- location_name: Mapped[str] = mapped_column(String(512), primary_key=True)
628
- location_code: Mapped[str] = mapped_column(String(128), primary_key=True)
629
- admin1_name: Mapped[str] = mapped_column(String(512), primary_key=True)
630
- admin1_code: Mapped[str] = mapped_column(String(128), primary_key=True)
631
- admin2_name: Mapped[str] = mapped_column(String(512), primary_key=True)
632
- admin2_code: Mapped[str] = mapped_column(String(128), primary_key=True)
633
- admin_level: Mapped[int] = mapped_column(Integer)
626
+ id: Mapped[int] = mapped_column(
627
+ Integer, primary_key=True, autoincrement=True
628
+ )
629
+ category: Mapped[str] = mapped_column(String(128), index=True)
630
+ subcategory: Mapped[str] = mapped_column(String(128), index=True)
631
+ location_name: Mapped[str] = mapped_column(String(512), index=True)
632
+ location_code: Mapped[str] = mapped_column(String(128), index=True)
633
+ admin1_name: Mapped[str] = mapped_column(String(512), index=True)
634
+ admin1_code: Mapped[str] = mapped_column(String(128), index=True)
635
+ admin2_name: Mapped[str] = mapped_column(String(512), index=True)
636
+ admin2_code: Mapped[str] = mapped_column(String(128), index=True)
637
+ admin_level: Mapped[int] = mapped_column(Integer, index=True)
634
638
  hapi_updated_date: Mapped[datetime] = mapped_column(DateTime, index=True)
@@ -9,6 +9,7 @@ from hapi_schema.db_location import DBLocation
9
9
  from hapi_schema.utils.base import Base
10
10
  from hapi_schema.utils.constraints import latlon_constraint
11
11
  from hapi_schema.utils.view_params import ViewParams
12
+ from hapi_schema.views import get_admin2_case
12
13
 
13
14
 
14
15
  class DBWFPMarket(Base):
@@ -50,6 +51,7 @@ view_params_wfp_market = ViewParams(
50
51
  DBAdmin2.name.label("admin2_name"),
51
52
  DBAdmin2.is_unspecified.label("admin2_is_unspecified"),
52
53
  DBAdmin2.admin1_ref.label("admin1_ref"),
54
+ get_admin2_case(DBWFPMarket),
53
55
  ).select_from(
54
56
  # Join market to admin2 to admin1 to loc
55
57
  DBWFPMarket.__table__.join(
@@ -0,0 +1,35 @@
1
+ """
2
+ The constants below are used to create the category and subcategory names.
3
+ Be careful when changing them as these are used to create the endpoints.
4
+ """
5
+
6
+ # categories
7
+ AFFECTED_PEOPLE = "affected-people"
8
+ COORDINATION_CONTEXT = "coordination-context"
9
+ FOOD_SECURITY = "food-security-nutrition-poverty"
10
+ GEOGRAPHY_INFRASTRUCTURE = "geography-infrastructure"
11
+
12
+ CONFLICT_EVENT_CAT = COORDINATION_CONTEXT
13
+ CONFLICT_EVENT_SUBCAT = "conflict-events"
14
+ FOOD_PRICE_CAT = FOOD_SECURITY
15
+ FOOD_PRICE_SUBCAT = "food-prices-market-monitor"
16
+ FOOD_SECURITY_CAT = FOOD_SECURITY
17
+ FOOD_SECURITY_SUBCAT = "food-security"
18
+ FUNDING_CAT = COORDINATION_CONTEXT
19
+ FUNDING_SUBCAT = "funding"
20
+ HUMANITARIAN_NEEDS_CAT = AFFECTED_PEOPLE
21
+ HUMANITARIAN_NEEDS_SUBCAT = "humanitarian-needs"
22
+ IDPS_CAT = AFFECTED_PEOPLE
23
+ IDPS_SUBCAT = "idps"
24
+ NATIONAL_RISK_CAT = COORDINATION_CONTEXT
25
+ NATIONA_RISK_SUBCAT = "national-risk"
26
+ OPERATIONAL_PRESENCE_CAT = COORDINATION_CONTEXT
27
+ OPERATIONAL_PRESENCE_SUBCAT = "operational-presence"
28
+ POPULATION_CAT = GEOGRAPHY_INFRASTRUCTURE
29
+ POPULATION_SUBCAT = "baseline-population"
30
+ POVERTY_RATE_CAT = FOOD_SECURITY
31
+ POVERTY_RATE_SUBCAT = "poverty-rate"
32
+ REFUGEES_CAT = AFFECTED_PEOPLE
33
+ REFUGEES_SUBCAT = "refugees-persons-of-concern"
34
+ RETURNEES_CAT = AFFECTED_PEOPLE
35
+ RETURNEES_SUBCAT = "returnees"
@@ -35,7 +35,7 @@ def test_conflict_event_availability(run_view_test):
35
35
  view=view_availability,
36
36
  whereclause=(
37
37
  view_availability.c.category == "coordination-context",
38
- view_availability.c.subcategory == "conflict-event",
38
+ view_availability.c.subcategory == "conflict-events",
39
39
  view_availability.c.location_code == "FOO",
40
40
  view_availability.c.admin1_name == "Province 01",
41
41
  view_availability.c.admin2_name == "District A",
@@ -44,8 +44,8 @@ def test_food_price_availability(run_view_test):
44
44
  run_view_test(
45
45
  view=view_availability,
46
46
  whereclause=(
47
- view_availability.c.category == "food",
48
- view_availability.c.subcategory == "food-price",
47
+ view_availability.c.category == "food-security-nutrition-poverty",
48
+ view_availability.c.subcategory == "food-prices-market-monitor",
49
49
  view_availability.c.location_code == "FOO",
50
50
  view_availability.c.admin1_name == "Province 01",
51
51
  view_availability.c.admin2_name == "District A",
@@ -34,7 +34,7 @@ def test_food_security_availability(run_view_test):
34
34
  run_view_test(
35
35
  view=view_availability,
36
36
  whereclause=(
37
- view_availability.c.category == "food",
37
+ view_availability.c.category == "food-security-nutrition-poverty",
38
38
  view_availability.c.subcategory == "food-security",
39
39
  view_availability.c.location_code == "FOO",
40
40
  view_availability.c.admin1_name == "Province 01",
@@ -32,8 +32,8 @@ def test_population_availability(run_view_test):
32
32
  run_view_test(
33
33
  view=view_availability,
34
34
  whereclause=(
35
- view_availability.c.category == "population-social",
36
- view_availability.c.subcategory == "population",
35
+ view_availability.c.category == "geography-infrastructure",
36
+ view_availability.c.subcategory == "baseline-population",
37
37
  view_availability.c.location_code == "FOO",
38
38
  view_availability.c.admin1_name == "Province 01",
39
39
  view_availability.c.admin2_name == "District A",
@@ -32,7 +32,7 @@ def test_poverty_rate_availability(run_view_test):
32
32
  run_view_test(
33
33
  view=view_availability,
34
34
  whereclause=(
35
- view_availability.c.category == "population-social",
35
+ view_availability.c.category == "food-security-nutrition-poverty",
36
36
  view_availability.c.subcategory == "poverty-rate",
37
37
  view_availability.c.location_code == "FOO",
38
38
  view_availability.c.admin1_name == "Province 01",
@@ -29,9 +29,8 @@ def test_refugees_availability(run_view_test):
29
29
  view=view_availability,
30
30
  whereclause=(
31
31
  view_availability.c.category == "affected-people",
32
- view_availability.c.subcategory == "refugees",
33
- view_availability.c.location_code
34
- == "BAR", # we use the country of asylum, not origin
32
+ view_availability.c.subcategory == "refugees-persons-of-concern",
33
+ view_availability.c.location_code == "BAR",
35
34
  view_availability.c.admin1_name == "",
36
35
  view_availability.c.admin2_name == "",
37
36
  view_availability.c.hapi_updated_date == datetime(2023, 8, 1),
@@ -30,8 +30,7 @@ def test_returnees_availability(run_view_test):
30
30
  whereclause=(
31
31
  view_availability.c.category == "affected-people",
32
32
  view_availability.c.subcategory == "returnees",
33
- view_availability.c.location_code
34
- == "BAR", # we use the country of asylum, not origin
33
+ view_availability.c.location_code == "BAR",
35
34
  view_availability.c.admin1_name == "",
36
35
  view_availability.c.admin2_name == "",
37
36
  view_availability.c.hapi_updated_date == datetime(2023, 8, 1),
@@ -79,6 +79,7 @@ def test_conflict_event_vat(
79
79
  "admin1_name",
80
80
  "admin2_code",
81
81
  "admin2_name",
82
+ "admin_level",
82
83
  ]
83
84
  run_columns_test(
84
85
  "conflict_event_vat", "conflict_event_view", view_params_conflict_event
@@ -136,6 +137,7 @@ def test_food_price_vat(
136
137
  "admin1_name",
137
138
  "admin2_code",
138
139
  "admin2_name",
140
+ "admin_level",
139
141
  ]
140
142
  run_columns_test(
141
143
  "food_price_vat", "food_price_view", view_params_food_price
@@ -166,6 +168,7 @@ def test_food_security_vat(
166
168
  "admin1_name",
167
169
  "admin2_code",
168
170
  "admin2_name",
171
+ "admin_level",
169
172
  ]
170
173
  run_columns_test(
171
174
  "food_security_vat", "food_security_view", view_params_food_security
@@ -213,6 +216,7 @@ def test_humanitarian_needs_vat(
213
216
  "admin1_name",
214
217
  "admin2_code",
215
218
  "admin2_name",
219
+ "admin_level",
216
220
  ]
217
221
  run_columns_test(
218
222
  "humanitarian_needs_vat",
@@ -243,6 +247,7 @@ def test_idps_vat(run_indexes_test, run_columns_test, run_primary_keys_test):
243
247
  "admin1_code",
244
248
  "admin2_name",
245
249
  "admin2_code",
250
+ "admin_level",
246
251
  ]
247
252
  run_columns_test("idps_vat", "idps_view", view_params_idps)
248
253
  run_primary_keys_test("idps_vat", expected_primary_keys)
@@ -304,6 +309,7 @@ def test_operational_presence_vat(
304
309
  "admin1_name",
305
310
  "admin2_code",
306
311
  "admin2_name",
312
+ "admin_level",
307
313
  ]
308
314
  run_columns_test(
309
315
  "operational_presence_vat",
@@ -371,6 +377,7 @@ def test_population_vat(
371
377
  "admin1_name",
372
378
  "admin2_code",
373
379
  "admin2_name",
380
+ "admin_level",
374
381
  ]
375
382
  run_columns_test(
376
383
  "population_vat", "population_view", view_params_population
@@ -393,6 +400,7 @@ def test_poverty_rate_vat(
393
400
  "location_ref",
394
401
  "location_code",
395
402
  "location_name",
403
+ "admin_level",
396
404
  ]
397
405
  run_columns_test(
398
406
  "poverty_rate_vat", "poverty_rate_view", view_params_poverty_rate
@@ -511,6 +519,7 @@ def test_wfp_market_vat(
511
519
  "admin1_name",
512
520
  "admin2_code",
513
521
  "admin2_name",
522
+ "admin_level",
514
523
  ]
515
524
  run_columns_test(
516
525
  "wfp_market_vat", "wfp_market_view", view_params_wfp_market
@@ -522,6 +531,9 @@ def test_wfp_market_vat(
522
531
  def test_data_availability_vat(run_indexes_test, run_primary_keys_test):
523
532
  """Check that wfp_market_vat is correct - columns match, expected indexes present"""
524
533
  expected_primary_keys = [
534
+ "id",
535
+ ]
536
+ expected_indexes = [
525
537
  "category",
526
538
  "subcategory",
527
539
  "location_name",
@@ -530,8 +542,7 @@ def test_data_availability_vat(run_indexes_test, run_primary_keys_test):
530
542
  "admin1_code",
531
543
  "admin2_name",
532
544
  "admin2_code",
533
- ]
534
- expected_indexes = [
545
+ "admin_level",
535
546
  "hapi_updated_date",
536
547
  ]
537
548
  # run_columns_test(
File without changes
File without changes
File without changes
File without changes