Redesign the interface around Scan and Library, classify uncatalogued books from similar ones

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Fable 5.2 committed 2026-11-18 11:01:50 -07:00
1 parent 308c0e1ed3
commit 6cec404e21
71 files changed
+8634 -1502

No files matched your search

+5 -1
View File
@@ -9,6 +9,8 @@ export interface MarcFields {
meta: Partial<BookMeta>;
/** Every 100/700 $a, cleaned but still in "Surname, Forename" form; used to verify title/author matches. */
names: string[];
/** Subject headings with their subdivisions and place names (650, 651), for judging what a book is about. */
topics: string[];
}
type Node = Record<string, unknown>;
@@ -114,6 +116,8 @@ export function parseMarcRecord(rec: Node): MarcFields {
const ym = pub ? /\b(1[0-9]\d\d|20\d\d)\b/.exec(sub(pub, 'c')) : null;
const subjects = uniq(all('650').map((f) => trimPunct(sub(f, 'a'))).filter(Boolean));
const topics = uniq([...all('650'), ...all('651')].flatMap((f) =>
f.subs.filter((s) => 'avxyz'.includes(s.code) && s.value).map((s) => trimPunct(s.value))));
const f010 = all('010')[0];
const lccn = f010 && sub(f010, 'a') ? sub(f010, 'a').replace(/\s+/g, '') : null;
@@ -123,7 +127,7 @@ export function parseMarcRecord(rec: Node): MarcFields {
if (publisher) meta.publisher = publisher;
if (ym) meta.year = Number(ym[1]);
if (lccn) meta.lccn = lccn;
return { lccn, lcc, dewey, meta, names };
return { lccn, lcc, dewey, meta, names, topics };
}
/** Parse every MARC record in an SRU response or a bare LCCN permalink record. */