Author improvements#1245
Conversation
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.
There was a problem hiding this comment.
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
Personmodel andHasPeople/HasOrcidconcerns, plus database migrations migrating existing string data - Updated controllers, serializers, views, and Bioschemas generator to use the new structured
Personmodel - Comprehensive new test coverage for the
Personmodel, 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*.rb – 202603*.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.
Fixes matching on blank ORCID etc.
(even though the migration up/down is fine without)
… author-improvements
|
Check. |
There was a problem hiding this comment.
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.
…hors/contributors can be removed
Summary of changes
authorsandcontributorsforMaterial,WorkflowandLearningPathfrom string arrays to ahas_manyrelationship with a new genericPersonmodel containingfull_name, andorcidfieldsHasPeopleconcern with ahas_person_rolemacro for DRY code that can be applied to any model and rolePersonobjects or strings)Still to do
WorkflowandLearningPathcontributorsandauthorsPersonobjects being needlessly destroyed/recreated when a scraper "updates" a resource.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
Checklist
to license it to the TeSS codebase under the
BSD license.