⚙️  Backend Issue — Implement International Generic Sample Number (IGSN) Minting via SEPIA
🎯  Goal
Enable minting of International Generic Sample Numbers (IGSNs) directly through SEPIA for registered samples. This feature will allow users to generate and register globally unique IGSNs via SEPIA’s backend by integrating with DataCite or another IGSN registration service.
🧩  Implementation Details
1. New Endpoint
- 
Endpoint: 
POST /sample/{id}/mint_igsn - Purpose: Mint and register an IGSN for a specific sample.
 - Authentication: Requires a valid ICAT session and sufficient permissions.
 
Request Example:
{
  "sample_id": 123,
  "register": true
}
Response Example:
{
  "sample_id": 123,
  "igsn": "IGSN:HZB000123",
  "status": "registered",
  "registration_date": "2025-10-22T11:35:00Z"
}
2. Workflow
- Validate that the sample contains all mandatory metadata for IGSN registration (name, type, creator, dates, etc.).
 - Build a DataCite JSON payload following the IGSN metadata schema.
 - Register the record using the (DataCite API?, Kiel University? ...) with SEPIA’s configured credentials.
 - Store the returned IGSN and registration metadata in the SEPIA database (
sample.pidfield). - Return a structured response with registration details.
 
3. Implementation Notes
- 
Extend the OpenAPI spec and implement the endpoint using connexion.  - 
Follow existing authentication patterns using session_id. - 
Introduce an internal service module, e.g., igsn_service.py, to manage payload construction, validation, and DataCite interaction. - 
Handle edge cases (validation errors, registration timeouts, API failures).  - 
Optionally support register=falseto validate metadata without actual minting (test mode). 
🧪  Testing
- 
IGSNs are correctly minted and stored.  - 
Validation errors are surfaced clearly.  - 
Integration with DataCite works end-to-end.  - 
Registration logs and responses are traceable.  - 
Compatible with multiple sample types.  
🏷️  Labels
backend feature igsn datacite sample priority::high