🌐  Feature Request — Retrieve Sample User Info via ORCID (Fallback) to Pre-Fill “New Sample User” Form
🗣️  User Feedback
“Can you get person info through their ORCID? Currently, no — we can get info using an email address if the person already exists in ICAT. Maybe we could use ORCID for future cases where users aren’t in ICAT, to pre-fill the New Sample User form.”
🎯  Goal
Enhance the “New Sample User” form so that SEPIA can:
- First look up user information in ICAT using the provided email address.
 - If not found, query the ORCID public API to fetch and pre-fill relevant sample user details.
 
This reduces manual entry and improves data accuracy for users not yet in ICAT.
🧩  Implementation Details
Proposed Workflow
- 
User enters email address → Check ICAT for existing user. (Which is already done)
- If found → populate form fields from ICAT data.
 
 - 
If ICAT lookup fails, and an ORCID iD is provided:
- 
Query the ORCID public API:
GET https://pub.orcid.org/v3.0/{orcid}/person - 
Extract and pre-fill available fields.
 
 - 
 - 
User reviews and edits pre-filled data before submission.
 
🧱  Target Fields for Pre-Fill
SampleUser Model Fields
| Field | Source | Description | 
|---|---|---|
given_name | 
ORCID name.given-names.value
 | 
Given name | 
family_name | 
ORCID name.family-name.value
 | 
Family name | 
full_name | 
Derived (given_name + family_name) | 
Full name | 
email | 
ORCID emails.email (if public) | 
Email address | 
pid | 
ORCID iD (e.g., 0000-0002-1825-0097) | 
Persistent identifier | 
contributor_type | 
Manual/default (e.g., “Creator”) | Type of contributor | 
icat_user_id | 
From ICAT (if exists) | ICAT user ID | 
sample_id | 
Existing field | Link to parent sample | 
order_key | 
Generated/optional | Ordering or position key | 
created_at / updated_at
 | 
System-generated | Timestamps | 
Affiliation Model Fields
| Field | Source | Description | 
|---|---|---|
name | 
ORCID organization.name
 | 
Organization name | 
full_reference | 
Derived (organization + location) | Full formatted reference | 
pid | 
ORCID organization.identifier.value (if available) | 
Persistent identifier | 
If ORCID returns multiple affiliations, allow user to select one or choose the most recent.
🧩  Frontend Tasks
- 
Add ICAT lookup (email → ICAT API) for sample users.  - 
Add ORCID lookup as a fallback for users not in ICAT.  - 
Map ORCID response to SampleUser and Affiliation fields.  - 
Autofill form fields while keeping them editable.  - 
Add a “Fetch from ORCID” button (triggered after valid ORCID iD).  - 
Handle missing/private ORCID fields gracefully.  - 
Display clear status messages (“User found in ICAT”, “Data fetched from ORCID”, “No data found”).  
🧪  Testing
- 
Verify ICAT lookup priority and correct data population.  - 
Verify ORCID fallback works when ICAT user not found.  - 
Validate accurate mapping for given/family names and affiliations.  - 
Ensure manual edits persist after pre-fill.  - 
Confirm robust handling of multiple ORCID affiliations.  
🏷️  Labels
frontend feature enhancement integration orcid icat sample-user priority::medium
📘  References
- 
ICAT integration: existing email → user info lookup
 - 
Related models:
SampleUserAffiliation