From 771b499f8ff0b514e7ab4a280097a1c4a4cc6bc6 Mon Sep 17 00:00:00 2001 From: jtyoung84 <104453205+jtyoung84@users.noreply.github.com> Date: Sat, 7 Sep 2024 11:31:05 -0700 Subject: [PATCH 1/2] feat: upgrades aind-data-schema to v1.0 --- pyproject.toml | 4 ++-- src/aind_data_transfer_service/configs/job_configs.py | 7 +++---- .../configs/job_upload_template.py | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c342487..fb7df6c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,9 +18,9 @@ dynamic = ["version"] dependencies = [ 'boto3', - 'pydantic>=2.0', + 'pydantic>=2.0,<2.9', 'pydantic-settings>=2.0', - 'aind-data-transfer-models==0.6.2' + 'aind-data-transfer-models==0.7.0' ] [project.optional-dependencies] diff --git a/src/aind_data_transfer_service/configs/job_configs.py b/src/aind_data_transfer_service/configs/job_configs.py index a1f8ef1..e25e817 100644 --- a/src/aind_data_transfer_service/configs/job_configs.py +++ b/src/aind_data_transfer_service/configs/job_configs.py @@ -33,7 +33,7 @@ class ModalityConfigs(BaseSettings): # added to the Modality class _MODALITY_MAP: ClassVar = { m().abbreviation.upper().replace("-", "_"): m().abbreviation - for m in Modality._ALL + for m in Modality.ALL } # Optional number id to assign to modality config @@ -116,10 +116,9 @@ class BasicUploadJobConfigs(BaseSettings): extra="allow", ) - # Need some way to extract abbreviations. Maybe a public method can be - # added to the Platform class + # Legacy way required users to input platform in screaming snake case _PLATFORM_MAP: ClassVar = { - p().abbreviation.upper(): p().abbreviation for p in Platform._ALL + a.upper().replace("-", "_"): a for a in Platform.abbreviation_map.keys() } _MODALITY_ENTRY_PATTERN: ClassVar = re.compile(r"^modality(\d*)$") _DATETIME_PATTERN1: ClassVar = re.compile( diff --git a/src/aind_data_transfer_service/configs/job_upload_template.py b/src/aind_data_transfer_service/configs/job_upload_template.py index 057132d..557be9a 100644 --- a/src/aind_data_transfer_service/configs/job_upload_template.py +++ b/src/aind_data_transfer_service/configs/job_upload_template.py @@ -84,13 +84,13 @@ def validators(self) -> List[Dict[str, Any]]: { "name": "platform", "type": "list", - "options": [p().abbreviation for p in Platform._ALL], + "options": list(Platform.abbreviation_map.keys()), "column_indexes": [self.HEADERS.index("platform")], }, { "name": "modality", "type": "list", - "options": [m().abbreviation for m in Modality._ALL], + "options": list(Modality.abbreviation_map.keys()), "column_indexes": [ self.HEADERS.index("modality0"), self.HEADERS.index("modality1"), From b6cf2c99088f84f5828e25dae9415b26d83b1aef Mon Sep 17 00:00:00 2001 From: jtyoung84 <104453205+jtyoung84@users.noreply.github.com> Date: Sat, 7 Sep 2024 11:44:18 -0700 Subject: [PATCH 2/2] fix: runs linters --- src/aind_data_transfer_service/configs/job_configs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/aind_data_transfer_service/configs/job_configs.py b/src/aind_data_transfer_service/configs/job_configs.py index e25e817..9f8cf15 100644 --- a/src/aind_data_transfer_service/configs/job_configs.py +++ b/src/aind_data_transfer_service/configs/job_configs.py @@ -118,7 +118,8 @@ class BasicUploadJobConfigs(BaseSettings): # Legacy way required users to input platform in screaming snake case _PLATFORM_MAP: ClassVar = { - a.upper().replace("-", "_"): a for a in Platform.abbreviation_map.keys() + a.upper().replace("-", "_"): a + for a in Platform.abbreviation_map.keys() } _MODALITY_ENTRY_PATTERN: ClassVar = re.compile(r"^modality(\d*)$") _DATETIME_PATTERN1: ClassVar = re.compile(