Skip to content

Author improvements#1245

Merged
fbacall merged 57 commits into
masterfrom
author-improvements
Mar 24, 2026
Merged

Author improvements#1245
fbacall merged 57 commits into
masterfrom
author-improvements

Conversation

@fbacall

@fbacall fbacall commented Mar 2, 2026

Copy link
Copy Markdown
Member

Summary of changes

  • Migrated authors and contributors for Material, Workflow and LearningPath from string arrays to a has_many relationship with a new generic Person model containing full_name, and orcid fields
  • Created a reusable HasPeople concern with a has_person_role macro for DRY code that can be applied to any model and role
  • Added database migrations to migrate existing author/contributor data.
  • Updated Bioschemas generator to include ORCID identifiers for authors/contributors.
  • Added custom setters for backwards compatibility with legacy API clients (accepts either Person objects or strings)
  • Added optional link between Person and TeSS Profile, with automatic linking based on matching ORCID.

Still to do

  • Migrate Workflow and LearningPath contributors and authors
  • Autocomplete for "people" form, looking up ORCIDs from profiles.
  • Prevent Person objects being needlessly destroyed/recreated when a scraper "updates" a resource.
  • Query ORCID API for accurate full_name (and first/last name?).

Motivation and context

The string arrays were limiting metadata quality and prevented linking to external author identifiers. Directly linking to authors/contributors to their ORCID/TeSS Profile opens up opportunities for better credit/recognition for people working in the training ecosystem. Additionally makes it easier to link other "roles" to resources in the future, e.g. instructors for events, maintainers for learning paths etc.

Screenshots

image image

Checklist

  • I have read and followed the CONTRIBUTING guide.
  • I confirm that I have the authority necessary to make this contribution on behalf of its copyright owner and agree
    to license it to the TeSS codebase under the
    BSD license.

Copilot AI and others added 28 commits February 11, 2026 16:10
Co-authored-by: fbacall <503373+fbacall@users.noreply.github.com>
Co-authored-by: fbacall <503373+fbacall@users.noreply.github.com>
Co-authored-by: fbacall <503373+fbacall@users.noreply.github.com>
Co-authored-by: fbacall <503373+fbacall@users.noreply.github.com>
Co-authored-by: fbacall <503373+fbacall@users.noreply.github.com>
Co-authored-by: fbacall <503373+fbacall@users.noreply.github.com>
…y_name

Co-authored-by: fbacall <503373+fbacall@users.noreply.github.com>
… compatibility

Co-authored-by: fbacall <503373+fbacall@users.noreply.github.com>
Co-authored-by: fbacall <503373+fbacall@users.noreply.github.com>
Remove the data migration for now, needs to be safer/better.

* This saves having to centrally manage People and provide ways of correcting metadata etc.
Too complex trying to manage both split names and full names.
@fbacall
fbacall marked this pull request as ready for review March 5, 2026 14:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 migrates authors and contributors from simple string arrays to a new Person model with name and orcid fields. It introduces a reusable HasPeople concern with a has_person_role macro, updates Bioschemas output to include ORCID identifiers, adds a custom display_people helper with profile/ORCID links, and implements PersonLinkWorker to automatically link Person records to TeSS profiles by ORCID.

Changes:

  • New Person model and HasPeople/HasOrcid concerns, plus database migrations migrating existing string data
  • Updated controllers, serializers, views, and Bioschemas generator to use the new structured Person model
  • Comprehensive new test coverage for the Person model, worker, and updated ingestor/controller tests

Reviewed changes

Copilot reviewed 61 out of 62 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
app/models/person.rb New Person model with ORCID support, autocomplete query, and profile auto-linking
app/models/concerns/has_people.rb New concern with has_person_role macro and flexible setter accepting strings/hashes/Person objects
app/models/concerns/has_orcid.rb New concern extracting ORCID normalization shared between Profile and Person
app/models/profile.rb Includes HasOrcid concern; triggers PersonLinkWorker after ORCID authentication
app/models/material.rb / workflow.rb / learning_path.rb Include HasPeople, use has_person_role for authors/contributors
app/workers/person_link_worker.rb Background worker that re-saves Person records by ORCID to update profile links
lib/bioschemas/generator.rb Adds @id/identifier (ORCID URL) to Person schema output
app/helpers/materials_helper.rb New display_people helper rendering profile/ORCID links
app/controllers/*_controller.rb Updated *_params to permit structured authors/contributors and people_attributes
app/serializers/*_serializer.rb Serializes authors/contributors as display name arrays via people helper
db/migrate/202602*.rb202603*.rb Migrations to create people table, migrate legacy data, rename columns
db/schema.rb Reflects new people table and renamed deprecated_* columns
test/models/person_test.rb New comprehensive tests for Person model
test/workers/person_link_worker_test.rb New tests for PersonLinkWorker
test/models/profile_test.rb Updated to assert PersonLinkWorker job is enqueued on ORCID change
test/controllers/materials_controller_test.rb / workflows_controller_test.rb / learning_paths_controller_test.rb New tests for structured/legacy author update endpoints
test/unit/ingestors/*_test.rb Updated assertions to use display_name/ORCID on Person objects
test/fixtures/people.yml New fixture file for Person records
app/views/common/_people_form.html.erb / _person_form.html.erb New people sub-form partials for the UI
app/assets/javascripts/people.js New JS for dynamic people form (autocomplete, add/remove)

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

You can also share your feedback on Copilot code review. Take the survey.

Comment thread app/models/profile.rb Outdated
Comment thread test/controllers/autocomplete_controller_test.rb Outdated
Comment thread test/models/person_test.rb Outdated
Comment thread db/migrate/20260220152727_migrate_material_people.rb
Comment thread test/models/person_test.rb Outdated
Comment thread app/models/person.rb Outdated
Comment thread app/models/concerns/has_people.rb Outdated
@Lucas-Souza-Sarmento

Copy link
Copy Markdown

Check.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 61 out of 62 changed files in this pull request and generated 7 comments.


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

You can also share your feedback on Copilot code review. Take the survey.

Comment thread app/views/common/_person_form.html.erb
Comment thread app/models/concerns/has_people.rb Outdated
Comment thread test/controllers/materials_controller_test.rb Outdated
Comment thread app/views/common/_person_form.html.erb
Comment thread app/models/person.rb
Comment thread app/helpers/materials_helper.rb
Comment thread app/models/person.rb
@fbacall
fbacall merged commit 56a6f79 into master Mar 24, 2026
11 checks passed
@fbacall
fbacall deleted the author-improvements branch March 24, 2026 12:38
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.

4 participants