Skip to content

【W2025-33b】Improvements to researchmap integration - #1177

Open
asuzuki1 wants to merge 3 commits into
ivis-weko3-dev:feature/W2025-33bfrom
asuzuki1:featute/W2025-33b
Open

【W2025-33b】Improvements to researchmap integration#1177
asuzuki1 wants to merge 3 commits into
ivis-weko3-dev:feature/W2025-33bfrom
asuzuki1:featute/W2025-33b

Conversation

@asuzuki1

Copy link
Copy Markdown

No description provided.

asuzuki1 added 2 commits July 9, 2026 16:52
- Implemented a feature to save the linkage between researchmap-retrieved achievement IDs and specific data fields.
- Added an option to choose whether to register a new entry if a previously linked achievement ID is not found on researchmap during an update.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves WEKO’s researchmap integration by adding a persistent “item ↔ researchmap achievement” linkage model, exposing a “create connection if missing” option end-to-end (UI → workflow → queue), and enhancing autofill/linkage behaviors around existing associations.

Changes:

  • Add LinkageItems model + migration to persist and manage researchmap linkage state per item/author (including deleted/registered status).
  • Extend researchmap linkage requests with should_create_if_not_found and add UI controls + workflow handling for it.
  • Update researchmap sync processing to update linkage statuses, re-sync, and optionally re-create linkages; expand tests accordingly.

Reviewed changes

Copilot reviewed 29 out of 35 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
modules/weko-workflow/weko_workflow/views.py Pass new linkage options to signal; surface linked IDs; attempt to persist linkage info on workflow completion.
modules/weko-workflow/tests/test_views.py Add test coverage for the updated workflow linkage behavior and adjust related display tests.
modules/weko-workflow/tests/conftest.py Ensure user_activity_logs partitions exist during tests (timezone-aware).
modules/weko-search-ui/weko_search_ui/utils.py Send should_create_if_not_found when importing items that request researchmap linkage.
modules/weko-search-ui/weko_search_ui/config.py Add export label .RESEARCHMAP_LINKAGE_CREATE_IF_MISSING.
modules/weko-search-ui/tests/conftest.py Ensure user_activity_logs partitions exist during tests (timezone-aware).
modules/weko-items-ui/weko_items_ui/utils.py Add new export field .researchmap_linkage_create_if_missing and keep its export value blank.
modules/weko-items-ui/weko_items_ui/translations/messages.pot Update POT metadata and add new UI strings for linkage/autofill.
modules/weko-items-ui/weko_items_ui/translations/ja/LC_MESSAGES/messages.po Update Japanese translations for new/shifted UI strings.
modules/weko-items-ui/weko_items_ui/translations/en/LC_MESSAGES/messages.po Update English translations for new/shifted UI strings.
modules/weko-items-ui/weko_items_ui/templates/weko_items_ui/iframe/item_edit.html Add “create connection if missing” UI checkbox and hidden fields used by autofill/linkage UI logic.
modules/weko-items-ui/weko_items_ui/templates/weko_items_ui/edit.html Add hidden label string for “achievement id link to item”.
modules/weko-items-ui/weko_items_ui/tasks.py Refactor researchmap queue processing to update linkage status and sync per-author with linkage tracking.
modules/weko-items-ui/weko_items_ui/static/js/weko_items_ui/item.autofill.js Add “achievement id link to item” control and linked-ID warning behavior in the autofill modal UI.
modules/weko-items-ui/weko_items_ui/static/js/weko_items_ui/app.js Send new linkage flags and autofill linkage payload in saved workflow metadata; show autofill warnings.
modules/weko-items-ui/weko_items_ui/signals.py Extend MQ payload to include should_create_if_not_found.
modules/weko-items-ui/weko_items_ui/models.py Add LinkageItems ORM model and helper query/create/update methods.
modules/weko-items-ui/weko_items_ui/api.py Initialize cris_linkage with a new linked field for UI use.
modules/weko-items-ui/weko_items_ui/alembic/61ac7d4b0c06_create_linkage_items_table.py Add migration to create linkage_items table.
modules/weko-items-ui/tests/test_tasks.py Expand task tests for linkage status updates, sync behavior, and build_one_data linkage insertion.
modules/weko-items-ui/tests/test_models.py Add model-level tests for LinkageItems CRUD/query helpers.
modules/weko-items-ui/tests/conftest.py Ensure user_activity_logs partitions exist during tests; add fixture creating linkage items.
modules/weko-items-autofill/weko_items_autofill/views.py Add linkage validation warnings when enabling item↔achievement linking during researchmap autofill.
modules/weko-items-autofill/weko_items_autofill/translations/messages.pot Add new autofill warning strings (and update POT metadata).
modules/weko-items-autofill/weko_items_autofill/translations/ja/LC_MESSAGES/messages.po Add Japanese translations for new autofill warnings.
modules/weko-items-autofill/weko_items_autofill/translations/en/LC_MESSAGES/messages.po Add English translations for new autofill warnings.
modules/weko-items-autofill/tests/test_views.py Expand autofill API tests to cover new warning behavior and extra providers.
modules/weko-authors/weko_authors/utils.py Add get_name_identifiers() utility for extracting identifiers from nested author metadata.
modules/weko-authors/tests/test_utils.py Add unit test for get_name_identifiers().
Comments suppressed due to low confidence (5)

