hapi-schema 0.9.9__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.
Files changed (104) hide show
  1. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/PKG-INFO +1 -1
  2. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/changelog.md +6 -0
  3. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/requirements.txt +3 -3
  4. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/_version.py +2 -2
  5. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/db_funding.py +1 -3
  6. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/db_population.py +1 -1
  7. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/db_views_as_tables.py +20 -31
  8. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/test_views_as_tables.py +6 -2
  9. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/.config/coveragerc +0 -0
  10. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/.config/pre-commit-config.yaml +0 -0
  11. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/.config/pytest.ini +0 -0
  12. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/.config/ruff.toml +0 -0
  13. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/.github/workflows/publish.yaml +0 -0
  14. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/.github/workflows/run-python-tests.yaml +0 -0
  15. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/.gitignore +0 -0
  16. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/LICENSE +0 -0
  17. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/README.md +0 -0
  18. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/contributing.md +0 -0
  19. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/docker/docker-compose.yml +0 -0
  20. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/initialize_test_db.sh +0 -0
  21. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/pyproject.toml +0 -0
  22. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/__init__.py +0 -0
  23. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/db_admin1.py +0 -0
  24. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/db_admin2.py +0 -0
  25. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/db_conflict_event.py +0 -0
  26. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/db_currency.py +0 -0
  27. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/db_dataset.py +0 -0
  28. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/db_food_price.py +0 -0
  29. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/db_food_security.py +0 -0
  30. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/db_humanitarian_needs.py +0 -0
  31. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/db_idps.py +0 -0
  32. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/db_location.py +0 -0
  33. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/db_national_risk.py +0 -0
  34. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/db_operational_presence.py +0 -0
  35. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/db_org.py +0 -0
  36. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/db_org_type.py +0 -0
  37. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/db_patch.py +0 -0
  38. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/db_poverty_rate.py +0 -0
  39. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/db_refugees.py +0 -0
  40. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/db_resource.py +0 -0
  41. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/db_returnees.py +0 -0
  42. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/db_sector.py +0 -0
  43. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/db_wfp_commodity.py +0 -0
  44. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/db_wfp_market.py +0 -0
  45. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/utils/__init__.py +0 -0
  46. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/utils/base.py +0 -0
  47. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/utils/constraints.py +0 -0
  48. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/utils/endpoint_constants.py +0 -0
  49. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/utils/enums.py +0 -0
  50. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/utils/hapi_views_code_generator.py +0 -0
  51. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/utils/view_as_table_code_generator.py +0 -0
  52. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/utils/view_as_table_definitions.toml +0 -0
  53. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/utils/view_params.py +0 -0
  54. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/src/hapi_schema/views.py +0 -0
  55. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/conftest.py +0 -0
  56. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/sample_data/__init__.py +0 -0
  57. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/sample_data/data_admin1.py +0 -0
  58. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/sample_data/data_admin2.py +0 -0
  59. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/sample_data/data_conflict_event.py +0 -0
  60. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/sample_data/data_currency.py +0 -0
  61. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/sample_data/data_dataset.py +0 -0
  62. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/sample_data/data_food_price.py +0 -0
  63. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/sample_data/data_food_security.py +0 -0
  64. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/sample_data/data_funding.py +0 -0
  65. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/sample_data/data_humanitarian_needs.py +0 -0
  66. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/sample_data/data_idps.py +0 -0
  67. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/sample_data/data_location.py +0 -0
  68. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/sample_data/data_national_risk.py +0 -0
  69. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/sample_data/data_operational_presence.py +0 -0
  70. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/sample_data/data_org.py +0 -0
  71. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/sample_data/data_org_type.py +0 -0
  72. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/sample_data/data_patch.py +0 -0
  73. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/sample_data/data_population.py +0 -0
  74. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/sample_data/data_poverty_rate.py +0 -0
  75. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/sample_data/data_refugees.py +0 -0
  76. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/sample_data/data_resource.py +0 -0
  77. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/sample_data/data_returnees.py +0 -0
  78. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/sample_data/data_sector.py +0 -0
  79. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/sample_data/data_wfp_commodity.py +0 -0
  80. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/sample_data/data_wfp_market.py +0 -0
  81. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/test_admin1.py +0 -0
  82. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/test_admin2.py +0 -0
  83. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/test_conflict_event.py +0 -0
  84. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/test_currency.py +0 -0
  85. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/test_dataset.py +0 -0
  86. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/test_food_price.py +0 -0
  87. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/test_food_security.py +0 -0
  88. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/test_funding.py +0 -0
  89. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/test_humanitarian_needs.py +0 -0
  90. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/test_idps.py +0 -0
  91. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/test_location.py +0 -0
  92. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/test_national_risk.py +0 -0
  93. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/test_operational_presence.py +0 -0
  94. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/test_org.py +0 -0
  95. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/test_org_type.py +0 -0
  96. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/test_patch.py +0 -0
  97. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/test_population.py +0 -0
  98. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/test_poverty_rate.py +0 -0
  99. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/test_refugees.py +0 -0
  100. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/test_resource.py +0 -0
  101. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/test_returnees.py +0 -0
  102. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/test_sector.py +0 -0
  103. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/test_wfp_commodity.py +0 -0
  104. {hapi_schema-0.9.9 → hapi_schema-0.9.10}/tests/test_wfp_market.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hapi-schema
3
- Version: 0.9.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>
@@ -5,6 +5,12 @@ 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
+
8
14
  ## 0.9.9
9
15
 
10
16
  ### Changed
@@ -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.7
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.4
29
+ psycopg==3.2.5
30
30
  # via hapi-schema (pyproject.toml)
31
- psycopg-binary==3.2.4
31
+ psycopg-binary==3.2.5
32
32
  # via psycopg
33
33
  pytest==8.3.4
34
34
  # via
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.9.9'
21
- __version_tuple__ = version_tuple = (0, 9, 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
@@ -71,8 +70,7 @@ class DBFunding(Base):
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, index=True
60
+ nullable=False, primary_key=True
61
61
  )
62
62
  reference_period_end: Mapped[datetime] = mapped_column(
63
63
  nullable=False, index=True
@@ -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(index=True)
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, index=True
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, index=True
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(Float)
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)
@@ -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 = ["appeal_code", "location_ref"]
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
- "reference_period_start",
193
+ "reference_period_end",
190
194
  "location_code",
191
195
  "location_name",
192
196
  ]
File without changes
File without changes
File without changes
File without changes