Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
b-j-mills committed Sep 19, 2024
2 parents 7e58923 + 5a92a14 commit a66168c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 3 deletions.
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ Major refactoring to allow partial/incremental standardisation of subnational ge
- updated `poverty\_rate\_view` and VAT to include `admin1_name` from `admin1` table
- made `reference\_period\_start` part of the primary key for `population\_vat` (originally omitted in error)

## 0.8.17

### Added

- `operation` and additional primary keys to `idps` table

## 0.8.16

### Added
Expand Down
5 changes: 3 additions & 2 deletions src/hapi_schema/db_idps.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,15 @@ class DBIDPs(Base):
build_enum_using_values(DTMAssessmentType), primary_key=True
)

reporting_round: Mapped[int] = mapped_column(Integer, nullable=True)
reporting_round: Mapped[int] = mapped_column(Integer, primary_key=True)
operation: Mapped[str] = mapped_column(String, primary_key=True)

population: Mapped[int] = mapped_column(
Integer, nullable=False, index=True
)

reference_period_start: Mapped[datetime] = mapped_column(
DateTime, nullable=False, index=True
DateTime, primary_key=True
)

reference_period_end: Mapped[datetime] = mapped_column(
Expand Down
3 changes: 2 additions & 1 deletion src/hapi_schema/db_views_as_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ class DBIDPsVAT(Base):
String(512), primary_key=True
)
assessment_type: Mapped[str] = mapped_column(String(32), primary_key=True)
reporting_round: Mapped[int] = mapped_column(Integer, nullable=True)
reporting_round: Mapped[int] = mapped_column(Integer, primary_key=True)
operation: Mapped[str] = mapped_column(String, primary_key=True)
population: Mapped[int] = mapped_column(Integer, index=True)
reference_period_start: Mapped[datetime] = mapped_column(
DateTime, primary_key=True
Expand Down
1 change: 1 addition & 0 deletions tests/sample_data/data_idps.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
provider_admin2_name="Distrito B",
assessment_type="BA",
reporting_round=18,
operation="Operation",
population=25000,
reference_period_start=datetime(2024, 1, 1),
reference_period_end=datetime(2024, 12, 31),
Expand Down
2 changes: 2 additions & 0 deletions tests/test_idps.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def test_idps_view(run_view_test):
view_idps.c.provider_admin2_name == "Distrito B",
view_idps.c.assessment_type == "BA",
view_idps.c.reporting_round == 18,
view_idps.c.operation == "Operation",
view_idps.c.population == 25000,
view_idps.c.admin2_code == "FOO-001-XXX",
view_idps.c.admin1_code == "FOO-001",
Expand Down Expand Up @@ -55,6 +56,7 @@ def base_parameters():
provider_admin2_name="Distrito B",
assessment_type="BA",
reporting_round=18,
operation="operation",
population=25000,
reference_period_start=datetime(2020, 1, 1),
reference_period_end=datetime(2020, 1, 2),
Expand Down
2 changes: 2 additions & 0 deletions tests/test_views_as_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ def test_idps_vat(run_indexes_test, run_columns_test, run_primary_keys_test):
"provider_admin1_name",
"provider_admin2_name",
"assessment_type",
"reporting_round",
"operation",
"reference_period_start",
]
expected_indexes = [
Expand Down

0 comments on commit a66168c

Please sign in to comment.