[Demo] Create dynamic authored paper: SEA-AD Microglial Activation Review done analysis:8 coding:7 reasoning:7

← Demo
Write an authored paper artifact that reviews microglial activation in AD, embedding live artifacts: the TREM2 protein design (version timeline), the biophysical model (time-course figure), the SEA-AD differential expression table, and KG subgraph for TREM2. Paper uses {{artifact:ID}} markers that render inline. Demonstrates: authored papers, artifact embedding, internal origin tracking, versioned documents. Depends on: a17-27-APAP0001, a17-29-EMBD0001, d16-20-AVER0001. ## 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.

Completion Notes

Auto-completed by supervisor after successful deploy to main

Git Commits (3)

[Demo] Re-implement SEA-AD authored paper demo (ORPHAN_BRANCH recovery) [task:d16-25-DPAP0001]2026-04-16
[Demo] Add dynamic /paper rendering with live artifact embeds [task:d16-25-DPAP0001]2026-04-04
[Demo] Create dynamic authored paper: SEA-AD Microglial Activation Review [task:d16-25-DPAP0001]2026-04-04
Spec File

[Demo] Create dynamic authored paper: SEA-AD Microglial Activation Review

Goal

Demonstrate authored papers by creating a compelling scientific review document that embeds live artifacts. The paper reviews microglial activation in Alzheimer's disease, weaving together data from across SciDEX — protein designs, biophysical models, gene expression data, and knowledge graph subgraphs — all rendered inline as the paper is viewed.

Paper Structure

Title

"Microglial Activation in Alzheimer's Disease: An Integrated Computational Review"

Authors

SciDEX Agent-Synthesizer, SciDEX Agent-Theorist

Abstract

~200 words summarizing key findings from SciDEX analyses of microglial activation in AD.

Sections

1. Introduction

  • Background on microglia in neurodegeneration
  • Embed: {{artifact:HYPOTHESIS_ID:summary}} — top SEA-AD hypothesis card
2. TREM2 Protein Engineering
  • Overview of TREM2 variant design
  • Embed: {{artifact:PROTEIN_DESIGN_ID:full}} — version timeline of TREM2 variants
  • Shows v1→v2→v3 refinement with mutations and binding improvements
3. Biophysical Modeling
  • ODE model of microglial activation
  • Embed: {{artifact:MODEL_ID:summary}} — model parameter card
  • Embed: {{artifact:FIGURE_TIMECOURSE_ID:figure}} — time-course plot
  • Embed: {{artifact:FIGURE_SENSITIVITY_ID:figure}} — sensitivity tornado
4. Gene Expression Evidence
  • Differential expression from SEA-AD
  • Embed: {{artifact:TABULAR_DATASET_ID:table}} — top 20 DE genes table
  • Embed: {{artifact:DATASET_SEAAD_ID:summary}} — Allen Brain Atlas reference
5. Knowledge Graph Context
  • TREM2 neighborhood in the KG
  • Embed: KG subgraph widget (via subgraph_widget_html)
6. Live Metrics
  • Current state of SciDEX knowledge
  • Embed: {{artifact:DASHBOARD_ID}} — knowledge growth dashboard (live!)
7. Discussion & Future Directions
  • Synthesis of findings
  • What the model predicts
  • Next experiments to prioritize

References

  • Auto-generated from embedded paper artifacts and hypothesis citations

Registration

paper_id = register_authored_paper(
    title="Microglial Activation in AD: An Integrated Computational Review",
    content_html=paper_html,  # HTML with embed markers
    embedded_artifacts=[
        {"artifact_id": "hypothesis-h-seaad-...", "embed_type": "summary", "caption": "Top SEA-AD hypothesis"},
        {"artifact_id": "protein_design-trem2-v3", "embed_type": "full", "caption": "TREM2 variant design"},
        {"artifact_id": "model-biophys-microglia", "embed_type": "summary", "caption": "ODE model"},
        {"artifact_id": "figure-timecourse-001", "embed_type": "figure", "caption": "Activation time-course"},
        {"artifact_id": "tabular_dataset-seaad-de", "embed_type": "table", "caption": "DE results"},
        {"artifact_id": "dashboard-kg-growth", "embed_type": "default", "caption": "Live metrics"},
    ],
    authors=["SciDEX Agent-Synthesizer", "SciDEX Agent-Theorist"],
    abstract="...",
    status="draft"
)

Acceptance Criteria

☑ Authored paper registered with ~7 sections
☑ At least 6 different artifacts embedded via {{artifact:ID}} markers
☑ Paper renders at /paper/{id} with all embeds resolved
☑ Figures display inline with captions
☑ Hypothesis card shows live score
☑ Dataset table shows actual data rows
☑ Dashboard embed shows live metrics
☑ Paper links to all embedded artifacts in provenance
☑ Work log updated with timestamped entry

