From e428d0ee0d90e60a6dbda72412e6f972129b3d5a Mon Sep 17 00:00:00 2001 From: Josh Humphries Date: Tue, 24 Sep 2024 22:27:25 +0100 Subject: [PATCH] feat: add sg prefix All indices are prefixed with nhm- and this needs to be reflected! --- dataimporter/importer.py | 8 ++++---- dataimporter/lib/config.py | 1 + tests/test_config.py | 2 ++ tests/test_importer.py | 1 + 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dataimporter/importer.py b/dataimporter/importer.py index c17747f..5849e86 100644 --- a/dataimporter/importer.py +++ b/dataimporter/importer.py @@ -95,14 +95,14 @@ def __init__(self, config: Config): self.views_path / "artefact", ecatalogue_store, image_view, - config.artefact_id, + f"{config.sg_prefix}{config.artefact_id}", ) indexlot_view = IndexLotView( self.views_path / "indexlot", ecatalogue_store, image_view, taxonomy_view, - config.indexlot_id, + f"{config.sg_prefix}{config.indexlot_id}", ) mammal_part_view = MammalPartView( self.views_path / "mammalpart", ecatalogue_store @@ -114,13 +114,13 @@ def __init__(self, config: Config): taxonomy_view, gbif_view, mammal_part_view, - config.specimen_id, + f"{config.sg_prefix}{config.specimen_id}", ) prep_view = PreparationView( self.views_path / "preparation", ecatalogue_store, specimen_view, - config.preparation_id, + f"{config.sg_prefix}{config.preparation_id}", ) self.views = [ image_view, diff --git a/dataimporter/lib/config.py b/dataimporter/lib/config.py index d88c3f2..b2df1ab 100644 --- a/dataimporter/lib/config.py +++ b/dataimporter/lib/config.py @@ -40,6 +40,7 @@ class Config: artefact_id: str indexlot_id: str preparation_id: str + sg_prefix: str iiif_base_url: str mongo_config: MongoConfig es_config: ElasticsearchConfig diff --git a/tests/test_config.py b/tests/test_config.py index 3a7951b..3c7ffba 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -48,6 +48,7 @@ def test_str_paths_become_paths(self): MagicMock(), MagicMock(), MagicMock(), + MagicMock(), ) assert isinstance(config.data_path, Path) @@ -62,6 +63,7 @@ def test_get_clients(self): MagicMock(), MagicMock(), MagicMock(), + MagicMock(), MongoConfig(), ElasticsearchConfig(), MagicMock(), diff --git a/tests/test_importer.py b/tests/test_importer.py index c8017c2..acb842a 100644 --- a/tests/test_importer.py +++ b/tests/test_importer.py @@ -41,6 +41,7 @@ def config(tmp_path: Path) -> Config: artefact_id="artefact-id", indexlot_id="indexlot-id", preparation_id="preparation-id", + sg_prefix="test-", iiif_base_url="https://not.a.real.domain.com/media", mongo_config=mongo_config, es_config=elasticsearch_config,