hapi-schema 0.9.8__tar.gz → 0.9.10__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.
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/.config/pre-commit-config.yaml +2 -2
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/PKG-INFO +2 -2
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/changelog.md +14 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/pyproject.toml +2 -2
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/requirements.txt +4 -4
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/_version.py +9 -4
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/db_funding.py +4 -6
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/db_population.py +1 -1
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/db_poverty_rate.py +1 -1
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/db_views_as_tables.py +21 -31
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/db_wfp_market.py +2 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/sample_data/data_funding.py +14 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/test_funding.py +3 -3
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/test_views_as_tables.py +7 -2
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/.config/coveragerc +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/.config/pytest.ini +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/.config/ruff.toml +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/.github/workflows/publish.yaml +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/.github/workflows/run-python-tests.yaml +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/.gitignore +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/LICENSE +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/README.md +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/contributing.md +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/docker/docker-compose.yml +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/initialize_test_db.sh +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/__init__.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/db_admin1.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/db_admin2.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/db_conflict_event.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/db_currency.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/db_dataset.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/db_food_price.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/db_food_security.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/db_humanitarian_needs.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/db_idps.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/db_location.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/db_national_risk.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/db_operational_presence.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/db_org.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/db_org_type.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/db_patch.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/db_refugees.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/db_resource.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/db_returnees.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/db_sector.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/db_wfp_commodity.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/utils/__init__.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/utils/base.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/utils/constraints.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/utils/endpoint_constants.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/utils/enums.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/utils/hapi_views_code_generator.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/utils/view_as_table_code_generator.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/utils/view_as_table_definitions.toml +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/utils/view_params.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/views.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/conftest.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/sample_data/__init__.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/sample_data/data_admin1.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/sample_data/data_admin2.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/sample_data/data_conflict_event.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/sample_data/data_currency.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/sample_data/data_dataset.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/sample_data/data_food_price.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/sample_data/data_food_security.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/sample_data/data_humanitarian_needs.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/sample_data/data_idps.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/sample_data/data_location.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/sample_data/data_national_risk.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/sample_data/data_operational_presence.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/sample_data/data_org.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/sample_data/data_org_type.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/sample_data/data_patch.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/sample_data/data_population.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/sample_data/data_poverty_rate.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/sample_data/data_refugees.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/sample_data/data_resource.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/sample_data/data_returnees.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/sample_data/data_sector.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/sample_data/data_wfp_commodity.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/sample_data/data_wfp_market.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/test_admin1.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/test_admin2.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/test_conflict_event.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/test_currency.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/test_dataset.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/test_food_price.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/test_food_security.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/test_humanitarian_needs.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/test_idps.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/test_location.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/test_national_risk.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/test_operational_presence.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/test_org.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/test_org_type.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/test_patch.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/test_population.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/test_poverty_rate.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/test_refugees.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/test_resource.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/test_returnees.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/test_sector.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/tests/test_wfp_commodity.py +0 -0
- {hapi_schema-0.9.8 → hapi_schema-0.9.10}/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.9.
|
|
11
|
+
rev: v0.9.6
|
|
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.
|
|
20
|
+
rev: 0.6.1
|
|
21
21
|
hooks:
|
|
22
22
|
# Run the pip compile
|
|
23
23
|
- id: pip-compile
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hapi-schema
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.10
|
|
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>
|
|
@@ -30,7 +30,7 @@ Requires-Dist: hdx-python-database>=1.3.5; extra == 'database'
|
|
|
30
30
|
Provides-Extra: dev
|
|
31
31
|
Requires-Dist: pre-commit; extra == 'dev'
|
|
32
32
|
Provides-Extra: test
|
|
33
|
-
Requires-Dist: hdx-python-database>=1.3.
|
|
33
|
+
Requires-Dist: hdx-python-database>=1.3.5; extra == 'test'
|
|
34
34
|
Requires-Dist: psycopg[binary]; extra == 'test'
|
|
35
35
|
Requires-Dist: pytest; extra == 'test'
|
|
36
36
|
Requires-Dist: pytest-cov; extra == 'test'
|
|
@@ -5,6 +5,20 @@ 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.10
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Align VAT definitions with database tables
|
|
13
|
+
|
|
14
|
+
## 0.9.9
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- Added admin level to WFP Market table
|
|
19
|
+
- Allow intensity of deprivation in poverty rate to be nullable
|
|
20
|
+
- Allow non-appeal funding in funding table
|
|
21
|
+
|
|
8
22
|
## 0.9.8
|
|
9
23
|
|
|
10
24
|
### Fixed
|
|
@@ -44,7 +44,7 @@ Homepage = "https://github.com/OCHA-DAP/hapi-schemas"
|
|
|
44
44
|
[project.optional-dependencies]
|
|
45
45
|
database = ["hdx-python-database>=1.3.5"]
|
|
46
46
|
dev = ["pre-commit"]
|
|
47
|
-
test = ["hdx-python-database>=1.3.
|
|
47
|
+
test = ["hdx-python-database>=1.3.5", "psycopg[binary]", "pytest", "pytest-cov"]
|
|
48
48
|
|
|
49
49
|
#########
|
|
50
50
|
# Hatch #
|
|
@@ -86,7 +86,7 @@ run = """
|
|
|
86
86
|
"""
|
|
87
87
|
|
|
88
88
|
[tool.hatch.envs.hatch-static-analysis]
|
|
89
|
-
dependencies = ["ruff==0.9.
|
|
89
|
+
dependencies = ["ruff==0.9.6"]
|
|
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,7 +2,7 @@
|
|
|
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.
|
|
5
|
+
coverage==7.6.12
|
|
6
6
|
# via pytest-cov
|
|
7
7
|
distlib==0.3.9
|
|
8
8
|
# via virtualenv
|
|
@@ -12,7 +12,7 @@ greenlet==3.1.1
|
|
|
12
12
|
# via sqlalchemy
|
|
13
13
|
hdx-python-database==1.3.5
|
|
14
14
|
# via hapi-schema (pyproject.toml)
|
|
15
|
-
identify==2.6.
|
|
15
|
+
identify==2.6.8
|
|
16
16
|
# via pre-commit
|
|
17
17
|
iniconfig==2.0.0
|
|
18
18
|
# via pytest
|
|
@@ -26,9 +26,9 @@ pluggy==1.5.0
|
|
|
26
26
|
# via pytest
|
|
27
27
|
pre-commit==4.1.0
|
|
28
28
|
# via hapi-schema (pyproject.toml)
|
|
29
|
-
psycopg==3.2.
|
|
29
|
+
psycopg==3.2.5
|
|
30
30
|
# via hapi-schema (pyproject.toml)
|
|
31
|
-
psycopg-binary==3.2.
|
|
31
|
+
psycopg-binary==3.2.5
|
|
32
32
|
# via psycopg
|
|
33
33
|
pytest==8.3.4
|
|
34
34
|
# via
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
# file generated by
|
|
1
|
+
# file generated by setuptools-scm
|
|
2
2
|
# don't change, don't track in version control
|
|
3
|
+
|
|
4
|
+
__all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
|
|
5
|
+
|
|
3
6
|
TYPE_CHECKING = False
|
|
4
7
|
if TYPE_CHECKING:
|
|
5
|
-
from typing import Tuple
|
|
8
|
+
from typing import Tuple
|
|
9
|
+
from typing import Union
|
|
10
|
+
|
|
6
11
|
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
7
12
|
else:
|
|
8
13
|
VERSION_TUPLE = object
|
|
@@ -12,5 +17,5 @@ __version__: str
|
|
|
12
17
|
__version_tuple__: VERSION_TUPLE
|
|
13
18
|
version_tuple: VERSION_TUPLE
|
|
14
19
|
|
|
15
|
-
__version__ = version = '0.9.
|
|
16
|
-
__version_tuple__ = version_tuple = (0, 9,
|
|
20
|
+
__version__ = version = '0.9.10'
|
|
21
|
+
__version_tuple__ = version_tuple = (0, 9, 10)
|
|
@@ -8,7 +8,6 @@ from sqlalchemy import (
|
|
|
8
8
|
ForeignKey,
|
|
9
9
|
String,
|
|
10
10
|
select,
|
|
11
|
-
text,
|
|
12
11
|
)
|
|
13
12
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
14
13
|
from sqlalchemy.sql.expression import literal
|
|
@@ -56,23 +55,22 @@ class DBFunding(Base):
|
|
|
56
55
|
|
|
57
56
|
appeal_name: Mapped[str] = mapped_column(String(256), nullable=False)
|
|
58
57
|
|
|
59
|
-
appeal_type: Mapped[str] = mapped_column(String(32), nullable=
|
|
58
|
+
appeal_type: Mapped[str] = mapped_column(String(32), nullable=True)
|
|
60
59
|
|
|
61
60
|
requirements_usd: Mapped[Decimal] = mapped_column(
|
|
62
|
-
nullable=
|
|
61
|
+
nullable=True, index=True
|
|
63
62
|
)
|
|
64
63
|
|
|
65
64
|
funding_usd: Mapped[Decimal] = mapped_column(nullable=False, index=True)
|
|
66
65
|
|
|
67
|
-
funding_pct: Mapped[Decimal] = mapped_column(nullable=
|
|
66
|
+
funding_pct: Mapped[Decimal] = mapped_column(nullable=True, index=True)
|
|
68
67
|
|
|
69
68
|
reference_period_start: Mapped[datetime] = mapped_column(
|
|
70
69
|
primary_key=True,
|
|
71
70
|
)
|
|
72
71
|
|
|
73
72
|
reference_period_end: Mapped[datetime] = mapped_column(
|
|
74
|
-
nullable=True
|
|
75
|
-
server_default=text("NULL"),
|
|
73
|
+
nullable=False, index=True
|
|
76
74
|
)
|
|
77
75
|
|
|
78
76
|
resource = relationship(DBResource)
|
|
@@ -57,7 +57,7 @@ class DBPopulation(Base):
|
|
|
57
57
|
Integer, nullable=False, index=True
|
|
58
58
|
)
|
|
59
59
|
reference_period_start: Mapped[datetime] = mapped_column(
|
|
60
|
-
nullable=False,
|
|
60
|
+
nullable=False, primary_key=True
|
|
61
61
|
)
|
|
62
62
|
reference_period_end: Mapped[datetime] = mapped_column(
|
|
63
63
|
nullable=False, index=True
|
|
@@ -57,7 +57,7 @@ class DBPovertyRate(Base):
|
|
|
57
57
|
Float, nullable=False, index=False
|
|
58
58
|
)
|
|
59
59
|
intensity_of_deprivation: Mapped[float] = mapped_column(
|
|
60
|
-
Float, nullable=
|
|
60
|
+
Float, nullable=True, index=False
|
|
61
61
|
)
|
|
62
62
|
vulnerable_to_poverty: Mapped[float] = mapped_column(
|
|
63
63
|
Float, nullable=False, index=False
|
|
@@ -35,7 +35,7 @@ class DBAdmin1VAT(Base):
|
|
|
35
35
|
is_unspecified: Mapped[bool] = mapped_column(Boolean)
|
|
36
36
|
from_cods: Mapped[bool] = mapped_column(Boolean)
|
|
37
37
|
reference_period_start: Mapped[datetime] = mapped_column(
|
|
38
|
-
DateTime, index=True
|
|
38
|
+
DateTime, nullable=True, index=True
|
|
39
39
|
)
|
|
40
40
|
reference_period_end: Mapped[datetime] = mapped_column(
|
|
41
41
|
DateTime,
|
|
@@ -95,7 +95,6 @@ class DBConflictEventVAT(Base):
|
|
|
95
95
|
reference_period_end: Mapped[datetime] = mapped_column(
|
|
96
96
|
DateTime,
|
|
97
97
|
index=True,
|
|
98
|
-
nullable=True,
|
|
99
98
|
)
|
|
100
99
|
location_code: Mapped[str] = mapped_column(String(128), index=True)
|
|
101
100
|
location_name: Mapped[str] = mapped_column(String(512), index=True)
|
|
@@ -151,7 +150,6 @@ class DBFoodPriceVAT(Base):
|
|
|
151
150
|
reference_period_end: Mapped[datetime] = mapped_column(
|
|
152
151
|
DateTime,
|
|
153
152
|
index=True,
|
|
154
|
-
nullable=True,
|
|
155
153
|
)
|
|
156
154
|
admin2_ref: Mapped[int] = mapped_column(Integer)
|
|
157
155
|
provider_admin1_name: Mapped[str] = mapped_column(String(512), index=True)
|
|
@@ -202,7 +200,6 @@ class DBFoodSecurityVAT(Base):
|
|
|
202
200
|
reference_period_end: Mapped[datetime] = mapped_column(
|
|
203
201
|
DateTime,
|
|
204
202
|
index=True,
|
|
205
|
-
nullable=True,
|
|
206
203
|
)
|
|
207
204
|
location_code: Mapped[str] = mapped_column(String(128), index=True)
|
|
208
205
|
location_name: Mapped[str] = mapped_column(String(512), index=True)
|
|
@@ -225,16 +222,17 @@ class DBFundingVAT(Base):
|
|
|
225
222
|
appeal_code: Mapped[str] = mapped_column(String(32), primary_key=True)
|
|
226
223
|
location_ref: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
227
224
|
appeal_name: Mapped[str] = mapped_column(String(256))
|
|
228
|
-
appeal_type: Mapped[str] = mapped_column(String(32))
|
|
229
|
-
requirements_usd: Mapped[Decimal] = mapped_column(
|
|
225
|
+
appeal_type: Mapped[str] = mapped_column(String(32), nullable=True)
|
|
226
|
+
requirements_usd: Mapped[Decimal] = mapped_column(
|
|
227
|
+
index=True, nullable=True
|
|
228
|
+
)
|
|
230
229
|
funding_usd: Mapped[Decimal] = mapped_column(index=True)
|
|
231
|
-
funding_pct: Mapped[Decimal] = mapped_column(index=True)
|
|
230
|
+
funding_pct: Mapped[Decimal] = mapped_column(index=True, nullable=True)
|
|
232
231
|
reference_period_start: Mapped[datetime] = mapped_column(
|
|
233
|
-
DateTime,
|
|
232
|
+
DateTime, primary_key=True
|
|
234
233
|
)
|
|
235
234
|
reference_period_end: Mapped[datetime] = mapped_column(
|
|
236
|
-
DateTime,
|
|
237
|
-
nullable=True,
|
|
235
|
+
DateTime, index=True
|
|
238
236
|
)
|
|
239
237
|
location_code: Mapped[str] = mapped_column(String(128), index=True)
|
|
240
238
|
location_name: Mapped[str] = mapped_column(String(512), index=True)
|
|
@@ -262,9 +260,7 @@ class DBHumanitarianNeedsVAT(Base):
|
|
|
262
260
|
DateTime, primary_key=True
|
|
263
261
|
)
|
|
264
262
|
reference_period_end: Mapped[datetime] = mapped_column(
|
|
265
|
-
DateTime,
|
|
266
|
-
index=True,
|
|
267
|
-
nullable=True,
|
|
263
|
+
DateTime, index=True
|
|
268
264
|
)
|
|
269
265
|
sector_name: Mapped[str] = mapped_column(String(512))
|
|
270
266
|
location_code: Mapped[str] = mapped_column(String(128), index=True)
|
|
@@ -300,9 +296,7 @@ class DBIDPsVAT(Base):
|
|
|
300
296
|
DateTime, primary_key=True
|
|
301
297
|
)
|
|
302
298
|
reference_period_end: Mapped[datetime] = mapped_column(
|
|
303
|
-
DateTime,
|
|
304
|
-
index=True,
|
|
305
|
-
nullable=True,
|
|
299
|
+
DateTime, index=True
|
|
306
300
|
)
|
|
307
301
|
location_code: Mapped[str] = mapped_column(String(128), index=True)
|
|
308
302
|
location_name: Mapped[str] = mapped_column(String(512), index=True)
|
|
@@ -328,7 +322,9 @@ class DBLocationVAT(Base):
|
|
|
328
322
|
has_hrp: Mapped[bool] = mapped_column(Boolean)
|
|
329
323
|
in_gho: Mapped[bool] = mapped_column(Boolean)
|
|
330
324
|
reference_period_start: Mapped[datetime] = mapped_column(
|
|
331
|
-
DateTime,
|
|
325
|
+
DateTime,
|
|
326
|
+
index=True,
|
|
327
|
+
nullable=True,
|
|
332
328
|
)
|
|
333
329
|
reference_period_end: Mapped[datetime] = mapped_column(
|
|
334
330
|
DateTime,
|
|
@@ -355,9 +351,7 @@ class DBNationalRiskVAT(Base):
|
|
|
355
351
|
DateTime, primary_key=True
|
|
356
352
|
)
|
|
357
353
|
reference_period_end: Mapped[datetime] = mapped_column(
|
|
358
|
-
DateTime,
|
|
359
|
-
index=True,
|
|
360
|
-
nullable=True,
|
|
354
|
+
DateTime, index=True
|
|
361
355
|
)
|
|
362
356
|
location_code: Mapped[str] = mapped_column(String(128), index=True)
|
|
363
357
|
location_name: Mapped[str] = mapped_column(String(512), index=True)
|
|
@@ -441,9 +435,7 @@ class DBPopulationVAT(Base):
|
|
|
441
435
|
DateTime, primary_key=True
|
|
442
436
|
)
|
|
443
437
|
reference_period_end: Mapped[datetime] = mapped_column(
|
|
444
|
-
DateTime,
|
|
445
|
-
index=True,
|
|
446
|
-
nullable=True,
|
|
438
|
+
DateTime, index=True
|
|
447
439
|
)
|
|
448
440
|
location_code: Mapped[str] = mapped_column(String(128), index=True)
|
|
449
441
|
location_name: Mapped[str] = mapped_column(String(512), index=True)
|
|
@@ -470,16 +462,16 @@ class DBPovertyRateVAT(Base):
|
|
|
470
462
|
)
|
|
471
463
|
mpi: Mapped[float] = mapped_column(Float)
|
|
472
464
|
headcount_ratio: Mapped[float] = mapped_column(Float)
|
|
473
|
-
intensity_of_deprivation: Mapped[float] = mapped_column(
|
|
465
|
+
intensity_of_deprivation: Mapped[float] = mapped_column(
|
|
466
|
+
Float, nullable=True
|
|
467
|
+
)
|
|
474
468
|
vulnerable_to_poverty: Mapped[float] = mapped_column(Float)
|
|
475
469
|
in_severe_poverty: Mapped[float] = mapped_column(Float)
|
|
476
470
|
reference_period_start: Mapped[datetime] = mapped_column(
|
|
477
471
|
DateTime, primary_key=True
|
|
478
472
|
)
|
|
479
473
|
reference_period_end: Mapped[datetime] = mapped_column(
|
|
480
|
-
DateTime,
|
|
481
|
-
index=True,
|
|
482
|
-
nullable=True,
|
|
474
|
+
DateTime, index=True
|
|
483
475
|
)
|
|
484
476
|
location_code: Mapped[str] = mapped_column(String(128), index=True)
|
|
485
477
|
location_name: Mapped[str] = mapped_column(String(512), index=True)
|
|
@@ -511,9 +503,7 @@ class DBRefugeesVAT(Base):
|
|
|
511
503
|
DateTime, primary_key=True
|
|
512
504
|
)
|
|
513
505
|
reference_period_end: Mapped[datetime] = mapped_column(
|
|
514
|
-
DateTime,
|
|
515
|
-
index=True,
|
|
516
|
-
nullable=True,
|
|
506
|
+
DateTime, index=True
|
|
517
507
|
)
|
|
518
508
|
origin_location_code: Mapped[str] = mapped_column(String(128), index=True)
|
|
519
509
|
origin_location_name: Mapped[str] = mapped_column(String(512), index=True)
|
|
@@ -570,7 +560,6 @@ class DBReturneesVAT(Base):
|
|
|
570
560
|
reference_period_end: Mapped[datetime] = mapped_column(
|
|
571
561
|
DateTime,
|
|
572
562
|
index=True,
|
|
573
|
-
nullable=True,
|
|
574
563
|
)
|
|
575
564
|
origin_location_code: Mapped[str] = mapped_column(String(128), index=True)
|
|
576
565
|
origin_location_name: Mapped[str] = mapped_column(String(512), index=True)
|
|
@@ -618,6 +607,7 @@ class DBWfpMarketVAT(Base):
|
|
|
618
607
|
admin2_name: Mapped[str] = mapped_column(String(512), index=True)
|
|
619
608
|
admin2_is_unspecified: Mapped[bool] = mapped_column(Boolean)
|
|
620
609
|
admin1_ref: Mapped[int] = mapped_column(Integer)
|
|
610
|
+
admin_level: Mapped[int] = mapped_column(Integer, index=True)
|
|
621
611
|
|
|
622
612
|
|
|
623
613
|
class DBAvailabilityVAT(Base):
|
|
@@ -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(
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from datetime import datetime
|
|
2
2
|
|
|
3
3
|
data_funding = [
|
|
4
|
+
# appeal funding
|
|
4
5
|
dict(
|
|
5
6
|
resource_hdx_id="90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
6
7
|
appeal_code="HFOO24",
|
|
@@ -13,4 +14,17 @@ data_funding = [
|
|
|
13
14
|
reference_period_start=datetime(2024, 1, 1),
|
|
14
15
|
reference_period_end=datetime(2024, 12, 31),
|
|
15
16
|
),
|
|
17
|
+
# non-appeal funding
|
|
18
|
+
dict(
|
|
19
|
+
resource_hdx_id="90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
20
|
+
appeal_code="",
|
|
21
|
+
location_ref=1,
|
|
22
|
+
appeal_name="Not specified",
|
|
23
|
+
appeal_type=None,
|
|
24
|
+
requirements_usd=None,
|
|
25
|
+
funding_usd=300000.0,
|
|
26
|
+
funding_pct=None,
|
|
27
|
+
reference_period_start=datetime(2024, 1, 1),
|
|
28
|
+
reference_period_end=datetime(2024, 12, 31),
|
|
29
|
+
),
|
|
16
30
|
]
|
|
@@ -10,7 +10,7 @@ from hapi_schema.views import prepare_hapi_views
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
def test_funding_view(run_view_test):
|
|
13
|
-
"""Check
|
|
13
|
+
"""Check funding view has all columns."""
|
|
14
14
|
view_funding = Database.prepare_view(view_params_funding.__dict__)
|
|
15
15
|
run_view_test(
|
|
16
16
|
view=view_funding,
|
|
@@ -67,7 +67,7 @@ def test_reference_period_constraint(run_constraints_test):
|
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
def test_requirements_usd_constraint(run_constraints_test):
|
|
70
|
-
"""Check that
|
|
70
|
+
"""Check that requirements usd cannot be less than zero"""
|
|
71
71
|
run_constraints_test(
|
|
72
72
|
new_rows=[
|
|
73
73
|
DBFunding(
|
|
@@ -88,7 +88,7 @@ def test_requirements_usd_constraint(run_constraints_test):
|
|
|
88
88
|
|
|
89
89
|
|
|
90
90
|
def test_funding_usd_constraint(run_constraints_test):
|
|
91
|
-
"""Check that
|
|
91
|
+
"""Check that funding usd cannot be less than zero"""
|
|
92
92
|
run_constraints_test(
|
|
93
93
|
new_rows=[
|
|
94
94
|
DBFunding(
|
|
@@ -181,12 +181,16 @@ def test_funding_vat(
|
|
|
181
181
|
run_indexes_test, run_columns_test, run_primary_keys_test
|
|
182
182
|
):
|
|
183
183
|
"""Check that funding_vat is correct - columns match, expected indexes present"""
|
|
184
|
-
expected_primary_keys = [
|
|
184
|
+
expected_primary_keys = [
|
|
185
|
+
"appeal_code",
|
|
186
|
+
"location_ref",
|
|
187
|
+
"reference_period_start",
|
|
188
|
+
]
|
|
185
189
|
expected_indexes = [
|
|
186
190
|
"requirements_usd",
|
|
187
191
|
"funding_usd",
|
|
188
192
|
"funding_pct",
|
|
189
|
-
"
|
|
193
|
+
"reference_period_end",
|
|
190
194
|
"location_code",
|
|
191
195
|
"location_name",
|
|
192
196
|
]
|
|
@@ -519,6 +523,7 @@ def test_wfp_market_vat(
|
|
|
519
523
|
"admin1_name",
|
|
520
524
|
"admin2_code",
|
|
521
525
|
"admin2_name",
|
|
526
|
+
"admin_level",
|
|
522
527
|
]
|
|
523
528
|
run_columns_test(
|
|
524
529
|
"wfp_market_vat", "wfp_market_view", view_params_wfp_market
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/utils/view_as_table_code_generator.py
RENAMED
|
File without changes
|
{hapi_schema-0.9.8 → hapi_schema-0.9.10}/src/hapi_schema/utils/view_as_table_definitions.toml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|