Skip to content

⚙️ Backend Issue — Public Sample Landing Page Endpoint (by IGSN)

🎯 Goal

Provide a public, read-only endpoint that serves all relevant metadata for a sample identified by its IGSN (pid), without requiring authentication (session_id). This endpoint will power the Sample Landing Page in SEPIA and serve as the target URL for IGSN registrations (e.g., linked from DataCite records).


🧩 Implementation Details

1. New Endpoint

  • Endpoint:

    GET /sample/{igsn}/public
  • Purpose: Retrieve a full metadata representation of a sample using its IGSN (PID). Accessible without authentication to allow public visibility for registered samples.

  • Access Control:

    • No session_id required.
    • Only samples with a valid, registered IGSN should be resolvable.
    • Return 404 if no sample matches the given IGSN.

Example Request:

GET /sample/IGSN:HZB000123/public

Example Response:

{
  "igsn": "IGSN:HZB000123",
  "name": "Catalyst Sample X",
  "description": "High-surface catalyst tested under beamline A.",
  "sample_type": {
    "name": "Catalyst",
    "description": "Solid catalyst type"
  },
  "creator": {
    "full_name": "Dr. Alice Example",
    "affiliation": "HZB"
  },
  "keywords": ["Catalyst", "Surface Analysis"],
  "dates": [
    {"type": "Created", "value": "2024-05-03"},
    {"type": "Analyzed", "value": "2024-06-15"}
  ],
  "related_items": [
    {"type": "Publication", "title": "Surface Chemistry Study", "url": "https://doi.org/..."}
  ],
  "created_at": "2024-05-03T10:30:00Z",
  "updated_at": "2024-09-14T12:40:00Z"
}

2. Implementation Notes

  • Extend OpenAPI spec to define this new public route.

  • Implement using connexion with operationId: "sample.read_public_by_igsn".

  • Query Sample by pid (IGSN) instead of id.

  • Include related objects:

    • sample_type
    • sample_users (with limited info: full_name, affiliation)
    • keywords, dates, and related_items
  • Use a dedicated serializer schema (e.g. SamplePublicSchema) that omits internal or sensitive fields.

  • Optionally apply response caching (e.g., TTLCache from cachetools with 10 min live) to reduce database load for public views.

  • Return minimal error payloads (404, 500) to avoid leaking backend details.


3. Integration with IGSN Minting

  • When an IGSN is minted (via /sample/{id}/mint_igsn), SEPIA should store the landing page URL:

    https://sepia.helmholtz-berlin.de/sample/{igsn}/public
  • This URL will be sent to DataCite as the landing page in the registration metadata.


🧪 Testing

  • Works with valid IGSN, returns full metadata.
  • Returns 404 for unknown or unregistered IGSN.
  • No session_id required.
  • Includes correct related data (sample type, users, keywords, dates).
  • Data structure matches frontend requirements.
  • Performance acceptable for public queries.

🏷️ Labels

backend feature igsn sample landing-page public-endpoint priority::high