From 3f3ca897f7aee5f2fdbd8247ea577c57e8cfb859 Mon Sep 17 00:00:00 2001 From: Kevin Powell Date: Tue, 26 Sep 2023 09:33:59 -0400 Subject: [PATCH 1/2] first round of edits --- CONTRIBUTING.md | 2 +- pyproject.toml | 1 + src/fetch_default_ref_data.py | 2 +- src/folio_migration_tools/__main__.py | 2 +- .../mapping_file_transformation/mapping_file_mapper_base.py | 2 +- .../mapping_file_transformation/order_mapper.py | 2 +- .../mapping_file_transformation/organization_mapper.py | 2 +- .../migration_tasks/migration_task_base.py | 2 +- 8 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1de70ae1..e0827564 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -107,7 +107,7 @@ positional arguments: optional arguments: -h, --help show this help message and exit --okapi_password OKAPI_PASSWORD - pasword for the tenant in the configuration file + password for the tenant in the configuration file --base_folder_path BASE_FOLDER_PATH path to the base folder for this library. Built on migration_repo_template ``` diff --git a/pyproject.toml b/pyproject.toml index 170ed215..9baac30e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,6 +44,7 @@ argparse-prompt = "^0.0.5" deepdiff = "^6.2.3" pyaml = "^21.10.1" httpx = "^0.23.3" +ipykernel = "^6.25.2" [tool.poetry.group.dev.dependencies] pytest = "^7.1.3" diff --git a/src/fetch_default_ref_data.py b/src/fetch_default_ref_data.py index 00f8b44a..63252113 100644 --- a/src/fetch_default_ref_data.py +++ b/src/fetch_default_ref_data.py @@ -87,7 +87,7 @@ def main(): def get_ref_data_from_github_folder(owner, repo, folder_path: str): ret_arr = [] try: - logging.info("Using GITHB_TOKEN environment variable for Gihub API Access") + logging.info("Using GITHUB_TOKEN environment variable for Github API Access") github_headers = { "content-type": "application/json", "User-Agent": "Folio Client (https://github.com/FOLIO-FSE/FolioClient)", diff --git a/src/folio_migration_tools/__main__.py b/src/folio_migration_tools/__main__.py index f9ab7fdb..e147e2b7 100644 --- a/src/folio_migration_tools/__main__.py +++ b/src/folio_migration_tools/__main__.py @@ -24,7 +24,7 @@ def parse_args(): ) parser.add_argument( "--okapi_password", - help="pasword for the tenant in the configuration file", + help="password for the tenant in the configuration file", secure=True, ) parser.add_argument( diff --git a/src/folio_migration_tools/mapping_file_transformation/mapping_file_mapper_base.py b/src/folio_migration_tools/mapping_file_transformation/mapping_file_mapper_base.py index 94e3aaef..26a0dbc7 100644 --- a/src/folio_migration_tools/mapping_file_transformation/mapping_file_mapper_base.py +++ b/src/folio_migration_tools/mapping_file_transformation/mapping_file_mapper_base.py @@ -778,7 +778,7 @@ def verify_legacy_record(self, legacy_object, idx): missing_keys_in_record, ) else: - logging.info("All maped legacy fields are in the legacy object") + logging.info("All mapped legacy fields are in the legacy object") def get_ref_data_tuple_by_code(self, ref_data, ref_name, code): return self.get_ref_data_tuple(ref_data, ref_name, code, "code") diff --git a/src/folio_migration_tools/mapping_file_transformation/order_mapper.py b/src/folio_migration_tools/mapping_file_transformation/order_mapper.py index 68cd1a0c..fdadf0de 100644 --- a/src/folio_migration_tools/mapping_file_transformation/order_mapper.py +++ b/src/folio_migration_tools/mapping_file_transformation/order_mapper.py @@ -141,7 +141,7 @@ def get_latest_acq_schemas_from_github(owner, repo, module, object): } if os.environ.get("GITHUB_TOKEN"): - logging.info("Using GITHB_TOKEN environment variable for Gihub API Access") + logging.info("Using GITHUB_TOKEN environment variable for Github API Access") github_headers["authorization"] = f"token {os.environ.get('GITHUB_TOKEN')}" # Start talkign to GitHub... diff --git a/src/folio_migration_tools/mapping_file_transformation/organization_mapper.py b/src/folio_migration_tools/mapping_file_transformation/organization_mapper.py index 4ebb757d..53df7713 100644 --- a/src/folio_migration_tools/mapping_file_transformation/organization_mapper.py +++ b/src/folio_migration_tools/mapping_file_transformation/organization_mapper.py @@ -32,7 +32,7 @@ def __init__( ): # Build composite organization schema if os.environ.get("GITHUB_TOKEN"): - logging.info("Using GITHB_TOKEN environment variable for Gihub API Access") + logging.info("Using GITHUB_TOKEN environment variable for Github API Access") organization_schema = OrganizationMapper.get_latest_acq_schemas_from_github( "folio-org", "mod-organizations-storage", "mod-orgs", "organization" ) diff --git a/src/folio_migration_tools/migration_tasks/migration_task_base.py b/src/folio_migration_tools/migration_tasks/migration_task_base.py index 676b9477..8ae6d7d5 100644 --- a/src/folio_migration_tools/migration_tasks/migration_task_base.py +++ b/src/folio_migration_tools/migration_tasks/migration_task_base.py @@ -297,7 +297,7 @@ def load_ref_data_mapping_file( ), ) logging.info( - "%s will be used for determinig %s", + "%s will be used for determining %s", ", ".join(ref_data_map[0].keys()), folio_property_name, ) From 3b7fd1f0a55b0f8436e01741d31ef983fa2a515d Mon Sep 17 00:00:00 2001 From: Kevin Powell Date: Thu, 28 Sep 2023 16:28:34 -0400 Subject: [PATCH 2/2] remove conditions --- .../organization_mapper.py | 48 +++++++------------ 1 file changed, 18 insertions(+), 30 deletions(-) diff --git a/src/folio_migration_tools/mapping_file_transformation/organization_mapper.py b/src/folio_migration_tools/mapping_file_transformation/organization_mapper.py index 75062558..b0a996c8 100644 --- a/src/folio_migration_tools/mapping_file_transformation/organization_mapper.py +++ b/src/folio_migration_tools/mapping_file_transformation/organization_mapper.py @@ -131,38 +131,26 @@ def set_up_reference_data_mapping( "categories", ) - if address_categories_map: - self.address_categories_map = RefDataMapping( - *categories_shared_args, address_categories_map, "value", "CategoriesMapping" - ) - else: - self.address_categories_map = None + self.address_categories_map = RefDataMapping( + *categories_shared_args, address_categories_map, "value", "CategoriesMapping" + ) - if email_categories_map: - self.email_categories_map = RefDataMapping( - *categories_shared_args, email_categories_map, "value", "CategoriesMapping" - ) - else: - self.email_categories_map = None + self.email_categories_map = RefDataMapping( + *categories_shared_args, email_categories_map, "value", "CategoriesMapping" + ) - if phone_categories_map: - self.phone_categories_map = RefDataMapping( - *categories_shared_args, phone_categories_map, "value", "CategoriesMapping" - ) - else: - self.phone_categories_map = None - - if organization_types_map: - self.organization_types_map = RefDataMapping( - self.folio_client, - "/organizations-storage/organization-types", - "organizationTypes", - organization_types_map, - "name", - "OrganizationTypeMapping", - ) - else: - self.organization_types_map = None + self.phone_categories_map = RefDataMapping( + *categories_shared_args, phone_categories_map, "value", "CategoriesMapping" + ) + + self.organization_types_map = RefDataMapping( + self.folio_client, + "/organizations-storage/organization-types", + "organizationTypes", + organization_types_map, + "name", + "OrganizationTypeMapping", + ) @staticmethod def get_latest_acq_schemas_from_github(owner, repo, module, object):