diff --git a/Makefile b/Makefile index 477332e46..e17be6ce2 100644 --- a/Makefile +++ b/Makefile @@ -247,8 +247,8 @@ logging-add-dotenv-file: @ sed -i '/^LOGGING_TYPE/d' .env @ echo LOGGING_TYPE=PY,ELK >> .env -refresh-normaliser-mapping-files: - @ python -m ted_sws.metadata_normaliser.entrypoints.generate_mapping_resources +refresh-mapping-files: + @ python -m ted_sws.data_manager.entrypoints.generate_mapping_resources #clean-mongo-db: # @ export PYTHONPATH=$(PWD) && python ./tests/clean_mongo_db.py diff --git a/setup.py b/setup.py index d794cc078..1cb2613dc 100644 --- a/setup.py +++ b/setup.py @@ -76,7 +76,7 @@ def open_local(paths, mode="r", encoding="utf8"): entry_points={ "console_scripts": [ "transformer = ted_sws.notice_transformer.entrypoints.cmd_mapping_suite_transformer:main", - "normalisation_resource_generator = ted_sws.metadata_normaliser.entrypoints.generate_mapping_resources:main" + "normalisation_resource_generator = ted_sws.data_manager.entrypoints.generate_mapping_resources:main" ], }, include_package_data=True, diff --git a/ted_sws/metadata_normaliser/entrypoints/generate_mapping_resources.py b/ted_sws/data_manager/entrypoints/generate_mapping_resources.py similarity index 94% rename from ted_sws/metadata_normaliser/entrypoints/generate_mapping_resources.py rename to ted_sws/data_manager/entrypoints/generate_mapping_resources.py index e1803910b..e0064c3bf 100644 --- a/ted_sws/metadata_normaliser/entrypoints/generate_mapping_resources.py +++ b/ted_sws/data_manager/entrypoints/generate_mapping_resources.py @@ -4,7 +4,7 @@ import click from ted_sws.core.adapters.sparql_triple_store import SPARQLTripleStore, TripleStoreABC -from ted_sws.metadata_normaliser.resources import MAPPING_FILES_PATH, QUERIES_PATH +from ted_sws.resources import MAPPING_FILES_PATH, QUERIES_PATH logger = logging.getLogger(__name__) diff --git a/ted_sws/metadata_normaliser/services/metadata_normalizer.py b/ted_sws/metadata_normaliser/services/metadata_normalizer.py index 439ddff6f..6b168caa2 100644 --- a/ted_sws/metadata_normaliser/services/metadata_normalizer.py +++ b/ted_sws/metadata_normaliser/services/metadata_normalizer.py @@ -9,7 +9,7 @@ from ted_sws.core.service.metadata_constraints import filter_df_by_variables from ted_sws.data_manager.adapters.notice_repository import NoticeRepositoryABC from ted_sws.metadata_normaliser.model.metadata import ExtractedMetadata -from ted_sws.metadata_normaliser.resources.mapping_files_registry import MappingFilesRegistry +from ted_sws.resources.mapping_files_registry import MappingFilesRegistry from ted_sws.metadata_normaliser.services.xml_manifestation_metadata_extractor import XMLManifestationMetadataExtractor JOIN_SEP = " :: " diff --git a/ted_sws/metadata_normaliser/resources/__init__.py b/ted_sws/resources/__init__.py similarity index 93% rename from ted_sws/metadata_normaliser/resources/__init__.py rename to ted_sws/resources/__init__.py index 56ca22d70..dd6d0af06 100644 --- a/ted_sws/metadata_normaliser/resources/__init__.py +++ b/ted_sws/resources/__init__.py @@ -10,7 +10,7 @@ # Try backported to PY<37 `importlib_resources`. import importlib_resources as pkg_resources -import ted_sws.metadata_normaliser.resources.mapping_files +import ted_sws.resources.mapping_files def get_mapping_json_file(mapping_file_name: str) -> dict: diff --git a/ted_sws/metadata_normaliser/resources/mapping_files/__init__.py b/ted_sws/resources/mapping_files/__init__.py similarity index 100% rename from ted_sws/metadata_normaliser/resources/mapping_files/__init__.py rename to ted_sws/resources/mapping_files/__init__.py diff --git a/ted_sws/metadata_normaliser/resources/mapping_files/countries.json b/ted_sws/resources/mapping_files/countries.json similarity index 100% rename from ted_sws/metadata_normaliser/resources/mapping_files/countries.json rename to ted_sws/resources/mapping_files/countries.json diff --git a/ted_sws/metadata_normaliser/resources/mapping_files/eforms_mapping.csv b/ted_sws/resources/mapping_files/eforms_mapping.csv similarity index 100% rename from ted_sws/metadata_normaliser/resources/mapping_files/eforms_mapping.csv rename to ted_sws/resources/mapping_files/eforms_mapping.csv diff --git a/ted_sws/metadata_normaliser/resources/mapping_files/form_type.json b/ted_sws/resources/mapping_files/form_type.json similarity index 100% rename from ted_sws/metadata_normaliser/resources/mapping_files/form_type.json rename to ted_sws/resources/mapping_files/form_type.json diff --git a/ted_sws/metadata_normaliser/resources/mapping_files/languages.json b/ted_sws/resources/mapping_files/languages.json similarity index 100% rename from ted_sws/metadata_normaliser/resources/mapping_files/languages.json rename to ted_sws/resources/mapping_files/languages.json diff --git a/ted_sws/metadata_normaliser/resources/mapping_files/legal_basis.json b/ted_sws/resources/mapping_files/legal_basis.json similarity index 100% rename from ted_sws/metadata_normaliser/resources/mapping_files/legal_basis.json rename to ted_sws/resources/mapping_files/legal_basis.json diff --git a/ted_sws/metadata_normaliser/resources/mapping_files/notice_type.json b/ted_sws/resources/mapping_files/notice_type.json similarity index 100% rename from ted_sws/metadata_normaliser/resources/mapping_files/notice_type.json rename to ted_sws/resources/mapping_files/notice_type.json diff --git a/ted_sws/metadata_normaliser/resources/mapping_files/nuts.json b/ted_sws/resources/mapping_files/nuts.json similarity index 100% rename from ted_sws/metadata_normaliser/resources/mapping_files/nuts.json rename to ted_sws/resources/mapping_files/nuts.json diff --git a/ted_sws/metadata_normaliser/resources/mapping_files/sforms_mapping.csv b/ted_sws/resources/mapping_files/sforms_mapping.csv similarity index 100% rename from ted_sws/metadata_normaliser/resources/mapping_files/sforms_mapping.csv rename to ted_sws/resources/mapping_files/sforms_mapping.csv diff --git a/ted_sws/metadata_normaliser/resources/mapping_files_registry.py b/ted_sws/resources/mapping_files_registry.py similarity index 90% rename from ted_sws/metadata_normaliser/resources/mapping_files_registry.py rename to ted_sws/resources/mapping_files_registry.py index fb17014b1..af76f5aa3 100644 --- a/ted_sws/metadata_normaliser/resources/mapping_files_registry.py +++ b/ted_sws/resources/mapping_files_registry.py @@ -1,4 +1,4 @@ -from ted_sws.metadata_normaliser.resources import get_mapping_json_file, get_mapping_csv_file +from ted_sws.resources import get_mapping_json_file, get_mapping_csv_file class MappingFilesRegistry: diff --git a/ted_sws/metadata_normaliser/resources/queries/countries.rq b/ted_sws/resources/queries/countries.rq similarity index 100% rename from ted_sws/metadata_normaliser/resources/queries/countries.rq rename to ted_sws/resources/queries/countries.rq diff --git a/ted_sws/metadata_normaliser/resources/queries/form_type.rq b/ted_sws/resources/queries/form_type.rq similarity index 100% rename from ted_sws/metadata_normaliser/resources/queries/form_type.rq rename to ted_sws/resources/queries/form_type.rq diff --git a/ted_sws/metadata_normaliser/resources/queries/languages.rq b/ted_sws/resources/queries/languages.rq similarity index 100% rename from ted_sws/metadata_normaliser/resources/queries/languages.rq rename to ted_sws/resources/queries/languages.rq diff --git a/ted_sws/metadata_normaliser/resources/queries/legal_basis.rq b/ted_sws/resources/queries/legal_basis.rq similarity index 100% rename from ted_sws/metadata_normaliser/resources/queries/legal_basis.rq rename to ted_sws/resources/queries/legal_basis.rq diff --git a/ted_sws/metadata_normaliser/resources/queries/notice_type.rq b/ted_sws/resources/queries/notice_type.rq similarity index 100% rename from ted_sws/metadata_normaliser/resources/queries/notice_type.rq rename to ted_sws/resources/queries/notice_type.rq diff --git a/ted_sws/metadata_normaliser/resources/queries/nuts.rq b/ted_sws/resources/queries/nuts.rq similarity index 100% rename from ted_sws/metadata_normaliser/resources/queries/nuts.rq rename to ted_sws/resources/queries/nuts.rq diff --git a/tests/unit/metadata_normaliser/test_generate_mapping_resources.py b/tests/unit/metadata_normaliser/test_generate_mapping_resources.py index 1abb0d380..7c5545ff0 100644 --- a/tests/unit/metadata_normaliser/test_generate_mapping_resources.py +++ b/tests/unit/metadata_normaliser/test_generate_mapping_resources.py @@ -3,7 +3,7 @@ from click.testing import CliRunner -from ted_sws.metadata_normaliser.entrypoints.generate_mapping_resources import generate_mapping_files, main as cli_main +from ted_sws.data_manager.entrypoints.generate_mapping_resources import generate_mapping_files, main as cli_main from tests import TEST_DATA_PATH from tests.fakes.fake_triple_store import FakeTripleStore diff --git a/tests/unit/metadata_normaliser/test_mapping_files_registry.py b/tests/unit/metadata_normaliser/test_mapping_files_registry.py index bff2dc854..decbbc4da 100644 --- a/tests/unit/metadata_normaliser/test_mapping_files_registry.py +++ b/tests/unit/metadata_normaliser/test_mapping_files_registry.py @@ -1,6 +1,6 @@ import pandas as pd -from ted_sws.metadata_normaliser.resources.mapping_files_registry import MappingFilesRegistry +from ted_sws.resources.mapping_files_registry import MappingFilesRegistry def test_mapping_file_registry(): diff --git a/tests/unit/metadata_normaliser/test_metadata_normaliser.py b/tests/unit/metadata_normaliser/test_metadata_normaliser.py index 3aae94b49..1c5d4977e 100644 --- a/tests/unit/metadata_normaliser/test_metadata_normaliser.py +++ b/tests/unit/metadata_normaliser/test_metadata_normaliser.py @@ -2,7 +2,7 @@ from ted_sws.core.model.notice import NoticeStatus from ted_sws.core.service.metadata_constraints import filter_df_by_variables -from ted_sws.metadata_normaliser.resources.mapping_files_registry import MappingFilesRegistry +from ted_sws.resources.mapping_files_registry import MappingFilesRegistry from ted_sws.metadata_normaliser.services.metadata_normalizer import normalise_notice, normalise_notice_by_id, \ MetadataNormaliser, ExtractedMetadataNormaliser from ted_sws.metadata_normaliser.services.xml_manifestation_metadata_extractor import XMLManifestationMetadataExtractor