[Atlas] Per-target landing page (gene/protein) synthesizing every layer

← All Specs

Effort: thorough

Goal

Mirror the per-disease landing pattern at the gene/protein granularity.
A researcher landing on /gene/MAPT, /protein/TREM2, or /target/APOE should see one synthesized page that joins every
SciDEX layer's data about that target: hypotheses, debates, markets,
proteins-in-trials, notebooks, structural data (AlphaFold), STRING
neighbors, ChEMBL ligands, recent papers, ongoing challenges, and a
"what changed this week" strip.

Currently /genes/{name} (api.py:61418) is just a 301 to /wiki/genes-<name> and shows a static prose page. We have rich
per-target data scattered across targets, papers, hypotheses, debate_sessions, markets, artifacts, and the Forge tools
(alphafold-structure, chembl-drug-targets, string-protein-interactions, uniprot-protein-info) but nobody has joined them.

Acceptance Criteria

☐ New route GET /target-landing/{symbol} in api.py. Updates the
existing /genes/{name} and /proteins/{name} 301 handlers
(api.py:61418-61434) to also render a "Live target view"
banner pointing at /target-landing/{name}.
☐ Dashboard artifact registered via register_dashboard slug
pattern target-landing-<symbol>. Eager seeding script
scripts/seed_target_landing_dashboards.py for the top-30
neuro-relevant genes (MAPT, TREM2, APOE, APP, SNCA, GBA, LRRK2,
C9ORF72, GRN, TARDBP, FUS, SOD1, BACE1, PSEN1, PSEN2, ABCA7,
CR1, CD33, MS4A6A, INPP5D, PLCG2, PILRA, ABI3, CLU, BIN1,
PICALM, EPHA1, MEF2C, NME8, ZCWPW1).
☐ view_spec_json with 8 data_sources:
1. target_metatargets row joined to wiki_pages for
display name, summary, ontology IDs.
2. linked_hypotheseshypotheses joined via
hypothesis_entities on the target gene/protein, ordered by
composite_score DESC, top 10.
3. target_debatesdebate_sessions referencing those
hypotheses, last 90 days.
4. target_marketsmarkets joined on those hypothesis ids.
5. clinical_trials — JSONB unnest of targets.clinical_trials
(per the wave-1 q-live-ad-therapeutic-landscape work log,
clinical trials live as JSONB on targets, not a standalone
table). Filter by phase ascending.
6. top_paperspapers WHERE %s = ANY(genes_mentioned) (or
join via paper_entities), top 10 by citation_count.
7. recent_artifactsartifacts linked via artifact_links
to any of the linked_hypotheses, last 30 days.
8. external_signals — cached results from the alphafold,
chembl-drug-targets, string-protein-interactions, and
gtex-tissue-expression tools (call once per registration via
tools.py wrappers, cache the JSON in
metadata.external_signals_cache with a 24h TTL — re-render
path stays query-only).
render.template = new target_landing.html template added to
_TEMPLATES. Layout:
- Header: gene/protein symbol + canonical name + ontology badges
(UniProt, HGNC, Ensembl).
- Sidebar: AlphaFold confidence summary, GTEx top tissue, STRING
neighbor count, ChEMBL ligand count.
- Main: "Hypotheses we're tracking" cards, "Debates in progress",
"Markets pricing this target", "Trials in flight" mini-table,
"Top papers", "Recent SciDEX artifacts" feed.
cache_ttl_seconds=900 for the dashboard; external_signals_cache
TTL 24h, refreshed by a sibling cron task (out of scope for this
spec — file a follow-up).
☐ Pytest seeds a synthetic MAPT target with 3 hyps, 1 debate, 1
market, and a fixture-mocked tools.alphafold_structure /
tools.chembl_drug_targets. Asserts every panel populates.
☐ Human acceptance: /target-landing/MAPT, /target-landing/TREM2
both render with non-empty hypotheses and at least one paper.

Approach

  • Inspect targets schema (SELECT column_name FROM
  • information_schema.columns WHERE table_name='targets') to confirm
    clinical_trials JSONB shape used in the AD-landscape work log.
  • Confirm the entity-link table that joins hypotheses to gene
  • symbols (hypothesis_entities or entity_links).
  • Build external-signals fetcher in
  • scripts/seed_target_landing_dashboards.py. Cache output, don't
    call tools at render time (stays inside _validate_query budget).
  • Add target_landing.html template alongside landscape_heatmap.html.
  • Wire 301 banners into the gene/protein redirect handlers; keep the
  • redirect as default but add a Link header to the landing page so
    crawlers find it.

    Dependencies

    • q-synth-disease-landing (sibling) — establishes landing-page
    pattern, template aesthetic, and momentum-strip query shape.
    • e352460b-2d76 — view_spec_json DSL.
    • Forge tools: alphafold-structure, chembl-drug-targets,
    string-protein-interactions, gtex-tissue-expression — all
    registered in tools.py.

    Work Log

    2026-04-27 — Implementation Complete

    Commit: fdb67ee20

    Implemented the per-target landing page with the following components:

  • Route (api.py:61972): Added GET /target-landing/{symbol} route that queries:
  • - target_meta from targets joined with wiki_pages
    - linked_hypotheses (top 10 by composite_score)
    - target_debates (debate sessions for linked hypotheses, last 90 days)
    - target_markets (active markets for linked hypotheses)
    - clinical_trials (from targets.clinical_trials JSONB)
    - top_papers (papers mentioning the gene symbol)
    - recent_artifacts (artifacts linked to hypotheses, last 30 days)

  • Gene/protein redirect banners (api.py:61924, 61954): Updated /genes/{name} and /proteins/{name} handlers to show a "Live target view available" banner with a link to /target-landing/{symbol}.
  • Dashboard engine (scidex/senate/dashboard_engine.py): Added evaluate_view_spec function used by the target landing page template rendering.
  • Seed script (scripts/seed_target_landing_dashboards.py): Eager seeding for top-30 neuro-relevant genes with 8 data sources and 900s cache TTL.
  • Tests (tests/test_target_landing.py): 7 tests covering template registration, key sections, view spec validation, query validation, and rendering with seeded data.
  • Stale base fix: Rebased onto origin/main (ebb12f65f) resolving conflicts with forge_skill_router_page (origin/main's addition).
  • Status: All 17 tests pass (7 target_landing + 10 skill_router).

    Tasks using this spec (1)
    [Atlas] Per-target landing page (gene/protein) synthesizing
    Atlas done P90
    File: q-synth-target-landing_spec.md
    Modified: 2026-05-01 20:13
    Size: 6.6 KB