Files
ai-taxonomy-literature-anal…/pages/landscape.tsx
T

160 lines
7.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { GetServerSideProps } from 'next';
import Link from 'next/link';
import Layout from '../components/Layout';
import TaxonomyTree from '../components/TaxonomyTree';
import { getConferences, getNodeConfBreakdown, getTaxonomyTree } from '../lib/queries';
import { getBenchmarks, getMatrix } from '../lib/worktypes';
import { listReviews } from '../lib/reviews';
import { typeSlug } from '../lib/slug';
import { TaxNode } from '../lib/types';
type Matrix = Awaited<ReturnType<typeof getMatrix>>;
interface Props {
matrix: Matrix;
reviews: Awaited<ReturnType<typeof listReviews>>;
benchmarks: Awaited<ReturnType<typeof getBenchmarks>>;
tree: TaxNode[];
breakdown: Record<string, Record<string, number>>;
confLabel: Record<string, string>;
src: 'llm' | 'all';
llm: boolean;
}
export const getServerSideProps: GetServerSideProps<Props> = async ({ query }) => {
const src = query.src === 'llm' ? 'llm' : 'all';
const llm = query.llm === '1';
const [matrix, reviews, benchmarks, tree, breakdown, confs] = await Promise.all([
getMatrix({ src }), listReviews(), getBenchmarks(2), getTaxonomyTree({ llm }), getNodeConfBreakdown({ llm }), getConferences(),
]);
return { props: { matrix, reviews, benchmarks, tree, breakdown, confLabel: Object.fromEntries(confs.map((c) => [c.slug, c.short])), src, llm } };
};
const SECTIONS = [
{ id: 'types', label: 'Types of work' },
{ id: 'benchmarks', label: 'Benchmarks' },
{ id: 'taxonomy', label: 'Taxonomy' },
];
export default function Landscape({ matrix, reviews, benchmarks, tree, breakdown, confLabel, src, llm }: Props) {
const { roles, areas, cells } = matrix;
const max = Math.max(1, ...Object.values(cells));
const groups: ('agent' | 'general')[] = ['agent', 'general'];
/** link back to this page with one filter changed, keeping the other */
const here = (patch: { src?: 'llm' | 'all'; llm?: boolean }, hash: string) => {
const s = patch.src ?? src; const l = patch.llm ?? llm;
const sp = new URLSearchParams();
if (s === 'llm') sp.set('src', 'llm');
if (l) sp.set('llm', '1');
const q = sp.toString();
return `/landscape${q ? '?' + q : ''}#${hash}`;
};
const q = llm ? '&llm=1' : '';
return (
<Layout title="Landscape">
<h1>Research landscape</h1>
<p className="sub">The three views of the corpus on one page: what kind of work papers do, which benchmarks they use, and where they sit in the topic tree.</p>
<div className="tabs">
{SECTIONS.map((s) => <a key={s.id} href={`#${s.id}`}>{s.label}</a>)}
</div>
<section id="types">
<h2>Types of work</h2>
<p className="sub">
A type of work = research <b>area</b> × <b>role</b>. The role says what a paper contributes and what it holds fixed versus varies, so two papers on the same benchmark land in different types when one
fixes the agent and changes the environment while the other does the opposite. A paper can belong to several types.
</p>
{reviews.length > 0 && (
<>
<h3>Reviews ({reviews.length})</h3>
<div className="cards">
{reviews.map((r) => (
<Link key={r.type_id} href={`/work-types/${typeSlug(r.type_id)}`} className="card" style={{ color: 'inherit', textDecoration: 'none' }}>
<div className="sub" style={{ margin: 0, fontSize: 12 }}>{areas.find((a) => a.id === r.area)?.label ?? r.area} · {roles.find((x) => x.id === r.role)?.label ?? r.role}</div>
<b style={{ color: 'var(--accent)' }}>{r.title}</b>
<div className="sub" style={{ margin: '4px 0 0', fontSize: 13 }}>{r.n} papers · {(r.abstract ?? '').slice(0, 160)}…</div>
</Link>
))}
</div>
</>
)}
<div className="filters" style={{ marginTop: 12 }}>
<Link className={`btn ${src === 'all' ? '' : 'ghost'}`} href={here({ src: 'all' }, 'types')}>All papers (LLM labels + rules)</Link>
<Link className={`btn ${src === 'llm' ? '' : 'ghost'}`} href={here({ src: 'llm' }, 'types')}>Detailed labels only (agent-related, read by LLM)</Link>
</div>
<h3>Roles</h3>
<table>
<thead><tr><th>Role</th><th>Fixes</th><th>Varies</th><th>What it means</th><th>Papers</th></tr></thead>
<tbody>
{roles.map((r) => (
<tr key={r.id}><td><b>{r.label}</b></td><td>{r.fixes || '—'}</td><td>{r.varies || '—'}</td><td>{r.descr}</td><td>{r.n.toLocaleString()}</td></tr>
))}
</tbody>
</table>
{groups.map((g) => (
<div key={g}>
<h3>{g === 'agent' ? 'Agent research areas' : 'Other LLM research areas'}</h3>
<div style={{ overflowX: 'auto' }}>
<table>
<thead>
<tr><th>Area</th>{roles.map((r) => <th key={r.id} title={r.label} style={{ fontSize: 10 }}>{r.id}</th>)}<th>Σ</th></tr>
</thead>
<tbody>
{areas.filter((a) => a.kind === g).map((a) => (
<tr key={a.id}>
<td style={{ whiteSpace: 'nowrap' }}>{a.label.length > 52 ? a.label.slice(0, 50) + '…' : a.label}</td>
{roles.map((r) => {
const id = `${a.id}|${r.id}`; const n = cells[id] ?? 0;
return (
<td key={r.id} style={n ? { background: `color-mix(in srgb, var(--accent) ${Math.min(80, 8 + (n / max) * 120)}%, transparent)` } : undefined}>
{n ? <Link href={`/work-types/${typeSlug(id)}${src === 'llm' ? '?src=llm' : ''}`}>{n}</Link> : ''}
</td>
);
})}
<td>{a.n.toLocaleString()}</td>
</tr>
))}
</tbody>
</table>
</div>
</div>
))}
</section>
<section id="benchmarks">
<h2>Benchmarks</h2>
<p className="sub">Benchmarks named in at least two papers’ abstracts ({benchmarks.length}). Extracted from the detailed agent-paper labels and matched by name in the remaining papers.</p>
<div style={{ maxHeight: 520, overflow: 'auto', border: '1px solid var(--line)', borderRadius: 10 }}>
<table style={{ border: 0 }}>
<thead><tr><th>Benchmark</th><th>Papers</th><th>Introduced in 2026</th><th>Scores recorded</th></tr></thead>
<tbody>
{benchmarks.map((b) => (
<tr key={b.id}><td><Link href={`/benchmarks/${b.id}`}>{b.name}</Link></td><td>{b.n_papers}</td><td>{b.n_new || ''}</td><td>{b.n_results || ''}</td></tr>
))}
</tbody>
</table>
</div>
</section>
<section id="taxonomy">
<h2>Taxonomy</h2>
<p className="sub">
One topic tree across all conferences. Each paper keeps its conference as a tag: the chips next to a topic show how many of its papers come from each venue, and clicking one lists them.
</p>
<div className="filters">
<Link className="btn ghost" href={here({ llm: !llm }, 'taxonomy')}>{llm ? 'Include non-LLM papers' : 'LLM-related only'}</Link>
</div>
<div className="card">
<TaxonomyTree
openAll
nodes={tree}
breakdown={breakdown}
confLabel={confLabel}
href={(id) => `/papers?node=${id}${q}`}
chipHref={(id, conf) => `/papers?node=${id}&conf=${conf}${q}`}
/>
</div>
</section>
</Layout>
);
}