hapi-schema 0.7.3__tar.gz → 0.7.4__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.7.3 → hapi_schema-0.7.4}/PKG-INFO +1 -1
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/changelog.md +10 -1
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/src/hapi_schema/_version.py +2 -2
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/src/hapi_schema/db_dataset.py +2 -5
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/src/hapi_schema/db_food_security.py +4 -5
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/src/hapi_schema/db_humanitarian_needs.py +4 -5
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/src/hapi_schema/db_national_risk.py +4 -5
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/src/hapi_schema/db_operational_presence.py +4 -5
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/src/hapi_schema/db_patch.py +16 -15
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/src/hapi_schema/db_population.py +4 -5
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/src/hapi_schema/db_resource.py +4 -9
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/sample_data/data_dataset.py +0 -2
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/sample_data/data_food_security.py +3 -3
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/sample_data/data_humanitarian_needs.py +4 -4
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/sample_data/data_national_risk.py +1 -1
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/sample_data/data_operational_presence.py +5 -5
- hapi_schema-0.7.4/tests/sample_data/data_patch.py +40 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/sample_data/data_population.py +4 -4
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/sample_data/data_resource.py +3 -6
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/test_dataset.py +1 -1
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/test_food_security.py +2 -1
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/test_humanitarian_needs.py +2 -1
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/test_national_risk.py +3 -2
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/test_operational_presence.py +2 -1
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/test_patch.py +7 -3
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/test_population.py +3 -2
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/test_resource.py +4 -5
- hapi_schema-0.7.3/tests/sample_data/data_patch.py +0 -31
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/.config/coveragerc +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/.config/pre-commit-config.yaml +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/.config/pytest.ini +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/.config/ruff.toml +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/.github/workflows/publish.yaml +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/.github/workflows/run-python-tests.yaml +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/.gitignore +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/LICENSE +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/README.md +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/contributing.md +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/pyproject.toml +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/requirements.txt +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/src/hapi_schema/__init__.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/src/hapi_schema/db_admin1.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/src/hapi_schema/db_admin2.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/src/hapi_schema/db_age_range.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/src/hapi_schema/db_gender.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/src/hapi_schema/db_ipc_phase.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/src/hapi_schema/db_ipc_type.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/src/hapi_schema/db_location.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/src/hapi_schema/db_org.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/src/hapi_schema/db_org_type.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/src/hapi_schema/db_population_group.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/src/hapi_schema/db_population_status.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/src/hapi_schema/db_sector.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/src/hapi_schema/utils/__init__.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/src/hapi_schema/utils/base.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/src/hapi_schema/utils/view_params.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/conftest.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/sample_data/__init__.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/sample_data/data_admin1.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/sample_data/data_admin2.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/sample_data/data_age_range.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/sample_data/data_gender.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/sample_data/data_ipc_phase.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/sample_data/data_ipc_type.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/sample_data/data_location.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/sample_data/data_org.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/sample_data/data_org_type.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/sample_data/data_population_group.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/sample_data/data_population_status.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/sample_data/data_sector.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/test_admin1.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/test_admin2.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/test_age_range.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/test_gender.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/test_ipc_phase.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/test_ipc_type.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/test_location.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/test_org.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/test_org_type.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/test_population_group.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/test_population_status.py +0 -0
- {hapi_schema-0.7.3 → hapi_schema-0.7.4}/tests/test_sector.py +0 -0
|
@@ -5,7 +5,14 @@ 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
|
-
|
|
8
|
+
## [0.7.4]
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Added columns to the patches table
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## [0.7.3]
|
|
9
16
|
|
|
10
17
|
### Fixed
|
|
11
18
|
|
|
@@ -29,6 +36,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
29
36
|
- Tests on the constraints
|
|
30
37
|
- `hapi_updated_date` and `hapi_replaced_date` fields
|
|
31
38
|
|
|
39
|
+
## [0.7.0]
|
|
40
|
+
|
|
32
41
|
### Changed
|
|
33
42
|
|
|
34
43
|
- Small changes to other dates for HAPI v2
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Dataset table and view."""
|
|
2
2
|
|
|
3
|
-
from sqlalchemy import
|
|
3
|
+
from sqlalchemy import String, select
|
|
4
4
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
5
5
|
|
|
6
6
|
from hapi_schema.utils.base import Base
|
|
@@ -10,10 +10,7 @@ from hapi_schema.utils.view_params import ViewParams
|
|
|
10
10
|
class DBDataset(Base):
|
|
11
11
|
__tablename__ = "dataset"
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
hdx_id: Mapped[str] = mapped_column(
|
|
15
|
-
String(36), unique=True, nullable=False
|
|
16
|
-
)
|
|
13
|
+
hdx_id: Mapped[str] = mapped_column(String(36), primary_key=True)
|
|
17
14
|
hdx_stub: Mapped[str] = mapped_column(
|
|
18
15
|
String(128), unique=True, nullable=False
|
|
19
16
|
)
|
|
@@ -35,8 +35,8 @@ class DBFoodSecurity(Base):
|
|
|
35
35
|
)
|
|
36
36
|
|
|
37
37
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
38
|
-
|
|
39
|
-
ForeignKey("resource.
|
|
38
|
+
resource_hdx_id: Mapped[int] = mapped_column(
|
|
39
|
+
ForeignKey("resource.hdx_id", onupdate="CASCADE", ondelete="CASCADE"),
|
|
40
40
|
nullable=False,
|
|
41
41
|
)
|
|
42
42
|
admin2_ref: Mapped[int] = mapped_column(
|
|
@@ -79,7 +79,6 @@ view_params_food_security = ViewParams(
|
|
|
79
79
|
DBDataset.hdx_provider_stub.label("dataset_hdx_provider_stub"),
|
|
80
80
|
DBDataset.hdx_provider_name.label("dataset_hdx_provider_name"),
|
|
81
81
|
DBIpcPhase.name.label("ipc_phase_name"),
|
|
82
|
-
DBResource.hdx_id.label("resource_hdx_id"),
|
|
83
82
|
DBResource.name.label("resource_name"),
|
|
84
83
|
DBResource.update_date.label("resource_update_date"),
|
|
85
84
|
DBResource.hapi_updated_date.label("hapi_updated_date"),
|
|
@@ -114,12 +113,12 @@ view_params_food_security = ViewParams(
|
|
|
114
113
|
# Join pop to resource to dataset
|
|
115
114
|
.join(
|
|
116
115
|
DBResource.__table__,
|
|
117
|
-
DBFoodSecurity.
|
|
116
|
+
DBFoodSecurity.resource_hdx_id == DBResource.hdx_id,
|
|
118
117
|
isouter=True,
|
|
119
118
|
)
|
|
120
119
|
.join(
|
|
121
120
|
DBDataset.__table__,
|
|
122
|
-
DBResource.
|
|
121
|
+
DBResource.dataset_hdx_id == DBDataset.hdx_id,
|
|
123
122
|
isouter=True,
|
|
124
123
|
)
|
|
125
124
|
# Join to ipc phase
|
|
@@ -35,8 +35,8 @@ class DBHumanitarianNeeds(Base):
|
|
|
35
35
|
)
|
|
36
36
|
|
|
37
37
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
38
|
-
|
|
39
|
-
ForeignKey("resource.
|
|
38
|
+
resource_hdx_id: Mapped[int] = mapped_column(
|
|
39
|
+
ForeignKey("resource.hdx_id", onupdate="CASCADE", ondelete="CASCADE"),
|
|
40
40
|
nullable=False,
|
|
41
41
|
)
|
|
42
42
|
admin2_ref: Mapped[int] = mapped_column(
|
|
@@ -91,7 +91,6 @@ view_params_humanitarian_needs = ViewParams(
|
|
|
91
91
|
DBDataset.title.label("dataset_title"),
|
|
92
92
|
DBDataset.hdx_provider_stub.label("dataset_hdx_provider_stub"),
|
|
93
93
|
DBDataset.hdx_provider_name.label("dataset_hdx_provider_name"),
|
|
94
|
-
DBResource.hdx_id.label("resource_hdx_id"),
|
|
95
94
|
DBResource.name.label("resource_name"),
|
|
96
95
|
DBResource.update_date.label("resource_update_date"),
|
|
97
96
|
DBResource.hapi_updated_date.label("hapi_updated_date"),
|
|
@@ -127,12 +126,12 @@ view_params_humanitarian_needs = ViewParams(
|
|
|
127
126
|
# Join needs to resource to dataset
|
|
128
127
|
.join(
|
|
129
128
|
DBResource.__table__,
|
|
130
|
-
DBHumanitarianNeeds.
|
|
129
|
+
DBHumanitarianNeeds.resource_hdx_id == DBResource.hdx_id,
|
|
131
130
|
isouter=True,
|
|
132
131
|
)
|
|
133
132
|
.join(
|
|
134
133
|
DBDataset.__table__,
|
|
135
|
-
DBResource.
|
|
134
|
+
DBResource.dataset_hdx_id == DBDataset.hdx_id,
|
|
136
135
|
isouter=True,
|
|
137
136
|
)
|
|
138
137
|
# Join needs to sector
|
|
@@ -37,8 +37,8 @@ class DBNationalRisk(Base):
|
|
|
37
37
|
)
|
|
38
38
|
|
|
39
39
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
40
|
-
|
|
41
|
-
ForeignKey("resource.
|
|
40
|
+
resource_hdx_id: Mapped[int] = mapped_column(
|
|
41
|
+
ForeignKey("resource.hdx_id", onupdate="CASCADE", ondelete="CASCADE"),
|
|
42
42
|
nullable=False,
|
|
43
43
|
)
|
|
44
44
|
admin2_ref: Mapped[int] = mapped_column(
|
|
@@ -78,7 +78,6 @@ view_params_national_risk = ViewParams(
|
|
|
78
78
|
DBDataset.title.label("dataset_title"),
|
|
79
79
|
DBDataset.hdx_provider_stub.label("dataset_hdx_provider_stub"),
|
|
80
80
|
DBDataset.hdx_provider_name.label("dataset_hdx_provider_name"),
|
|
81
|
-
DBResource.hdx_id.label("resource_hdx_id"),
|
|
82
81
|
DBResource.name.label("resource_name"),
|
|
83
82
|
DBResource.update_date.label("resource_update_date"),
|
|
84
83
|
DBResource.hapi_updated_date.label("hapi_updated_date"),
|
|
@@ -111,12 +110,12 @@ view_params_national_risk = ViewParams(
|
|
|
111
110
|
# Join risk to resource to dataset
|
|
112
111
|
.join(
|
|
113
112
|
DBResource.__table__,
|
|
114
|
-
DBNationalRisk.
|
|
113
|
+
DBNationalRisk.resource_hdx_id == DBResource.hdx_id,
|
|
115
114
|
isouter=True,
|
|
116
115
|
)
|
|
117
116
|
.join(
|
|
118
117
|
DBDataset.__table__,
|
|
119
|
-
DBResource.
|
|
118
|
+
DBResource.dataset_hdx_id == DBDataset.hdx_id,
|
|
120
119
|
isouter=True,
|
|
121
120
|
)
|
|
122
121
|
),
|
|
@@ -35,8 +35,8 @@ class DBOperationalPresence(Base):
|
|
|
35
35
|
)
|
|
36
36
|
|
|
37
37
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
38
|
-
|
|
39
|
-
ForeignKey("resource.
|
|
38
|
+
resource_hdx_id = mapped_column(
|
|
39
|
+
ForeignKey("resource.hdx_id", onupdate="CASCADE", ondelete="CASCADE"),
|
|
40
40
|
nullable=False,
|
|
41
41
|
)
|
|
42
42
|
admin2_ref: Mapped[int] = mapped_column(
|
|
@@ -72,7 +72,6 @@ view_params_operational_presence = ViewParams(
|
|
|
72
72
|
DBDataset.title.label("dataset_title"),
|
|
73
73
|
DBDataset.hdx_provider_stub.label("dataset_hdx_provider_stub"),
|
|
74
74
|
DBDataset.hdx_provider_name.label("dataset_hdx_provider_name"),
|
|
75
|
-
DBResource.hdx_id.label("resource_hdx_id"),
|
|
76
75
|
DBResource.name.label("resource_name"),
|
|
77
76
|
DBResource.update_date.label("resource_update_date"),
|
|
78
77
|
DBResource.hapi_updated_date.label("hapi_updated_date"),
|
|
@@ -112,12 +111,12 @@ view_params_operational_presence = ViewParams(
|
|
|
112
111
|
# Join op to resource to dataset
|
|
113
112
|
.join(
|
|
114
113
|
DBResource.__table__,
|
|
115
|
-
DBOperationalPresence.
|
|
114
|
+
DBOperationalPresence.resource_hdx_id == DBResource.hdx_id,
|
|
116
115
|
isouter=True,
|
|
117
116
|
)
|
|
118
117
|
.join(
|
|
119
118
|
DBDataset.__table__,
|
|
120
|
-
DBResource.
|
|
119
|
+
DBResource.dataset_hdx_id == DBDataset.hdx_id,
|
|
121
120
|
isouter=True,
|
|
122
121
|
)
|
|
123
122
|
# Join op to org to org type
|
|
@@ -10,18 +10,15 @@ from hapi_schema.utils.base import Base
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class StateEnum(str, enum.Enum):
|
|
13
|
-
discovered = 1
|
|
14
|
-
executed = 2
|
|
15
|
-
failed = 3
|
|
16
|
-
|
|
13
|
+
discovered = 1 # -> it was found in the patch repo
|
|
14
|
+
executed = 2 # -> the patch was executed successfully
|
|
15
|
+
failed = 3 # -> HWA tried to execute the patch but it failed (either pre-conditions
|
|
16
|
+
# were not met OR the transaction failed and was rolled back)
|
|
17
|
+
canceled = 4 # -> it was marked as canceled in the patch repo
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
class DBPatch(Base):
|
|
20
21
|
__tablename__ = "patch"
|
|
21
|
-
# __table_args__ = (
|
|
22
|
-
# Index(None, "patch_sequence_number"),
|
|
23
|
-
# Index(None, "state"),
|
|
24
|
-
# )
|
|
25
22
|
|
|
26
23
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
27
24
|
patch_sequence_number: Mapped[int] = mapped_column(
|
|
@@ -31,15 +28,19 @@ class DBPatch(Base):
|
|
|
31
28
|
String(48), unique=True, nullable=False
|
|
32
29
|
)
|
|
33
30
|
commit_date: Mapped[datetime] = mapped_column(DateTime, nullable=False)
|
|
34
|
-
patch_path: Mapped[str] = mapped_column(
|
|
35
|
-
|
|
31
|
+
patch_path: Mapped[str] = mapped_column(
|
|
32
|
+
String(512), nullable=False, index=True
|
|
33
|
+
)
|
|
34
|
+
patch_permalink_url: Mapped[str] = mapped_column(
|
|
36
35
|
String(1024), nullable=False, unique=True
|
|
37
36
|
)
|
|
37
|
+
patch_target: Mapped[str] = mapped_column(String(128), nullable=False)
|
|
38
|
+
patch_hash: Mapped[str] = mapped_column(
|
|
39
|
+
String(48), unique=True, nullable=False
|
|
40
|
+
)
|
|
38
41
|
state: Mapped[StateEnum] = mapped_column(
|
|
39
42
|
Enum(StateEnum), nullable=False, index=True
|
|
40
43
|
)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
# were not met OR the transaction failed and was rolled back)
|
|
45
|
-
# canceled -> it was marked as canceled in the patch repo
|
|
44
|
+
execution_date: Mapped[datetime] = mapped_column(
|
|
45
|
+
DateTime, nullable=True, index=True
|
|
46
|
+
)
|
|
@@ -33,8 +33,8 @@ class DBPopulation(Base):
|
|
|
33
33
|
)
|
|
34
34
|
|
|
35
35
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
36
|
-
|
|
37
|
-
ForeignKey("resource.
|
|
36
|
+
resource_hdx_id: Mapped[int] = mapped_column(
|
|
37
|
+
ForeignKey("resource.hdx_id", onupdate="CASCADE", ondelete="CASCADE"),
|
|
38
38
|
nullable=False,
|
|
39
39
|
)
|
|
40
40
|
admin2_ref: Mapped[int] = mapped_column(
|
|
@@ -73,7 +73,6 @@ view_params_population = ViewParams(
|
|
|
73
73
|
DBDataset.title.label("dataset_title"),
|
|
74
74
|
DBDataset.hdx_provider_stub.label("dataset_hdx_provider_stub"),
|
|
75
75
|
DBDataset.hdx_provider_name.label("dataset_hdx_provider_name"),
|
|
76
|
-
DBResource.hdx_id.label("resource_hdx_id"),
|
|
77
76
|
DBResource.name.label("resource_name"),
|
|
78
77
|
DBResource.update_date.label("resource_update_date"),
|
|
79
78
|
DBResource.hapi_updated_date.label("hapi_updated_date"),
|
|
@@ -108,12 +107,12 @@ view_params_population = ViewParams(
|
|
|
108
107
|
# Join pop to resource to dataset
|
|
109
108
|
.join(
|
|
110
109
|
DBResource.__table__,
|
|
111
|
-
DBPopulation.
|
|
110
|
+
DBPopulation.resource_hdx_id == DBResource.hdx_id,
|
|
112
111
|
isouter=True,
|
|
113
112
|
)
|
|
114
113
|
.join(
|
|
115
114
|
DBDataset.__table__,
|
|
116
|
-
DBResource.
|
|
115
|
+
DBResource.dataset_hdx_id == DBDataset.hdx_id,
|
|
117
116
|
isouter=True,
|
|
118
117
|
)
|
|
119
118
|
),
|
|
@@ -7,7 +7,6 @@ from sqlalchemy import (
|
|
|
7
7
|
CheckConstraint,
|
|
8
8
|
DateTime,
|
|
9
9
|
ForeignKey,
|
|
10
|
-
Integer,
|
|
11
10
|
String,
|
|
12
11
|
select,
|
|
13
12
|
text,
|
|
@@ -28,14 +27,11 @@ class DBResource(Base):
|
|
|
28
27
|
),
|
|
29
28
|
)
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
ForeignKey("dataset.
|
|
30
|
+
hdx_id: Mapped[str] = mapped_column(String(36), primary_key=True)
|
|
31
|
+
dataset_hdx_id: Mapped[int] = mapped_column(
|
|
32
|
+
ForeignKey("dataset.hdx_id", onupdate="CASCADE", ondelete="CASCADE"),
|
|
34
33
|
nullable=False,
|
|
35
34
|
)
|
|
36
|
-
hdx_id: Mapped[str] = mapped_column(
|
|
37
|
-
String(36), unique=True, nullable=False
|
|
38
|
-
)
|
|
39
35
|
name: Mapped[str] = mapped_column(String(256), nullable=False)
|
|
40
36
|
format: Mapped[str] = mapped_column(String(32), nullable=False)
|
|
41
37
|
update_date = mapped_column(DateTime, nullable=False, index=True)
|
|
@@ -55,7 +51,6 @@ view_params_resource = ViewParams(
|
|
|
55
51
|
metadata=Base.metadata,
|
|
56
52
|
selectable=select(
|
|
57
53
|
*DBResource.__table__.columns,
|
|
58
|
-
DBDataset.hdx_id.label("dataset_hdx_id"),
|
|
59
54
|
DBDataset.hdx_stub.label("dataset_hdx_stub"),
|
|
60
55
|
DBDataset.title.label("dataset_title"),
|
|
61
56
|
DBDataset.hdx_provider_stub.label("dataset_hdx_provider_stub"),
|
|
@@ -63,7 +58,7 @@ view_params_resource = ViewParams(
|
|
|
63
58
|
).select_from(
|
|
64
59
|
DBResource.__table__.join(
|
|
65
60
|
DBDataset.__table__,
|
|
66
|
-
DBResource.
|
|
61
|
+
DBResource.dataset_hdx_id == DBDataset.hdx_id,
|
|
67
62
|
isouter=True,
|
|
68
63
|
)
|
|
69
64
|
),
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
data_dataset = [
|
|
2
2
|
dict(
|
|
3
|
-
id=1,
|
|
4
3
|
hdx_id="c3f001fa-b45b-464c-9460-1ca79fd39b40",
|
|
5
4
|
hdx_stub="dataset01",
|
|
6
5
|
title="Dataset #1",
|
|
@@ -8,7 +7,6 @@ data_dataset = [
|
|
|
8
7
|
hdx_provider_name="Provider #1",
|
|
9
8
|
),
|
|
10
9
|
dict(
|
|
11
|
-
id=2,
|
|
12
10
|
hdx_id="7cf3cec8-dbbc-4c96-9762-1464cd0bff75",
|
|
13
11
|
hdx_stub="dataset02",
|
|
14
12
|
title="Dataset #2",
|
|
@@ -4,7 +4,7 @@ data_food_security = [
|
|
|
4
4
|
# Phase 1 current national
|
|
5
5
|
dict(
|
|
6
6
|
id=1,
|
|
7
|
-
|
|
7
|
+
resource_hdx_id="62ad6e55-5f5d-4494-854c-4110687e9e25",
|
|
8
8
|
admin2_ref=1,
|
|
9
9
|
ipc_phase_code="1",
|
|
10
10
|
ipc_type_code="current",
|
|
@@ -17,7 +17,7 @@ data_food_security = [
|
|
|
17
17
|
# Phase 2 first projection admin1
|
|
18
18
|
dict(
|
|
19
19
|
id=2,
|
|
20
|
-
|
|
20
|
+
resource_hdx_id="62ad6e55-5f5d-4494-854c-4110687e9e25",
|
|
21
21
|
admin2_ref=2,
|
|
22
22
|
ipc_phase_code="2",
|
|
23
23
|
ipc_type_code="first projection",
|
|
@@ -30,7 +30,7 @@ data_food_security = [
|
|
|
30
30
|
# Phase 3 second projection admin2
|
|
31
31
|
dict(
|
|
32
32
|
id=3,
|
|
33
|
-
|
|
33
|
+
resource_hdx_id="62ad6e55-5f5d-4494-854c-4110687e9e25",
|
|
34
34
|
admin2_ref=4,
|
|
35
35
|
ipc_phase_code="3",
|
|
36
36
|
ipc_type_code="second projection",
|
|
@@ -4,7 +4,7 @@ data_humanitarian_needs = [
|
|
|
4
4
|
# total national
|
|
5
5
|
dict(
|
|
6
6
|
id=1,
|
|
7
|
-
|
|
7
|
+
resource_hdx_id="90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
8
8
|
admin2_ref=1,
|
|
9
9
|
gender_code=None,
|
|
10
10
|
age_range_code=None,
|
|
@@ -20,7 +20,7 @@ data_humanitarian_needs = [
|
|
|
20
20
|
# national f, all ages, disabled, sector SHL
|
|
21
21
|
dict(
|
|
22
22
|
id=2,
|
|
23
|
-
|
|
23
|
+
resource_hdx_id="90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
24
24
|
admin2_ref=1,
|
|
25
25
|
gender_code="f",
|
|
26
26
|
age_range_code=None,
|
|
@@ -36,7 +36,7 @@ data_humanitarian_needs = [
|
|
|
36
36
|
# admin1 f, age 0-4, not disabled, sector WSH
|
|
37
37
|
dict(
|
|
38
38
|
id=3,
|
|
39
|
-
|
|
39
|
+
resource_hdx_id="90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
40
40
|
admin2_ref=2,
|
|
41
41
|
gender_code="f",
|
|
42
42
|
age_range_code="0-4",
|
|
@@ -52,7 +52,7 @@ data_humanitarian_needs = [
|
|
|
52
52
|
# admin2 ages 80+, disabled, sector HEA
|
|
53
53
|
dict(
|
|
54
54
|
id=4,
|
|
55
|
-
|
|
55
|
+
resource_hdx_id="90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
56
56
|
admin2_ref=4,
|
|
57
57
|
gender_code=None,
|
|
58
58
|
age_range_code="80+",
|
|
@@ -3,7 +3,7 @@ from datetime import datetime
|
|
|
3
3
|
data_operational_presence = [
|
|
4
4
|
dict(
|
|
5
5
|
id=1,
|
|
6
|
-
|
|
6
|
+
resource_hdx_id="90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
7
7
|
admin2_ref=2,
|
|
8
8
|
org_ref=1,
|
|
9
9
|
sector_code="SHL",
|
|
@@ -13,7 +13,7 @@ data_operational_presence = [
|
|
|
13
13
|
),
|
|
14
14
|
dict(
|
|
15
15
|
id=2,
|
|
16
|
-
|
|
16
|
+
resource_hdx_id="90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
17
17
|
admin2_ref=4,
|
|
18
18
|
org_ref=2,
|
|
19
19
|
sector_code="FSC",
|
|
@@ -23,7 +23,7 @@ data_operational_presence = [
|
|
|
23
23
|
),
|
|
24
24
|
dict(
|
|
25
25
|
id=3,
|
|
26
|
-
|
|
26
|
+
resource_hdx_id="90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
27
27
|
admin2_ref=4,
|
|
28
28
|
org_ref=3,
|
|
29
29
|
sector_code="WSH",
|
|
@@ -33,7 +33,7 @@ data_operational_presence = [
|
|
|
33
33
|
),
|
|
34
34
|
dict(
|
|
35
35
|
id=4,
|
|
36
|
-
|
|
36
|
+
resource_hdx_id="90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
37
37
|
admin2_ref=6,
|
|
38
38
|
org_ref=3,
|
|
39
39
|
sector_code="HEA",
|
|
@@ -43,7 +43,7 @@ data_operational_presence = [
|
|
|
43
43
|
),
|
|
44
44
|
dict(
|
|
45
45
|
id=5,
|
|
46
|
-
|
|
46
|
+
resource_hdx_id="90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
47
47
|
admin2_ref=1,
|
|
48
48
|
org_ref=2,
|
|
49
49
|
sector_code="WSH",
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
data_patch = [
|
|
4
|
+
dict(
|
|
5
|
+
id=1,
|
|
6
|
+
patch_sequence_number=1,
|
|
7
|
+
commit_hash="66e7e589a1224a1832ba7360817dda7a7d9313cf",
|
|
8
|
+
commit_date=datetime(2023, 1, 1),
|
|
9
|
+
patch_path="/2024/01/hapi_patch_1_hno.json",
|
|
10
|
+
patch_target="humanitarian_needs",
|
|
11
|
+
patch_hash="66e7e589a1224a1832ba7360817dda7a7d9313dg",
|
|
12
|
+
patch_permalink_url="https://github.com/OCHA-DAP/hapi-patch-repo/blob/66e7e589a1224a1832ba7360817dda7a7d9313cf/2024/01/hapi_patch_1_hno.json",
|
|
13
|
+
state="executed",
|
|
14
|
+
execution_date=datetime(2023, 1, 2),
|
|
15
|
+
),
|
|
16
|
+
dict(
|
|
17
|
+
id=2,
|
|
18
|
+
patch_sequence_number=2,
|
|
19
|
+
commit_hash="554f18a92cf6a23a14e0f29356a6dec150f651ff",
|
|
20
|
+
commit_date=datetime(2023, 1, 2),
|
|
21
|
+
patch_path="2024/01/hapi_patch_2_hno.json",
|
|
22
|
+
patch_target="humanitarian_needs",
|
|
23
|
+
patch_hash="554f18a92cf6a23a14e0f29356a6dec150f651gg",
|
|
24
|
+
patch_permalink_url="https://github.com/OCHA-DAP/hapi-patch-repo/blob/554f18a92cf6a23a14e0f29356a6dec150f651ff/2024/01/hapi_patch_2_hno.json",
|
|
25
|
+
state="failed",
|
|
26
|
+
execution_date=datetime(2023, 1, 3),
|
|
27
|
+
),
|
|
28
|
+
dict(
|
|
29
|
+
id=3,
|
|
30
|
+
patch_sequence_number=3,
|
|
31
|
+
commit_hash="35ea27da009e5add8d8d227e02fd2c4bbcc84b76",
|
|
32
|
+
commit_date=datetime(2023, 1, 3),
|
|
33
|
+
patch_path="2024/01/hapi_patch_3_hno.json",
|
|
34
|
+
patch_target="humanitarian_needs",
|
|
35
|
+
patch_hash="554f18a92cf6a23a14e0f29356a6dec150f65187",
|
|
36
|
+
patch_permalink_url="https://github.com/OCHA-DAP/hapi-patch-repo/blob/35ea27da009e5add8d8d227e02fd2c4bbcc84b76/2024/01/hapi_patch_3_hno.json",
|
|
37
|
+
state="discovered",
|
|
38
|
+
execution_date=None,
|
|
39
|
+
),
|
|
40
|
+
]
|
|
@@ -4,7 +4,7 @@ data_population = [
|
|
|
4
4
|
# total national
|
|
5
5
|
dict(
|
|
6
6
|
id=1,
|
|
7
|
-
|
|
7
|
+
resource_hdx_id="90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
8
8
|
admin2_ref=1,
|
|
9
9
|
gender_code=None,
|
|
10
10
|
age_range_code=None,
|
|
@@ -16,7 +16,7 @@ data_population = [
|
|
|
16
16
|
# national f, all ages
|
|
17
17
|
dict(
|
|
18
18
|
id=2,
|
|
19
|
-
|
|
19
|
+
resource_hdx_id="90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
20
20
|
admin2_ref=1,
|
|
21
21
|
gender_code="f",
|
|
22
22
|
age_range_code=None,
|
|
@@ -28,7 +28,7 @@ data_population = [
|
|
|
28
28
|
# admin1 f, age 0-4
|
|
29
29
|
dict(
|
|
30
30
|
id=3,
|
|
31
|
-
|
|
31
|
+
resource_hdx_id="90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
32
32
|
admin2_ref=2,
|
|
33
33
|
gender_code="f",
|
|
34
34
|
age_range_code="0-4",
|
|
@@ -40,7 +40,7 @@ data_population = [
|
|
|
40
40
|
# admin2 ages 80+
|
|
41
41
|
dict(
|
|
42
42
|
id=4,
|
|
43
|
-
|
|
43
|
+
resource_hdx_id="90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
44
44
|
admin2_ref=4,
|
|
45
45
|
gender_code=None,
|
|
46
46
|
age_range_code="80+",
|
|
@@ -2,9 +2,8 @@ from datetime import datetime
|
|
|
2
2
|
|
|
3
3
|
data_resource = [
|
|
4
4
|
dict(
|
|
5
|
-
id=1,
|
|
6
|
-
dataset_ref=1,
|
|
7
5
|
hdx_id="90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
6
|
+
dataset_hdx_id="c3f001fa-b45b-464c-9460-1ca79fd39b40",
|
|
8
7
|
name="resource-01.csv",
|
|
9
8
|
format="csv",
|
|
10
9
|
update_date=datetime(2023, 6, 1),
|
|
@@ -14,9 +13,8 @@ data_resource = [
|
|
|
14
13
|
hapi_replaced_date=None,
|
|
15
14
|
),
|
|
16
15
|
dict(
|
|
17
|
-
id=2,
|
|
18
|
-
dataset_ref=1,
|
|
19
16
|
hdx_id="b9e438e0-b68a-49f9-b9a9-68c0f3e93604",
|
|
17
|
+
dataset_hdx_id="c3f001fa-b45b-464c-9460-1ca79fd39b40",
|
|
20
18
|
name="resource-02.xlsx",
|
|
21
19
|
format="xlsx",
|
|
22
20
|
update_date=datetime(2023, 7, 1),
|
|
@@ -26,9 +24,8 @@ data_resource = [
|
|
|
26
24
|
hapi_replaced_date=None,
|
|
27
25
|
),
|
|
28
26
|
dict(
|
|
29
|
-
id=3,
|
|
30
|
-
dataset_ref=2,
|
|
31
27
|
hdx_id="62ad6e55-5f5d-4494-854c-4110687e9e25",
|
|
28
|
+
dataset_hdx_id="7cf3cec8-dbbc-4c96-9762-1464cd0bff75",
|
|
32
29
|
name="resource-03.csv",
|
|
33
30
|
format="csv",
|
|
34
31
|
update_date=datetime(2023, 8, 1),
|
|
@@ -9,7 +9,7 @@ def test_dataset_view(run_view_test):
|
|
|
9
9
|
run_view_test(
|
|
10
10
|
view=view_dataset,
|
|
11
11
|
whereclause=(
|
|
12
|
-
view_dataset.c.
|
|
12
|
+
view_dataset.c.hdx_id == "c3f001fa-b45b-464c-9460-1ca79fd39b40",
|
|
13
13
|
view_dataset.c.hdx_stub == "dataset01",
|
|
14
14
|
view_dataset.c.title == "Dataset #1",
|
|
15
15
|
view_dataset.c.hdx_provider_stub == "provider01",
|
|
@@ -19,6 +19,7 @@ def test_food_security_view(run_view_test):
|
|
|
19
19
|
== "7cf3cec8-dbbc-4c96-9762-1464cd0bff75",
|
|
20
20
|
view_food_security.c.resource_hdx_id
|
|
21
21
|
== "62ad6e55-5f5d-4494-854c-4110687e9e25",
|
|
22
|
+
view_food_security.c.resource_name == "resource-03.csv",
|
|
22
23
|
view_food_security.c.ipc_phase_name == "Phase 3: Crisis",
|
|
23
24
|
view_food_security.c.admin2_code == "FOO-001-A",
|
|
24
25
|
view_food_security.c.admin1_code == "FOO-001",
|
|
@@ -32,7 +33,7 @@ def test_reference_period_constraint(run_constraints_test):
|
|
|
32
33
|
run_constraints_test(
|
|
33
34
|
new_rows=[
|
|
34
35
|
DBFoodSecurity(
|
|
35
|
-
|
|
36
|
+
resource_hdx_id="62ad6e55-5f5d-4494-854c-4110687e9e25",
|
|
36
37
|
admin2_ref=4,
|
|
37
38
|
ipc_phase_code="1",
|
|
38
39
|
ipc_type_code="current",
|
|
@@ -21,6 +21,7 @@ def test_humanitarian_needs_view(run_view_test):
|
|
|
21
21
|
== "c3f001fa-b45b-464c-9460-1ca79fd39b40",
|
|
22
22
|
view_humanitarian_needs.c.resource_hdx_id
|
|
23
23
|
== "90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
24
|
+
view_humanitarian_needs.c.resource_name == "resource-01.csv",
|
|
24
25
|
view_humanitarian_needs.c.admin2_code == "FOO-001-XXX",
|
|
25
26
|
view_humanitarian_needs.c.admin1_code == "FOO-001",
|
|
26
27
|
view_humanitarian_needs.c.location_code == "FOO",
|
|
@@ -39,7 +40,7 @@ def test_reference_period_constraint(run_constraints_test):
|
|
|
39
40
|
run_constraints_test(
|
|
40
41
|
new_rows=[
|
|
41
42
|
DBHumanitarianNeeds(
|
|
42
|
-
|
|
43
|
+
resource_hdx_id="90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
43
44
|
admin2_ref=1,
|
|
44
45
|
gender_code=None,
|
|
45
46
|
age_range_code=None,
|
|
@@ -19,6 +19,7 @@ def test_national_risk_view(run_view_test):
|
|
|
19
19
|
== "c3f001fa-b45b-464c-9460-1ca79fd39b40",
|
|
20
20
|
view_national_risk.c.resource_hdx_id
|
|
21
21
|
== "90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
22
|
+
view_national_risk.c.resource_name == "resource-01.csv",
|
|
22
23
|
view_national_risk.c.admin2_code == "FOO-XXX-XXX",
|
|
23
24
|
view_national_risk.c.admin1_code == "FOO-XXX",
|
|
24
25
|
view_national_risk.c.location_code == "FOO",
|
|
@@ -31,7 +32,7 @@ def test_reference_period_constraint(run_constraints_test):
|
|
|
31
32
|
run_constraints_test(
|
|
32
33
|
new_rows=[
|
|
33
34
|
DBNationalRisk(
|
|
34
|
-
|
|
35
|
+
resource_hdx_id="90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
35
36
|
admin2_ref=1,
|
|
36
37
|
risk_class=5,
|
|
37
38
|
global_rank=4,
|
|
@@ -55,7 +56,7 @@ def test_meta_avg_recentness_constraint(run_constraints_test):
|
|
|
55
56
|
run_constraints_test(
|
|
56
57
|
new_rows=[
|
|
57
58
|
DBNationalRisk(
|
|
58
|
-
|
|
59
|
+
resource_hdx_id="90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
59
60
|
admin2_ref=1,
|
|
60
61
|
risk_class=5,
|
|
61
62
|
global_rank=4,
|
|
@@ -21,6 +21,7 @@ def test_operational_presence_view(run_view_test):
|
|
|
21
21
|
== "c3f001fa-b45b-464c-9460-1ca79fd39b40",
|
|
22
22
|
view_operational_presence.c.resource_hdx_id
|
|
23
23
|
== "90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
24
|
+
view_operational_presence.c.resource_name == "resource-01.csv",
|
|
24
25
|
view_operational_presence.c.admin2_code == "FOO-XXX-XXX",
|
|
25
26
|
view_operational_presence.c.admin1_code == "FOO-XXX",
|
|
26
27
|
view_operational_presence.c.location_code == "FOO",
|
|
@@ -38,7 +39,7 @@ def test_reference_period_constraint(run_constraints_test):
|
|
|
38
39
|
run_constraints_test(
|
|
39
40
|
new_rows=[
|
|
40
41
|
DBOperationalPresence(
|
|
41
|
-
|
|
42
|
+
resource_hdx_id="90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
42
43
|
admin2_ref=2,
|
|
43
44
|
org_ref=1,
|
|
44
45
|
sector_code="SHL",
|
|
@@ -14,12 +14,16 @@ def test_db_patch(capfd):
|
|
|
14
14
|
patch_sequence_number INTEGER NOT NULL,
|
|
15
15
|
commit_hash VARCHAR(48) NOT NULL,
|
|
16
16
|
commit_date DATETIME NOT NULL,
|
|
17
|
-
patch_path VARCHAR(
|
|
18
|
-
|
|
17
|
+
patch_path VARCHAR(512) NOT NULL,
|
|
18
|
+
patch_permalink_url VARCHAR(1024) NOT NULL,
|
|
19
|
+
patch_target VARCHAR(128) NOT NULL,
|
|
20
|
+
patch_hash VARCHAR(48) NOT NULL,
|
|
19
21
|
state VARCHAR(10) NOT NULL,
|
|
22
|
+
execution_date DATETIME,
|
|
20
23
|
PRIMARY KEY (id),
|
|
21
24
|
UNIQUE (commit_hash),
|
|
22
|
-
UNIQUE (
|
|
25
|
+
UNIQUE (patch_permalink_url),
|
|
26
|
+
UNIQUE (patch_hash)
|
|
23
27
|
)
|
|
24
28
|
"""
|
|
25
29
|
sql_patch_sequence_number_index_creation = """
|
|
@@ -16,6 +16,7 @@ def test_population_view(run_view_test):
|
|
|
16
16
|
== "c3f001fa-b45b-464c-9460-1ca79fd39b40",
|
|
17
17
|
view_population.c.resource_hdx_id
|
|
18
18
|
== "90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
19
|
+
view_population.c.resource_name == "resource-01.csv",
|
|
19
20
|
view_population.c.admin2_code == "FOO-001-XXX",
|
|
20
21
|
view_population.c.admin1_code == "FOO-001",
|
|
21
22
|
view_population.c.location_code == "FOO",
|
|
@@ -29,7 +30,7 @@ def test_reference_period_constraint(run_constraints_test):
|
|
|
29
30
|
run_constraints_test(
|
|
30
31
|
new_rows=[
|
|
31
32
|
DBPopulation(
|
|
32
|
-
|
|
33
|
+
resource_hdx_id="90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
33
34
|
admin2_ref=1,
|
|
34
35
|
gender_code=None,
|
|
35
36
|
age_range_code=None,
|
|
@@ -48,7 +49,7 @@ def test_population_positive(run_constraints_test):
|
|
|
48
49
|
run_constraints_test(
|
|
49
50
|
new_rows=[
|
|
50
51
|
DBPopulation(
|
|
51
|
-
|
|
52
|
+
resource_hdx_id="90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
52
53
|
admin2_ref=1,
|
|
53
54
|
gender_code=None,
|
|
54
55
|
age_range_code=None,
|
|
@@ -11,9 +11,8 @@ def test_resource_view(run_view_test):
|
|
|
11
11
|
run_view_test(
|
|
12
12
|
view=view_resource,
|
|
13
13
|
whereclause=(
|
|
14
|
-
view_resource.c.
|
|
15
|
-
view_resource.c.
|
|
16
|
-
== "c3f001fa-b45b-464c-9460-1ca79fd39b40",
|
|
14
|
+
view_resource.c.hdx_id == "90deb235-1bf5-4bae-b231-3393222c2d01",
|
|
15
|
+
view_resource.c.dataset_hdx_stub == "dataset01",
|
|
17
16
|
),
|
|
18
17
|
)
|
|
19
18
|
|
|
@@ -23,8 +22,8 @@ def test_hapi_date_constraint(run_constraints_test):
|
|
|
23
22
|
run_constraints_test(
|
|
24
23
|
new_rows=[
|
|
25
24
|
DBResource(
|
|
26
|
-
dataset_ref=2,
|
|
27
25
|
hdx_id="9d9e07c9-a758-43bd-87dc-5cdd3b3f7e9f",
|
|
26
|
+
dataset_hdx_id="7cf3cec8-dbbc-4c96-9762-1464cd0bff75",
|
|
28
27
|
name="resource-04.csv",
|
|
29
28
|
format="csv",
|
|
30
29
|
update_date=datetime(2023, 1, 1),
|
|
@@ -39,8 +38,8 @@ def test_hapi_date_constraint(run_constraints_test):
|
|
|
39
38
|
|
|
40
39
|
(
|
|
41
40
|
dict(
|
|
42
|
-
dataset_ref=2,
|
|
43
41
|
hdx_id="9d9e07c9-a758-43bd-87dc-5cdd3b3f7e9f",
|
|
42
|
+
dataset_hdx_id="7cf3cec8-dbbc-4c96-9762-1464cd0bff75",
|
|
44
43
|
name="resource-04.csv",
|
|
45
44
|
format="csv",
|
|
46
45
|
update_date=datetime(2023, 1, 1),
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
from datetime import datetime
|
|
2
|
-
|
|
3
|
-
data_patch = [
|
|
4
|
-
dict(
|
|
5
|
-
id=1,
|
|
6
|
-
patch_sequence_number=1,
|
|
7
|
-
commit_hash="66e7e589a1224a1832ba7360817dda7a7d9313cf",
|
|
8
|
-
commit_date=datetime(2023, 1, 1),
|
|
9
|
-
patch_path="2024/01",
|
|
10
|
-
permanent_download_url="https://github.com/OCHA-DAP/hapi-patch-repo/blob/66e7e589a1224a1832ba7360817dda7a7d9313cf/2024/01/hapi_patch_10_hno.json",
|
|
11
|
-
state="executed",
|
|
12
|
-
),
|
|
13
|
-
dict(
|
|
14
|
-
id=2,
|
|
15
|
-
patch_sequence_number=2,
|
|
16
|
-
commit_hash="554f18a92cf6a23a14e0f29356a6dec150f651ff",
|
|
17
|
-
commit_date=datetime(2023, 1, 2),
|
|
18
|
-
patch_path="2024/01",
|
|
19
|
-
permanent_download_url="https://github.com/OCHA-DAP/hapi-patch-repo/blob/554f18a92cf6a23a14e0f29356a6dec150f651ff/2024/01/hapi_patch_10_hno.json",
|
|
20
|
-
state="failed",
|
|
21
|
-
),
|
|
22
|
-
dict(
|
|
23
|
-
id=3,
|
|
24
|
-
patch_sequence_number=3,
|
|
25
|
-
commit_hash="35ea27da009e5add8d8d227e02fd2c4bbcc84b76",
|
|
26
|
-
commit_date=datetime(2023, 1, 3),
|
|
27
|
-
patch_path="2024/01",
|
|
28
|
-
permanent_download_url="https://github.com/OCHA-DAP/hapi-patch-repo/blob/35ea27da009e5add8d8d227e02fd2c4bbcc84b76/2024/01/hapi_patch_10_hno.json",
|
|
29
|
-
state="discovered",
|
|
30
|
-
),
|
|
31
|
-
]
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|