[Artifacts] Add Mol* 3D protein viewer to hypothesis pages done coding:8

← Artifacts
Embed interactive 3D protein structure viewers using Mol* (molstar.org) on hypothesis pages. Load PDB structures for target proteins mentioned in hypotheses. Add viewer to hypothesis detail page template. Support PDB ID input and automatic structure loading. See docs/planning/specs/d16_4_molstar_protein_viewer_spec.md IMPORTANT: Keep Mol* protein viewer on entity/hypothesis/challenge detail pages where it adds value. Do NOT feature it prominently on /showcase. Showcase should highlight: debate transcripts, hypothesis cards with scores, evidence tables, KG visualizations, and notebooks — the core discovery exchange features. ## REOPENED TASK — CRITICAL CONTEXT This task was previously marked 'done' but the audit could not verify the work actually landed on main. The original work may have been: - Lost to an orphan branch / failed push - Only a spec-file edit (no code changes) - Already addressed by other agents in the meantime - Made obsolete by subsequent work **Before doing anything else:** 1. **Re-evaluate the task in light of CURRENT main state.** Read the spec and the relevant files on origin/main NOW. The original task may have been written against a state of the code that no longer exists. 2. **Verify the task still advances SciDEX's aims.** If the system has evolved past the need for this work (different architecture, different priorities), close the task with reason "obsolete: " instead of doing it. 3. **Check if it's already done.** Run `git log --grep=''` and read the related commits. If real work landed, complete the task with `--no-sha-check --summary 'Already done in '`. 4. **Make sure your changes don't regress recent functionality.** Many agents have been working on this codebase. Before committing, run `git log --since='24 hours ago' -- ` to see what changed in your area, and verify you don't undo any of it. 5. **Stay scoped.** Only do what this specific task asks for. Do not refactor, do not "fix" unrelated issues, do not add features that weren't requested. Scope creep at this point is regression risk. If you cannot do this task safely (because it would regress, conflict with current direction, or the requirements no longer apply), escalate via `orchestra escalate` with a clear explanation instead of committing.

Git Commits (2)

[Docs] Add spec for eb11ca2a: Mol* viewer already on main via 05a277d62026-04-13
[Artifacts] Add Mol* 3D viewer spec: task already on main [task:05a277d6-f4cc-4439-ae7a-71806332e313]2026-04-13
Spec File

[Artifacts] Add Mol* 3D protein viewer to hypothesis pages

ID: d16_4 Task ID: 05a277d6-f4cc-4439-ae7a-71806332e313 Priority: 90 Type: one_shot Status: done

Goal

Embed interactive 3D protein structure viewers using Mol (molstar.org) on hypothesis pages. Load PDB structures for target proteins mentioned in hypotheses. Support PDB ID input and automatic structure loading. Keep Mol viewer on entity/hypothesis/challenge detail pages but NOT on /showcase.

Acceptance Criteria

☑ Mol* 3D viewer embedded in hypothesis_detail() page
☑ Mol* 3D viewer embedded in entity_detail() page
☑ Mol* 3D viewer embedded in challenge_detail() page
☑ Mol* viewer NOT shown on /showcase page
☑ PDB structures loaded for target proteins with known PDB IDs
☑ AlphaFold predicted structures used when experimental PDB not available
☑ Lazy-loading (collapsible) to avoid impacting page performance
☑ Spec file created

Implementation

Files Modified

  • api.py — Added Mol* viewer HTML/JS to hypothesis_detail(), entity_detail(), and challenge_detail()

Key Implementation Details

  • Lazy-loaded collapsible viewers — Mol* CSS/JS loaded only when PDB structures available
  • PDBe Mol* plugin — Uses https://www.ebi.ac.uk/pdbe/pdb-component-library/js/pdbe-molstar-plugin-3.1.0.js
  • PDB ID mapping — Curated mapping of neurodegeneration targets to PDB IDs
  • AlphaFold fallback — When no experimental structure exists, uses AlphaFold predicted model via UniProt ID
  • Auto-detection — Targets matched by gene name aliases (TDP-43->TARDBP, APOE4->APOE, Tau->MAPT, etc.)
  • Commits on Main

    • afebddfec — [Demo] Add Mol* 3D protein viewers to walkthrough pages [task:8aba1c2f-6223-4836-bbd8-e0c02e958a44]
    • 7fb8ef909 — [Artifacts] Enrich targets with PDB/UniProt IDs + fix challenge Mol* auto-linking [task:e27b4301-b99b-41ae-ad45-d29b603468c0]
    • db23ef9cf — [Artifacts] Add 8 PDB + 3 UniProt protein mappings for Mol* viewers [task:d271b465-bf6]
    • 91ec0016e — [Quality] Remove Mol* protein viewer section from /showcase page [task:b278d4d3-7b17-4069-b2a1-320a0247e3f4]

    Work Log

    2026-04-13 21:10 PT — Slot minimax:57

    • Status: Verified complete on main — implementation already exists in api.py
    • Verification: hypothesis_detail() has Mol* viewer (lines 27093-27350)
    • Verification: entity_detail() has Mol* viewer (verified via curl)
    • Verification: challenge_detail() has Mol* viewer (lines ~55718+)
    • Verification: /showcase has NO Mol* viewer (correct per requirement)
    • Result: Task 05a277d6-f4cc-4439-ae7a-71806332e313 complete — Mol* viewer already on main via commits afebddfec, 7fb8ef909, db23ef9cf, 91ec0016e

    Already Resolved — 2026-04-23 09:20:00Z

    Evidence: 122 molstar/pdbe-molstar references in api.py confirmed via grep. Commits afebddfec, 7fb8ef909, db23ef9cf, 91ec0016e all present on main.

    Root cause of 5 abandons: Workers correctly found the task already done but exited with code 0 without calling orchestra complete. No code changes were needed.

    Fix: Watchdog task b857b2e2 marked original task c684ec5f done via orchestra update --status done.

    Payload JSON
    {
      "requirements": {
        "coding": 8
      },
      "_stall_skip_providers": [
        "minimax"
      ],
      "_stall_requeued_by": "minimax",
      "_stall_requeued_at": "2026-04-14 12:34:05",
      "_stall_skip_at": {},
      "_stall_skip_pruned_at": "2026-04-14T10:37:14.022390+00:00",
      "_watchdog_repair_task_id": "ebb63f5c-d508-4ab1-97b5-14f543b79807",
      "_watchdog_repair_created_at": "2026-04-23T06:56:54.562358+00:00",
      "_reset_note": "This task was reset after a database incident on 2026-04-17.\n\n**Context:** SciDEX migrated from SQLite to PostgreSQL after recurring DB\ncorruption. Some work done during Apr 16-17 may have been lost.\n\n**Before starting work:**\n1. Check if the task's goal is ALREADY satisfied (run the relevant checks)\n2. Check `git log --all --grep=task:YOUR_TASK_ID` for prior commits\n3. If complete, verify and mark done. If partial, continue. If not done, proceed.\n\n**DB change:** SciDEX now uses PostgreSQL. `get_db()` auto-detects via\nSCIDEX_DB_BACKEND=postgres env var.",
      "_reset_at": "2026-04-18T06:29:22.046013+00:00",
      "_reset_from_status": "done"
    }

    Sibling Tasks in Quest (Artifacts) ↗

    Task Dependencies

    ↓ Referenced by (downstream)