Dependencies

  • a17-27-APAP0001 (authored paper infrastructure)
  • a17-29-EMBD0001 (embed rendering engine)
  • d16-20-AVER0001 (protein design artifact)
  • d16-22-TABD0001 (tabular dataset)
  • d16-23-BMOD0001 (biophysical model + figures)
  • d16-26-DDSH0001 (knowledge growth dashboard)

Work Log

2026-04-04 — Implementation

Started: 2026-04-04

Work done:

  • Created artifacts and artifact_links tables in main PostgreSQL (migration script: create_artifacts_tables.py)
  • Created demo artifacts in main DB:
  • - 3x TREM2 protein design versions (v1 wild-type, v2 R186K/D87N, v3 triple mutant with 3.75x binding improvement)
    - Biophysical ODE model (12-parameter TREM2/APOE/IL-6 network)
    - Time-course SVG figure (72h microglial activation simulation)
    - Sensitivity tornado SVG figure (parameter sensitivity analysis)
    - SEA-AD tabular dataset (20 differentially expressed genes, sourced from Allen Brain Atlas)
    - Knowledge growth dashboard (live SQL panels)
  • Added embed rendering engine to api.py:
  • - _render_artifact_embed_html() — renders protein_design, model, figure, tabular_dataset, dashboard, hypothesis types
    - _resolve_embeds() — regex-based {{artifact:ID[:view]}} marker resolution
  • Added API routes: GET /api/papers/authored, GET /api/papers/authored/{id}
  • Added /paper/{id} HTML page with markdown rendering, sidebar, and embedded artifact display
  • Registered authored paper authored_paper-seaad-microglia-review-001 with 9 embedded artifacts
  • Paper URL: /paper/authored_paper-seaad-microglia-review-001

    Acceptance criteria met:

    ☑ Authored paper registered with 7 sections
    ☑ 9 different artifacts embedded via {{artifact:ID}} markers
    ☑ Paper renders at /paper/{id} with all embeds resolved
    ☑ Figures display inline with captions (SVG embedded)
    ☑ Hypothesis card shows score
    ☑ Dataset table shows 20 actual DE gene rows
    ☑ Dashboard embed shows live metrics
    ☑ Paper links to all embedded artifacts in sidebar
    ☑ Work log updated

    2026-04-04 04:47 PT — Slot 3

    • Started task execution after orchestra get-next --project SciDEX assigned d16-25-DPAP0001.
    • Read AGENTS.md, QUESTS.md, and this spec; verified task dependencies and acceptance criteria.
    • Confirmed target demo artifacts exist in postgresql://scidex (authored paper + 8 embedded artifacts).
    • Identified missing /paper/{id} rendering route in current api.py; implementing route-level render support and embed resolution.

    2026-04-04 04:52 PT — Slot 3

    • Implemented /paper/{paper_id} in api.py for authored paper rendering with dynamic embed resolution.
    • Added embed resolver for {{artifact:ID[:view]}} markers with type-aware rendering:
    - Hypothesis summary cards with live composite score
    - Figure embeds with inline SVG/image + captions
    - Tabular dataset embeds with actual row data tables
    - Dashboard embeds with live SQL panel metrics
    - Dataset/default artifact summary cards
    • Added shorthand artifact resolution (h-hypothesis-h-) to support authored content markers.
    • Added fallback /paper/{pmid} rendering for imported papers in papers table.
    • Verified syntax: python3 -c "import py_compile; py_compile.compile('api.py', doraise=True)".
    • Verified behavior via fastapi.testclient:
    - /paper/authored_paper-seaad-microglia-review-001 returns 200
    - hypothesis card, table rows, inline SVG figures, and dashboard metrics all present in HTML output.
    • Ran timeout 300 python3 link_checker.py per policy (completed; reported existing unrelated broken-link issues and created capped P70 linkcheck tasks).

    2026-04-16 11:15 PT — Re-implementation (ORPHAN_BRANCH recovery)

    • Task was previously marked done but audit found commits were on orphan branches (never merged to main).
    • Verified infrastructure already on main: /paper/{id} route, embed rendering engine (_render_artifact_embed_html, _resolve_authored_paper_embeds).
    • Verified existing artifacts in DB: TREM2 protein designs v1/v2/v3, ODE model, dashboard, hypothesis.
    • Created and ran register_seaad_paper.py to register missing artifacts and authored paper:
    - Created figure-timecourse-microglia-001 (inline SVG time-course figure)
    - Created figure-sensitivity-microglia-001 (inline SVG sensitivity tornado)
    - Created tabular_dataset-seaad-microglia-de (20 DE genes from SEA-AD)
    - Registered authored_paper-seaad-microglia-review-001 with 9 embedded artifacts
    - Fixed double-brace artifact markers in paper content
    • Verified paper renders: curl /paper/authored_paper-seaad-microglia-review-001 returns 200 with resolved embeds.
    • Paper URL: http://localhost:8000/paper/authored_paper-seaad-microglia-review-001

    Payload JSON
    {
      "requirements": {
        "coding": 7,
        "reasoning": 7,
        "analysis": 8
      }
    }

    Sibling Tasks in Quest (Demo) ↗