Skip to content

Commit

Permalink
Switch HNO to use prod HDX data (OCHA-DAP#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcarans authored Jun 5, 2024
1 parent b518a01 commit 5fe17d8
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [0.9.15] - 2024-06-05

### Changed

- Switch HNO to use prod HDX data

## [0.9.14] - 2024-06-03

### Added
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ classifiers = [
requires-python = ">=3.8"

dependencies = [
"hapi-schema>=0.8.8",
"hdx-python-api>= 6.2.8",
"hapi-schema>=0.8.9",
"hdx-python-api>= 6.2.9",
"hdx-python-country>= 3.7.2",
"hdx-python-database[postgresql]>= 1.3.1",
"hdx-python-scraper>= 2.3.7",
"hdx-python-utilities>= 3.6.8",
"hdx-python-utilities>= 3.6.9",
"libhxl",
"sqlalchemy"
]
Expand Down
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ click==8.1.7
# via typer
coverage==7.5.3
# via pytest-cov
cryptography==42.0.7
cryptography==42.0.8
# via pyopenssl
defopt==6.4.0
# via hdx-python-api
Expand Down Expand Up @@ -60,7 +60,7 @@ gspread==6.1.2
# via hdx-python-scraper
hapi-schema==0.8.9
# via hapi-pipelines (pyproject.toml)
hdx-python-api==6.2.8
hdx-python-api==6.2.9
# via
# hapi-pipelines (pyproject.toml)
# hdx-python-scraper
Expand All @@ -73,7 +73,7 @@ hdx-python-database==1.3.1
# via hapi-pipelines (pyproject.toml)
hdx-python-scraper==2.3.7
# via hapi-pipelines (pyproject.toml)
hdx-python-utilities==3.6.8
hdx-python-utilities==3.6.9
# via
# hapi-pipelines (pyproject.toml)
# hdx-python-api
Expand Down Expand Up @@ -128,7 +128,7 @@ more-itertools==10.2.0
# via inflect
ndg-httpsclient==0.5.1
# via hdx-python-api
nodeenv==1.9.0
nodeenv==1.9.1
# via pre-commit
num2words==0.5.13
# via quantulum3
Expand Down Expand Up @@ -178,7 +178,7 @@ pyopenssl==24.1.0
# ndg-httpsclient
pyphonetics==0.5.3
# via hdx-python-country
pytest==8.2.1
pytest==8.2.2
# via
# hapi-pipelines (pyproject.toml)
# pytest-check
Expand Down
1 change: 1 addition & 0 deletions src/hapi/pipelines/app/pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ def output(self):
metadata=self.metadata,
admins=self.admins,
sector=self.sector,
configuration=self.configuration,
)
humanitarian_needs.populate()

Expand Down
6 changes: 3 additions & 3 deletions src/hapi/pipelines/database/humanitarian_needs.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ def __init__(
metadata: Metadata,
admins: admins.Admins,
sector: Sector,
configuration: Configuration,
):
super().__init__(session)
self._metadata = metadata
self._admins = admins
self._sector = sector
self._configuration = configuration

def get_admin2_ref(self, countryiso3, row, dataset_name, errors):
admin_code = row["Admin 2 PCode"]
Expand Down Expand Up @@ -59,12 +61,10 @@ def get_admin2_ref(self, countryiso3, row, dataset_name, errors):
def populate(self):
logger.info("Populating humanitarian needs table")
reader = Read.get_reader("hdx")
configuration = Configuration(hdx_site="stage", hdx_read_only=True)
configuration.setup_session_remoteckan()
datasets = reader.search_datasets(
filename="hno_dataset",
fq="name:hno-data-for-*",
configuration=configuration,
configuration=self._configuration,
)
warnings = set()
errors = set()
Expand Down

0 comments on commit 5fe17d8

Please sign in to comment.