From 08b39e3a97331e77bcf0308a0c69350cc04fdf14 Mon Sep 17 00:00:00 2001 From: Tom Morrell Date: Tue, 28 May 2024 13:31:16 +0200 Subject: [PATCH] datastreams: add affiliations and update funders --- invenio_app_rdm/administration/domains/__init__.py | 1 + invenio_app_rdm/administration/records/__init__.py | 1 + invenio_app_rdm/administration/records/records.py | 1 + .../administration/user_moderation/user_moderation.py | 1 + invenio_app_rdm/administration/users/__init__.py | 1 + invenio_app_rdm/administration/users/users.py | 1 + invenio_app_rdm/administration/views/ui.py | 1 + invenio_app_rdm/cli.py | 1 + invenio_app_rdm/config.py | 10 +++++++--- invenio_app_rdm/ext.py | 1 + invenio_app_rdm/fixtures/pages.py | 1 + invenio_app_rdm/records_ui/views/deposits.py | 4 +--- invenio_app_rdm/upgrade_scripts/migrate_6_0_to_7_0.py | 1 - invenio_app_rdm/users/schemas.py | 1 - tests/test_tasks.py | 1 - 15 files changed, 18 insertions(+), 9 deletions(-) diff --git a/invenio_app_rdm/administration/domains/__init__.py b/invenio_app_rdm/administration/domains/__init__.py index 14557df40..64fe24017 100644 --- a/invenio_app_rdm/administration/domains/__init__.py +++ b/invenio_app_rdm/administration/domains/__init__.py @@ -6,6 +6,7 @@ # under the terms of the MIT License; see LICENSE file for more details. """Invenio administration module for user resources.""" + from .domains import ( DomainsCreateView, DomainsDetailView, diff --git a/invenio_app_rdm/administration/records/__init__.py b/invenio_app_rdm/administration/records/__init__.py index 8f6ca832a..08db609a5 100644 --- a/invenio_app_rdm/administration/records/__init__.py +++ b/invenio_app_rdm/administration/records/__init__.py @@ -6,6 +6,7 @@ # under the terms of the MIT License; see LICENSE file for more details. """Invenio app rdm records administration module.""" + from invenio_app_rdm.administration.records.records import ( DraftAdminListView, RecordAdminListView, diff --git a/invenio_app_rdm/administration/records/records.py b/invenio_app_rdm/administration/records/records.py index c11092d53..b605383f0 100644 --- a/invenio_app_rdm/administration/records/records.py +++ b/invenio_app_rdm/administration/records/records.py @@ -8,6 +8,7 @@ # details. """Invenio administration OAI-PMH view module.""" + from functools import partial from flask import current_app diff --git a/invenio_app_rdm/administration/user_moderation/user_moderation.py b/invenio_app_rdm/administration/user_moderation/user_moderation.py index c4fbdbc8f..5102f422c 100644 --- a/invenio_app_rdm/administration/user_moderation/user_moderation.py +++ b/invenio_app_rdm/administration/user_moderation/user_moderation.py @@ -5,6 +5,7 @@ # Invenio App RDM is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Invenio administration view module for user moderation.""" + from functools import partial from flask import current_app diff --git a/invenio_app_rdm/administration/users/__init__.py b/invenio_app_rdm/administration/users/__init__.py index a31a59be3..140952624 100644 --- a/invenio_app_rdm/administration/users/__init__.py +++ b/invenio_app_rdm/administration/users/__init__.py @@ -6,6 +6,7 @@ # under the terms of the MIT License; see LICENSE file for more details. """Invenio administration module for user resources.""" + from .users import UsersDetailView, UsersListView __all__ = ("UsersDetailView", "UsersListView") diff --git a/invenio_app_rdm/administration/users/users.py b/invenio_app_rdm/administration/users/users.py index 5d0824541..c22937cf7 100644 --- a/invenio_app_rdm/administration/users/users.py +++ b/invenio_app_rdm/administration/users/users.py @@ -6,6 +6,7 @@ # under the terms of the MIT License; see LICENSE file for more details. """Invenio administration users view module.""" + from functools import partial from flask import current_app diff --git a/invenio_app_rdm/administration/views/ui.py b/invenio_app_rdm/administration/views/ui.py index 4b8b287ed..8a6db1ffb 100644 --- a/invenio_app_rdm/administration/views/ui.py +++ b/invenio_app_rdm/administration/views/ui.py @@ -5,6 +5,7 @@ # Invenio App RDM is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """Administration ui views module.""" + from flask import Blueprint diff --git a/invenio_app_rdm/cli.py b/invenio_app_rdm/cli.py index 3ec88cb32..e72008a34 100644 --- a/invenio_app_rdm/cli.py +++ b/invenio_app_rdm/cli.py @@ -6,6 +6,7 @@ # it under the terms of the MIT License; see LICENSE file for more details. """Command-line tools for invenio app rdm.""" + import click from flask.cli import with_appcontext from invenio_access.permissions import system_identity diff --git a/invenio_app_rdm/config.py b/invenio_app_rdm/config.py index 0e8baac01..5cc109b17 100644 --- a/invenio_app_rdm/config.py +++ b/invenio_app_rdm/config.py @@ -96,6 +96,9 @@ VOCABULARIES_DATASTREAM_TRANSFORMERS, VOCABULARIES_DATASTREAM_WRITERS, ) +from invenio_vocabularies.contrib.affiliations.datastreams import ( + VOCABULARIES_DATASTREAM_WRITERS as AFFILIATIONS_WRITERS, +) from invenio_vocabularies.contrib.awards.datastreams import ( VOCABULARIES_DATASTREAM_READERS as AWARDS_READERS, ) @@ -108,8 +111,8 @@ from invenio_vocabularies.contrib.common.ror.datastreams import ( VOCABULARIES_DATASTREAM_READERS as COMMON_ROR_READERS, ) -from invenio_vocabularies.contrib.funders.datastreams import ( - VOCABULARIES_DATASTREAM_TRANSFORMERS as FUNDERS_TRANSFORMERS, +from invenio_vocabularies.contrib.common.ror.datastreams import ( + VOCABULARIES_DATASTREAM_TRANSFORMERS as COMMON_ROR_TRANSFORMERS, ) from invenio_vocabularies.contrib.funders.datastreams import ( VOCABULARIES_DATASTREAM_WRITERS as FUNDERS_WRITERS, @@ -697,7 +700,7 @@ def files_rest_permission_factory(obj, action): VOCABULARIES_DATASTREAM_TRANSFORMERS = { **VOCABULARIES_DATASTREAM_TRANSFORMERS, **NAMES_TRANSFORMERS, - **FUNDERS_TRANSFORMERS, + **COMMON_ROR_TRANSFORMERS, **AWARDS_TRANSFORMERS, } """Data Streams transformers.""" @@ -707,6 +710,7 @@ def files_rest_permission_factory(obj, action): **NAMES_WRITERS, **FUNDERS_WRITERS, **AWARDS_WRITERS, + **AFFILIATIONS_WRITERS, } """Data Streams writers.""" diff --git a/invenio_app_rdm/ext.py b/invenio_app_rdm/ext.py index 10944778a..977ac9adf 100644 --- a/invenio_app_rdm/ext.py +++ b/invenio_app_rdm/ext.py @@ -6,6 +6,7 @@ # under the terms of the MIT License; see LICENSE file for more details. """Invenio Research Data Management.""" + import warnings from datetime import timedelta diff --git a/invenio_app_rdm/fixtures/pages.py b/invenio_app_rdm/fixtures/pages.py index 689b29f7c..67cfba06b 100644 --- a/invenio_app_rdm/fixtures/pages.py +++ b/invenio_app_rdm/fixtures/pages.py @@ -6,6 +6,7 @@ # it under the terms of the MIT License; see LICENSE file for more details. """Static pages.""" + from pathlib import Path from flask import current_app diff --git a/invenio_app_rdm/records_ui/views/deposits.py b/invenio_app_rdm/records_ui/views/deposits.py index 73c663e13..048687a50 100644 --- a/invenio_app_rdm/records_ui/views/deposits.py +++ b/invenio_app_rdm/records_ui/views/deposits.py @@ -154,9 +154,7 @@ def _resource_types(self, extra_filter): { "icon": hit.get("icon", ""), "id": hit["id"], - "subtype_name": self._get_type_subtype_label(hit, type_labels)[ - 1 - ], # noqa + "subtype_name": self._get_type_subtype_label(hit, type_labels)[1], "type_name": self._get_type_subtype_label(hit, type_labels)[0], } for hit in subset_resource_types.to_dict()["hits"]["hits"] diff --git a/invenio_app_rdm/upgrade_scripts/migrate_6_0_to_7_0.py b/invenio_app_rdm/upgrade_scripts/migrate_6_0_to_7_0.py index 23a251b78..500fc44c3 100644 --- a/invenio_app_rdm/upgrade_scripts/migrate_6_0_to_7_0.py +++ b/invenio_app_rdm/upgrade_scripts/migrate_6_0_to_7_0.py @@ -13,7 +13,6 @@ is that nothing happens! """ - from click import secho from invenio_db import db from invenio_rdm_records.proxies import current_rdm_records_service diff --git a/invenio_app_rdm/users/schemas.py b/invenio_app_rdm/users/schemas.py index 82629f6cc..2ea35be07 100644 --- a/invenio_app_rdm/users/schemas.py +++ b/invenio_app_rdm/users/schemas.py @@ -7,7 +7,6 @@ """RDM User Schemas.""" - from invenio_users_resources.services.schemas import ( NotificationPreferences, UserPreferencesSchema, diff --git a/tests/test_tasks.py b/tests/test_tasks.py index af601b350..ea225bb5a 100644 --- a/tests/test_tasks.py +++ b/tests/test_tasks.py @@ -6,7 +6,6 @@ # under the terms of the MIT License; see LICENSE file for more details. """Test invenio-app-rdm celery tasks.""" - from invenio_app_rdm.tasks import file_integrity_report