From f5d014a022b602a74a9d87ff3d51ec48c04f49d2 Mon Sep 17 00:00:00 2001 From: claude-bot <10+claude-bot@noreply.localhost> Date: Thu, 22 Oct 2026 14:50:03 +0000 Subject: [PATCH] Add reviews view, work-type UI updates, and permanent deploy workflow (ces-control) Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01FbMbJPadPzVwvt9rU9GBNo --- .gitea/workflows/deploy.yml | 21 +++ components/LegacyTypeView.tsx | 116 ++++++++++++++++ components/Markdown.tsx | 48 +++++++ components/ReviewCharts.tsx | 49 +++++++ lib/reviews.ts | 53 +++++++ pages/work-types/[slug].tsx | 255 ++++++++++++++++++++-------------- pages/work-types/index.tsx | 22 ++- scripts/build_worktypes.py | 7 +- scripts/deploy.sh | 50 +++++++ styles/globals.css | 22 +++ 10 files changed, 535 insertions(+), 108 deletions(-) create mode 100644 .gitea/workflows/deploy.yml create mode 100644 components/LegacyTypeView.tsx create mode 100644 components/Markdown.tsx create mode 100644 components/ReviewCharts.tsx create mode 100644 lib/reviews.ts create mode 100644 scripts/deploy.sh diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..7dbd579 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,21 @@ +name: Deploy +on: + push: + branches: [main] + workflow_dispatch: {} + +jobs: + deploy: + runs-on: ces-control + timeout-minutes: 30 + steps: + - name: Checkout + run: | + git init . + git remote add origin "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git" + git -c http.extraHeader="Authorization: token ${{ github.token }}" fetch --depth 1 origin "$GITHUB_SHA" + git checkout --detach FETCH_HEAD + - name: Deploy (systemd service, permanent) + env: + APP_PORT: ${{ vars.APP_PORT }} + run: sh scripts/deploy.sh "$GITHUB_SHA" diff --git a/components/LegacyTypeView.tsx b/components/LegacyTypeView.tsx new file mode 100644 index 0000000..9dd650b --- /dev/null +++ b/components/LegacyTypeView.tsx @@ -0,0 +1,116 @@ +import Link from 'next/link'; +import Layout from './Layout'; +import { ScoreBars, ScoreScatter, TimelineBars } from './SvgCharts'; +import { typeSlug } from '../lib/slug'; +import type { getWorkType } from '../lib/worktypes'; + +type Data = NonNullable>; +const sc = (d: string) => (d.length > 140 ? d.slice(0, 138) + '…' : d); + +export default function LegacyTypeView({ data, page, llm, slug }: { data: Data; page: number; llm: boolean; slug: string }) { + const { type, area, role, members, timeline, benchmarks, results, siblings, sameRole, note, workflows, total, pageSize } = data; + const pages = Math.max(1, Math.ceil(total / pageSize)); + const href = (p: number, src = llm) => `/work-types/${slug}?${[src ? 'src=llm' : '', p > 1 ? `page=${p}` : ''].filter(Boolean).join('&')}`; + const withScores = results.length > 0; + return ( + +

← All types of work

+

{role.label}

+

in {area.label} · {type.n_papers.toLocaleString()} papers ({type.n_llm_labeled} labelled in detail)

+ +

1. Time order

+
+ +

Papers placed by venue date; the table below lists them in the same order. Exact submission dates need arXiv access.

+
+ +

2. How it is classified, and why different papers are the same type

+
+

Definition. {role.descr}

+

Holds fixed: {role.fixes || '—'}   Varies: {role.varies || '—'}

+ {note?.why_same &&

What these papers share: {note.why_same}

} + {note?.narrative &&

{note.narrative}

} +

How this type differs from neighbours in the same area

+ + + + {siblings.map((s) => ( + + + + ))} + +
Role (same area)FixesVariesPapers
{s.id === type.id ? s.label : {s.label}}{s.fixes || '—'}{s.varies || '—'}{s.n_papers}
+ {sameRole.length > 0 && ( +

Same role in other areas:{' '} + {sameRole.map((s) => {s.label.slice(0, 40)} {s.n_papers})} +

+ )} +
+ +

3. Benchmarks usually used, and what they are used to show

+ {benchmarks.length ? ( + + + + {benchmarks.map((b) => ( + + ))} + +
BenchmarkPapersIntroduced hereUsed to show
{b.name}{b.n}{b.n_new || ''}{b.purposes ?? '—'}
+ ) :

No benchmark named in these papers’ abstracts yet.

} + {note?.bench_summary &&

{note.bench_summary}

} + +

4. Workflow

+
+ {note && note.workflow.length > 0 && ( +
    {note.workflow.map((s, i) =>
  1. {s}
  2. )}
+ )} + {workflows.length > 0 ? workflows.map((w) => ( +

+ {w.title.slice(0, 60)}: {w.steps.join(' → ')} +

+ )) : Workflows are extracted for papers that were read in detail.} +
+ +

5. Scores

+
+ {withScores ? ( + <> + ({ date: r.date, score: r.score, series: r.setting ?? 'reported', label: `${r.system ?? '?'} on ${r.bench}`, unit: r.unit }))} /> +

Best reported score per system

+ ({ label: `${r.system ?? '?'} · ${r.bench}`, score: r.score, series: r.setting ?? 'reported' }))} /> + + ) : ( +

+ No numeric scores are stated in the abstracts of this type’s papers. Scores sit in result tables, which need the full text (arXiv / OpenReview / ACL Anthology). The chart renders automatically once results are loaded. +

+ )} +
+ +

Papers in time order

+
+ All labels + Detailed (LLM-read) only +
+ + + + {members.map((m) => ( + + + + + + + ))} + +
DatePaperWhat it varies / holds fixedWhy this type
{m.date.slice(0, 7)}
{m.conf_short}{m.track ? ` · ${m.track}` : ''}
{m.title}{m.source === 'rule' && rule}{m.summary &&
{sc(m.summary)}
}
{m.varies.length ? <>varies: {m.varies.join('; ')} : '—'}{m.fixes.length ? <>
fixes: {m.fixes.join('; ')} : null}
{m.why || '—'}
+
+ ← Prev + Page {page} / {pages} + = pages ? 'dis' : ''}`} href={href(page + 1)}>Next → +
+
+ ); +} diff --git a/components/Markdown.tsx b/components/Markdown.tsx new file mode 100644 index 0000000..d9b6145 --- /dev/null +++ b/components/Markdown.tsx @@ -0,0 +1,48 @@ +import Link from 'next/link'; +import { Fragment, ReactNode } from 'react'; + +/** Minimal, safe markdown: paragraphs, ###/#### headings, -/1. lists, **bold**, *italic*, `code`, citations [#id] / [#a, #b]. */ +export default function Markdown({ text, cite }: { text: string; cite: Record }) { + const blocks = (text ?? '').replace(/\r/g, '').split(/\n{2,}/); + return <>{blocks.map((b, i) => )}; +} + +function Block({ src, cite }: { src: string; cite: Record }) { + if (!src) return null; + const h = src.match(/^(#{2,4})\s+(.*)$/); + if (h && !src.includes('\n')) { + const lvl = h[1].length; + return lvl <= 3 ?

{inline(h[2], cite)}

:

{inline(h[2], cite)}

; + } + const lines = src.split('\n'); + if (lines.every((l) => /^\s*[-*]\s+/.test(l))) return
    {lines.map((l, i) =>
  • {inline(l.replace(/^\s*[-*]\s+/, ''), cite)}
  • )}
; + if (lines.every((l) => /^\s*\d+[.)]\s+/.test(l))) return
    {lines.map((l, i) =>
  1. {inline(l.replace(/^\s*\d+[.)]\s+/, ''), cite)}
  2. )}
; + return

{inline(lines.join(' '), cite)}

; +} + +export function inline(s: string, cite: Record): ReactNode[] { + const out: ReactNode[] = []; + const re = /(\[#\d+(?:\s*[,;]\s*#?\d+)*\])|(\*\*[^*]+\*\*)|(\*[^*\s][^*]*\*)|(`[^`]+`)/g; + let last = 0; let m: RegExpExecArray | null; let k = 0; + while ((m = re.exec(s))) { + if (m.index > last) out.push(s.slice(last, m.index)); + const t = m[0]; + if (m[1]) { + const ids = [...t.matchAll(/(\d+)/g)].map((x) => Number(x[1])); + out.push([{ids.map((id, j) => ( + {j > 0 && ','}{cite[id] ?? '?'} + ))}]); + } else if (m[2]) out.push({t.slice(2, -2)}); + else if (m[3]) out.push({t.slice(1, -1)}); + else out.push({t.slice(1, -1)}); + last = m.index + t.length; + } + if (last < s.length) out.push(s.slice(last)); + return out; +} + +/** Inline list of citation chips for id arrays (tables). */ +export function Cites({ ids, cite }: { ids: number[]; cite: Record }) { + return <>{ids.map((id) => [{cite[id] ?? '?'}])}; +} +export { Link }; diff --git a/components/ReviewCharts.tsx b/components/ReviewCharts.tsx new file mode 100644 index 0000000..cee999c --- /dev/null +++ b/components/ReviewCharts.tsx @@ -0,0 +1,49 @@ +const PALETTE = ['#2f5bea', '#e0702b', '#1b9e77', '#a14b9c', '#c9a227', '#d6336c', '#37a0d6', '#6b8e23']; + +/** Swimlane: one lane per subfield, papers as dots on a venue-date axis. */ +export function SubfieldTimeline({ lanes, cite }: { lanes: { name: string; papers: { id: number; date: string; title: string }[] }[]; cite: Record }) { + const all = lanes.flatMap((l) => l.papers); + if (!all.length) return null; + const ts = (d: string) => new Date(d + (d.length === 7 ? '-15' : '') + 'T00:00:00Z').getTime(); + const lo = Math.min(...all.map((p) => ts(p.date))) - 25 * 864e5, hi = Math.max(...all.map((p) => ts(p.date))) + 25 * 864e5; + const W = 760, L = 210, R = 16, laneH = 34, top = 8, H = top + lanes.length * laneH + 30; + const X = (t: number) => L + ((t - lo) / (hi - lo || 1)) * (W - L - R); + const months: number[] = []; + for (let d = new Date(lo); d.getTime() <= hi; d.setUTCMonth(d.getUTCMonth() + 1)) months.push(Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), 1)); + return ( + + {months.map((m) => ({new Date(m).toISOString().slice(0, 7)}))} + {lanes.map((l, i) => { + const y = top + i * laneH + laneH / 2; + const byDate: Record = {}; + return ( + + {l.name.length > 32 ? l.name.slice(0, 31) + '…' : l.name} + + {l.papers.map((p) => { + const k = (byDate[p.date] = (byDate[p.date] ?? 0) + 1); + const dx = ((k - 1) % 6) * 7 - 17, dy = Math.floor((k - 1) / 6) * 7 - 5; + return ( + + {`[${cite[p.id]}] ${p.title} (${p.date})`} + + ); + })} + + ); + })} + + ); +} + +/** Horizontal workflow: boxes with arrows, wrapping. */ +export function WorkflowFlow({ steps }: { steps: string[] }) { + if (!steps.length) return null; + return ( +
+ {steps.map((s, i) => ( +
{i + 1}{s}{i < steps.length - 1 && →}
+ ))} +
+ ); +} diff --git a/lib/reviews.ts b/lib/reviews.ts new file mode 100644 index 0000000..6907864 --- /dev/null +++ b/lib/reviews.ts @@ -0,0 +1,53 @@ +import { db } from './db'; + +export interface Review { + type_id: string; title: string; abstract: string; + perspective: { options: { name: string; pros: string; cons: string }[]; chosen: string; why: string }; + outline: { section: string; purpose: string; words: number }[]; + subfields: { name: string; description: string; focus: string; key_paper_ids: number[]; paper_ids: number[]; relations: string }[]; + evolution: { pioneering: { id: number; why: string }[]; paths: { name: string; paper_ids: number[]; narrative: string }[]; gaps: string[]; connections: string[]; reading_order: number[] }; + papers: { id: number; question: string; innovation: string; method: string; findings: string; contribution: string; limitations: string; summary: string; subfield: string }[]; + methods: { families: { name: string; description: string; paper_ids: number[]; pros: string; cons: string; trend: string }[]; trends: string; suggested_new_methods: string[] }; + key_data: { rows: { id: number; subject: string; metric: string; data: string; conclusion: string }[]; patterns: string; contradictions: string; missing: string }; + sections: { introduction: string; body: { title: string; subfield: string; content: string }[]; comparative: string; challenges: string; future: string; conclusion: string }; + novel_perspective: string; + quality: { checks: { issue: string; status: string; note: string }[]; limitations_of_this_review: string }; +} + +export interface RefMeta { id: number; title: string; authors: string; venue: string; date: string; url: string | null } + +const CITE = /\[#(\d+)(?:\s*[,;]\s*#?(\d+))*\]/g; + +/** Order of first citation across the article -> reference numbers. */ +function citationOrder(r: Review): number[] { + const parts = [r.sections.introduction, ...r.sections.body.map((b) => b.content), r.sections.comparative, r.sections.challenges, r.sections.future, r.sections.conclusion]; + const seen: number[] = []; + for (const t of parts) for (const m of (t ?? '').matchAll(/#(\d+)/g)) { + const id = Number(m[1]); if (!seen.includes(id)) seen.push(id); + } + return seen; +} + +export function getReview(typeId: string) { + let row: { json: string } | undefined; + try { row = db().prepare('SELECT json FROM type_reviews WHERE type_id = ?').get(typeId) as { json: string } | undefined; } catch { return null; } + if (!row) return null; + const review = JSON.parse(row.json) as Review; + const memberIds = review.papers.map((p) => p.id); + const order = citationOrder(review).filter((id) => memberIds.includes(id)); + const all = [...order, ...memberIds.filter((id) => !order.includes(id))]; + const stmt = db().prepare(`SELECT p.id, p.title, p.authors, c.short || ' 2026' AS venue, COALESCE(c.start_date,'2026-06-01') AS date, p.url FROM papers p JOIN conferences c ON c.slug = p.conf WHERE p.id = ?`); + const refs: RefMeta[] = all.map((id) => stmt.get(id) as RefMeta).filter(Boolean).map((r) => { + const a = (r.authors ?? '').split(', '); + return { ...r, authors: a[0] ? a[0] + (a.length > 1 ? ' et al.' : '') : '' }; + }); + return { review, refs, citeNum: Object.fromEntries(all.map((id, i) => [id, i + 1])) as Record }; +} + +export function listReviews() { + try { + return db().prepare(`SELECT r.type_id, json_extract(r.json,'$.title') AS title, json_extract(r.json,'$.abstract') AS abstract, w.n_llm_labeled AS n, w.area, w.role + FROM type_reviews r JOIN work_types w ON w.id = r.type_id ORDER BY w.area, w.n_llm_labeled DESC`).all() as { type_id: string; title: string; abstract: string; n: number; area: string; role: string }[]; + } catch { return []; } +} +export { CITE }; diff --git a/pages/work-types/[slug].tsx b/pages/work-types/[slug].tsx index 883e96f..7c9d893 100644 --- a/pages/work-types/[slug].tsx +++ b/pages/work-types/[slug].tsx @@ -1,126 +1,173 @@ import type { GetServerSideProps } from 'next'; import Link from 'next/link'; import Layout from '../../components/Layout'; -import { ScoreBars, ScoreScatter, TimelineBars } from '../../components/SvgCharts'; -import { getWorkType } from '../../lib/worktypes'; +import LegacyTypeView from '../../components/LegacyTypeView'; +import Markdown, { Cites, inline } from '../../components/Markdown'; +import { SubfieldTimeline, WorkflowFlow } from '../../components/ReviewCharts'; +import { ScoreBars, ScoreScatter } from '../../components/SvgCharts'; +import { getReview } from '../../lib/reviews'; import { typeIdFromSlug, typeSlug } from '../../lib/slug'; +import { getWorkType } from '../../lib/worktypes'; type Data = NonNullable>; -interface Props { data: Data; page: number; llm: boolean; slug: string } +type Rev = NonNullable>; +interface Props { data: Data; rev: Rev | null; page: number; llm: boolean; slug: string } export const getServerSideProps: GetServerSideProps = async ({ params, query }) => { const slug = String(params?.slug); const page = Math.max(1, parseInt(String(query.page ?? '1'), 10) || 1); const llm = query.src === 'llm'; - const data = getWorkType(typeIdFromSlug(slug), page, llm); - return data ? { props: { data, page, llm, slug } } : { notFound: true }; + const id = typeIdFromSlug(slug); + const data = getWorkType(id, page, llm); + if (!data) return { notFound: true }; + return { props: { data, rev: query.view === 'data' ? null : getReview(id), page, llm, slug } }; }; -const sc = (d: string) => (d.length > 140 ? d.slice(0, 138) + '…' : d); - -export default function WorkTypePage({ data, page, llm, slug }: Props) { - const { type, area, role, members, timeline, benchmarks, results, siblings, sameRole, note, workflows, total, pageSize } = data; - const pages = Math.max(1, Math.ceil(total / pageSize)); - const href = (p: number, src = llm) => `/work-types/${slug}?${[src ? 'src=llm' : '', p > 1 ? `page=${p}` : ''].filter(Boolean).join('&')}`; - const withScores = results.length > 0; +export default function WorkTypePage(props: Props) { + if (!props.rev) return ; + const { data, rev, slug } = props; + const { review: r, refs, citeNum: c } = rev; + const refById = Object.fromEntries(refs.map((x) => [x.id, x])); + const lanes = r.subfields.map((s) => ({ name: s.name, papers: s.paper_ids.map((id) => refById[id]).filter(Boolean).map((p) => ({ id: p.id, date: p.date.slice(0, 7), title: p.title })) })); + const bodyStart = 5; + const n = (k: number) => bodyStart + 1 + k; // section number after the body + const toc: { id: string; label: string; sub?: boolean }[] = [ + { id: 'intro', label: '1 Introduction' }, { id: 'scope', label: '2 Definition and scope' }, { id: 'perspective', label: '3 How this review is organised' }, + { id: 'landscape', label: '4 Landscape: subfields and evolution' }, { id: 'body', label: '5 Research directions' }, + ...r.sections.body.map((b, i) => ({ id: `body-${i}`, label: `5.${i + 1} ${b.title}`, sub: true })), + { id: 'methods', label: `${n(0)} Methods` }, { id: 'data', label: `${n(1)} Benchmarks and key data` }, { id: 'workflow', label: `${n(2)} Typical workflow` }, + { id: 'compare', label: `${n(3)} Comparative analysis` }, { id: 'challenges', label: `${n(4)} Problems and challenges` }, { id: 'future', label: `${n(5)} Future directions` }, + { id: 'conclusion', label: `${n(6)} Conclusion` }, { id: 'lens', label: `${n(7)} A new lens` }, + { id: 'appendix-papers', label: 'A Paper-by-paper extraction' }, { id: 'appendix-qa', label: 'B Quality assurance' }, { id: 'refs', label: 'References' }, + ]; + const wf = data.note?.workflow ?? []; return ( - -

← All types of work

-

{role.label}

-

in {area.label} · {type.n_papers.toLocaleString()} papers ({type.n_llm_labeled} labelled in detail)

+ +

← All types of work · data view

+
+ +
+

{data.area.label} · {data.role.label}

+

{r.title}

+

A review of {r.papers.length} accepted 2026 papers. Written from titles and abstracts; dates are venue dates.

+
Abstract. {inline(r.abstract, c)}
-

1. Time order

-
- -

Papers placed by venue date; the table below lists them in the same order. Exact submission dates need arXiv access.

-
+

1 Introduction

+ -

2. How it is classified, and why different papers are the same type

-
-

Definition. {role.descr}

-

Holds fixed: {role.fixes || '—'}   Varies: {role.varies || '—'}

- {note?.why_same &&

What these papers share: {note.why_same}

} - {note?.narrative &&

{note.narrative}

} -

How this type differs from neighbours in the same area

- - - - {siblings.map((s) => ( - - - - ))} - -
Role (same area)FixesVariesPapers
{s.id === type.id ? s.label : {s.label}}{s.fixes || '—'}{s.varies || '—'}{s.n_papers}
- {sameRole.length > 0 && ( -

Same role in other areas:{' '} - {sameRole.map((s) => {s.label.slice(0, 40)} {s.n_papers})} -

- )} -
+

2 Definition and scope

+
+

Type of work: {data.role.label} in {data.area.label}.

+

{data.role.descr}

+

Holds fixed: {data.role.fixes || '—'} · Varies: {data.role.varies || '—'}

+
+ {data.note?.why_same &&

{data.note.why_same}

} +

Neighbouring types in the same area differ in what they hold fixed and what they vary:

+ + {data.siblings.map((s) => ( + + + ))}
Role in {data.area.label.split(',')[0]}FixesVariesPapers
{s.id === data.type.id ? s.label : {s.label}}{s.fixes || '—'}{s.varies || '—'}{s.n_papers}
-

3. Benchmarks usually used, and what they are used to show

- {benchmarks.length ? ( - - - - {benchmarks.map((b) => ( - - ))} - -
BenchmarkPapersIntroduced hereUsed to show
{b.name}{b.n}{b.n_new || ''}{b.purposes ?? '—'}
- ) :

No benchmark named in these papers’ abstracts yet.

} - {note?.bench_summary &&

{note.bench_summary}

} +

3 How this review is organised

+ + {r.perspective.options.map((o) => )}
Possible organisationProsCons
{o.name}{o.pros}{o.cons}
+

Chosen: {r.perspective.chosen}. {r.perspective.why}

+ + {r.outline.map((o) => )}
SectionPurpose≈ words
{o.section}{o.purpose}{o.words}
-

4. Workflow

-
- {note && note.workflow.length > 0 && ( -
    {note.workflow.map((s, i) =>
  1. {s}
  2. )}
- )} - {workflows.length > 0 ? workflows.map((w) => ( -

- {w.title.slice(0, 60)}: {w.steps.join(' → ')} -

- )) : Workflows are extracted for papers that were read in detail.} -
- -

5. Scores

-
- {withScores ? ( - <> - ({ date: r.date, score: r.score, series: r.setting ?? 'reported', label: `${r.system ?? '?'} on ${r.bench}`, unit: r.unit }))} /> -

Best reported score per system

- ({ label: `${r.system ?? '?'} · ${r.bench}`, score: r.score, series: r.setting ?? 'reported' }))} /> - - ) : ( -

- No numeric scores are stated in the abstracts of this type’s papers. Scores sit in result tables, which need the full text (arXiv / OpenReview / ACL Anthology). The chart renders automatically once results are loaded. -

- )} -
- -

Papers in time order

-
- All labels - Detailed (LLM-read) only -
- - - - {members.map((m) => ( - - - - - - +

4 Landscape: subfields and evolution

+
DatePaperWhat it varies / holds fixedWhy this type
{m.date.slice(0, 7)}
{m.conf_short}{m.track ? ` · ${m.track}` : ''}
{m.title}{m.source === 'rule' && rule}{m.summary &&
{sc(m.summary)}
}
{m.varies.length ? <>varies: {m.varies.join('; ')} : '—'}{m.fixes.length ? <>
fixes: {m.fixes.join('; ')} : null}
{m.why || '—'}
+ {r.subfields.map((s) => ( + + ))}
SubfieldKey papers#Main focusRelationship with other subfields
{s.name}
{s.description}
{s.paper_ids.length}{s.focus}{s.relations}
+

Papers over time, by subfield

+
+

Representative and pioneering work

+ +

Evolutionary paths

+ {r.evolution.paths.map((p) => ( +
+ {p.name}: {p.paper_ids.map((id, i) => {i > 0 && ' → '}[{c[id]}])} +

{inline(p.narrative, c)}

+
))} - - -
- ← Prev - Page {page} / {pages} - = pages ? 'dis' : ''}`} href={href(page + 1)}>Next → +

Connections and gaps

+
    {r.evolution.connections.map((x, i) =>
  • {inline(x, c)}
  • )}
+
    {r.evolution.gaps.map((x, i) =>
  • Gap: {inline(x, c)}
  • )}
+ +

5 Research directions

+ {r.sections.body.map((b, i) => ( +
+

5.{i + 1} {b.title}

+ +
+ ))} + +

{n(0)} Methods

+ + {r.methods.families.map((m) => ( + + ))}
Method familyPapersProsConsTrend
{m.name}
{m.description}
({m.paper_ids.length}){m.pros}{m.cons}{m.trend}
+

{inline(r.methods.trends, c)}

+ {r.methods.suggested_new_methods.length > 0 && <>

Methods worth trying next:

    {r.methods.suggested_new_methods.map((x, i) =>
  • {inline(x, c)}
  • )}
} + +

{n(1)} Benchmarks and key data

+

Benchmarks used, and what they are used to show

+ {data.benchmarks.length ? ( + + {data.benchmarks.map((b) => )}
BenchmarkPapersIntroduced hereUsed to show
{b.name}{b.n}{b.n_new || ''}{b.purposes ?? '—'}
+ ) :

No benchmark is named in these abstracts.

} + {data.note?.bench_summary &&

{data.note.bench_summary}

} +

Key data reported in abstracts

+ {r.key_data.rows.length ? ( + + {r.key_data.rows.map((k, i) => )}
PaperSubjectMetricDataConclusion
[{c[k.id]}]{k.subject}{k.metric}{k.data}{k.conclusion}
+ ) :

No concrete numbers are stated in these abstracts.

} +

Patterns. {inline(r.key_data.patterns, c)}

+

Contradictions. {inline(r.key_data.contradictions, c)}

+

Missing data. {inline(r.key_data.missing, c)}

+ {data.results.length > 0 && ( +
+ Scores over time (abstract-reported) + ({ date: x.date, score: x.score, series: x.setting ?? 'reported', label: `${x.system ?? '?'} on ${x.bench}`, unit: x.unit }))} /> + ({ label: `${x.system ?? '?'} · ${x.bench}`, score: x.score, series: x.setting ?? 'reported' }))} /> +
+ )} + +

{n(2)} Typical workflow

+ {wf.length ? :

No common workflow recorded.

} + +

{n(3)} Comparative analysis

+ +

{n(4)} Problems and challenges

+ +

{n(5)} Future directions

+ +

{n(6)} Conclusion

+ +

{n(7)} A new lens on this work

+
{inline(r.novel_perspective, c)}
+ +

Appendix A · Paper-by-paper extraction

+
+ Show the core-information table for all {r.papers.length} papers + + {[...r.papers].sort((a, b) => (c[a.id] ?? 0) - (c[b.id] ?? 0)).map((p) => ( + + ))}
PaperResearch questionMethodKey findingsInnovationLimitations
[{c[p.id]}] {refById[p.id]?.title.slice(0, 60)}
{p.subfield}
{p.question}{p.method}{p.findings}{p.innovation}{p.limitations}
+
+ +

Appendix B · Quality assurance

+ + {r.quality.checks.map((q, i) => )}
CheckStatusNote
{q.issue}{q.status}{q.note}
+

Limitations of this review. {r.quality.limitations_of_this_review}

+ +

References

+
    {refs.map((x) => ( +
  1. {x.authors ? `${x.authors}. ` : ''}{x.title}. {x.venue}.{x.url && <> ↗}
  2. + ))}
+
); diff --git a/pages/work-types/index.tsx b/pages/work-types/index.tsx index db320ca..ab4e6fd 100644 --- a/pages/work-types/index.tsx +++ b/pages/work-types/index.tsx @@ -3,15 +3,16 @@ import Link from 'next/link'; import Layout from '../../components/Layout'; import { Area, Role, getMatrix } from '../../lib/worktypes'; import { typeSlug } from '../../lib/slug'; +import { listReviews } from '../../lib/reviews'; -interface Props { roles: Role[]; areas: Area[]; cells: Record; src: 'llm' | 'all' } +interface Props { roles: Role[]; areas: Area[]; cells: Record; src: 'llm' | 'all'; reviews: ReturnType } export const getServerSideProps: GetServerSideProps = async ({ query }) => { const src = query.src === 'llm' ? 'llm' : 'all'; - return { props: { ...getMatrix({ src }), src } }; + return { props: { ...getMatrix({ src }), src, reviews: listReviews() } }; }; -export default function WorkTypes({ roles, areas, cells, src }: Props) { +export default function WorkTypes({ roles, areas, cells, src, reviews }: Props) { const max = Math.max(1, ...Object.values(cells)); const groups: ('agent' | 'general')[] = ['agent', 'general']; return ( @@ -21,6 +22,21 @@ export default function WorkTypes({ roles, areas, cells, src }: Props) { A type of work = research area × role. 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.

+ {reviews.length > 0 && ( + <> +

Reviews ({reviews.length})

+
+ {reviews.map((r) => ( + +
{areas.find((a) => a.id === r.area)?.label ?? r.area} · {roles.find((x) => x.id === r.role)?.label ?? r.role}
+ {r.title} +
{r.n} papers · {(r.abstract ?? '').slice(0, 160)}…
+ + ))} +
+

All types (area × role)

+ + )}
All papers (LLM labels + rules) Detailed labels only (agent-related, read by LLM) diff --git a/scripts/build_worktypes.py b/scripts/build_worktypes.py index 1d7bb11..6d17a6a 100644 --- a/scripts/build_worktypes.py +++ b/scripts/build_worktypes.py @@ -17,7 +17,7 @@ ROLES, AGENT_AREAS, GEN_AREAS = W["roles"], W["agent_areas"], W["general_areas"] SCHEMA = """ DROP TABLE IF EXISTS roles; DROP TABLE IF EXISTS areas; DROP TABLE IF EXISTS work_types; DROP TABLE IF EXISTS paper_work_types; -DROP TABLE IF EXISTS paper_meta; DROP TABLE IF EXISTS benchmarks; DROP TABLE IF EXISTS paper_benchmarks; DROP TABLE IF EXISTS results; DROP TABLE IF EXISTS type_notes; +DROP TABLE IF EXISTS paper_meta; DROP TABLE IF EXISTS benchmarks; DROP TABLE IF EXISTS paper_benchmarks; DROP TABLE IF EXISTS results; DROP TABLE IF EXISTS type_notes; DROP TABLE IF EXISTS type_reviews; CREATE TABLE roles(id TEXT PRIMARY KEY, label TEXT, descr TEXT, fixes TEXT, varies TEXT, pattern TEXT, sort INT); CREATE TABLE areas(id TEXT PRIMARY KEY, label TEXT, kind TEXT, sort INT); CREATE TABLE work_types(id TEXT PRIMARY KEY, area TEXT REFERENCES areas(id), role TEXT REFERENCES roles(id), n_papers INT, n_llm_labeled INT); @@ -26,6 +26,7 @@ CREATE TABLE paper_meta(paper_id INTEGER PRIMARY KEY, summary TEXT, fixes TEXT, CREATE TABLE benchmarks(id INTEGER PRIMARY KEY, key TEXT UNIQUE, name TEXT, n_papers INT, n_new INT); CREATE TABLE paper_benchmarks(paper_id INT, bench_id INT, purpose TEXT, is_new INT, source TEXT, PRIMARY KEY(paper_id, bench_id)); CREATE TABLE results(id INTEGER PRIMARY KEY, paper_id INT, bench_id INT, system TEXT, base_model TEXT, setting TEXT, metric TEXT, score REAL, unit TEXT); +CREATE TABLE type_reviews(type_id TEXT PRIMARY KEY, json TEXT); CREATE TABLE type_notes(type_id TEXT PRIMARY KEY, why_same TEXT, workflow TEXT, bench_summary TEXT, narrative TEXT); CREATE INDEX idx_pwt_type ON paper_work_types(type_id); CREATE INDEX idx_pb_bench ON paper_benchmarks(bench_id); @@ -149,7 +150,11 @@ def main(): if os.path.exists(nf): for tid, n in json.load(open(nf)).items(): db.execute("INSERT OR REPLACE INTO type_notes VALUES(?,?,?,?,?)", (tid, n.get("why_same", ""), json.dumps(n.get("workflow", [])), n.get("bench_summary", ""), n.get("narrative", ""))) + for f in sorted(glob.glob(os.path.join(ROOT, "data", "reviews", "*.json"))): + r = json.load(open(f)) + db.execute("INSERT OR REPLACE INTO type_reviews VALUES(?,?)", (r["type_id"], json.dumps(r, ensure_ascii=False))) db.commit() + print("reviews:", db.execute("SELECT COUNT(*) FROM type_reviews").fetchone()[0]) print("llm-labelled:", len(labelled), " rule-labelled:", n_rule, " work types:", db.execute("SELECT COUNT(*) FROM work_types").fetchone()[0], " benchmarks:", db.execute("SELECT COUNT(*) FROM benchmarks").fetchone()[0], " results:", db.execute("SELECT COUNT(*) FROM results").fetchone()[0]) db.execute("VACUUM"); db.close() diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100644 index 0000000..ac9c51f --- /dev/null +++ b/scripts/deploy.sh @@ -0,0 +1,50 @@ +#!/bin/sh +# Permanent deploy on the ces-control host: /opt/llm-survey/releases/, `current` symlink, +# systemd unit `llm-survey`. Port is never 3000 or 18131 (taken). +set -eu +SHA="${1:?usage: deploy.sh }" +APP=llm-survey +ROOT=/opt/$APP +PORT="${APP_PORT:-18231}" +case "$PORT" in 3000|18131) echo "refusing reserved port $PORT" >&2; exit 1;; esac + +command -v node >/dev/null || { echo "node is not installed on this host" >&2; exit 1; } +node -e 'process.exit(+process.versions.node.split(".")[0] >= 18 ? 0 : 1)' || { echo "need node >= 18" >&2; exit 1; } + +# port must be free, or held by our own service +if ss -ltnH "sport = :$PORT" | grep -q . && ! systemctl is-active --quiet "$APP"; then + echo "port $PORT is in use by another process" >&2; exit 1 +fi + +REL="$ROOT/releases/$SHA" +mkdir -p "$ROOT/releases" +rm -rf "$REL"; mkdir -p "$REL" +tar --exclude=.git --exclude=node_modules --exclude=.next -cf - . | tar -xf - -C "$REL" +cd "$REL" +test -s data/papers.db || { echo "data/papers.db missing or empty" >&2; exit 1; } +npm ci --no-audit --no-fund +npm run build +node -e 'const D=require("better-sqlite3");const d=new D("data/papers.db",{readonly:true});console.log("papers:",d.prepare("select count(*) c from papers").get().c)' + +ln -sfn "$REL" "$ROOT/current.new" && mv -T "$ROOT/current.new" "$ROOT/current" +cat > /etc/systemd/system/$APP.service </dev/null 2>&1 +systemctl restart "$APP" +for i in 1 2 3 4 5 6 7 8 9 10; do + curl -fsS -o /dev/null "http://127.0.0.1:$PORT/" && { echo "healthy on :$PORT ($SHA)"; ok=1; break; }; sleep 2 +done +[ "${ok:-0}" = 1 ] || { journalctl -u "$APP" -n 40 --no-pager; exit 1; } +ls -1dt "$ROOT"/releases/* | tail -n +4 | xargs -r rm -rf diff --git a/styles/globals.css b/styles/globals.css index 543d9f0..5b0edf3 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -42,3 +42,25 @@ button,.btn{padding:7px 14px;border:1px solid var(--accent);background:var(--acc .pager .dis{opacity:.4;pointer-events:none} .bar{height:8px;background:var(--accent);border-radius:4px} .abs{white-space:pre-wrap} +/* review article */ +.article-grid{display:grid;grid-template-columns:230px minmax(0,1fr);gap:28px} +@media(max-width:900px){.article-grid{grid-template-columns:1fr}.toc{display:none}} +.toc{position:sticky;top:64px;align-self:start;max-height:calc(100vh - 80px);overflow:auto;font-size:13px;border-left:2px solid var(--line);padding-left:12px} +.toc a{display:block;color:var(--muted);padding:3px 0}.toc a:hover{color:var(--accent)} +.toc .sub-toc{padding-left:10px} +.article{max-width:820px;font-size:16px;line-height:1.7} +.article h2{font-size:21px;margin:40px 0 12px;padding-top:8px;border-top:1px solid var(--line)} +.article h3.md-h,.article h3{font-size:17px;margin:22px 0 8px} +.article p{margin:0 0 14px} +.abstract-box{background:var(--card);border:1px solid var(--line);border-left:4px solid var(--accent);border-radius:8px;padding:14px 18px;margin:16px 0} +.def-box{background:var(--accent-bg);border-radius:8px;padding:12px 16px;margin:12px 0;font-size:15px} +sup.cite{font-size:11px;margin-left:1px}sup.cite a{text-decoration:none} +.cite-chip{font-size:12px;margin-right:3px} +.article table{font-size:13.5px;line-height:1.5;margin:10px 0 18px} +.flow{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin:10px 0} +.flow-step{background:var(--card);border:1px solid var(--line);border-radius:8px;padding:8px 12px;font-size:14px;position:relative;margin-right:22px} +.flow-n{display:inline-block;width:20px;height:20px;border-radius:10px;background:var(--accent);color:#fff;font-size:11px;text-align:center;line-height:20px;margin-right:6px} +.flow-arrow{position:absolute;right:-19px;top:50%;transform:translateY(-50%);color:var(--muted)} +.refs{font-size:13.5px;padding-left:28px}.refs li{margin:4px 0}.refs li:target{background:var(--accent-bg)} +.qa-ok{color:#1b9e77;font-weight:600}.qa-fixed{color:#e0702b;font-weight:600} +details.extract summary{cursor:pointer;font-weight:600;margin:8px 0}