modules/weko-items-ui/weko_items_ui/tasks.py:173

  • get_record_without_version() is called with item_id (UUID) in sync_item_to_researchmap(), but it expects a PersistentIdentifier. This will raise at runtime; resolve the PID from the UUID first.
    pid_without_ver = get_record_without_version(item_id)

modules/weko-items-ui/weko_items_ui/static/js/weko_items_ui/item.autofill.js:95

  • In JSX, label should use htmlFor instead of for to correctly associate with the input and avoid React warnings.
                                    <label className="control-label" for="achievement_type">
                                        {this.props.achievement_type}
                                    </label>

modules/weko-items-ui/weko_items_ui/static/js/weko_items_ui/item.autofill.js:114

  • In JSX, label should use htmlFor instead of for to correctly associate with the input and avoid React warnings.
                                    <label className="control-label" for="achievement_id">
                                        {this.props.achievement_id}
                                    </label>

modules/weko-items-ui/weko_items_ui/static/js/weko_items_ui/item.autofill.js:124

  • In JSX, label should use htmlFor instead of for to correctly associate with the input and avoid React warnings.
                                    <label className="control-label" for="enable_item_achievement_link">
                                        {this.props.enable_item_achievement_link}
                                    </label>

modules/weko-items-ui/weko_items_ui/static/js/weko_items_ui/item.autofill.js:161

  • In JSX, label should use htmlFor instead of for; the current code uses for and will trigger React warnings.
                        <label className="input-group-text" for="autofill_id_type">
                            {this.props.selectMeta}
                        </label>

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

const parmalink = $("#parmalink").val();
const achievement_type = $("#achievement_type").val();
const achievement_id = $("#achievement_id").val();
const enable_item_achievement_link = $("#enable_item_achievement_link").val();
$scope.clearAllField();
$scope.setRecordDataCallBack(data);
$scope.resourceTypeSelect(data.resource_type);
$scope.set_autofill_warning_msg(data.type_data);
type: param.api_type,
enable_item_achievement_link: param.enable_item_achievement_link
};
$("#autofill_status").text(JSON.stringify(json_data));
'researchmap' : $('#researchmap_chk').prop("checked"),
'should_create_if_not_found' : $('#researchmap_new_chk').prop("checked")
},
'autofill_performance_id': $("#autofill_status").val()
Comment on lines +2016 to +2026
autofill_performance_id = json.loads(temp_data).get('autofill_performance_id' , None)
if autofill_performance_id:
is_linkage = True
ids = []
get_name_identifiers(json.loads(temp_data).get('metainfo',{}), "researchmap", ids)
if not ids or autofill_performance_id.get("permalink") not in ids:
# Not existing this permalink in this item
is_linkage = False

pid_without_ver = get_record_without_version(current_pid)
if is_linkage:
Comment on lines +81 to 83
<label className="control-label" for="parmalink">
{this.props.autofill_parmalink}
</label>
linkage_items = LinkageItems.get_by_external_item_id(achievement_id, LinkageItems.ExternalSystem.RM)
if linkage_items:
type_data.append(dict(ok=False, msg=_('This researchmap ID is already linked to other items.')))
type_data.append(dict(ok=False, msg=_('The used achievement ID must specify the permlink as a linkage destination in the metadata.')))
Comment on lines +55 to +57
msgid ""
"The used achievement ID must specify the permlink as a linkage "
"destination in the metadata."
Comment on lines +56 to +58
msgid ""
"The used achievement ID must specify the permlink as a linkage "
"destination in the metadata."
Comment on lines +56 to +59
msgid ""
"The used achievement ID must specify the permlink as a linkage "
"destination in the metadata."
msgstr "使用した業績IDの紐づけには、連携先としてpermlinkをメタデータ内で指定する必要があります"
- Corrected spelling of "permlink" to "permalink" in error messages.
- Renamed `failed_log` column to `message` in `cris_linkage_result` table and updated related code.
- Refactored `sync_item_to_researchmap` to improve error handling and linkage creation logic.
- Enhanced tests for linkage and task functionalities to cover new logic and edge cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants