Files
ai-taxonomy-literature-anal…/lib/db.ts
T
zzyang 13924f8985 Add LLM research survey site (Next.js pages router + SQLite)
- Next.js/React/TypeScript app: overview, paper explorer with FTS5 search,
  paper detail, global taxonomy tree with per-conference tag breakdown
- Python ingestion (ICLR/ICML 2026 via paperlists, ACL Anthology 2026) into
  data/papers.db, plus keyword-scored taxonomy (scripts/taxonomy.py)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bhs9LU8eMixk6g1kb1d3j7
2026-10-21 11:30:14 +00:00

14 lines
416 B
TypeScript

import Database from 'better-sqlite3';
import path from 'path';
let _db: Database.Database | null = null;
/** Read-only handle on data/papers.db (built by scripts/ingest.py). */
export function db(): Database.Database {
if (!_db) {
const file = process.env.PAPERS_DB ?? path.join(process.cwd(), 'data', 'papers.db');
_db = new Database(file, { readonly: true, fileMustExist: true });
}
return _db;
}