diff --git a/README.md b/README.md index df718ab..4f713a3 100644 --- a/README.md +++ b/README.md @@ -13,27 +13,20 @@ npm start Requires a recent Node (the server runs TypeScript directly). -## Scanning +## Using it -Use the **Scan** tab. Every way of adding a book ends up in the same session list, where a row goes from "Looking up" to "Ready" (a call number was found) or "Needs attention". +The header has **Scan**, **Library (N)** and a gear for settings. -- **Camera**: click *Start camera*, allow access, and hold the barcode (the one with 978 or 979 under it, usually on the back cover) steady in view. A beep means it was read. Reading the same book twice is recognised and not added again. -- **Typed ISBN**: the ISBN box is always focused. Type or paste 10 or 13 digits and press Enter. A USB barcode scanner works the same way, since it types the digits and presses Enter. -- **Search by title and author**: for books with no barcode. Pick the matching result. -- **Enter LCCN**: if the book's copyright page prints a Library of Congress Control Number. -- **Enter by hand**: title, authors, and optionally a call number you already know. +**Scan** is the home screen. On the left are the camera, the last book handled, and one entry box. Hold a barcode in the box on the video (a beep and a green flash mean it was read), press **Capture** or Space for one careful picture, or type an ISBN and press Enter (a USB barcode scanner does the same). The same box takes an LCCN (from the copyright page) or a title: type `Dune by Frank Herbert`, pick a result, or choose *Not listed? Enter it by hand*. On the right, **Cards to print** lists every queued book, books needing attention first. Use **Fix** on a book that needs attention, or the x to remove it (with 6 seconds to undo). A book already printed is only taken off the list, never deleted. -Books marked *Needs attention* appear on the **Print queue** tab, where you can retry the lookup, edit the details (including typing a call number), or delete them. Call numbers marked approximate were derived from a Dewey number rather than found in the Library of Congress catalog; check those. +**Print** opens a small panel: pick where the first card goes on the sheet (handy for a partly used sheet), then **Make PDF**. Cards are printed in shelf order on Avery 5388 sheets (three 3 x 5 inch cards). -## Printing on Avery 5388 +1. Open the PDF and print at **Actual size / 100%** (never "Fit to page"), **single-sided**, through the **manual feed slot**. +2. When the cards came out correctly, answer **Yes, clear them** so they are not printed twice. -On the **Print queue** tab, choose which of the three positions on the sheet the first card should use (handy for a partly used sheet) and click *Make PDF*. Cards are printed in shelf order. +**Library** shows every book in shelf order, grouped by main class, with search and a *Needs attention* filter. Click a book to edit it, print another card, look it up again, or delete it. A number marked `~` was borrowed from another edition or from similar books; check those. -1. Open the PDF in your PDF viewer and print at **Actual size / 100%** (never "Fit to page"). -2. Print **single-sided**, loading the sheet through the **manual feed slot**. -3. When the cards came out correctly, click *Yes, clear these from the queue* so they are not printed twice. - -If the text sits off-centre on the cards, print the **calibration page** (*Printer alignment*, then *Print calibration page*) on plain paper, hold it against a real sheet up to the light, and enter the X and Y offsets in millimetres (limit 10) that bring it into line. Offsets are saved and applied to every later PDF. +**Settings** (the gear) holds the camera picker and printer alignment. If the text sits off-centre on the cards, print the calibration page on plain paper, hold it against a real sheet up to the light, and enter the X and Y offsets in millimetres (limit 10). They are saved and applied to every later PDF. ## Where the data lives @@ -45,13 +38,3 @@ In `data/booksorter.db` (SQLite) in this folder, created on first run. Back it u npm test # unit and server tests npm run typecheck ``` - -The browser check drives Firefox through the real app. It needs a running server, and it adds, removes and re-adds the test book (ISBN 9781593278281 unless `ISBN` is set), so point the server at a scratch database (`BOOKSORTER_DB=/tmp/scratch.db npm start`) rather than your real one. The first run looks the book up live, which can take a minute: - -``` -npx playwright install firefox # once -npm start # in another terminal -npm run browser-check # or: node scripts/browser-check.ts [url] -``` - -Set `SHOTS=/some/dir` to save screenshots, and `ISBN=` to use a different already-resolved book. It checks that the page loads cleanly and calls only localhost, the tabs render, a typed ISBN is resolved, a generated EAN-13 barcode is decoded by the same wasm detector the camera uses, Firefox's fake camera starts and stops, and the print queue produces a PDF. It uses a fake camera, so it cannot prove that your own webcam reads real barcodes well. diff --git a/package-lock.json b/package-lock.json index 381f6a9..e922539 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,6 @@ "devDependencies": { "@types/node": "^26.6.6", "esbuild": "^0.28.2", - "playwright": "^1.65.1", "typescript": "^7.0.2" } }, @@ -1035,35 +1034,6 @@ "tslib": "^1.11.1" } }, - "node_modules/playwright": { - "version": "1.65.1", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.65.1.tgz", - "integrity": "sha512-vJ1FuoOrNwOKHUIVEvSt3jT1L+wjjDpwhwIstKtfvTh8XIG4FG4bIFuvNdMxi81LGfAhUgUZleVFaOLY4RIUUw==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "playwright-core": "1.65.1" - }, - "bin": { - "playwright": "cli.js" - }, - "engines": { - "node": ">=20" - } - }, - "node_modules/playwright-core": { - "version": "1.65.1", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.65.1.tgz", - "integrity": "sha512-hqPpz7blSMPxWVdoeE1yiBSzXsKiVOd2k+kjCvmUywD2GPO2Dd9HfcWnq9NN0GHbNZDFgZ9JfBFr+X5/BLo0qw==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "playwright-core": "cli.js" - }, - "engines": { - "node": ">=20" - } - }, "node_modules/preact": { "version": "11.2.0", "resolved": "https://registry.npmjs.org/preact/-/preact-11.2.0.tgz", diff --git a/package.json b/package.json index 9d3474a..6faa6b0 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,6 @@ "scripts": { "test": "node --test \"src/**/*.test.ts\"", "typecheck": "tsc --noEmit", - "browser-check": "node scripts/browser-check.ts", "build": "node scripts/build-web.ts", "start": "npm run build && node src/server/main.ts" }, @@ -23,7 +22,6 @@ "devDependencies": { "@types/node": "^26.6.6", "esbuild": "^0.28.2", - "playwright": "^1.65.1", "typescript": "^7.0.2" } } diff --git a/scripts/browser-check.ts b/scripts/browser-check.ts deleted file mode 100644 index 1722bfc..0000000 --- a/scripts/browser-check.ts +++ /dev/null @@ -1,424 +0,0 @@ -// Drives Chromium (the browser the app is used in) and Firefox against a running Booksorter server. -// Usage: node scripts/browser-check.ts [baseUrl] (point the server at a scratch database) -// npx playwright install chromium firefox # once -// PORT=4323 BOOKSORTER_DB=/tmp/scratch.db npm start # in another terminal -// Env: SHOTS= saves 1280px dark-mode screenshots; ISBN= uses another already-resolved book. -// The camera is Chromium's fake camera playing a .y4m video of an EAN-13 barcode that this script renders. -// It adds, removes and re-adds the test book, and invents a few books in the page (never on the server) to -// hold the "looking up" and "needs attention" states still. -import { chromium, firefox } from 'playwright'; -import type { Browser, BrowserContext, Page } from 'playwright'; -import { build } from 'esbuild'; -import { mkdirSync, mkdtempSync } from 'node:fs'; -import { tmpdir } from 'node:os'; -import { join } from 'node:path'; -import { fileURLToPath } from 'node:url'; -import { makeBarcodeY4m } from './browser-media.ts'; - -const base = process.argv[2] ?? 'http://localhost:4321'; -if (new URL(base).port === '4321' && !process.env.ALLOW_4321) { console.error('Refusing to run against port 4321 (the real database). Use a scratch server.'); process.exit(2); } -const shots = process.env.SHOTS; -if (shots) mkdirSync(shots, { recursive: true }); -const ISBN = process.env.ISBN ?? '9781593278281'; -const ISBN2 = '9780201835953'; // used only for invented books, never looked up -const root = fileURLToPath(new URL('..', import.meta.url)); -const work = mkdtempSync(join(tmpdir(), 'booksorter-check-')); - -const failures: string[] = []; -const check = (name: string, ok: boolean, detail = '') => { - console.log(`${ok ? 'PASS' : 'FAIL'} ${name}${detail ? ' ' + detail : ''}`); - if (!ok) failures.push(name); -}; -const norm = (s: string) => s.replace(/\s+/g, ' ').trim(); - -const consoleErrors: string[] = []; -const badRequests: string[] = []; -const foreign: string[] = []; -function watch(page: Page, label: string) { - page.on('console', (m) => { if (m.type() === 'error') consoleErrors.push(`${label}: ${m.text()}`); }); - page.on('pageerror', (e) => consoleErrors.push(`${label}: ${e}`)); - page.on('requestfailed', (r) => badRequests.push(`${label}: ${r.url()} ${r.failure()?.errorText}`)); - page.on('response', (r) => { if (r.status() >= 400) badRequests.push(`${label}: ${r.url()} ${r.status()}`); }); - page.on('request', (r) => { - const u = new URL(r.url()); - if (!['localhost', '127.0.0.1'].includes(u.hostname) && !['blob:', 'data:', 'about:'].includes(u.protocol)) foreign.push(r.url()); - }); -} -const shot = async (page: Page, name: string) => { if (shots) await page.screenshot({ path: `${shots}/${name}.png`, fullPage: true }); }; -const section = async (name: string, fn: () => Promise) => { - console.log(`\n# ${name}`); - try { await fn(); } catch (e) { check(`${name}: ran to completion`, false, String(e).split('\n')[0]); } -}; - -const api = (page: Page, path: string, init?: { method?: string; body?: unknown }): Promise => - page.evaluate(async ({ path, init }) => { - const r = await fetch(path, { method: init?.method ?? 'GET', headers: init?.body ? { 'Content-Type': 'application/json' } : undefined, body: init?.body ? JSON.stringify(init.body) : undefined }); - const t = await r.text(); - return t ? JSON.parse(t) : null; - }, { path, init }); - -const removeBook = (page: Page, isbn: string) => page.evaluate(async (isbn) => { - const books = await (await fetch('/api/books?filter=all')).json(); - for (const b of books.filter((x: any) => x.isbn13 === isbn)) await fetch(`/api/books/${b.id}`, { method: 'DELETE' }); -}, isbn); - -const fakeBook = (id: number, over: Record) => ({ - id, isbn13: null, lccn: null, title: `Book ${id}`, subtitle: null, authors: ['A. Writer'], publisher: null, year: null, subjects: [], - callNumber: null, sortKey: null, confidence: null, source: null, dewey: null, status: 'pending', attentionReason: null, - manualOverride: false, inQueue: true, printedAt: null, createdAt: new Date().toISOString(), updatedAt: new Date().toISOString(), ...over, -}); - -/** Answer POST /api/scan for one ISBN with an invented book instead of asking the server. */ -async function inventScan(page: Page, isbn: string, book: Record) { - await page.route('**/api/scan', async (route) => { - const sent = route.request().postDataJSON(); - if (sent?.isbn === isbn) await route.fulfill({ json: { book, duplicate: false } }); - else await route.fallback(); - }); -} - -const rows = (page: Page) => page.locator('.scan .right li.book'); -const statusLine = (page: Page) => page.getByRole('status').filter({ hasText: /\S/ }).first(); - -// Bundle the production scanner so a page can call its decode functions directly. -const bundled = await build({ - stdin: { contents: "export * from './src/web/scanner.ts';", resolveDir: root, loader: 'ts' }, - bundle: true, format: 'esm', write: false, target: 'es2022', logLevel: 'silent', -}); -const scannerJs = bundled.outputFiles[0].text.replaceAll('https://fastly.jsdelivr.net/npm/', '/local-only/'); - -// Videos for the fake camera: a barcode on white at a readable size, a hard (small, soft) one, and an empty page. -const videoOk = join(work, 'barcode.y4m'); -const videoHard = join(work, 'barcode-small.y4m'); -const videoBlank = join(work, 'blank.y4m'); -makeBarcodeY4m(videoOk, { isbn: ISBN, moduleScale: 2.0, frames: 24 }); -makeBarcodeY4m(videoHard, { isbn: ISBN, moduleScale: 1.6, frames: 24 }); -makeBarcodeY4m(videoBlank, { isbn: ISBN, moduleScale: 0.01, frames: 4 }); - -const chromiumFor = (video: string) => chromium.launch({ - headless: true, - args: ['--use-fake-device-for-media-stream', '--use-fake-ui-for-media-stream', `--use-file-for-fake-video-capture=${video}`], -}); -const darkContext = (b: Browser, extra: Parameters[0] = {}) => - b.newContext({ viewport: { width: 1280, height: 900 }, colorScheme: 'dark', permissions: ['camera'], ...extra }); - -/** Records every stream the page opens, and every change of the status line, for later assertions. */ -const instrument = (ctx: BrowserContext, gumDelayMs = 0) => ctx.addInitScript((delay) => { - const w = window as any; - w.__streams = []; w.__statuses = []; w.__flashes = 0; - const md = navigator.mediaDevices; - const orig = md.getUserMedia.bind(md); - md.getUserMedia = async (c) => { - if (delay) await new Promise((r) => setTimeout(r, delay)); - const s = await orig(c); w.__streams.push(s); return s; - }; - new MutationObserver((list) => { - for (const m of list) { - const t = m.target as HTMLElement; - if (t.classList?.contains('video-wrap') && t.classList.contains('flash')) w.__flashes++; - } - const st = document.querySelector('p.status'); - if (st && st.textContent && w.__statuses[w.__statuses.length - 1] !== st.textContent) w.__statuses.push(st.textContent); - }).observe(document, { subtree: true, childList: true, attributes: true, characterData: true }); -}, gumDelayMs); -const liveTracks = (page: Page) => page.evaluate(() => (window as any).__streams.flatMap((s: MediaStream) => s.getTracks()).filter((t: MediaStreamTrack) => t.readyState === 'live').length); - -let server404 = false; -try { const r = await fetch(base); server404 = !r.ok; } catch { server404 = true; } -if (server404) { console.error(`No Booksorter server answering at ${base}`); process.exit(2); } - -// --------------------------------------------------------------------------------------------------- -// 1. Typed ISBNs: one Enter is one request and one row (Chromium and Firefox) -// --------------------------------------------------------------------------------------------------- -for (const [name, type] of [['chromium', chromium], ['firefox', firefox]] as const) { - await section(`${name}: typed ISBN`, async () => { - const browser = await type.launch({ headless: true }); - const ctx = await browser.newContext({ viewport: { width: 1280, height: 900 }, colorScheme: 'dark' }); - const page = await ctx.newPage(); watch(page, name); - const posts: string[] = []; - page.on('request', (r) => { if (r.url().endsWith('/api/scan') && r.method() === 'POST') posts.push(r.postData() ?? ''); }); - await page.goto(base, { waitUntil: 'networkidle' }); - await removeBook(page, ISBN); // the lookup cache makes the re-add quick; a scratch database is assumed - const box = page.getByLabel('ISBN'); - check('ISBN box is focused on load', await box.evaluate((el) => el === document.activeElement)); - check('page loads, Scan tab renders', await page.getByRole('heading', { name: 'This session' }).isVisible()); - await box.fill(ISBN); - await box.press('Enter'); - await rows(page).first().waitFor(); - await page.waitForTimeout(700); - check('one typed ISBN + Enter sends exactly one POST /api/scan', posts.length === 1, `${posts.length} request(s)`); - check('one typed ISBN makes exactly one row', (await rows(page).count()) === 1); - await rows(page).first().locator('[data-state]').or(rows(page).first()).first().waitFor(); - await page.locator('.scan .right li.book:not(.looking)').first().waitFor({ timeout: 150_000 }); - const text = norm(await rows(page).first().innerText()); - check('the row shows one state', /Ready|Needs attention/.test(text) && !/Looking up/.test(text), text.slice(0, 120)); - - await box.fill(ISBN); - await box.press('Enter'); - await page.waitForTimeout(800); - check('typing the same ISBN again leaves one row', (await rows(page).count()) === 1, `${await rows(page).count()} row(s), ${posts.length} POSTs`); - check('the book already in this session is not marked "Already in catalog"', !/Already in catalog/.test(await rows(page).first().innerText())); - - // Two Enters while the first request is still in flight: still one request, one row. - await page.route('**/api/scan', async (route) => { await new Promise((r) => setTimeout(r, 600)); await route.fallback(); }); - const before = posts.length; - await box.fill(ISBN); await box.press('Enter'); - await box.fill(ISBN); await box.press('Enter'); - await page.waitForTimeout(1500); - check('two quick Enters for one ISBN send one request', posts.length - before === 1, `${posts.length - before} request(s)`); - check('and still one row', (await rows(page).count()) === 1); - - // Reload: the book is now an earlier one, so it is shown once with the note. - await page.reload({ waitUntil: 'networkidle' }); - await page.getByLabel('ISBN').fill(ISBN); await page.getByLabel('ISBN').press('Enter'); - await rows(page).first().waitFor(); - const earlier = norm(await rows(page).first().innerText()); - check('a book from an earlier session shows one row with "Already in catalog"', (await rows(page).count()) === 1 && /Already in catalog/.test(earlier), earlier.slice(0, 120)); - await browser.close(); - }); -} - -// --------------------------------------------------------------------------------------------------- -// 2. States, summary, queue (Chromium, invented books for the states that cannot be held still for real) -// --------------------------------------------------------------------------------------------------- -await section('session states, summary and print queue', async () => { - const browser = await chromium.launch({ headless: true }); - const ctx = await browser.newContext({ viewport: { width: 1280, height: 900 }, colorScheme: 'dark' }); - const page = await ctx.newPage(); watch(page, 'states'); - await page.goto(base, { waitUntil: 'networkidle' }); - await removeBook(page, ISBN); - const pendingBook = fakeBook(900001, { isbn13: ISBN2, title: 'The Mythical Man-Month', authors: ['Frederick P. Brooks'], attentionReason: 'Library of Congress did not answer. Trying again shortly.' }); - await inventScan(page, ISBN2, pendingBook); - const attentionBook = fakeBook(900002, { isbn13: null, title: 'A Book Nobody Catalogued', authors: ['Anon.'], status: 'needs_attention', attentionReason: 'No catalog record matched this ISBN.', inQueue: false }); - await page.route('**/api/books/lccn', (route) => route.fulfill({ json: { book: attentionBook } })); - - // Ready book 1: typed ISBN (resolved from cache). Ready book 2: entered by hand with a call number. - const box = page.getByLabel('ISBN'); - await box.fill(ISBN); await box.press('Enter'); - await page.locator('.scan .right li.book.ready').first().waitFor({ timeout: 150_000 }); - await page.locator('summary', { hasText: 'Enter by hand' }).click(); - const manual = page.locator('details', { hasText: 'Enter by hand' }); - await manual.getByLabel('Title').fill('Structure and Interpretation of Computer Programs'); - await manual.getByLabel('Authors (separate with ;)').fill('Harold Abelson; Gerald Jay Sussman'); - await manual.getByLabel('Call number (optional)').fill('QA76.6 .A24 1996'); - await manual.getByRole('button', { name: 'Add' }).click(); - await page.locator('.scan .right li.book.ready', { hasText: 'Structure and Interpretation' }).waitFor(); - // Looking-up book (invented scan), and a needs-attention book (invented LCCN answer). - await box.fill(ISBN2); await box.press('Enter'); - await rows(page).first().waitFor(); - await page.locator('summary', { hasText: 'Enter LCCN' }).click(); - const lccn = page.locator('details', { hasText: 'Enter LCCN' }); - await lccn.getByLabel('LCCN').fill('00000000'); - await lccn.getByRole('button', { name: 'Add' }).click(); - await page.locator('.scan .right li.book.attention').waitFor(); - await page.waitForTimeout(2200); // let the seconds count - - const summary = norm(await page.locator('.scan .summary').innerText()); - check('summary counts all four rows', summary === '4 scanned · 2 ready · 1 looking up · 1 needs attention', summary); - const looking = rows(page).filter({ hasText: 'Looking up' }); - const lookingText = norm(await looking.innerText()); - check('a pending book shows Looking up with elapsed seconds', /Looking up… \d+ s/.test(lookingText), lookingText); - check('a pending book shows its retry note', lookingText.includes('Trying again shortly')); - check('a pending book never says "No call number"', !/No call number/.test(lookingText)); - check('a pending book has a spinner', (await looking.locator('.spinner').count()) === 1); - const secs = Number(/(\d+) s/.exec(lookingText)?.[1] ?? 0); - check('the elapsed seconds are counting', secs >= 2, `${secs} s`); - const attn = norm(await rows(page).filter({ hasText: 'Needs attention' }).innerText()); - check('a needs-attention row shows the reason and a Fix button', attn.includes('No catalog record matched') && attn.includes('Fix'), attn); - check('every row shows exactly one state label', - (await rows(page).evaluateAll((els) => els.map((e) => e.querySelectorAll('.state-label').length))).every((n) => n === 1)); - await rows(page).filter({ hasText: 'Needs attention' }).getByRole('button', { name: 'Fix' }).click(); - check('Fix opens the editor', await page.getByLabel('Call number', { exact: true }).isVisible()); - // The year field rejects text, never sends NaN. - let patched = false; - await page.route('**/api/books/900002', async (route) => { patched = true; await route.fulfill({ json: attentionBook }); }); - await page.locator('.editor').getByLabel('Year').fill('abc'); - await page.locator('.editor').getByRole('button', { name: 'Save' }).click(); - check('the editor shows an error for a non-numeric year and sends nothing', (await page.locator('.editor [role=alert]').first().isVisible()) && !patched); - await page.locator('.editor').getByLabel('Year').fill(''); - await page.locator('.editor').getByRole('button', { name: 'Save' }).click(); - await page.waitForTimeout(300); - check('an empty year is saved as null', patched); - await shot(page, 'scan-three-states'); - - // Print queue - const readyCount = (await api(page, '/api/books?filter=queue')).filter((b) => b.status === 'resolved' && b.callNumber).length; - await page.getByRole('tab', { name: /^Print queue/ }).click(); - await page.getByRole('heading', { name: 'Print queue' }).waitFor(); - const head = norm(await page.locator('.queue .summary').innerText()); - const want = `${readyCount} ${readyCount === 1 ? 'card' : 'cards'} ready · 1 still looking up`; - check('queue header counts ready and looking-up books', head === want, `${head} (expected ${want})`); - check('the pending book is listed in the queue, greyed, with the spinner', (await page.locator('.queue li.item.dim .spinner').count()) === 1); - check('the tab label counts queued books (ready + looking up)', norm(await page.getByRole('tab', { name: /^Print queue/ }).innerText()) === `Print queue (${readyCount + 1})`); - check('"Needs attention" does not claim every book has a call number', !/Every book has a call number/.test(await page.locator('.queue').innerText())); - const pdfBtn = page.getByRole('button', { name: /^Make PDF/ }); - check('Make PDF says how many cards', norm(await pdfBtn.innerText()) === `Make PDF (${readyCount} ${readyCount === 1 ? 'card' : 'cards'})`, norm(await pdfBtn.innerText())); - await shot(page, 'queue-ready-and-looking'); - const [pdfResp] = await Promise.all([page.waitForResponse((r) => r.url().includes('/api/print.pdf')), pdfBtn.click()]); - const body = await pdfResp.body(); - check('Make PDF fetches a PDF', pdfResp.status() === 200 && body.subarray(0, 4).toString() === '%PDF', `${body.length} bytes`); - await page.getByText('Did the cards print correctly?').waitFor(); - await page.getByRole('button', { name: 'Not yet' }).click(); - await shot(page, 'queue-after-pdf'); - const catalog = page.getByRole('tab', { name: /^Catalog/ }); - await catalog.click(); - await page.waitForTimeout(400); - check('Catalog tab renders', (await page.locator('main').innerText()).trim().length > 0); - await browser.close(); -}); - -await section('print queue with nothing ready', async () => { - const browser = await chromium.launch({ headless: true }); - const ctx = await browser.newContext({ viewport: { width: 1280, height: 900 }, colorScheme: 'dark' }); - const page = await ctx.newPage(); watch(page, 'empty-queue'); - // Show only a pending book: the server's list is answered by an invented one. - await page.route('**/api/books?*', (route) => route.fulfill({ json: [fakeBook(900003, { title: 'Still Looking' })] })); - await page.goto(base, { waitUntil: 'networkidle' }); - await page.getByRole('tab', { name: /^Print queue/ }).click(); - const head = norm(await page.locator('.queue .summary').innerText()); - check('queue with only a pending book reads "0 cards ready · 1 still looking up"', head === '0 cards ready · 1 still looking up', head); - const pdfBtn = page.getByRole('button', { name: /^Make PDF/ }); - check('Make PDF is disabled with an explanation', (await pdfBtn.isDisabled()) && (await page.locator('#pdf-why').innerText()).includes('No card is ready yet')); - check('the tab label says (1)', norm(await page.getByRole('tab', { name: /^Print queue/ }).innerText()) === 'Print queue (1)'); - await browser.close(); -}); - -// --------------------------------------------------------------------------------------------------- -// 3. The camera, in Chromium with a fake camera playing a video of a barcode -// --------------------------------------------------------------------------------------------------- -await section('camera: Start camera reads the barcode from video alone', async () => { - const browser = await chromiumFor(videoOk); - const ctx = await darkContext(browser); - await instrument(ctx); - const page = await ctx.newPage(); watch(page, 'camera'); - const posts: string[] = []; - page.on('request', (r) => { if (r.url().endsWith('/api/scan') && r.method() === 'POST') posts.push(r.postData() ?? ''); }); - await page.goto(base, { waitUntil: 'networkidle' }); - await removeBook(page, ISBN); - check('camera off: Start camera is in the middle of the video area', await page.locator('.video-empty').getByRole('button', { name: 'Start camera' }).isVisible()); - check('camera off: the status line says so', /camera is off/i.test(await statusLine(page).innerText())); - - await page.getByRole('button', { name: 'Start camera' }).dblclick(); // a double click must not open two streams - await page.getByText('Hold the barcode inside the box').waitFor({ timeout: 20_000 }); - check('the target box and instruction are shown', await page.locator('.target').isVisible()); - check('the Scanning indicator is shown', await page.locator('.scanning').isVisible()); - await page.waitForFunction(() => (window as any).__statuses.some((s: string) => /^Read \d{13}$/.test(s)), null, { timeout: 30_000 }); - const statuses: string[] = await page.evaluate(() => (window as any).__statuses); - check('status line went "Looking for a barcode…" then "Read "', statuses.includes('Looking for a barcode…') && statuses.includes(`Read ${ISBN}`), JSON.stringify(statuses)); - check('the video border flashed green on the read', (await page.evaluate(() => (window as any).__flashes)) >= 1); - await rows(page).first().waitFor({ timeout: 15_000 }); - await page.waitForTimeout(1500); - check('the book appeared in the session list from the camera alone, one row', (await rows(page).count()) === 1, norm(await rows(page).first().innerText()).slice(0, 100)); - check('a barcode held in view posts once, not once per frame', posts.length === 1, `${posts.length} POST(s)`); - check('a double click on Start camera opened one stream', (await page.evaluate(() => (window as any).__streams.length)) === 1); - check('the video has real size', await page.evaluate(() => { const v = document.querySelector('video')!; return v.videoWidth > 0; })); - await shot(page, 'scan-camera-read'); - - // Capture button and Space - await page.waitForFunction(() => document.querySelector('p.status')?.textContent === 'Looking for a barcode…', null, { timeout: 10_000 }); - const mark = await page.evaluate(() => (window as any).__statuses.length); - await page.getByRole('button', { name: 'Capture' }).click(); - await page.waitForFunction((m) => (window as any).__statuses.slice(m).some((s: string) => /^Read \d{13}$/.test(s)), mark, { timeout: 20_000 }); - const after: string[] = await page.evaluate((m) => (window as any).__statuses.slice(m), mark); - check('Capture takes a picture and reads the barcode', after[0] === 'Taking a picture and reading it…' && after.includes(`Read ${ISBN}`), JSON.stringify(after)); - await page.waitForFunction(() => document.querySelector('p.status')?.textContent === 'Looking for a barcode…', null, { timeout: 10_000 }); - const mark2 = await page.evaluate(() => (window as any).__statuses.length); - await page.locator('video').click({ force: true }); // focus leaves the text field - await page.evaluate(() => (document.activeElement as HTMLElement)?.blur?.()); - await page.keyboard.press('Space'); - await page.waitForFunction((m) => (window as any).__statuses.slice(m).includes('Taking a picture and reading it…'), mark2, { timeout: 10_000 }); - check('Space triggers Capture when focus is not in a text field', true); - await page.waitForFunction((m) => (window as any).__statuses.slice(m).some((s: string) => /^Read \d{13}$/.test(s)), mark2, { timeout: 20_000 }); - const box = page.getByLabel('ISBN'); - await box.focus(); await page.keyboard.press('Space'); - check('Space in the ISBN box also captures and types no space', (await box.inputValue()) === ''); - check('the Capture reads never added a second row', (await rows(page).count()) === 1); - - // Remembered: reload starts the camera by itself; Stop forgets it. - await page.reload({ waitUntil: 'networkidle' }); - await page.getByRole('button', { name: 'Stop camera' }).waitFor({ timeout: 20_000 }); - check('after a reload the camera starts by itself (permission already granted)', true); - await page.getByRole('button', { name: 'Stop camera' }).click(); - await page.getByRole('button', { name: 'Start camera' }).waitFor(); - check('Stop camera releases every stream', (await liveTracks(page)) === 0); - await page.reload({ waitUntil: 'networkidle' }); - await page.waitForTimeout(800); - check('after Stop and a reload the camera stays off, with the Start button in the video area', await page.locator('.video-empty').getByRole('button', { name: 'Start camera' }).isVisible()); - await browser.close(); -}); - -await section('camera: leaving the view while the permission prompt is open', async () => { - const browser = await chromiumFor(videoOk); - const ctx = await darkContext(browser); - await instrument(ctx, 1500); // getUserMedia answers 1.5 s late, like a person reading the prompt - const page = await ctx.newPage(); watch(page, 'prompt'); - await page.goto(base, { waitUntil: 'networkidle' }); - const btn = page.getByRole('button', { name: /^Start camera|^Starting camera/ }); - await btn.click(); - check('Start is disabled while starting', await page.getByRole('button', { name: 'Starting camera…' }).isDisabled()); - await page.getByRole('tab', { name: /^Print queue/ }).click(); // the Scan view unmounts mid-prompt - await page.waitForFunction(() => (window as any).__streams.length === 1, null, { timeout: 10_000 }); - await page.waitForTimeout(300); - check('the stream that arrives after leaving is stopped at once', (await liveTracks(page)) === 0); - await browser.close(); -}); - -await section('camera: nothing readable in view', async () => { - const browser = await chromiumFor(videoBlank); - const ctx = await darkContext(browser); - await instrument(ctx); - const page = await ctx.newPage(); watch(page, 'blank'); - await page.goto(base, { waitUntil: 'networkidle' }); - await page.getByRole('button', { name: 'Start camera' }).click(); - await page.getByText('Hold the barcode inside the box').waitFor({ timeout: 20_000 }); - await page.waitForTimeout(1000); - check('with no barcode the status stays "Looking for a barcode…"', (await statusLine(page).innerText()) === 'Looking for a barcode…'); - await page.getByRole('button', { name: 'Capture' }).click(); - await page.getByText('No barcode found in that picture. Move closer, add light, or type the ISBN below.').waitFor({ timeout: 20_000 }); - check('Capture says plainly when it finds nothing', true); - check('and no row was added', (await rows(page).count()) === 0); - await browser.close(); -}); - -await section('decoder: the thorough decode reads a small, soft barcode the live loop misses', async () => { - const browser = await chromiumFor(videoHard); - const ctx = await darkContext(browser); - const page = await ctx.newPage(); watch(page, 'decode'); - await page.route('**/__check/scanner.js', (route) => route.fulfill({ contentType: 'text/javascript', body: scannerJs })); - await page.goto(base, { waitUntil: 'networkidle' }); - const r = await page.evaluate(async (isbn) => { - const mod = await import(/* @vite-ignore */ ('/__check/' + 'scanner.js')); mod.prepare(); - const stream = await navigator.mediaDevices.getUserMedia({ video: { width: 1920, height: 1080 } }); - const v = document.createElement('video'); v.srcObject = stream; v.muted = true; await v.play(); - await new Promise((res) => setTimeout(res, 500)); - const live = await mod.decodeLive(v); const thorough = await mod.decodeThorough(v); - stream.getTracks().forEach((t: MediaStreamTrack) => t.stop()); - return { live, thorough, isbn }; - }, ISBN); - check('thorough decode reads the small barcode', r.thorough.isbn === ISBN, JSON.stringify(r)); - check('live decode never returns a wrong ISBN for it', r.live.isbn === null || r.live.isbn === ISBN, JSON.stringify(r.live)); - await browser.close(); -}); - -// --------------------------------------------------------------------------------------------------- -// 4. Firefox's fake camera starts and stops -// --------------------------------------------------------------------------------------------------- -await section('firefox: fake camera starts and stops', async () => { - const browser = await firefox.launch({ headless: true, firefoxUserPrefs: { 'media.navigator.streams.fake': true, 'media.navigator.permission.disabled': true } }); - const ctx = await browser.newContext({ viewport: { width: 1280, height: 900 }, colorScheme: 'dark' }); - const page = await ctx.newPage(); watch(page, 'firefox-cam'); - await page.goto(base, { waitUntil: 'networkidle' }); - await page.getByRole('button', { name: 'Start camera' }).click(); - await page.getByRole('button', { name: 'Stop camera' }).waitFor({ timeout: 20_000 }); - check('Start camera plays video', await page.waitForFunction(() => { const v = document.querySelector('video') as HTMLVideoElement; return !!v.srcObject && v.videoWidth > 0 && !v.paused; }, null, { timeout: 15_000 }).then(() => true, () => false)); - await page.getByRole('button', { name: 'Stop camera' }).click(); - await page.getByRole('button', { name: 'Start camera' }).waitFor(); - check('Stop camera releases the stream', await page.evaluate(() => !(document.querySelector('video') as HTMLVideoElement).srcObject)); - await browser.close(); -}); - -check('no console errors', consoleErrors.length === 0, consoleErrors.join(' | ')); -check('no failed requests', badRequests.length === 0, badRequests.join(' | ')); -check('no request left localhost', foreign.length === 0, foreign.join(' | ')); -console.log(failures.length ? `\n${failures.length} check(s) failed: ${failures.join('; ')}` : '\nAll checks passed'); -process.exit(failures.length ? 1 : 0); diff --git a/scripts/browser-media.ts b/scripts/browser-media.ts deleted file mode 100644 index 557a1c0..0000000 --- a/scripts/browser-media.ts +++ /dev/null @@ -1,81 +0,0 @@ -// Helpers for scripts/browser-check.ts: an EAN-13 bitmap, and a .y4m video of it for Chromium's fake camera. -import { writeFileSync } from 'node:fs'; - -/** EAN-13 module pattern (95 modules, 1 = bar) for a 13-digit string. */ -export function ean13Modules(code: string): string { - const L = ['0001101', '0011001', '0010011', '0111101', '0100011', '0110001', '0101111', '0111011', '0110111', '0001011']; - const R = L.map((p) => [...p].map((b) => (b === '0' ? '1' : '0')).join('')); - const G = R.map((p) => [...p].reverse().join('')); - const parity = ['LLLLLL', 'LLGLGG', 'LLGGLG', 'LLGGGL', 'LGLLGG', 'LGGLLG', 'LGGGLL', 'LGLGLG', 'LGLGGL', 'LGGLGL']; - const d = [...code].map(Number); - let out = '101'; - for (let i = 0; i < 6; i++) out += parity[d[0]][i] === 'L' ? L[d[i + 1]] : G[d[i + 1]]; - out += '01010'; - for (let i = 7; i < 13; i++) out += R[d[i]]; - return out + '101'; -} - -export interface VideoOptions { - isbn: string; - width?: number; height?: number; frames?: number; - /** Pixels per barcode module. A real book held about 30 cm from a 720p webcam is roughly 1.2 to 2 px per module. */ - moduleScale?: number; -} - -/** Deterministic noise so a run is repeatable. */ -function rng(seed: number) { let s = seed >>> 0; return () => ((s = (Math.imul(s, 1664525) + 1013904223) >>> 0) / 4294967296); } - -/** Gray frames (Uint8Array, width*height) of a barcode on a white page: soft focus, sensor noise, hand jitter. */ -export function barcodeFrames(o: VideoOptions): Uint8Array[] { - const W = o.width ?? 1280, H = o.height ?? 720, n = o.frames ?? 24, m = o.moduleScale ?? 2.6; - const mods = ean13Modules(o.isbn); - const bw = 95 * m, bh = Math.round(bw * 0.62); - const rand = rng(7); - const frames: Uint8Array[] = []; - for (let f = 0; f < n; f++) { - const jx = (rand() - 0.5) * 5, jy = (rand() - 0.5) * 5; - const x0 = W / 2 - bw / 2 + jx, y0 = H / 2 - bh / 2 + jy; - const raw = new Float32Array(W * H); - for (let y = 0; y < H; y++) { - for (let x = 0; x < W; x++) { - let v = 238 - 14 * (x / W) - 8 * (y / H); // a lit page, slightly uneven - if (y >= y0 && y < y0 + bh) { - let dark = 0; - for (let s = 0; s < 4; s++) { // 4 samples across the pixel - const mi = Math.floor((x + (s + 0.5) / 4 - x0) / m); - if (mi >= 0 && mi < 95 && mods[mi] === '1') dark++; - } - v = v * (1 - dark / 4) + 22 * (dark / 4); - } - raw[y * W + x] = v; - } - } - // Soft focus: a [1 2 1] blur both ways, then noise. - const out = new Uint8Array(W * H); - const tmp = new Float32Array(W * H); - for (let y = 0; y < H; y++) for (let x = 0; x < W; x++) { - const a = raw[y * W + Math.max(0, x - 1)], b = raw[y * W + x], c = raw[y * W + Math.min(W - 1, x + 1)]; - tmp[y * W + x] = (a + 2 * b + c) / 4; - } - for (let y = 0; y < H; y++) for (let x = 0; x < W; x++) { - const a = tmp[Math.max(0, y - 1) * W + x], b = tmp[y * W + x], c = tmp[Math.min(H - 1, y + 1) * W + x]; - out[y * W + x] = Math.max(0, Math.min(255, Math.round((a + 2 * b + c) / 4 + (rand() - 0.5) * 8))); - } - frames.push(out); - } - return frames; -} - -/** Write gray frames as a YUV4MPEG2 (4:2:0) file, the format Chromium's --use-file-for-fake-video-capture reads. */ -export function writeY4m(path: string, frames: Uint8Array[], width: number, height: number): void { - const header = Buffer.from(`YUV4MPEG2 W${width} H${height} F30:1 Ip A1:1 C420jpeg\n`); - const chroma = Buffer.alloc((width / 2) * (height / 2) * 2, 128); - const parts: Buffer[] = [header]; - for (const f of frames) parts.push(Buffer.from('FRAME\n'), Buffer.from(f), chroma); - writeFileSync(path, Buffer.concat(parts)); -} - -export function makeBarcodeY4m(path: string, o: VideoOptions): void { - const W = o.width ?? 1280, H = o.height ?? 720; - writeY4m(path, barcodeFrames(o), W, H); -} diff --git a/src/server/jobs.ts b/src/server/jobs.ts index f07ed34..7fd077f 100644 --- a/src/server/jobs.ts +++ b/src/server/jobs.ts @@ -90,9 +90,10 @@ export function createJobs(deps: { if (book.year) input.year = book.year; const label = book.isbn13 ?? book.title; const started = Date.now(); + let similar = ''; const took = () => `${Date.now() - started} ms`; try { - const res = await resolver.resolve(input, { onMeta: (m) => applyMeta(id, m), tolerateLocFailure: final }); + const res = await resolver.resolve(input, { onMeta: (m) => applyMeta(id, m), tolerateLocFailure: final, onSimilar: (d) => { similar = d; } }); attempts.delete(id); const cur = db.getBook(id); if (!cur) return; @@ -106,7 +107,7 @@ export function createJobs(deps: { callNumber: res.callNumber, sortKey: res.sortKey, confidence: res.confidence, source: res.source, dewey, status: 'resolved', attentionReason: null, }); - log(`[lookup] ${label}: ${res.callNumber} (${res.source}) in ${took()}`); + log(`[lookup] ${label}: ${res.callNumber} (${res.source === 'similar' && similar ? `similar ${similar}` : res.source}) in ${took()}`); } else { const reason = res.reason ?? 'No Library of Congress number found'; emit(id, { dewey, status: 'needs_attention', attentionReason: reason }); diff --git a/src/server/resolve/match.test.ts b/src/server/resolve/match.test.ts index c33d194..e541a60 100644 --- a/src/server/resolve/match.test.ts +++ b/src/server/resolve/match.test.ts @@ -3,7 +3,7 @@ import assert from 'node:assert/strict'; import { normalizeTitle, recordMatches, titlesMatch } from './match.ts'; import type { MarcFields } from '../sources/marc.ts'; -const rec = (title: string, names: string[]): MarcFields => ({ lccn: null, lcc: [], dewey: null, meta: { title, authors: [], subjects: [] }, names }); +const rec = (title: string, names: string[]): MarcFields => ({ lccn: null, lcc: [], dewey: null, meta: { title, authors: [], subjects: [] }, names, topics: [] }); test('normalizeTitle', () => { assert.equal(normalizeTitle('The Mythical Man-Month: Essays on Software'), 'mythical man month'); diff --git a/src/server/resolve/resolver.test.ts b/src/server/resolve/resolver.test.ts index 1f5a10e..2c7dbba 100644 --- a/src/server/resolve/resolver.test.ts +++ b/src/server/resolve/resolver.test.ts @@ -217,7 +217,7 @@ test('title tier is skipped when the book has no author', async () => { const f = fixtureFetch(); const res = await createResolver({ fetch: f.fetch, cache: memCache(), sleep: noSleep }).resolve({ title: 'The Mythical Man-Month' }); assert.equal(res.callNumber, null); - assert.equal(f.locCalls().length, 0); + assert.equal(f.locCalls().filter((c) => decodeURIComponent(c).includes('bath.title')).length, 0); }); test('title tier ignores records for a different author', async () => { @@ -255,3 +255,69 @@ test('tolerateLocFailure: nothing from Open Library either still fails', async ( const r = createResolver({ fetch: locDown(f), cache: memCache(), sleep: noSleep }); await assert.rejects(r.resolve({ isbn13: '9780999999998' }, { tolerateLocFailure: true }), TemporaryError); }); + +const WIND_RIVER = { title: 'Beyond Trails in the Wind River Mountains of Wyoming', author: 'Nancy Pallister', year: 2025 }; + +test('similar tier: a book no catalogue has borrows the class of books on its subject', async () => { + const f = fixtureFetch(); + let detail = ''; + const res = await createResolver({ fetch: f.fetch, cache: memCache(), sleep: noSleep }) + .resolve(WIND_RIVER, { onSimilar: (d) => { detail = d; } }); + assert.equal(res.callNumber, 'GV199.42.W82 P35 2025'); + assert.equal(res.source, 'similar'); + assert.equal(res.confidence, 'approximate'); + assert.match(detail, /^GV199\.42\.W82 \(\d+ of \d+ candidates\)$/); +}); + +test('similar tier: nonsense words find nothing', async () => { + const f = fixtureFetch(); + const res = await createResolver({ fetch: f.fetch, cache: memCache(), sleep: noSleep }) + .resolve({ title: 'Xyzzy Plugh Quux Handbook', author: 'A. Nobody', year: 2020 }); + assert.equal(res.callNumber, null); + assert.equal(res.source, null); +}); + +test('similar tier: not tried for a book with no title', async () => { + const f = fixtureFetch(); + const res = await createResolver({ fetch: f.fetch, cache: memCache(), sleep: noSleep }).resolve({ isbn13: '9780999999998' }); + assert.equal(res.callNumber, null); + assert.equal(f.calls.some((c) => c.includes('q=')), false); +}); + +test('similar tier: searches are cached and make at most 3 Open Library and 2 LoC requests', async () => { + const f = fixtureFetch(); + const cache = memCache(); + const r = createResolver({ fetch: f.fetch, cache, sleep: noSleep }); + await r.resolve(WIND_RIVER); + const ol = f.calls.filter((c) => c.includes('openlibrary.org') && c.includes('q=')).length; + assert.ok(ol >= 1 && ol <= 3, String(ol)); + assert.ok(f.locCalls().filter((c) => decodeURIComponent(c).includes('bath.any')).length <= 2); + const before = f.calls.length; + const again = await r.resolve(WIND_RIVER); + assert.equal(again.callNumber, 'GV199.42.W82 P35 2025'); + // Only the (uncached) title search and nothing for the similar tier. + assert.equal(f.calls.slice(before).filter((c) => c.includes('q=') || c.includes('bath.any')).length, 0); +}); + +test('similar tier: the first four tiers win when they find a number', async () => { + const f = fixtureFetch(); + const res = await createResolver({ fetch: f.fetch, cache: memCache(), sleep: noSleep }).resolve({ isbn13: '9781593278281' }); + assert.equal(res.source, 'loc-isbn'); + assert.equal(f.calls.some((c) => c.includes('bath.any')), false); +}); + +test('similar tier: if the LoC is down, Open Library candidates alone vote', async () => { + const f = fixtureFetch(); + const inner = f.fetch; + const failLoc = ((u: string | URL | Request) => String(u).includes('loc.gov') ? Promise.reject(new Error('down')) : inner(u)) as typeof fetch; + const res = await createResolver({ fetch: failLoc, cache: memCache(), sleep: noSleep }).resolve(WIND_RIVER, { tolerateLocFailure: true }); + assert.equal(res.callNumber, 'GV199.42.W82 P35 2025'); + assert.equal(res.source, 'similar'); +}); + +test('similar tier: a LoC failure is still an error when not tolerated and nothing was found', async () => { + const f = fixtureFetch(); + const inner = f.fetch; + const failLoc = ((u: string | URL | Request) => String(u).includes('loc.gov') ? Promise.reject(new Error('down')) : inner(u)) as typeof fetch; + await assert.rejects(createResolver({ fetch: failLoc, cache: memCache(), sleep: noSleep }).resolve(WIND_RIVER), TemporaryError); +}); diff --git a/src/server/resolve/resolver.ts b/src/server/resolve/resolver.ts index 5a95769..e717e3a 100644 --- a/src/server/resolve/resolver.ts +++ b/src/server/resolve/resolver.ts @@ -4,6 +4,8 @@ import { chooseCallNumber } from './choose.ts'; import { createLoc } from '../sources/loc.ts'; import { createOpenLibrary } from '../sources/openlibrary.ts'; import type { OlInfo } from '../sources/openlibrary.ts'; +import { classified, finishSimilar, keywordsOf, mergeCandidates, queryPlan, voteSimilar } from './similar.ts'; +import type { SimilarCandidate } from './similar.ts'; import type { MarcFields } from '../sources/marc.ts'; import { TemporaryError } from '../sources/http.ts'; import { recordMatches } from './match.ts'; @@ -16,6 +18,8 @@ export interface ResolveOpts { onMeta?: (meta: BookMeta) => void; /** Last-attempt mode: a Library of Congress failure is not fatal; use Open Library's numbers if it has any. */ tolerateLocFailure?: boolean; + /** Called when the similar-books tier chose the number, for example "GV199.42.W8 (4 of 9 candidates)". */ + onSimilar?: (detail: string) => void; } export interface Resolver { @@ -51,11 +55,13 @@ export function createResolver(deps: { sleep?: (ms: number) => Promise; }): Resolver { const ol = createOpenLibrary({ fetch: deps.fetch, cache: deps.cache }); + const sleep = deps.sleep ?? ((ms: number) => new Promise((r) => setTimeout(r, ms))); const loc = createLoc({ fetch: deps.fetch, cache: deps.cache, intervalMs: deps.locIntervalMs ?? 6000, - sleep: deps.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms))), + sleep, }); + const OL_GAP_MS = 1000; async function resolve(input: ResolveInput, opts?: ResolveOpts): Promise { // In tolerant mode the first LoC failure switches the LoC tiers off for the rest of this lookup. @@ -151,6 +157,46 @@ export function createResolver(deps: { forChoose(meta), exactSource, ); + // Tier 5: borrow the class from similar books. Last resort, and only for a book with a title. + let olError: unknown = null; + if (!chosen && meta?.title) { + const kw = keywordsOf(meta.title, meta.subtitle, meta.subjects); + const groups: SimilarCandidate[][] = []; + let found = 0; + const plan = kw.title.length >= 2 ? queryPlan(kw.title) : queryPlan([...kw.title, ...kw.extra].slice(0, 3), 1); + for (const [i, words] of plan.entries()) { + if (i > 0) await sleep(OL_GAP_MS); + try { + const docs = await ol.similar(words); + groups.push(docs.map((d) => ({ title: d.title, ...(d.subtitle ? { subtitle: d.subtitle } : {}), subjects: d.subjects, lcc: d.lcc }))); + } catch (e) { + if (e instanceof TemporaryError) { olError = e; break; } + throw e; + } + found = classified(groups.flat()); + if (found >= 5) break; + } + const locWords = kw.title.slice(0, 3); + if (locWords.length > 0) { + for (const words of locWords.length > 2 ? [locWords, locWords.slice(0, 2)] : [locWords]) { + const recs = await locCall(() => loc.byKeywords(words)); + groups.push(recs.map((r) => ({ + title: r.meta.title ?? '', ...(r.meta.subtitle ? { subtitle: r.meta.subtitle } : {}), + subjects: [...(r.meta.subjects ?? []), ...r.topics], lcc: r.lcc.map((c) => c.raw), + }))); + if (classified(groups.at(-1)!) >= 5 || locError) break; + } + } + const vote = voteSimilar(kw, mergeCandidates(groups)); + if (vote) { + const done = finishSimilar(vote.key, forChoose(meta)); + if (done) { + chosen = { callNumber: done.callNumber, sortKey: done.sortKey, confidence: 'approximate', source: 'similar' }; + opts?.onSimilar?.(`${vote.key} (${vote.support} of ${vote.counted} candidates)`); + } + } + } + const dewey = locRecs.map((r) => r.dewey).find(Boolean) ?? edition?.dewey ?? work?.dewey ?? locTitleRecs.map((r) => r.dewey).find(Boolean) ?? null; @@ -162,6 +208,7 @@ export function createResolver(deps: { } // Open Library had nothing and the LoC could not be asked: report that, not "no number found". if (locError) throw locError; + if (olError) throw olError; return { meta, callNumber: null, sortKey: null, confidence: null, source: null, dewey, reason: meta ? 'No Library of Congress number found' : 'Not found in Open Library or the Library of Congress', diff --git a/src/server/resolve/similar.test.ts b/src/server/resolve/similar.test.ts new file mode 100644 index 0000000..a61c3bb --- /dev/null +++ b/src/server/resolve/similar.test.ts @@ -0,0 +1,143 @@ +import { test } from 'node:test'; +import assert from 'node:assert/strict'; +import { readFileSync } from 'node:fs'; +import { join } from 'node:path'; +import { classified, finishSimilar, keywordsOf, mergeCandidates, queryPlan, stem, voteSimilar } from './similar.ts'; +import type { SimilarCandidate } from './similar.ts'; +import { parseMarcXml } from '../sources/marc.ts'; +import { parseSimilar } from '../sources/openlibrary.ts'; + +const FIX = join(import.meta.dirname, '..', 'sources', 'fixtures'); +const c = (title: string, lcc: string[], subjects: string[] = []): SimilarCandidate => ({ title, subjects, lcc }); + +test('stem folds plurals and -ing', () => { + assert.equal(stem('hikes'), stem('hiking')); + assert.equal(stem('mountains'), stem('mountain')); + assert.equal(stem('birds'), stem('bird')); +}); + +test('keywords drop stop and generic words, numbers and short words', () => { + const k = keywordsOf('Beyond Trails in the Wind River Mountains of Wyoming'); + assert.deepEqual([...k.title].sort(), ['mountains', 'river', 'trails', 'wind', 'wyoming']); + assert.equal(k.title[0], 'mountains'); // longest first + assert.deepEqual(keywordsOf('100 Classic Hikes Utah').title.sort(), ['hikes', 'utah']); + assert.deepEqual(keywordsOf('The Complete Guide to the New Edition').title, []); +}); + +test('subjects add extra keywords, without noise or repeats of title words', () => { + const k = keywordsOf('Guns of August', undefined, ['World War, 1914-1918', 'Accessible book', 'Campaigns', 'Guns']); + assert.ok(k.extra.includes('campaigns')); + assert.ok(!k.extra.includes('accessible')); + assert.ok(!k.extra.includes('guns')); +}); + +test('query plan: widest first, fewer keywords after, at most 3, never one word for a multi-word title', () => { + const plan = queryPlan(['a1', 'b2', 'c3', 'd4', 'e5']); + assert.deepEqual(plan.map((p) => p.length), [5, 4, 3]); + assert.deepEqual(plan[2], ['a1', 'b2', 'c3']); + assert.deepEqual(queryPlan(['aa', 'bb']), [['aa', 'bb']]); + assert.deepEqual(queryPlan([]), []); +}); + +test('the same book from two searches counts once', () => { + const m = mergeCandidates([[c('Hiking Utah', ['GV199.42.U8 A1'])], [c('hiking utah', ['GV199.42.U8 B2'], ['Utah'])]]); + assert.equal(m.length, 1); + assert.equal(m[0]!.lcc.length, 2); + assert.equal(classified(m), 1); +}); + +test('votes by class key; two agreeing books win', () => { + const kw = keywordsOf('Hiking Utah Canyons'); + const v = voteSimilar(kw, [ + c('Hiking Utah canyons', ['GV199.42.U8 B1 2001']), + c('Utah canyons hiking guide', ['GV199.42.U8 C2 2005']), + c('Utah hiking', ['GV199.42.U8 D3 2010']), + c('Canyons of the Southwest', ['F788 .E5']), + ]); + assert.ok(v); + assert.equal(v.key, 'GV199.42.U8'); + assert.equal(v.support, 3); +}); + +test('one unrelated popular book does not capture a generic title', () => { + const kw = keywordsOf('Summer Guns'); + const v = voteSimilar(kw, [ + c('Guns of August', ['D530 .T8']), + c('Gun control', ['HV7436 .G86']), + c('Summer nights', ['PS3566 .A1']), + c('Summer rain', ['QC925 .R3']), + ]); + assert.equal(v, null); +}); + +test('a single candidate needs to match most of the keywords', () => { + const kw = keywordsOf('Alpine Wildflowers Colorado'); + assert.equal(voteSimilar(kw, [c('Alpine wildflowers of Colorado', ['QK144 .A4'])])?.key, 'QK144'); + assert.equal(voteSimilar(kw, [c('Alpine skiing', ['GV854 .A4']), c('Colorado history', ['F776 .H5'])]), null); +}); + +test('candidates matching too few keywords are ignored', () => { + const kw = keywordsOf('Alpine Wildflowers Colorado'); + assert.equal(voteSimilar(kw, [c('Alpine skiing', ['GV854 .A4']), c('Alpine lakes', ['GB1 .A1']), c('Alpine huts', ['GV854 .B1'])]), null); +}); + +test('scattered fine keys fall back to the class, and scattered classes return nothing', () => { + const kw = keywordsOf('Bread Baking Pizza'); + const v = voteSimilar(kw, [ + c('Bread baking', ['TX769 .A1 2000']), + c('Pizza and bread', ['TX770.P58 B1 2001']), + c('Baking bread, pizza', ['TX770.P58 C1 2002']), + c('Baking pizza', ['TX770.P6 D1 2003']), + ]); + assert.ok(v); + assert.match(v.key, /^TX7/); + assert.equal(voteSimilar(kw, [c('Bread baking', ['TX769 .A1']), c('Pizza bread', ['QA76 .B1']), c('Baking pizza', ['HD9 .C1'])]), null); +}); + +test('neighbouring classes do not cancel each other out', () => { + const kw = keywordsOf('Western Birds Field'); + const v = voteSimilar(kw, [ + c('Western birds', ['QL683.W4 A1']), c('Field birds western', ['QL683.W4 B1']), + c('Birds field', ['QL681 .C1']), c('Birds of the field', ['QL681 .D1']), + ]); + assert.ok(v); + assert.match(v.key, /^QL68[13]/); +}); + +test('author-numbered literature classes are never borrowed', () => { + const kw = keywordsOf('Dark Summer Novel'); + assert.equal(voteSimilar(kw, [c('Dark summer', ['PS3562 .A1']), c('Summer dark novel', ['PS3562 .A2'])]), null); +}); + +test('candidates without a parseable call number do not vote', () => { + const kw = keywordsOf('Hiking Utah'); + assert.equal(voteSimilar(kw, [c('Hiking Utah', ['CPB Box no. 1']), c('Utah hiking', [])]), null); +}); + +test('finish: own author cutter and year after the borrowed key', () => { + assert.deepEqual(finishSimilar('GV199.42.W8', { authors: ['Nancy Pallister'], title: 'Beyond Trails', year: 2025 })!.callNumber, 'GV199.42.W8 P35 2025'); + assert.equal(finishSimilar('TX769', { authors: ['Ken Forkish'], title: 'Flour', year: 2012 })!.callNumber, 'TX769.F67 2012'); + assert.equal(finishSimilar('QL683', { authors: [], title: 'A Field Guide' })!.callNumber, 'QL683.F54'); + assert.equal(finishSimilar('???', { authors: [], title: 'x' }), null); +}); + +test('real responses: Wind River Mountains votes for hiking in Wyoming, nonsense for nothing', () => { + const ol = parseSimilar(readFileSync(join(FIX, 'ol-similar-mountains-wyoming-trails.json'), 'utf8')); + const loc = parseMarcXml(readFileSync(join(FIX, 'loc-similar-mountains-wyoming.xml'), 'utf8')); + const cands = mergeCandidates([ + ol.map((d) => ({ title: d.title, ...(d.subtitle ? { subtitle: d.subtitle } : {}), subjects: d.subjects, lcc: d.lcc })), + loc.map((r) => ({ title: r.meta.title ?? '', subjects: [...(r.meta.subjects ?? []), ...r.topics], lcc: r.lcc.map((x) => x.raw) })), + ]); + const v = voteSimilar(keywordsOf('Beyond Trails in the Wind River Mountains of Wyoming'), cands); + assert.ok(v); + assert.match(v.key, /^GV199\.42/); + assert.ok(v.support >= 2); + assert.equal(voteSimilar(keywordsOf('Xyzzy Plugh Quux Handbook'), cands), null); +}); + +test('real responses: bread books vote for TX769', () => { + const loc = parseMarcXml(readFileSync(join(FIX, 'loc-similar-artisan-flour.xml'), 'utf8')); + const cands = loc.map((r) => ({ title: r.meta.title ?? '', subjects: [...(r.meta.subjects ?? []), ...r.topics], lcc: r.lcc.map((x) => x.raw) })); + const v = voteSimilar(keywordsOf('Artisan Flour Water Bread'), cands); + assert.equal(v?.key, 'TX769'); +}); diff --git a/src/server/resolve/similar.ts b/src/server/resolve/similar.ts new file mode 100644 index 0000000..f17474d --- /dev/null +++ b/src/server/resolve/similar.ts @@ -0,0 +1,245 @@ +import type { CallNumber } from '../../shared/callnumber.ts'; +import { cardLines, formatCallNumber, parseCallNumber, sortKey, withYear } from '../../shared/callnumber.ts'; +import { cutterFor, mainEntry } from '../../shared/cutter.ts'; + +// The fifth tier: when no catalogue has the book, shelve it where books on the same subject are shelved. +// Everything here is pure: the searches live in sources/, the wiring in resolver.ts. + +/** A book found by a keyword search, from either Open Library or the Library of Congress. */ +export interface SimilarCandidate { title: string; subtitle?: string; subjects: string[]; lcc: string[] } + +export interface Keywords { + /** From the title and subtitle, most distinctive first. These drive the queries and the support rules. */ + title: string[]; + /** From the book's own subjects; they only add a little to a candidate's score. */ + extra: string[]; +} + +export interface Vote { + /** The class key the winners share, for example GV199.42.W8 or TX769. */ + key: string; + /** How many candidates voted for it, and how many candidates were counted at all. */ + support: number; + counted: number; + level: 'fine' | 'cutter' | 'class'; +} + +const STOP = new Set(`a an the of in on at to for from by with without and or nor but as is are be was were it its this that these +those into onto about over under between through up down out off than then so not no your you my our their his her +guide guides book books edition editions complete completely new newly revised updated update third second first fourth fifth +beyond handbook introduction intro essential essentials ultimate definitive classic classics best great little big way ways +fundamentals basic basics practical modern vol volume part series story stories tales tale +user users reference manual illustrated annotated expanded anniversary collection selected works day days year years +one two three your more most all how what why who when where`.split(/\s+/)); + +// Words that turn up in Open Library subject lists without saying what a book is about. +const SUBJECT_NOISE = new Set(`accessible protected daisy large print fiction nonfiction juvenile general history study +lending library internet archive open in miscellanea miscellaneous`.split(/\s+/)); + +const plain = (s: string): string => s.normalize('NFD').replace(/[̀-ͯ]/g, '').toLowerCase(); + +/** A rough stem, so "hikes" matches "hiking" and "mountains" matches "mountain". */ +export function stem(w: string): string { + let s = w; + if (s.length > 4 && s.endsWith('ies')) s = s.slice(0, -3) + 'y'; + else if (s.length > 4 && /(ss|x|ch|sh)es$/.test(s)) s = s.slice(0, -2); + else if (s.length > 3 && s.endsWith('s') && !s.endsWith('ss') && !s.endsWith('us')) s = s.slice(0, -1); + if (s.length > 5 && s.endsWith('ing')) s = s.slice(0, -3); + else if (s.length > 5 && s.endsWith('ed')) s = s.slice(0, -2); + if (s.length > 3 && s.endsWith('e')) s = s.slice(0, -1); + return s; +} + +function words(s: string): string[] { + return plain(s).replace(/['’]s\b/g, '').split(/[^a-z0-9]+/).filter(Boolean); +} + +function usable(w: string): boolean { + return w.length >= 3 && !/^\d+$/.test(w) && !STOP.has(w); +} + +/** Distinct words, longer (so rarer, on the whole) first; ties keep their order in the title. */ +function ranked(ws: string[]): string[] { + const seen = new Set(); + const out: { w: string; i: number }[] = []; + ws.forEach((w, i) => { + const s = stem(w); + if (seen.has(s)) return; + seen.add(s); + out.push({ w, i }); + }); + return out.sort((a, b) => b.w.length - a.w.length || a.i - b.i).map((x) => x.w); +} + +export function keywordsOf(title: string, subtitle?: string, subjects: string[] = []): Keywords { + const t = ranked(words(`${title} ${subtitle ?? ''}`).filter(usable)); + const have = new Set(t.map(stem)); + const counts = new Map(); + for (const s of subjects) { + for (const w of new Set(words(s).filter((x) => usable(x) && !SUBJECT_NOISE.has(x)))) { + if (!have.has(stem(w))) counts.set(w, (counts.get(w) ?? 0) + 1); + } + } + const extra = [...counts].sort((a, b) => b[1] - a[1] || b[0].length - a[0].length).slice(0, 4).map((x) => x[0]); + return { title: t.slice(0, 8), extra }; +} + +/** Normalised form of the keywords; the cache key for a search. */ +export function keywordKey(kws: string[]): string { + return [...kws].map(stem).sort().join(' '); +} + +/** The keyword sets to try, widest first: all of them, then progressively fewer (dropping the shortest). At most `max`. */ +export function queryPlan(kws: string[], max = 3): string[][] { + if (kws.length === 0) return []; + const sizes = [kws.length, Math.ceil(kws.length * 0.7), Math.ceil(kws.length * 0.5)] + .map((n) => (kws.length >= 2 ? Math.max(2, n) : n)); + const out: string[][] = []; + for (const n of sizes) { + if (out.length < max && !out.some((o) => o.length === n)) out.push(kws.slice(0, n)); + } + return out; +} + +/** Normalised main title, for spotting the same book coming back from two searches. */ +function titleId(c: SimilarCandidate): string { + return plain(c.title.split(':')[0]!).replace(/[^a-z0-9]+/g, ' ').trim().replace(/^(a|an|the) /, ''); +} + +/** One candidate per book: the same title from Open Library and the Library of Congress counts once. */ +export function mergeCandidates(groups: SimilarCandidate[][]): SimilarCandidate[] { + const byId = new Map(); + for (const g of groups) { + for (const c of g) { + const id = titleId(c); + if (!id) continue; + const have = byId.get(id); + if (!have) { byId.set(id, { ...c, subjects: [...c.subjects], lcc: [...c.lcc] }); continue; } + have.subjects = [...new Set([...have.subjects, ...c.subjects])]; + have.lcc = [...have.lcc, ...c.lcc]; + have.subtitle ??= c.subtitle; + } + } + return [...byId.values()]; +} + +// Literature classes number each author, so a neighbour's number says nothing about this book. +const AUTHOR_CLASSES = new Set(['PQ', 'PR', 'PS', 'PT', 'PZ']); + +interface Keys { fine: string; cutter: string; cls: string } + +/** The three granularities of one call number: with its topical cutter, with that cutter cut short, and the bare class. */ +function keysOf(cn: CallNumber): Keys | null { + if (AUTHOR_CLASSES.has(cn.letters)) return null; + const fine = cardLines(cn)[0]; + const c0 = cn.cutters[0]; + const cutter = cn.cutters.length >= 2 && c0 ? `${cn.letters}${cn.number}${cn.decimal ? '.' + cn.decimal : ''}.${c0.letter}${c0.digits.slice(0, 1)}` : fine; + return { fine, cutter, cls: cn.letters + cn.number }; +} + +/** A candidate's own keys: the ones its (possibly several) call numbers agree on most. */ +function candidateKeys(c: SimilarCandidate): Keys | null { + const all = c.lcc.map(parseCallNumber).filter((x): x is CallNumber => x !== null).map(keysOf).filter((k): k is Keys => k !== null); + if (all.length === 0) return null; + const tally = new Map(); + for (const k of all) { + const t = tally.get(k.fine); + if (t) t.n++; else tally.set(k.fine, { k, n: 1 }); + } + return [...tally.values()].sort((a, b) => b.n - a.n)[0]!.k; +} + +interface Scored { keys: Keys; score: number; matched: number } + +function scoreCandidate(kw: Keywords, c: SimilarCandidate): { score: number; matched: number } { + const inTitle = new Set(words(`${c.title} ${c.subtitle ?? ''}`).map(stem)); + const inSubjects = new Set(c.subjects.flatMap(words).map(stem)); + let score = 0; + let matched = 0; + for (const k of kw.title) { + const s = stem(k); + const t = inTitle.has(s); + const j = inSubjects.has(s); + if (t || j) { matched++; score += j ? 1.5 : 1; } + } + for (const k of kw.extra) { + const s = stem(k); + if (inTitle.has(s) || inSubjects.has(s)) score += 0.5; + } + return { score, matched }; +} + +function neighbours(a: string, b: string): boolean { + const x = /^([A-Z]+)(\d+)/.exec(a); + const y = /^([A-Z]+)(\d+)/.exec(b); + return !!x && !!y && x[1] === y[1] && Math.abs(Number(x[2]) - Number(y[2])) <= 10; +} + +export interface VoteOpts { + /** Share of the counted score the winner must hold. */ + minShare?: number; + /** The winner must beat the runner-up by this factor. */ + margin?: number; +} + +/** + * Vote for the class most similar books share. A candidate counts only if it matches enough of the title's + * keywords. The winner needs real support (two candidates, or one that matches most keywords), a fair share of + * all the score, and a clear lead; otherwise the next coarser key gets the same test, and then nothing wins. + */ +export function voteSimilar(kw: Keywords, cands: SimilarCandidate[], opts: VoteOpts = {}): Vote | null { + const n = kw.title.length; + if (n === 0) return null; + const minMatched = n >= 3 ? 2 : 1; + const minShare = opts.minShare ?? 0.25; + const margin = opts.margin ?? 1.3; + const counted: Scored[] = []; + for (const c of cands) { + const keys = candidateKeys(c); + if (!keys) continue; + const { score, matched } = scoreCandidate(kw, c); + if (matched < minMatched) continue; + counted.push({ keys, score, matched }); + } + if (counted.length === 0) return null; + const total = counted.reduce((a, c) => a + c.score, 0); + for (const level of ['fine', 'cutter', 'class'] as const) { + const groups = new Map(); + for (const c of counted) { + const key = c.keys[level === 'class' ? 'cls' : level]; + const g = groups.get(key); + if (g) g.push(c); else groups.set(key, [c]); + } + const sums = [...groups].map(([key, g]) => ({ key, g, sum: g.reduce((a, c) => a + c.score, 0) })) + .sort((a, b) => b.sum - a.sum || b.g.length - a.g.length || a.key.length - b.key.length); + const win = sums[0]!; + // Keys a few class numbers away (QL681 and QL683) are neighbours on the shelf: they do not count as rivals, + // and their score counts towards the winner's share. + const near = sums.slice(1).filter((x) => neighbours(win.key, x.key)); + const rival = sums.slice(1).find((x) => !neighbours(win.key, x.key)); + const family = win.sum + near.reduce((a, x) => a + x.sum, 0); + const strong = win.g.length >= 2 || win.g.some((c) => c.matched / n >= 0.6); + if (!strong) continue; + if (family < minShare * total) continue; + if (rival && win.sum < margin * rival.sum) continue; + return { key: win.key, support: win.g.length, counted: counted.length, level }; + } + return null; +} + +/** Finish a borrowed class with this book's own author cutter and year, as a cataloguer would. */ +export function finishSimilar( + key: string, meta: { authors: string[]; title: string; year?: number }, +): { callNumber: string; sortKey: string } | null { + const cn = parseCallNumber(key); + if (!cn) return null; + const c = cutterFor(mainEntry(meta.authors, meta.title)); + let out: CallNumber = { ...cn, cutters: [...cn.cutters, { letter: c[0]!, digits: c.slice(1) }], suffix: '' }; + if (meta.year) out = withYear(out, meta.year); + return { callNumber: formatCallNumber(out), sortKey: sortKey(out) }; +} + +/** Does this keyword search return enough classified books to vote on? */ +export function classified(cands: SimilarCandidate[]): number { + return cands.filter((c) => c.lcc.some((l) => parseCallNumber(l) !== null)).length; +} diff --git a/src/server/sources/fixture-fetch.ts b/src/server/sources/fixture-fetch.ts index 7f20159..3ab15cc 100644 --- a/src/server/sources/fixture-fetch.ts +++ b/src/server/sources/fixture-fetch.ts @@ -12,9 +12,13 @@ export interface FixtureFetch { locOverride: string | null; } +const slug = (s: string) => s.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, ''); + function pick(u: URL, locOverride: string | null): string | null { if (u.hostname === 'openlibrary.org') { if (u.pathname === '/api/books') return `ol-data-${u.searchParams.get('bibkeys')!.replace('ISBN:', '')}.json`; + const kw = u.searchParams.get('q'); + if (kw) return `ol-similar-${slug(kw)}.json`; // keyword search for the similar-books tier const isbn = u.searchParams.get('isbn'); if (isbn) return `ol-search-${isbn}.json`; return 'ol-title-search.json'; @@ -24,6 +28,10 @@ function pick(u: URL, locOverride: string | null): string | null { const q = u.searchParams.get('query') ?? ''; const m = /^bath\.isbn=(\d+)$/.exec(q); if (m) return `loc-isbn-${m[1]}.xml`; + if (q.startsWith('bath.any=')) { + const name = `loc-similar-${slug(q.replace(/bath\.any=/g, '').replace(/ and /g, ' '))}.xml`; + return existsSync(join(DIR, name)) ? name : 'loc-isbn-9780999999998.xml'; // unknown keywords: zero records + } if (q.startsWith('bath.title=')) { return /mythical/i.test(q) ? 'loc-title-mythical-brooks.xml' : 'loc-isbn-9780999999998.xml'; // zero records } diff --git a/src/server/sources/fixtures/loc-similar-artisan-flour-water.xml b/src/server/sources/fixtures/loc-similar-artisan-flour-water.xml new file mode 100644 index 0000000..37198b9 --- /dev/null +++ b/src/server/sources/fixtures/loc-similar-artisan-flour-water.xml @@ -0,0 +1,250 @@ + +1.12marcxmlxml + 03204cam a22004214a 4500 + 17280132 + 20250607050442.0 + 120501s2012 caua 001 0 eng + + 17280132 + + + 7 + cbc + orignew + 1 + ecip + 20 + y-gencatlg + + + acquire + 2 shelf copies + policy default + + + xh12 2012-05-01 + xh12 2012-05-01 ONIX + rd13 2012-05-02 + xn03 2012-09-21 1 copy rec'd., to CIP ver.; + rg07 2012-09-25, c. 1 to CALM + rf18 2013-04-18 copy 2 added + + + LCAP batch update 2025-06-02-04:00: LCAPM-644 + + + 2012012080 + + + 9781607742739 + hardback + + + 9781607742746 + ebook + + + DLC + DLC + DLC + + + pcc + + + TX769 + .F67 2012 + + + 641.81/5 + 23 + + + CKB009000 + CKB064000 + CKB004000 + bisacsh + + + Forkish, Ken. + + + Flour water salt yeast : + the fundamentals of artisan bread and pizza / + Ken Forkish ; photography by Alan Weiner. + + + 1st ed. + + + [Berkeley] : + Ten Speed Press, + c2012. + + + 265 p. : + col. ill. ; + 26 cm. + + + text + txt + rdacontent + + + unmediated + n + rdamedia + + + volume + nc + rdacarrier + + + Includes index. + + + "From Portland's most acclaimed and beloved baker comes this must-have baking guide, featuring scores of recipes for world-class breads and pizzas and a variety of schedules suited for the home baker. In Flour Water Salt Yeast, author Ken Forkish demonstrates that high-quality artisan bread and pizza is within the reach of any home baker. Whether it's a basic straight dough, dough made with a pre-ferment, or a complex levain, each of Forkish's impeccable recipes yields exceptional results. Tips on creating and adapting bread baking schedules that fit in reader's day-to-day lives--enabling them to bake the breads they love in the time they have available--make Flour Water Salt Yeast an indispensable resource for bakers, be they novices or serious enthusiasts"-- + Provided by publisher. + + + "In Flour Water Salt Yeast, author Ken Forkish demonstrates that high-quality artisan bread and pizza is within the reach of any home baker. Whether it's a basic straight dough, dough made with a pre-ferment, or complex levain, each of Forkish's impeccable recipes yields exceptional results. But in addition to the recipes, Flour Water Salt Yeast offers readers a complete baking education, with a thorough yet accessible explanation of the tools and techniques that set artisan bread apart. With a tutorial on baker's percentages, advice for manipulating ingredients ratios to create custom doughs, and tips for creating and adapting bread baking schedules that fit in readers' day-to-day lives (enabling them to bake the breads they love in the time they have available), Flour Water Salt Yeast is an indispensable resource for bakers, be they novices or serious enthusiasts"-- + Provided by publisher. + + + Bread. + + + Pizza. + + + COOKING / Courses & Dishes / Bread. + bisacsh + + + COOKING / Courses & Dishes / Pizza. + bisacsh + + + COOKING / Methods / Baking. + bisacsh + + + Cookbooks. + lcgft + +1marcxmlxml + 01289cam a2200361 i 4500 + 22493436 + 20250607113011.7 + 220405s2022 caua 001 0 eng + + 22493436 + + + 7 + cbc + orignew + 2 + epcn + 20 + y-gencatlg + + + acquire + 1 shelf copy + policy default + + + xd14 2022-04-05 + xn16 2022-12-07 1 copy rec'd., to USASH + rk23 2022-12-09 to PresSvrs + + + 2022936137 + + + 9781984860378 + (hardcover) + + + 9781984860385 + (ebook) + + + DLC + eng + rda + DLC + + + pcc + + + TX769 + .F669 2022 + + + 641.815 + 23 + + + Forkish, Ken, + author. + + + Evolutions in Bread : + artisan pan breads and dutch-oven loaves at home / + Ken Forkish, James Beard Award-winning author of Flour Water Salt Yeast ; photographs by Alan Weiner. + + + First edition. + + + [Berkeley] California: + Ten Speed Press, + [2022] + + + 249 pages : + color illustrations ; + 26 cm + + + text + txt + rdacontent + + + still image + sti + rdacontent + + + unmediated + n + rdamedia + + + volume + nc + rdacarrier + + + Includes index. + + + Bread. + + + Sourdough bread. + + + Baking. + + + Cookbooks. + lcgft + +21.1bath.any=artisan and bath.any=flour and bath.any=water20xmlmarcxml diff --git a/src/server/sources/fixtures/loc-similar-artisan-flour.xml b/src/server/sources/fixtures/loc-similar-artisan-flour.xml new file mode 100644 index 0000000..12d948d --- /dev/null +++ b/src/server/sources/fixtures/loc-similar-artisan-flour.xml @@ -0,0 +1,625 @@ + +1.15marcxmlxml + 03204cam a22004214a 4500 + 17280132 + 20250607050442.0 + 120501s2012 caua 001 0 eng + + 17280132 + + + 7 + cbc + orignew + 1 + ecip + 20 + y-gencatlg + + + acquire + 2 shelf copies + policy default + + + xh12 2012-05-01 + xh12 2012-05-01 ONIX + rd13 2012-05-02 + xn03 2012-09-21 1 copy rec'd., to CIP ver.; + rg07 2012-09-25, c. 1 to CALM + rf18 2013-04-18 copy 2 added + + + LCAP batch update 2025-06-02-04:00: LCAPM-644 + + + 2012012080 + + + 9781607742739 + hardback + + + 9781607742746 + ebook + + + DLC + DLC + DLC + + + pcc + + + TX769 + .F67 2012 + + + 641.81/5 + 23 + + + CKB009000 + CKB064000 + CKB004000 + bisacsh + + + Forkish, Ken. + + + Flour water salt yeast : + the fundamentals of artisan bread and pizza / + Ken Forkish ; photography by Alan Weiner. + + + 1st ed. + + + [Berkeley] : + Ten Speed Press, + c2012. + + + 265 p. : + col. ill. ; + 26 cm. + + + text + txt + rdacontent + + + unmediated + n + rdamedia + + + volume + nc + rdacarrier + + + Includes index. + + + "From Portland's most acclaimed and beloved baker comes this must-have baking guide, featuring scores of recipes for world-class breads and pizzas and a variety of schedules suited for the home baker. In Flour Water Salt Yeast, author Ken Forkish demonstrates that high-quality artisan bread and pizza is within the reach of any home baker. Whether it's a basic straight dough, dough made with a pre-ferment, or a complex levain, each of Forkish's impeccable recipes yields exceptional results. Tips on creating and adapting bread baking schedules that fit in reader's day-to-day lives--enabling them to bake the breads they love in the time they have available--make Flour Water Salt Yeast an indispensable resource for bakers, be they novices or serious enthusiasts"-- + Provided by publisher. + + + "In Flour Water Salt Yeast, author Ken Forkish demonstrates that high-quality artisan bread and pizza is within the reach of any home baker. Whether it's a basic straight dough, dough made with a pre-ferment, or complex levain, each of Forkish's impeccable recipes yields exceptional results. But in addition to the recipes, Flour Water Salt Yeast offers readers a complete baking education, with a thorough yet accessible explanation of the tools and techniques that set artisan bread apart. With a tutorial on baker's percentages, advice for manipulating ingredients ratios to create custom doughs, and tips for creating and adapting bread baking schedules that fit in readers' day-to-day lives (enabling them to bake the breads they love in the time they have available), Flour Water Salt Yeast is an indispensable resource for bakers, be they novices or serious enthusiasts"-- + Provided by publisher. + + + Bread. + + + Pizza. + + + COOKING / Courses & Dishes / Bread. + bisacsh + + + COOKING / Courses & Dishes / Pizza. + bisacsh + + + COOKING / Methods / Baking. + bisacsh + + + Cookbooks. + lcgft + +1marcxmlxml + 01289cam a2200361 i 4500 + 22493436 + 20250607113011.7 + 220405s2022 caua 001 0 eng + + 22493436 + + + 7 + cbc + orignew + 2 + epcn + 20 + y-gencatlg + + + acquire + 1 shelf copy + policy default + + + xd14 2022-04-05 + xn16 2022-12-07 1 copy rec'd., to USASH + rk23 2022-12-09 to PresSvrs + + + 2022936137 + + + 9781984860378 + (hardcover) + + + 9781984860385 + (ebook) + + + DLC + eng + rda + DLC + + + pcc + + + TX769 + .F669 2022 + + + 641.815 + 23 + + + Forkish, Ken, + author. + + + Evolutions in Bread : + artisan pan breads and dutch-oven loaves at home / + Ken Forkish, James Beard Award-winning author of Flour Water Salt Yeast ; photographs by Alan Weiner. + + + First edition. + + + [Berkeley] California: + Ten Speed Press, + [2022] + + + 249 pages : + color illustrations ; + 26 cm + + + text + txt + rdacontent + + + still image + sti + rdacontent + + + unmediated + n + rdamedia + + + volume + nc + rdacarrier + + + Includes index. + + + Bread. + + + Sourdough bread. + + + Baking. + + + Cookbooks. + lcgft + +2marcxmlxml + 01468cam a2200373 i 4500 + 20412023 + 20250607085600.0 + 180319s2018 caua b 001 0 eng + + 20412023 + + + 7 + cbc + orignew + 1 + ecip + 20 + y-gencatlg + + + acquire + 1 shelf copy + policy default + + + rk14 2018-03-19 + rk14 2018-03-19 telework to subj rev + rk09 2018-03-20 to Dewey + xm09 2018-03-22 + xn11 2019-04-02 1 copy rec'd., to CIP ver. + rk20 2019-04-09 book received in ART + rl06 2019-07-20 to CALM + rk23 2021-01-30 (TW Situational) c. 2 to DISCARDS (0046146872A) + + + 2018009826 + + + 9781452167879 + (hardcover) + + + DLC + eng + DLC + rda + DLC + + + pcc + + + TX769 + .K557 2018 + + + 641.81/5 + 23 + + + King, Ellen, + author. + + + Heritage baking : + recipes for rustic breads and pastries baked with artisanal flour from Hewn Bakery / + by Ellen King with Amelia Levin ; photographs by John Lee. + + + San Francisco : + Chronicle Books, + [2018] + + + ©2018 + + + 223 pages : + color illustrations ; + 24 cm + + + text + txt + rdacontent + + + unmediated + n + rdamedia + + + volume + nc + rdacarrier + + + Includes index. + + + Bread. + + + Baking. + + + Grain. + + + Heirloom varieties (Plants) + + + Cookbooks. + lcgft + + + Levin, Amelia, + author. + + + Hewn Bakery. + +3marcxmlxml + 01306cam a2200361 i 4500 + 22800345 + 20250607115436.3 + 220922t20232023maua 001 0 eng + + 22800345 + + + 7 + cbc + orignew + 2 + epcn + 20 + y-gencatlg + + + acquire + 1 shelf copy + policy default + + + xd15 2022-09-22 + xn11 2024-01-30 1 copy rec'd., to USASH + rk27 2024-02-13 to Dewey + xm51 2024-03-28 + + + 2022946941 + + + 9781645679592 + (paperback) + + + 1645679594 + (paperback) + + + 9781645677765 + (ebook) + + + DLC + eng + rda + DLC + DLC + + + pcc + + + TX769 + .G5548 2023 + + + 641.81/5 + 23/eng/20240328 + + + Giuffi, Tim, + author. + + + The fresh-milled flour bread book : + the complete guide to mastering your home mill for artisan sourdough, pizza, croissants and more / + Tim Giuffi, owner of Lyman Ave. Bread. + + + Salem, MA : + Page Street Publishing Co., + 2023. + + + ©2023 + + + 144 pages : + color illustrations ; + 23 cm + + + text + txt + rdacontent + + + unmediated + n + rdamedia + + + volume + nc + rdacarrier + + + Includes index. + + + Bread. + + + Cooking (Bread) + + + Baking. + + + Cookbooks. + lcgft + +4marcxmlxml + 03071cam a2200457 i 4500 + 18179898 + 20250607061004.5 + 140606s2014 nyua 000 0 eng + + 18179898 + + + 7 + cbc + orignew + 1 + ecip + 20 + y-gencatlg + + + acquire + 1 shelf copy + policy default + + + bd22 2014-06-06 + bd22 2014-06-06 ONIX telework to Dewey + xl03 2014-06-09 + xn11 2014-10-27 1 copy rec'd., to CIP ver. + rl09 2014-11-05 ; to CALM + + + LCAP batch update 2025-06-02-04:00: LCAPM-821 + + + 2014022132 + + + 9781250018311 + hbk + + + 1250018315 + hbk + + + 9781250018304 (ebk.) + + + 1250018307 (ebk.) + + + DLC + eng + DLC + rda + DLC + + + pcc + + + RM237.86 + .H47 2014 + + + 641.5/638 + 23 + + + CKB009000 + CKB004000 + bisacsh + + + Hertzberg, Jeff. + + + Gluten-free artisan bread in five minutes a day : + the baking revolution continues with 90 new, delicious and easy recipes made with gluten-free flours / + Jeff Hertzberg, MD, and Zoë François ; photographs by Stephen Scott Gross. + + + First edition. + + + New York : + Thomas Dunne Books, St. Martin's Press, + 2014. + + + xi, 291 pages : + illustrations (some color) ; + 24 cm + + + text + rdacontent + + + unmediated + rdamedia + + + volume + rdacarrier + + + Includes bibliographical references (pages 275-277) and index. + + + "Americans are turning in record numbers to gluten-free foods as a means to health, and an often-quoted University of Maryland study estimates that 1 out of 133 Americans (1% of the population) have celiac disease (a debilitating auto-immune disease caused by gluten). As the gluten-free trend has grown, a much larger population is experimenting with the gluten-free lifestyle to treat health symptoms. And one of the number one items those on a gluten-free diet miss most is bread. Based on overwhelming requests from readers at their interactive website BreadIn5.com, Jeff Hertzberg and Zoë François have returned to their test kitchens to build on the popular gluten-free recipes that appeared in their earlier titles for an entirely gluten-free bread cookbook. Gluten-Free Bread in Five Minutes a Day extends their revolutionary stored-dough method to yeasted and unleavened breads made without wheat, barley, or rye. With more than 60 recipes--as well as 100 black-and-white instructional photos and 40 gorgeous color images--the authors adopt the rich palette of world breads to their unique method. With this revolutionary approach, you CAN have mouth-watering gluten-free artisan bread in just five minutes a day!"-- + Provided by publisher. + + + Gluten-free diet + Recipes. + + + Bread. + + + Cooking (Bread) + + + COOKING / Courses & Dishes / Bread. + bisacsh + + + COOKING / Methods / Baking. + bisacsh + + + Cookbooks. + lcgft + + + François, Zoë. + + + Gross, Stephen Scott, + illustrator. + +51.1bath.any=artisan and bath.any=flour20xmlmarcxml diff --git a/src/server/sources/fixtures/loc-similar-mountains-wyoming-trails.xml b/src/server/sources/fixtures/loc-similar-mountains-wyoming-trails.xml new file mode 100644 index 0000000..3bb613d --- /dev/null +++ b/src/server/sources/fixtures/loc-similar-mountains-wyoming-trails.xml @@ -0,0 +1,2768 @@ + +1.186marcxmlxml + 02270cem a2200505 a 4500 + 12293222 + 20250606184513.4 + aj|aazba + 010129s1999 pauag a 0 eng + + 12293222 + + + 7 + cbc + orignew + u + ncip + 20 + n-geogmaps + + + ga05; sent to CMT 01-30-01 + + + LCAP batch update 2025-06-01-04:00: LCAPM-779 + + + 2001621050 + + + a + 24000 + W0763730 + W0763000 + N0413000 + N0412230 + + + DLC + DLC + DLC + + + G3824.E112E63 1999 + .S7 + + + 3824 + E112 + + + 3822 + W9 + + + E63 + lcg + + + Shambaugh, Craig. + + + Equestrian, hiking, mountain, public use, Wyoming State Forest, Endless Mtns., Pa. / + trails by Craig Shambaugh. + + + Up dated 8-12-99. + + + Scale 1:24,000 + (W 76°37ʹ30ʺ--W 76°30ʹ00ʺ/N 41°30ʹ00ʺ--N 41°22ʹ30ʺ). + + + [Eagles Mere, Pa.? : + s.n., + 1999] + + + 1 map : + photocopy ; + 58 x 50 cm. + + + cartographic image + cri + rdacontent + + + unmediated + n + rdamedia + + + sheet + nb + rdacarrier + + + Covers Eagles Mere (village) region and part of Wyoming State Forest (Pa.). + + + Relief shown by contours and spot heights. + + + Trails and related recreation features shown on USGS topographic base: Eagles Mere quadrangle, Pennsylvania--Sullivan Co., 7.5 minute series (topographic). + + + Title, statement of attribution, and ed. statement are handwritten in ink in margins. + + + Xerographic copy. + + + Accompanied by text sheet: Re maps of Eagles Mere, PA (Sullivan County). [1] sheet ; 28 x 22 cm. + + + Includes location map and advertisement. + + + Gift; + Barbara Christy; + Dec. 2000. + + + Trails + Pennsylvania + Eagles Mere Region + Maps. + + + Trails + Pennsylvania + Wyoming State Forest + Maps. + + + Recreation areas + Pennsylvania + Eagles Mere Region + Maps. + + + Recreation areas + Pennsylvania + Wyoming State Forest + Maps. + + + Eagles Mere Region (Pa.) + Maps. + + + Wyoming State Forest (Pa.) + Maps. + + + Topographic maps. + lcgft + + + Eagles Mere quadrangle, Pennsylvania--Sullivan Co. + +1marcxmlxml + 01403cem a2200313 4500 + 5439785 + 20250607183232.2 + 771108s1977 pau a 0 eng + + 5439785 + + + 7 + cbc + orignew + u + ncip + 19 + y-geogmaps + + + 77697562 + + + (DLC) 77697562 + + + DLC + DLC + DLC + + + G3792.S9E63 1977 + .A3 + + + 3792 + S9 + + + Ad/Art/Photo Service. + + + Susquehanna water trails in the Endless Mountains, northeastern Pennsylvania; + Bradford County--Sullivan County--Susquehanna County--Wyoming County. + Prepared for the Endless Mountains Association as a project of the Endless Mountains Resource Conservation and Development Project. + + + Williamsport, Pa., + c1977. + + + 8 col. maps + on sheet 41 x 46 cm. fold. to 23 x 11 cm. + + + Printed on both sides of sheet. + + + "Note: these maps were compiled prior to the 1972 flood." + + + Includes text, boating and canoeing information, 2 blank areas for notes, 2 index maps, 2 location maps, and col. illus. + + + Scale ca. 1:70,000. + + + Boats and boating + Susquehanna River + Maps. + + + White-water canoeing + Susquehanna River + Maps. + + + Susquehanna River + Maps. + + + Endless Mountains Association. + + + AACR2 + + + c-G&M + G3792.S9E63 1977 + .A3 + Copy 1 + MAPS + +2marcxmlxml + 01468cam a22003494a 4500 + 13181756 + 20250606200926.5 + 030430s2003 wyuab b 001 0 eng + + 13181756 + + + 7 + cbc + orignew + 2 + epcn + 20 + y-gencatlg + + + acquire + 2 shelf copies + policy default + + + pc16 2003-04-30 + pv21 2003-08-21 to ASCD + sj02 2003-09-02; + sj07 2003-09-09; + sj04 2003-09-10 to Dewey; + aa11 2003-09-12 + + + LCAP batch update 2025-06-01-04:00: LCAPM-644, LCAPM-893 + + + 2003106395 + + + 097409000X + pbk. + + + (DLC) 2003106395 + + + DLC + DLC + + + pcc + + + n-us-wy + + + GV199.42.W82 + M436 2003 + + + 917.87/86034 + 22 + + + Smith, Marc, + 1975- + + + Hiking Wyoming's Medicine Bow National Forest : + a trail guide to Pole Mountain, Snowy Range, Medicine Bow Mountains, Sierra Madre, and Laramie Mountains / + Marc Smith. + + + Casper, Wyo. : + Open Space Publications, + c2003. + + + 144 p. : + ill., maps ; + 23 cm. + + + text + txt + rdacontent + + + unmediated + n + rdamedia + + + volume + nc + rdacarrier + + + Includes bibliographical references (p. 143) and index. + + + Hiking + Wyoming + Medicine Bow National Forest + Guidebooks. + + + Medicine Bow National Forest (Wyo.) + Guidebooks. + + + Guidebooks. + lcgft + https://id.loc.gov/authorities/genreForms/gf2014026108 + +3marcxmlxml + 02331cem a2200529 a 4500 + 12653316 + 20250606191912.8 + aj|canzn + 020123s2001 paub a 1 eng + + 12653316 + + + 7 + cbc + orignew + u + ncip + 20 + n-geogmaps + + + ga05 2002-01-24 sent to CMT + + + LCAP batch update 2025-06-01-04:00: LCAPM-779 + + + 2002620125 + + + a + 300000 + + + DLC + DLC + DLC + + + G3822.E6E635 2001 + .D5 + + + 3822 + E6 + + + 3823 + B7 + S7 + S8 + W9 + + + E635 + lcg + + + DKW Design (Firm) + + + Endless Mountains Heritage Trail, scenic back roads and memorable destinations : + Bradford, Sullivan, Susquehanna, and Wyoming counties, Pennsylvania / + produced by JMA/Watson, West Chester, Pa., in conjunction with the National Trust for Historic Preservation and Urban Research and Development Corporation, Bethlehem, Pa. ; designed by DKW Design--Diane K. Woodward, Philadelphia, Pa. + + + Title within map border: + Endless Mountains Heritage Trail + + + Scale [ca. 1:300,000]. + + + Tunkhannock, Pa. : + Endless Mountains Visitors Bureau, + [2001?] + + + 1 map : + col. ; + 30 x 48 cm., folded to 25 x 11 cm. + + + cartographic image + cri + rdacontent + + + unmediated + n + rdamedia + + + sheet + nb + rdacarrier + + + Relief shown by shading. + + + Does not show specific trail routes. + + + Panel title. + + + Includes text, index to points of interest, location map (inset), and col. ill. + + + Text, location map, and ill. (some col.) on verso. + + + Heritage tourism + Pennsylvania + Endless Mountains + Maps. + + + Scenic byways + Pennsylvania + Endless Mountains + Maps. + + + Endless Mountains (Pa.) + Maps. + + + Bradford County (Pa.) + Maps. + + + Sullivan County (Pa.) + Maps. + + + Susquehanna County (Pa.) + Maps. + + + Wyoming County (Pa.) + Maps. + + + Tourist maps. + lcgft + + + Woodward, Diana K. + + + JMA/Watson (Firm) + + + National Trust for Historic Preservation in the United States. + + + Urban Research & Development Corporation. + + + Endless Mountains Visitors Bureau. + +4marcxmlxml + 02462ckd a22004573a 4500 + 19558871 + 20250607074613.7 + cr|||||||||||| + ki|c|| + 170214s2016 wyunnn uo kneng + + 19558871 + + + 0 + cbc + orignew + u + ncip + 20 + y-printpho + + + qw63 2017-03 + + + 2017688134 + + + (DLC)hig2017003144 + + + LC-DIG-highsm-38242 + DLC + (original digital file) + + + DLC + DLC + dcrmg + eng + + + LC-DIG-highsm- + 38242 + + + Highsmith, Carol M., + 1946- + photographer. + + + In the distance, to the right, in the mountains of Fremont County, Wyoming, is a notch that was an important landmark to westward-moving emigrants along the Oregon Trail (and the Mormon Trail, California Trail, and Pony Express route) which followed the same path before diverging in western Wyoming + [graphic]. + + + 2016-05-29. + + + 1 photograph : + digital, tiff file, color. + + + still image + sti + rdacontent + + + computer + c + rdamedia + + + online resource + cr + rdacarrier + + + Title, date and keywords based on information provided by the photographer. + + + They called it "Split Rock." It could be viewed for miles, and the gunsight-looking notch pointed them directly to South Pass to the west. There, the emigrants could cross through the rugged Rocky Mountains via a low, passable valley + + + Credit line: Gates Frontiers Fund Wyoming Collection within the Carol M. Highsmith Archive, Library of Congress, Prints and Photographs Division. + + + No known restrictions on publication. + + + Gift; + Gates Frontiers Fund; + 2015; + (DLC/PP-2015:069). + + + Forms part of: Gates Frontiers Fund Wyoming Collection within the Carol M. Highsmith Archive. + + + America + Split Rock + Oregon Trail + Mormon Trail + + + Digital photographs + Color + 2010-2020. + gmgpc + + + United States + Wyoming + Fremont County. + local + + + Highsmith, Carol M., 1946- + Carol M. Highsmith Archive. + (DLC) 00650024 + + + Library of Congress + Prints and Photographs Division + Washington, D.C. 20540 USA + dcu + http://hdl.loc.gov/loc.pnp/pp.print + + + original digital file + highsm + 38242 + p + http://hdl.loc.gov/loc.pnp/highsm.38242 + + + pp/highsm + + + pp/minload + + + pp/diof + + + c-P&P + (ONLINE) + +5marcxmlxml + 02462ckd a22004573a 4500 + 19558872 + 20250607074613.6 + cr|||||||||||| + ki|c|| + 170214s2016 wyunnn uo kneng + + 19558872 + + + 0 + cbc + orignew + u + ncip + 20 + y-printpho + + + qw63 2017-03 + + + 2017688135 + + + (DLC)hig2017003145 + + + LC-DIG-highsm-38243 + DLC + (original digital file) + + + DLC + DLC + dcrmg + eng + + + LC-DIG-highsm- + 38243 + + + Highsmith, Carol M., + 1946- + photographer. + + + In the distance, to the right, in the mountains of Fremont County, Wyoming, is a notch that was an important landmark to westward-moving emigrants along the Oregon Trail (and the Mormon Trail, California Trail, and Pony Express route) which followed the same path before diverging in western Wyoming + [graphic]. + + + 2016-05-29. + + + 1 photograph : + digital, tiff file, color. + + + still image + sti + rdacontent + + + computer + c + rdamedia + + + online resource + cr + rdacarrier + + + Title, date and keywords based on information provided by the photographer. + + + They called it "Split Rock." It could be viewed for miles, and the gunsight-looking notch pointed them directly to South Pass to the west. There, the emigrants could cross through the rugged Rocky Mountains via a low, passable valley + + + Credit line: Gates Frontiers Fund Wyoming Collection within the Carol M. Highsmith Archive, Library of Congress, Prints and Photographs Division. + + + No known restrictions on publication. + + + Gift; + Gates Frontiers Fund; + 2015; + (DLC/PP-2015:069). + + + Forms part of: Gates Frontiers Fund Wyoming Collection within the Carol M. Highsmith Archive. + + + America + Split Rock + Oregon Trail + Mormon Trail + + + Digital photographs + Color + 2010-2020. + gmgpc + + + United States + Wyoming + Fremont County. + local + + + Highsmith, Carol M., 1946- + Carol M. Highsmith Archive. + (DLC) 00650024 + + + Library of Congress + Prints and Photographs Division + Washington, D.C. 20540 USA + dcu + http://hdl.loc.gov/loc.pnp/pp.print + + + original digital file + highsm + 38243 + p + http://hdl.loc.gov/loc.pnp/highsm.38243 + + + pp/highsm + + + pp/minload + + + pp/diof + + + c-P&P + (ONLINE) + +6marcxmlxml + 01473cam a2200361 a 4500 + 15559758 + 20250607030133.3 + 081217s2009 wyuab b 001 0 eng + + 15559758 + + + 7 + cbc + origres + 2 + ncip + 20 + y-gencatlg + + + acquire + 2 shelf copies + policy default + + + pc20 2008-12-17 + xh00 2009-07-28 to USPL/STM + + + xh04 2010-11-03 z-processor + xh82 2010-11-23 to subj + xh07 2010-12-06 to Dewey + + + LCAP batch update 2025-06-01-04:00: LCAPM-644, LCAPM-893 + + + 2008943736 + + + 9780974090047 + pbk. + + + 0974090042 + pbk. + + + DLC + DLC + + + pcc + + + n-us-wy + + + GV199.42.W82 + M436 2009 + + + Smith, Marc, + 1975- + + + Hiking Wyoming's Medicine Bow National Forest : + a trail guide to Snowy Range, Sierra Madre, Medicine Bow, Pole, and Laramie Mountains / + Marc Smith. + + + 3rd ed. + + + Casper, Wyo. : + Open Space Publications, + c2009. + + + 223 p. : + ill. (some col.), maps ; + 23 cm. + + + text + txt + rdacontent + + + unmediated + n + rdamedia + + + volume + nc + rdacarrier + + + Includes bibliographical references (p. 210) and index. + + + Hiking + Wyoming + Medicine Bow National Forest + Guidebooks. + + + Medicine Bow National Forest (Wyo.) + Guidebooks. + + + Guidebooks. + lcgft + https://id.loc.gov/authorities/genreForms/gf2014026108 + +7marcxmlxml + 01375cam a22003375a 4500 + 14601608 + 20250607014727.5 + 061019s2007 wyu 000 0 eng + + 14601608 + + + 7 + cbc + orignew + 2 + epcn + 20 + y-gencatlg + + + acquire + 2 shelf copies + policy default + + + pc20 2006-10-19 + sf17 2007-04-05 + sf32 2007-04-30 + + + LCAP batch update 2025-06-01-04:00: LCAPM-644, LCAPM-893, LCAPM-150 + + + 2006936955 + + + 0974090026 + + + 9780974090023 + + + DLC + DLC + DLC + + + n-us-wy + + + GV199.42.W82 + M436 2007 + + + Smith, Marc, + 1975- + + + Hiking Wyoming's Medicine Bow National Forest : + a trail guide to, Snowy Range, Sierra Madre, Medicine Bow, Pole, and Laramie Mountains / + Marc Smith. + + + 2nd ed. + + + Casper, WY : + Open Space Publications, + c2007. + + + 207 p. : + ill., maps ; + 23 cm. + + + text + txt + rdacontent + + + unmediated + n + rdamedia + + + volume + nc + rdacarrier + + + Hiking + Wyoming + Medicine Bow National Forest + Guidebooks. + + + Medicine Bow National Forest (Wyo.) + Guidebooks. + + + Guidebooks. + lcgft + https://id.loc.gov/authorities/genreForms/gf2014026108 + + + Table of contents only + http://www.loc.gov/catdir/toc/fy0710/2006936955.html + +8marcxmlxml + 02515ckd a22004573a 4500 + 19558868 + 20250607074613.6 + cr|||||||||||| + ki|c|| + 170214s2016 wyunnn uo kneng + + 19558868 + + + 0 + cbc + orignew + u + ncip + 20 + y-printpho + + + qw63 2017-03 + + + 2017688131 + + + (DLC)hig2017003141 + + + LC-DIG-highsm-38239 + DLC + (original digital file) + + + DLC + DLC + dcrmg + eng + + + LC-DIG-highsm- + 38239 + + + Highsmith, Carol M., + 1946- + photographer. + + + The well-weathered marker denotes Split Rock, a notch in the distant mountains of Fremont County, Wyoming, not visible in this image. The notch was an important landmark to westward-moving emigrants along the Oregon Trail (and the Mormon Trail, California Trail, and Pony Express route) which followed the same path before diverging in western Wyoming + [graphic]. + + + 2016-05-29. + + + 1 photograph : + digital, tiff file, color. + + + still image + sti + rdacontent + + + computer + c + rdamedia + + + online resource + cr + rdacarrier + + + Title, date and keywords based on information provided by the photographer. + + + Split Rock could be viewed for miles, and the gunsight-looking notch pointed them directly to South Pass to the west. There, the emigrants could cross through the rugged Rocky Mountains via a low, passable valley + + + Credit line: Gates Frontiers Fund Wyoming Collection within the Carol M. Highsmith Archive, Library of Congress, Prints and Photographs Division. + + + No known restrictions on publication. + + + Gift; + Gates Frontiers Fund; + 2015; + (DLC/PP-2015:069). + + + Forms part of: Gates Frontiers Fund Wyoming Collection within the Carol M. Highsmith Archive. + + + America + Split Rock + Oregon Trail + Mormon Trail + Oregon trail markers + + + Digital photographs + Color + 2010-2020. + gmgpc + + + United States + Wyoming + Fremont County. + local + + + Highsmith, Carol M., 1946- + Carol M. Highsmith Archive. + (DLC) 00650024 + + + Library of Congress + Prints and Photographs Division + Washington, D.C. 20540 USA + dcu + http://hdl.loc.gov/loc.pnp/pp.print + + + original digital file + highsm + 38239 + p + http://hdl.loc.gov/loc.pnp/highsm.38239 + + + pp/highsm + + + pp/minload + + + pp/diof + + + c-P&P + (ONLINE) + +9marcxmlxml + 01819cem a2200385 a 4500 + 15742456 + 20250607031452.9 + aj aanzn + 090518s2008 pau a 1 eng + + 15742456 + + + 7 + cbc + origcop + u + ncip + 20 + y-geogmaps + + + ga05 2009-05-19 sent to CMT + + + LCAP batch update 2025-06-01-04:00: LCAPM-779 + + + 2009584065 + + + a + + + DLC + DLC + DLC + + + G3824.T78E635 2008 + .T8 + + + 3824 + T78 + + + Tunkhannock Business and Professional Association. + + + Welcome to Tunkhannock historic district on the National Register on historic PA Route 6 : + shops, eateries, antiques & collectibles, galleries, parks / + brochures compliments of Tunkhannock Business & Professional Association and Wyoming County Chamber of Commerce. + + + Title in upper margin: + Tunkhannock, Pennsylvania, on historic Route 6 : + Sullivan's trail, gateway to the Endless Mountains + + + Scale not given. + + + [Tunkhannock, Pa.] : + Tunkhannock Business and Professional Association : + Wyoming County Chamber of Commerce, + [2008?] + + + 1 map ; + 13 x 28 cm., on sheet 44 x 28 cm., folded to 22 x 10 cm. + + + cartographic image + cri + rdacontent + + + unmediated + n + rdamedia + + + sheet + nb + rdacarrier + + + Title from panel. + + + Includes notes, index to points of interest, location map, calendar of events, and ill. + + + Indexed business directory on verso. + + + Historic districts + Pennsylvania + Tunkhannock + Maps. + + + Business enterprises + Pennsylvania + Tunkhannock + Maps. + + + Tunkhannock (Pa.) + Maps. + + + Tourist maps. + lcgft + + + Wyoming County Chamber of Commerce (Pa.) + +10marcxmlxml + 02569ckd a22004573a 4500 + 19558874 + 20250607074613.8 + cr|||||||||||| + ki|c|| + 170214s2016 wyunnn uo kneng + + 19558874 + + + 0 + cbc + orignew + u + ncip + 20 + y-printpho + + + qw63 2017-03 + + + 2017688137 + + + (DLC)hig2017003147 + + + LC-DIG-highsm-38245 + DLC + (original digital file) + + + DLC + DLC + dcrmg + eng + + + LC-DIG-highsm- + 38245 + + + Highsmith, Carol M., + 1946- + photographer. + + + Devil's Gate, a fissure in the mountains of what is now Natrona County, Wyoming, caused by erosion from the Sweetwater River. It was a noted landmark along the Oregon Trail (and California Trail, Mormon Trail, and Pony Express route that followed the same path before diverging farther west) + [graphic]. + + + 2016-05-29. + + + 1 photograph : + digital, tiff file, color. + + + still image + sti + rdacontent + + + computer + c + rdamedia + + + online resource + cr + rdacarrier + + + Title, date and keywords based on information provided by the photographer. + + + While it gave no particular directional guidance, emigrants, who were walking or riding alongside, not through, the gap carrying the river, frequently stopped to hike around this feature and carve their names. The occurrence of several murders in this region led some emigrants to believe this was a bedeviled site + + + Credit line: Gates Frontiers Fund Wyoming Collection within the Carol M. Highsmith Archive, Library of Congress, Prints and Photographs Division. + + + No known restrictions on publication. + + + Gift; + Gates Frontiers Fund; + 2015; + (DLC/PP-2015:069). + + + Forms part of: Gates Frontiers Fund Wyoming Collection within the Carol M. Highsmith Archive. + + + America + Devil's Gate + Sweetwater River + Oregon Trail + Mormon Trail + Pony Express + + + Digital photographs + Color + 2010-2020. + gmgpc + + + United States + Wyoming + Natrona County. + local + + + Highsmith, Carol M., 1946- + Carol M. Highsmith Archive. + (DLC) 00650024 + + + Library of Congress + Prints and Photographs Division + Washington, D.C. 20540 USA + dcu + http://hdl.loc.gov/loc.pnp/pp.print + + + original digital file + highsm + 38245 + p + http://hdl.loc.gov/loc.pnp/highsm.38245 + + + pp/highsm + + + pp/minload + + + pp/diof + + + c-P&P + (ONLINE) + +11marcxmlxml + 02569ckd a22004573a 4500 + 19558875 + 20250607074613.6 + cr|||||||||||| + ki|c|| + 170214s2016 wyunnn uo kneng + + 19558875 + + + 0 + cbc + orignew + u + ncip + 20 + y-printpho + + + qw63 2017-03 + + + 2017688138 + + + (DLC)hig2017003148 + + + LC-DIG-highsm-38246 + DLC + (original digital file) + + + DLC + DLC + dcrmg + eng + + + LC-DIG-highsm- + 38246 + + + Highsmith, Carol M., + 1946- + photographer. + + + Devil's Gate, a fissure in the mountains of what is now Natrona County, Wyoming, caused by erosion from the Sweetwater River. It was a noted landmark along the Oregon Trail (and California Trail, Mormon Trail, and Pony Express route that followed the same path before diverging farther west) + [graphic]. + + + 2016-05-29. + + + 1 photograph : + digital, tiff file, color. + + + still image + sti + rdacontent + + + computer + c + rdamedia + + + online resource + cr + rdacarrier + + + Title, date and keywords based on information provided by the photographer. + + + While it gave no particular directional guidance, emigrants, who were walking or riding alongside, not through, the gap carrying the river, frequently stopped to hike around this feature and carve their names. The occurrence of several murders in this region led some emigrants to believe this was a bedeviled site + + + Credit line: Gates Frontiers Fund Wyoming Collection within the Carol M. Highsmith Archive, Library of Congress, Prints and Photographs Division. + + + No known restrictions on publication. + + + Gift; + Gates Frontiers Fund; + 2015; + (DLC/PP-2015:069). + + + Forms part of: Gates Frontiers Fund Wyoming Collection within the Carol M. Highsmith Archive. + + + America + Devil's Gate + Sweetwater River + Oregon Trail + Mormon Trail + Pony Express + + + Digital photographs + Color + 2010-2020. + gmgpc + + + United States + Wyoming + Natrona County. + local + + + Highsmith, Carol M., 1946- + Carol M. Highsmith Archive. + (DLC) 00650024 + + + Library of Congress + Prints and Photographs Division + Washington, D.C. 20540 USA + dcu + http://hdl.loc.gov/loc.pnp/pp.print + + + original digital file + highsm + 38246 + p + http://hdl.loc.gov/loc.pnp/highsm.38246 + + + pp/highsm + + + pp/minload + + + pp/diof + + + c-P&P + (ONLINE) + +12marcxmlxml + 02569ckd a22004573a 4500 + 19558873 + 20250607074613.7 + cr|||||||||||| + ki|c|| + 170214s2016 wyunnn uo kneng + + 19558873 + + + 0 + cbc + orignew + u + ncip + 20 + y-printpho + + + qw63 2017-03 + + + 2017688136 + + + (DLC)hig2017003146 + + + LC-DIG-highsm-38244 + DLC + (original digital file) + + + DLC + DLC + dcrmg + eng + + + LC-DIG-highsm- + 38244 + + + Highsmith, Carol M., + 1946- + photographer. + + + Devil's Gate, a fissure in the mountains of what is now Natrona County, Wyoming, caused by erosion from the Sweetwater River. It was a noted landmark along the Oregon Trail (and California Trail, Mormon Trail, and Pony Express route that followed the same path before diverging farther west) + [graphic]. + + + 2016-05-29. + + + 1 photograph : + digital, tiff file, color. + + + still image + sti + rdacontent + + + computer + c + rdamedia + + + online resource + cr + rdacarrier + + + Title, date and keywords based on information provided by the photographer. + + + While it gave no particular directional guidance, emigrants, who were walking or riding alongside, not through, the gap carrying the river, frequently stopped to hike around this feature and carve their names. The occurrence of several murders in this region led some emigrants to believe this was a bedeviled site + + + Credit line: Gates Frontiers Fund Wyoming Collection within the Carol M. Highsmith Archive, Library of Congress, Prints and Photographs Division. + + + No known restrictions on publication. + + + Gift; + Gates Frontiers Fund; + 2015; + (DLC/PP-2015:069). + + + Forms part of: Gates Frontiers Fund Wyoming Collection within the Carol M. Highsmith Archive. + + + America + Devil's Gate + Sweetwater River + Oregon Trail + Mormon Trail + Pony Express + + + Digital photographs + Color + 2010-2020. + gmgpc + + + United States + Wyoming + Natrona County. + local + + + Highsmith, Carol M., 1946- + Carol M. Highsmith Archive. + (DLC) 00650024 + + + Library of Congress + Prints and Photographs Division + Washington, D.C. 20540 USA + dcu + http://hdl.loc.gov/loc.pnp/pp.print + + + original digital file + highsm + 38244 + p + http://hdl.loc.gov/loc.pnp/highsm.38244 + + + pp/highsm + + + pp/minload + + + pp/diof + + + c-P&P + (ONLINE) + +13marcxmlxml + 02569ckd a22004573a 4500 + 19558878 + 20250607074613.7 + cr|||||||||||| + ki|c|| + 170214s2016 wyunnn uo kneng + + 19558878 + + + 0 + cbc + orignew + u + ncip + 20 + y-printpho + + + qw63 2017-03 + + + 2017688140 + + + (DLC)hig2017003150 + + + LC-DIG-highsm-38248 + DLC + (original digital file) + + + DLC + DLC + dcrmg + eng + + + LC-DIG-highsm- + 38248 + + + Highsmith, Carol M., + 1946- + photographer. + + + Devil's Gate, a fissure in the mountains of what is now Natrona County, Wyoming, caused by erosion from the Sweetwater River. It was a noted landmark along the Oregon Trail (and California Trail, Mormon Trail, and Pony Express route that followed the same path before diverging farther west) + [graphic]. + + + 2016-05-29. + + + 1 photograph : + digital, tiff file, color. + + + still image + sti + rdacontent + + + computer + c + rdamedia + + + online resource + cr + rdacarrier + + + Title, date and keywords based on information provided by the photographer. + + + While it gave no particular directional guidance, emigrants, who were walking or riding alongside, not through, the gap carrying the river, frequently stopped to hike around this feature and carve their names. The occurrence of several murders in this region led some emigrants to believe this was a bedeviled site + + + Credit line: Gates Frontiers Fund Wyoming Collection within the Carol M. Highsmith Archive, Library of Congress, Prints and Photographs Division. + + + No known restrictions on publication. + + + Gift; + Gates Frontiers Fund; + 2015; + (DLC/PP-2015:069). + + + Forms part of: Gates Frontiers Fund Wyoming Collection within the Carol M. Highsmith Archive. + + + America + Devil's Gate + Sweetwater River + Oregon Trail + Mormon Trail + Pony Express + + + Digital photographs + Color + 2010-2020. + gmgpc + + + United States + Wyoming + Natrona County. + local + + + Highsmith, Carol M., 1946- + Carol M. Highsmith Archive. + (DLC) 00650024 + + + Library of Congress + Prints and Photographs Division + Washington, D.C. 20540 USA + dcu + http://hdl.loc.gov/loc.pnp/pp.print + + + original digital file + highsm + 38248 + p + http://hdl.loc.gov/loc.pnp/highsm.38248 + + + pp/highsm + + + pp/minload + + + pp/diof + + + c-P&P + (ONLINE) + +14marcxmlxml + 02569ckd a22004573a 4500 + 19558879 + 20250607074613.9 + cr|||||||||||| + ki|c|| + 170214s2016 wyunnn uo kneng + + 19558879 + + + 0 + cbc + orignew + u + ncip + 20 + y-printpho + + + qw63 2017-03 + + + 2017688141 + + + (DLC)hig2017003151 + + + LC-DIG-highsm-38249 + DLC + (original digital file) + + + DLC + DLC + dcrmg + eng + + + LC-DIG-highsm- + 38249 + + + Highsmith, Carol M., + 1946- + photographer. + + + Devil's Gate, a fissure in the mountains of what is now Natrona County, Wyoming, caused by erosion from the Sweetwater River. It was a noted landmark along the Oregon Trail (and California Trail, Mormon Trail, and Pony Express route that followed the same path before diverging farther west) + [graphic]. + + + 2016-05-29. + + + 1 photograph : + digital, tiff file, color. + + + still image + sti + rdacontent + + + computer + c + rdamedia + + + online resource + cr + rdacarrier + + + Title, date and keywords based on information provided by the photographer. + + + While it gave no particular directional guidance, emigrants, who were walking or riding alongside, not through, the gap carrying the river, frequently stopped to hike around this feature and carve their names. The occurrence of several murders in this region led some emigrants to believe this was a bedeviled site + + + Credit line: Gates Frontiers Fund Wyoming Collection within the Carol M. Highsmith Archive, Library of Congress, Prints and Photographs Division. + + + No known restrictions on publication. + + + Gift; + Gates Frontiers Fund; + 2015; + (DLC/PP-2015:069). + + + Forms part of: Gates Frontiers Fund Wyoming Collection within the Carol M. Highsmith Archive. + + + America + Devil's Gate + Sweetwater River + Oregon Trail + Mormon Trail + Pony Express + + + Digital photographs + Color + 2010-2020. + gmgpc + + + United States + Wyoming + Natrona County. + local + + + Highsmith, Carol M., 1946- + Carol M. Highsmith Archive. + (DLC) 00650024 + + + Library of Congress + Prints and Photographs Division + Washington, D.C. 20540 USA + dcu + http://hdl.loc.gov/loc.pnp/pp.print + + + original digital file + highsm + 38249 + p + http://hdl.loc.gov/loc.pnp/highsm.38249 + + + pp/highsm + + + pp/minload + + + pp/diof + + + c-P&P + (ONLINE) + +15marcxmlxml + 02598ckd a22004573a 4500 + 19558869 + 20250607074613.8 + cr|||||||||||| + ki|c|| + 170214s2016 wyunnn uo kneng + + 19558869 + + + 0 + cbc + orignew + u + ncip + 20 + y-printpho + + + qw63 2017-03 + + + 2017688132 + + + (DLC)hig2017003142 + + + LC-DIG-highsm-38240 + DLC + (original digital file) + + + DLC + DLC + dcrmg + eng + + + LC-DIG-highsm- + 38240 + + + Highsmith, Carol M., + 1946- + photographer. + + + Why would a ranch in Fremont County, Wyoming, give itself the name of a fairly ordinary rock formation, the notch in the distant mountain to the right? It's because that notch was an important landmark to westward-moving emigrants along the Oregon Trail (and the Mormon Trail, California Trail, and Pony Express route) which followed the same path before diverging in western Wyoming + [graphic]. + + + 2016-05-29. + + + 1 photograph : + digital, tiff file, color. + + + still image + sti + rdacontent + + + computer + c + rdamedia + + + online resource + cr + rdacarrier + + + Title, date and keywords based on information provided by the photographer. + + + Split Rock, as the weary travelers called it, could be viewed for miles, and the gunsight-looking notch pointed them directly to South Pass to the west. There, the emigrants could cross through the rugged Rocky Mountains via a low, passable valley + + + Credit line: Gates Frontiers Fund Wyoming Collection within the Carol M. Highsmith Archive, Library of Congress, Prints and Photographs Division. + + + No known restrictions on publication. + + + Gift; + Gates Frontiers Fund; + 2015; + (DLC/PP-2015:069). + + + Forms part of: Gates Frontiers Fund Wyoming Collection within the Carol M. Highsmith Archive. + + + America + Split Rock + Split Rock Ranch + Oregon Trail + Mormon Trail + Westward emigrants + + + Digital photographs + Color + 2010-2020. + gmgpc + + + United States + Wyoming + Fremont County. + local + + + Highsmith, Carol M., 1946- + Carol M. Highsmith Archive. + (DLC) 00650024 + + + Library of Congress + Prints and Photographs Division + Washington, D.C. 20540 USA + dcu + http://hdl.loc.gov/loc.pnp/pp.print + + + original digital file + highsm + 38240 + p + http://hdl.loc.gov/loc.pnp/highsm.38240 + + + pp/highsm + + + pp/minload + + + pp/diof + + + c-P&P + (ONLINE) + +16marcxmlxml + 02598ckd a22004573a 4500 + 19558870 + 20250607074613.9 + cr|||||||||||| + ki|c|| + 170214s2016 wyunnn uo kneng + + 19558870 + + + 0 + cbc + orignew + u + ncip + 20 + y-printpho + + + qw63 2017-03 + + + 2017688133 + + + (DLC)hig2017003143 + + + LC-DIG-highsm-38241 + DLC + (original digital file) + + + DLC + DLC + dcrmg + eng + + + LC-DIG-highsm- + 38241 + + + Highsmith, Carol M., + 1946- + photographer. + + + Why would a ranch in Fremont County, Wyoming, give itself the name of a fairly ordinary rock formation, the notch in the distant mountain to the right? It's because that notch was an important landmark to westward-moving emigrants along the Oregon Trail (and the Mormon Trail, California Trail, and Pony Express route) which followed the same path before diverging in western Wyoming + [graphic]. + + + 2016-05-29. + + + 1 photograph : + digital, tiff file, color. + + + still image + sti + rdacontent + + + computer + c + rdamedia + + + online resource + cr + rdacarrier + + + Title, date and keywords based on information provided by the photographer. + + + Split Rock, as the weary travelers called it, could be viewed for miles, and the gunsight-looking notch pointed them directly to South Pass to the west. There, the emigrants could cross through the rugged Rocky Mountains via a low, passable valley + + + Credit line: Gates Frontiers Fund Wyoming Collection within the Carol M. Highsmith Archive, Library of Congress, Prints and Photographs Division. + + + No known restrictions on publication. + + + Gift; + Gates Frontiers Fund; + 2015; + (DLC/PP-2015:069). + + + Forms part of: Gates Frontiers Fund Wyoming Collection within the Carol M. Highsmith Archive. + + + America + Split Rock + Split Rock Ranch + Oregon Trail + Mormon Trail + Westward emigrants + + + Digital photographs + Color + 2010-2020. + gmgpc + + + United States + Wyoming + Fremont County. + local + + + Highsmith, Carol M., 1946- + Carol M. Highsmith Archive. + (DLC) 00650024 + + + Library of Congress + Prints and Photographs Division + Washington, D.C. 20540 USA + dcu + http://hdl.loc.gov/loc.pnp/pp.print + + + original digital file + highsm + 38241 + p + http://hdl.loc.gov/loc.pnp/highsm.38241 + + + pp/highsm + + + pp/minload + + + pp/diof + + + c-P&P + (ONLINE) + +17marcxmlxml + 02879ckd a22004573a 4500 + 19559032 + 20250607074615.0 + cr|||||||||||| + ki|c|| + 170214s2016 wyunnn uo kneng + + 19559032 + + + 0 + cbc + orignew + u + ncip + 20 + y-printpho + + + qw63 2017-03 + + + 2017688293 + + + (DLC)hig2017003303 + + + LC-DIG-highsm-38401 + DLC + (original digital file) + + + DLC + DLC + dcrmg + eng + + + LC-DIG-highsm- + 38401 + + + Highsmith, Carol M., + 1946- + photographer. + + + Interior of the schoolhouse, the first in Wyoming, at Fort Bridger, a Wyoming state historical site in the tiny Uinta County town of the same name in the southwestern corner of that state. Established by "mountain man" Jim Bridger and Louis Vasquez in 1843 as an emigrant supply stop along the Oregon Trail, the fort was obtained by the Mormons in the early 1850s, and then became a military outpost in 1858 + [graphic]. + + + 2016-05-24. + + + 1 photograph : + digital, tiff file, color. + + + still image + sti + rdacontent + + + computer + c + rdamedia + + + online resource + cr + rdacarrier + + + Title, date and keywords based on information provided by the photographer. + + + The Oregon and Mormon trails, which had followed the same route across Wyoming, diverged here, the Oregon Trail heading westward into what is now Idaho, and the Mormon Trail dipping southward into the Mormons' "New Zion" in Utah. The site features several restored historical buildings from the military time period, a reconstructed of the trading post operated by Bridger, and an interpretive archaeological site containing the base of the cobble rock wall built by the Mormons during their occupation of the fort + + + Credit line: Gates Frontiers Fund Wyoming Collection within the Carol M. Highsmith Archive, Library of Congress, Prints and Photographs Division. + + + No known restrictions on publication. + + + Gift; + Gates Frontiers Fund; + 2015; + (DLC/PP-2015:069). + + + Forms part of: Gates Frontiers Fund Wyoming Collection within the Carol M. Highsmith Archive. + + + America + Jim Bridger + Louis Vasquez + Oregon Trail + Mormon Trail + + + Digital photographs + Color + 2010-2020. + gmgpc + + + United States + Wyoming + Uinta County + Fort Bridger. + local + + + Highsmith, Carol M., 1946- + Carol M. Highsmith Archive. + (DLC) 00650024 + + + Library of Congress + Prints and Photographs Division + Washington, D.C. 20540 USA + dcu + http://hdl.loc.gov/loc.pnp/pp.print + + + original digital file + highsm + 38401 + p + http://hdl.loc.gov/loc.pnp/highsm.38401 + + + pp/highsm + + + pp/minload + + + pp/diof + + + c-P&P + (ONLINE) + +18marcxmlxml + 02881ckd a22004573a 4500 + 19559099 + 20250607074615.2 + cr|||||||||||| + ki|c|| + 170214s2016 wyunnn uo kneng + + 19559099 + + + 0 + cbc + orignew + u + ncip + 20 + y-printpho + + + qw63 2017-03 + + + 2017688353 + + + (DLC)hig2017003363 + + + LC-DIG-highsm-38461 + DLC + (original digital file) + + + DLC + DLC + dcrmg + eng + + + LC-DIG-highsm- + 38461 + + + Highsmith, Carol M., + 1946- + photographer. + + + State of Wyoming information sign at Fort Bridger, a Wyoming state historical site in the tiny Uinta County town of the same name in the southwestern corner of that state. Established by "mountain man" Jim Bridger and Louis Vasquez in 1843 as an emigrant supply stop along the Oregon Trail, the fort was obtained by the Mormons in the early 1850s, and then became a military outpost in 1858 + [graphic]. + + + 2016-05-24. + + + 1 photograph : + digital, tiff file, color. + + + still image + sti + rdacontent + + + computer + c + rdamedia + + + online resource + cr + rdacarrier + + + Title, date and keywords based on information provided by the photographer. + + + The Oregon and Mormon trails, which had followed the same route across Wyoming, diverged here, the Oregon Trail heading westward into what is now Idaho, and the Mormon Trail dipping southward into the Mormons' "New Zion" in Utah. The site features several restored historical buildings from the military time period, a reconstructed of the trading post operated by Bridger, and an interpretive archaeological site containing the base of the cobble rock wall built by the Mormons during their occupation of the fort + + + Credit line: Gates Frontiers Fund Wyoming Collection within the Carol M. Highsmith Archive, Library of Congress, Prints and Photographs Division. + + + No known restrictions on publication. + + + Gift; + Gates Frontiers Fund; + 2015; + (DLC/PP-2015:069). + + + Forms part of: Gates Frontiers Fund Wyoming Collection within the Carol M. Highsmith Archive. + + + America + Jim Bridger + Louis Vasquez + Oregon Trail + Mormon Trail + Information signs + + + Digital photographs + Color + 2010-2020. + gmgpc + + + United States + Wyoming + Uinta County + Fort Bridger. + local + + + Highsmith, Carol M., 1946- + Carol M. Highsmith Archive. + (DLC) 00650024 + + + Library of Congress + Prints and Photographs Division + Washington, D.C. 20540 USA + dcu + http://hdl.loc.gov/loc.pnp/pp.print + + + original digital file + highsm + 38461 + p + http://hdl.loc.gov/loc.pnp/highsm.38461 + + + pp/highsm + + + pp/minload + + + pp/diof + + + c-P&P + (ONLINE) + +19marcxmlxml + 02303ckd a22004453a 4500 + 19558843 + 20250607074613.5 + cr|||||||||||| + ki|c|| + 170214s2016 wyunnn uo kneng + + 19558843 + + + 0 + cbc + orignew + u + ncip + 20 + y-printpho + + + qw63 2017-03 + + + 2017688109 + + + (DLC)hig2017003119 + + + LC-DIG-highsm-38217 + DLC + (original digital file) + + + DLC + DLC + dcrmg + eng + + + LC-DIG-highsm- + 38217 + + + Highsmith, Carol M., + 1946- + photographer. + + + At first glance, this is a view of a fairly nondescript prairie in remote Fremont County, Wyoming. But it's quite a significant and historic place. This is South Pass, a natural crossing point of the Rocky Mountains that quickly became the route of choice for emigrants on the Oregon, California, and Mormon trails to the West during the 19th century + [graphic]. + + + 2016-05-27. + + + 1 photograph : + digital, tiff file, color. + + + still image + sti + rdacontent + + + computer + c + rdamedia + + + online resource + cr + rdacarrier + + + Title, date and keywords based on information provided by the photographer. + + + Credit line: Gates Frontiers Fund Wyoming Collection within the Carol M. Highsmith Archive, Library of Congress, Prints and Photographs Division. + + + No known restrictions on publication. + + + Gift; + Gates Frontiers Fund; + 2015; + (DLC/PP-2015:069). + + + Forms part of: Gates Frontiers Fund Wyoming Collection within the Carol M. Highsmith Archive. + + + America + South Pass + Emigrant trails + Oregon Trail + Mormon Trail + Rocky Mountain passes + + + Digital photographs + Color + 2010-2020. + gmgpc + + + United States + Wyoming + Fremont County. + local + + + Highsmith, Carol M., 1946- + Carol M. Highsmith Archive. + (DLC) 00650024 + + + Library of Congress + Prints and Photographs Division + Washington, D.C. 20540 USA + dcu + http://hdl.loc.gov/loc.pnp/pp.print + + + original digital file + highsm + 38217 + p + http://hdl.loc.gov/loc.pnp/highsm.38217 + + + pp/highsm + + + pp/minload + + + pp/diof + + + c-P&P + (ONLINE) + +20211.1bath.any=mountains and bath.any=wyoming and bath.any=trails20xmlmarcxml diff --git a/src/server/sources/fixtures/loc-similar-mountains-wyoming.xml b/src/server/sources/fixtures/loc-similar-mountains-wyoming.xml new file mode 100644 index 0000000..4548dac --- /dev/null +++ b/src/server/sources/fixtures/loc-similar-mountains-wyoming.xml @@ -0,0 +1,2409 @@ + +1.1581marcxmlxml + 02022ckd a22004937a 4500 + 14838652 + 20250607020641.9 + kh|||| + cr|||||||||||| + 910912s1896 xxunnn| ||||| | kneng + + 14838652 + + + 7 + cbc + orignew + u + ncip + 20 + y-printpho + + + LCAP batch update 2025-06-01-04:00: LCAPM-861 + + + 2007663101 + + + 5946B2 + U.S. Copyright Office + + + (DLC)pan1993002703/PP + + + LC-USZ62-128647 + DLC + (b&w film copy neg.) + + + DLC + DLC + gihc + + + PAN US GEOG - Pennsylvania + no. 89 + + + Wyoming Valley from Wilkesbarre Mountains + [graphic]. + + + c1896. + + + 1 photographic print : + silver printing-out paper ; + 15 x 46 in. + + + still image + sti + rdacontent + + + unmediated + n + rdamedia + + + Digital image + computer + c + rdamedia + + + sheet + nb + rdacarrier + + + Digital image + online resource + cr + rdacarrier + + + No. 575. + + + No known restrictions on publication. + + + Copyright deposit; + William Herman Rau; + January 21, 1896. + + + Valleys. + lctgm + + + Landscape photographs. + gmgpc + + + Silver printing-out paper prints. + gmgpc + + + Panoramic photographs. + gmgpc + + + Rau, William Herman, + 1855-1920, + copyright claimant. + + + United States + Pennsylvania + Wyoming Valley. + + + Panoramic photographs (Library of Congress) + (DLC) 93845487 + + + Library of Congress + Prints and Photographs Division + Washington, D.C. 20540 USA + dcu + + + digital file from intermediary roll film copy + pan + 6a15067 + p + http://hdl.loc.gov/loc.pnp/pan.6a15067 + + + digital file from b&w film copy neg. + cph + 3c28647 + p + http://hdl.loc.gov/loc.pnp/cph.3c28647 + + + pp/pan + ammem + + + pp/minload + + + pp/diof + + + c-P&P + PAN US GEOG - Pennsylvania + no. 89 + (E size) + ppsd + obj. + +1marcxmlxml + 01932cam a22003733i 4500 + 18399758 + 20250607062509.4 + 141208s2014 nyu 000 1 eng d + + 18399758 + + + 7 + cbc + copycat + 2 + ncip + 20 + y-genrareb + + + acquire + 1 copy only regardless of location + policy default + + + he05 2014-12-08 z-processor + he05 2014-12-08 + + + 2014658147 + + + 9780373282616 + paperback + + + 0373282613 + paperback + + + (OCoLC)860756701 + + + BTCTA + eng + BTCTA + IFA + IZ8 + OCLCO + OCLCF + DLC + rda + + + lccopycat + + + CPB Box no. 3842 vol. 18 + + + Mountain, Kerri. + + + Wyoming promises / + Kerri Mountain. + + + New York, NY : + Love Inspired Books, + [2014] + + + 280 pages, 8 unnumbered pages ; + 17 cm. + + + text + txt + rdacontent + + + unmediated + n + rdamedia + + + volume + nc + rdacarrier + + + Love inspired historical + + + Includes questions for discussion. + + + "Traveling through the Wyoming wilderness, all Bridger Jamison wants is a job and a safe haven for his brother. Finding work with the lovely Lola Martin solves at least one of his problems. And the charming town of Quiver Creek seems like the perfect place to start a new life. A string of mysterious deaths has the town--and Lola--on edge. She isn't sure what to make of the new man in town. But she can't help trusting the handsome carpenter who shows such tenderness toward his brother. When secrets come to light, Lola must put her faith in the man who's stolen her heart, or risk letting a perfect love pass her by..."--Page [4] of cover. + + + Love stories. + gsafd + + + Historical fiction. + gsafd + + + Religious fiction. + lcsh + + + Copyright Paperback Collection (Library of Congress) + DLC + + + Love inspired historical. + +2marcxmlxml + 00922cam a2200277u 4500 + 7850501 + 20250608015934.1 + 830118s1940 dcuab 000 0 eng + + 7850501 + + + 0 + cbc + premunv + u + ncip + 19 + y-gencatlg + + + LCAP batch update 2025-06-02-04:00: LCAPM-644 + + + 41015941 + + + (DLC) 41015941 + + + DLC + CarP + DLC + + + QE445 + .M23 + + + McLaughlin, Thad Gerald, + 1913- + + + Pegmatite dikes of the Bridger mountains, Wyoming, + + + [Washington, D.C., + 1940] + + + [1], 46-68 p. + illus. (incl. map) diagr. + 23 cm. + + + text + txt + rdacontent + + + unmediated + n + rdamedia + + + volume + nc + rdacarrier + + + Petrology + Bridger mountains. [from old catalog] + + + Dikes (Geology) + + + Pegmatites. + + + c-GenColl + QE445 + .M23 + 00040137877 + Copy 1 + PREM + +3marcxmlxml + 01993cam a22004333i 4500 + 23713309 + 20250607130253.8 + 240530s2023 onc 000 1 eng d + + 23713309 + + + 7 + cbc + copycat + 2 + ncip + 20 + y-genrareb + + + acquire + 1 copy only regardless of location + policy default + + + he08 2024-05-30 + he08 2024-05-30 TW routine + + + LCAP batch update 2025-06-02-04:00: LCAPM-893 + + + 2023525254 + + + 9781335582614 + (mass market paperback) + + + 1335582614 + (mass market paperback) + + + (OCoLC)1376380170 + + + IG$ + eng + rda + IG$ + BDX + TP7 + IHI + T7L + OCL + OCLCO + NLC + MTB + DZM + AZZPT + OCLCF + NLC + DLC + + + lccopycat + + + CPB Box no. 4477 vol. 16 + + + Rushdan, Juno, + author. + + + Wyoming mountain hostage / + Juno Rushdan. + + + Toronto, Ontario, Canada : + Harlequin Enterprises ULC, + 2023. + + + ©2023 + + + 248 pages ; + 17 cm. + + + text + txt + rdacontent + + + unmediated + n + rdamedia + + + volume + nc + rdacarrier + + + Harlequin intrigue ; + 2142 + + + Cowboy State Lawmen ; + [5] + + + When tough-as-nails FBI agent Becca Hammond becomes an unwitting hostage, top negotiator Jake Delgado faces the toughest crisis of his life. Becca's not only a trusted colleague, but she's also pregnant--with his child. Jake's got to figure out why the kidnappers are so desperate. Can he do that before it's too late for the town, Becca ... and their future together? + + + Hostage negotiations + Fiction. + + + Kidnapping + Fiction. + + + Man-woman relationships + Fiction. + + + Love stories. + gsafd + + + Religious fiction. + lcsh + + + Fiction. + lcgft + https://id.loc.gov/authorities/genreForms/gf2014026339 + + + Copyright Paperback Collection (Library of Congress) + DLC + + + Harlequin intrigue ; + 2142. + +4marcxmlxml + 01202cam a2200361 a 4500 + 1024670 + 20250606160048.2 + 880315s1987 mtua 000 0 eng + + 1024670 + + + 7 + cbc + orignew + 4 + ncip + 19 + y-gencatlg + + + bx24 to bd00 03-15-88; fd18 04-07-88 + + + LCAP batch update 2025-06-01-04:00: LCAPM-644, LCAPM-150 + + + 88120635 + + + 0938314270 + pbk. + + + 9780938314271 + (pbk.) + + + (DLC) 88120635 + + + DLC + DLC + DLC + + + n-us-wy + + + F765 + .B66 1987 + + + 917.87/02 + 19 + + + Bonney, Lorraine G. + + + Wyoming mountain ranges / + [by Lorraine G. Bonney]. + + + Helena, Mont. : + American Geographic Pub., + c1987. + + + 104 p. : + ill. (some col.) ; + 22 x 28 cm. + + + text + txt + rdacontent + + + unmediated + n + rdamedia + + + volume + nc + rdacarrier + + + Wyoming geographic series ; + no. 1 + + + Mountains + Wyoming. + + + Mountains + Wyoming + Pictorial works. + + + Wyoming + Pictorial works. + + + ad + + + c-GenColl + F765 + .B66 1987 + 00004522758 + Copy 1 + BOOKS + +5marcxmlxml + 02099cam a22004693i 4500 + 23912258 + 20250607131717.6 + 241104s2023 onc e 000 1 eng d + + 23912258 + + + 7 + cbc + copycat + 2 + ncip + 20 + y-genrareb + + + acquire + 1 copy only regardless of location + policy default + + + he08 2024-11-08 + he08 2024-11-08 TW routine + + + LCAP batch update 2025-06-02-04:00: LCAPM-893 + + + 2023514237 + + + 9781335582676 + (paperback) + + + 1335582673 + (paperback) + + + (OCoLC)1379428482 + + + UUC + eng + rda + UUC + BDX + OJ4 + T7L + OCLCF + OCLCO + OCLCL + OCLCQ + NLC + IHX + OCLCO + DLC + + + lccopycat + + + CPB Box no. 4519 vol. 6 + + + Rushdan, Juno, + author. + + + Wyoming mountain murder / + Juno Rushdan. + + + Toronto, Ontario, Canada : + Harlequin Enterprises ULC, + 2023. + + + ©2023 + + + 248 pages ; + 17 cm. + + + single unit + rdami + + + text + txt + rdacontent + + + unmediated + n + rdamedia + + + volume + nc + rdacarrier + + + perfect binding + rdatb + + + Harlequin intrigue ; + 2148 + + + Cowboy state lawmen + + + When self-defense trainer Charlie Sharp is nearly killed by an explosion, Wyoming detective Brian Bradshaw finds himself with a murder investigation on his hands. And worse, it involves one of his own. Now bodies are turning up, and Brian suspects Charlie knows more than she's telling. Trusting each other is hard enough. But knowing her secrets might be more danger than he bargained for... + + + Man-woman relationships + Fiction. + + + Murder + Investigation + Fiction. + + + Wyoming + Fiction. + + + Love stories. + gsafd + + + Suspense fiction. + gsafd + + + Romantic suspense fiction + gsafd + + + Fiction. + lcgft + https://id.loc.gov/authorities/genreForms/gf2014026339 + + + Copyright Paperback Collection (Library of Congress) + DLC + + + Harlequin intrigue ; + 2148. + +6marcxmlxml + 01363cam a22003734a 4500 + 4036237 + 20250607161556.8 + 981118s1999 mtuab 001 0 eng + + 4036237 + + + 7 + cbc + orignew + 1 + ocip + 19 + y-gencatlg + + + acquire + 2 shelf copies + policy default + + + pc16 to sa00 11-18-98; sj03 11-18-98; sj09 11-20-98; sj04 11-21-98 + ps07 2004-01-21 1 copy rec'd., to CIP ver.; + sj04 2004-01-27; + sj04 2004-01-27 to BCCD + + + LCAP batch update 2025-06-02-04:00: LCAPM-644, LCAPM-893, LCAPM-150 + + + 98050260 + + + 1560448059 + pbk. + + + 9781560448051 + (pbk.) + + + (DLC) 98050260 + + + DLC + DLC + DLC + WaU + + + pcc + + + n-us-wy + + + GV1045.5.W8 + T73 1999 + + + 796.6/3/09787 + 21 + + + Travsky, Amber, + 1955- + + + Mountain biking Wyoming / + Amber Travsky. + + + Helena, Mont. : + Falcon, + c1999. + + + ix, 273 p. : + ill., maps ; + 23 cm. + + + text + txt + rdacontent + + + unmediated + n + rdamedia + + + volume + nc + rdacarrier + + + A Falcon guide + + + Includes index. + + + Mountain biking + Wyoming + Guidebooks. + + + Wyoming + Guidebooks. + + + Guidebooks. + lcgft + https://id.loc.gov/authorities/genreForms/gf2014026108 + +7marcxmlxml + 01879cam a22003973i 4500 + 24219466 + 20250607133936.2 + 250524s2024 onc 000 1 eng d + + 24219466 + + + 7 + cbc + copycat + 2 + ncip + 20 + y-genrareb + + + acquire + 1 copy only regardless of location + policy default + + + he08 2025-05-28 + he08 2025-05-28 TW routine + + + LCAP batch update 2025-06-02-04:00: LCAPM-893 + + + 2025292991 + + + 9781335456793 + (mass market paperbound) + + + 1335456791 + + + (OCoLC)1458034921 + + + CGP + eng + rda + CGP + OCLCO + BDX + IG# + OCLCQ + DLC + + + lccopycat + + + CPB Box no. 4558 vol. 22 + + + Rushdan, Juno, + author. + + + Wyoming mountain investigation / + Juno Rushdan. + + + Toronto, Ontario, Canada : + Harlequin Enterprises ULC, + 2024. + + + 224 pages ; + 18 cm. + + + text + txt + rdacontent + + + unmediated + n + rdamedia + + + volume + nc + rdacarrier + + + Cowboy State Lawmen: Duty and Honor + + + Harlequin intrigue + + + "Rescuing teenage campers from a fire left Liz Kelley scarred for life. But her Wyoming town isn't all she left behind. Fire marshal Sawyer Powell can't forgive himself for failing to protect her that terrible night. Fifteen years later, a string of suspicious fires brings Liz--now an FBI agent--home. Working the case together gives the former lovers a second chance--but also makes them a killer's target."--Provided by publisher. + + + Man-woman relationships + Fiction. + + + Arson + Fiction. + + + Suspense fiction. + gsafd + + + Fiction. + lcgft + https://id.loc.gov/authorities/genreForms/gf2014026339 + + + Copyright Paperback Collection (Library of Congress) + DLC + + + Harlequin intrigue. + +8marcxmlxml + 02131nkd a22004577a 4500 + 19939236 + 20250607081652.9 + cr ||||||||||| + kg b|| + 000919s1941 wyunnn f kneng + + 19939236 + + + 0 + cbc + orignew + u + unde + 20 + y-printpho + + + LCAP batch update 2025-06-02-04:00: LCAPM-859 + + + 2017808421 + + + (DLC)fsa2000039608/PP + + + LC-USF34-058943-D + DLC + (b&w film neg.) + + + DLC + eng + DLC + gihc + + + LC-USF34- + 058943-D + + + G + 9067 + z + + + corresponding photographic print + LOT 131 + + + Wolcott, Marion Post, + 1910-1990, + photographer. + + + Ranchester, Big Horn Mountains, Wyoming. Stockmen's saloon + [graphic]. + + + 1941 Sept. + + + 1 negative : + safety ; + 3 1/4 x 4 1/4 inches or smaller. + + + still image + sti + rdacontent + + + unmediated + n + rdamedia + + + sheet + nb + rdacarrier + + + Title and other information from print in lot. + + + No known restrictions. For information, see U.S. Farm Security Administration/Office of War Information Black & White Photographs + http://www.loc.gov/rr/print/res/071_fsab.html + + + Transfer; + United States. Office of War Information. Overseas Picture Division. Washington Division; + 1944. + + + More information about the FSA/OWI Collection is available at + http://hdl.loc.gov/loc.pnp/pp.fsaowi + + + Safety film negatives. + gmgpc + + + United States + Wyoming + Sheridan County + Ranchester. + + + Farm Security Administration - Office of War Information Photograph Collection (Library of Congress) + (DLC) 2002708960 + + + Library of Congress + Prints and Photographs Division + Washington, D.C. 20540 USA + dcu + http://hdl.loc.gov/loc.pnp/pp.print + + + intermediary roll film + fsa + 8c35985 + p + http://hdl.loc.gov/loc.pnp/fsa.8c35985 + + + Temp. note: usf34batch7 + + + Film copy on SIS roll 27, frame 972. + + + pp/fsa + ammem + + + pp/diof + + + c-P&P + obj. + +9marcxmlxml + 02018ckm a22004937a 4500 + 15344658 + 20250607024518.4 + kf bo| + cr ||||||||||| + 080626s1898 |||nnn || kneng + + 15344658 + + + 0 + ibc + orignew + u + ncip + 20 + y-printpho + + + LCAP batch update 2025-06-01-04:00: LCAPM-861 + + + 2008678243 + + + LC-DIG-ppmsca-18043 + DLC + (digital file from original item) + + + DLC + DLC + DLC + gihc + + + n-us--- + + + LOT 13923, + no. 235 [item] + + + Detroit Photographic Co. + + + Wyoming. Lake d'Amalia, Wind River Mountains + [graphic]. + + + c1898. + + + 1 photomechanical print : + photochrom, color. + + + still image + sti + rdacontent + + + unmediated + n + rdamedia + + + Digital image + computer + c + rdamedia + + + sheet + nb + rdacarrier + + + Digital image + online resource + cr + rdacarrier + + + Copyright 1898 by Detroit Photographic Co. + + + Title from item. + + + Title on inventory list: Lake d'Amalia, Wind River Mtns. + + + Caption for similar image in LOT 12690, no. 15 (LC-USZ62-93667) lists title as: Lake de Amalia. + + + Detroit Publishing Co. no. "53269". + + + No known restrictions on publication. + + + More information about the Photochrom Print Collection is available at http://hdl.loc.gov/loc.pnp/pp.pgz + + + Forms part of: Photochrom Print Collection. + + + Lakes & ponds. + lctgm + + + Mountains. + lctgm + + + Photochrom prints + Color. + gmgpc + + + United States + Wyoming. + lcsh + + + Library of Congress + Prints and Photographs Division + Washington, D.C. 20540 USA + dcu + http://hdl.loc.gov/loc.pnp/pp.print + + + digital file from original item + ppmsca + 18043 + p + http://hdl.loc.gov/loc.pnp/ppmsca.18043 + + + pp/pgz + + + pp/diof + + + c-P&P + obj. + +10marcxmlxml + 00860cam a2200265u 4500 + 7747041 + 20250608014933.2 + 830126m18921896dcu 000 0 eng + + 7747041 + + + 0 + cbc + premunv + u + ncip + 19 + y-gencatlg + + + LCAP batch update 2025-06-02-04:00: LCAPM-644 + + + 08010561 + + + (DLC) 08010561 + + + DLC + CarP + DLC + + + n-us-wy + + + QK1 + .U5 vol. 3 + + + Rose, J. N. + (Joseph Nelson), + 1862-1928. + + + Plants from the Big Horn Mountains of Wyoming. + + + Washington, + 1892-96. + + + p. 567-574. 24 cm. + + + text + txt + rdacontent + + + unmediated + n + rdamedia + + + volume + nc + rdacarrier + + + Botany + Wyoming + Big Horn Mountains. [from old catalog] + + + c-GenColl + QK1 + .U5 vol. 3 + Copy 1 + PREM + +11marcxmlxml + 01685ckm a22003977a 4500 + 22797116 + 20250607115416.7 + kh |oc + cr ||||||||||| + 220920q19341946xx nnn kneng + + 22797116 + + + 0 + ibc + orignew + u + ncip + 20 + y-printpho + + + pnpm qw86 2022-09 + + + 2022653856 + + + LC-DIG-stereo-1s46275 + DLC + (digital file from original, front) + + + LC-DIG-stereo-2s46275 + DLC + (digital file from original, back) + + + DLC + eng + dcrmg + DLC + + + LOT 11033 + [item] + + + Keystone View Company, + publisher + + + The Teton Mountains across Jackson Lake, Wyoming + [graphic]. + + + [between 1934 and 1946] + + + 1 photograph : + print ; + mount 9 x 18 cm (stereograph format) + + + still image + sti + rdacontent + + + unmediated + n + rdamedia + + + sheet + nb + rdacarrier + + + Title transcribed from item. + + + No. 35466. + + + Rights status not evaluated. For general information see "Copyright and Other Restrictions ...," + https://hdl.loc.gov/loc.pnp/res.195.copr + + + Stereographs + 1930-1950. + gmgpc + + + Photographic prints + 1930-1950. + gmgpc + + + Library of Congress + Prints and Photographs Division + Washington, D.C. 20540 USA + dcu + https://hdl.loc.gov/loc.pnp/pp.print + + + digital file from original, front + stereo + 1s46275 + p + http://hdl.loc.gov/loc.pnp/stereo.1s46275 + + + digital file from original, back + stereo + 2s46275 + p + http://hdl.loc.gov/loc.pnp/stereo.2s46275 + + + pp/stereo + + + pp/diof + + + c-P&P + +12marcxmlxml + 00927cam a2200289u 4500 + 8751298 + 20250608032327.9 + 810304s1930 ctu 000 0 eng + + 8751298 + + + 0 + cbc + premunv + u + ncip + 19 + y-gencatlg + + + LCAP batch update 2025-06-02-04:00: LCAPM-644 + + + 31028876 + + + (DLC) 31028876 + + + DLC + CarP + DLC + + + n-us-wy + + + QE1 + .C7 vol. 40, no. 4 + + + Gilling, Katharine Stevens (Fowler), + 1902- + + + The anorthosite area of the Laramie mountains, Wyoming. + + + [New Haven, + 1930] + + + p. cm. + + + text + txt + rdacontent + + + unmediated + n + rdamedia + + + volume + nc + rdacarrier + + + Anorthosite + Wyoming. + + + Geology, Stratigraphic + Precambrian. + + + Petrology + Wyoming + Laramie Mountains. [from old catalog] + + + fcd 050dvc + +13marcxmlxml + 00965cam a2200289u 4500 + 6468528 + 20250607235104.1 + 830103s1946 wyubf s000 0 eng + + 6468528 + + + 0 + cbc + premunv + u + ncip + 19 + y-gencatlg + + + LCAP batch update 2025-06-02-04:00: LCAPM-644 + + + gs 46000135 + + + (DLC)gs 46000135 + + + DLC + CarP + DLC + + + n-us-wy + + + QE181 + .A25 no. 35 + + + QE182.W5 + B3 + + + Baker, Charles Laurence, + 1887- + + + Geology of the northwestern Wind River Mountains, Wyoming, + + + Laramie, Wyo., + University of Wyoming, + 1946. + + + 565-596 p. + plates, maps (1 fold.) + 25 cm. + + + text + txt + rdacontent + + + unmediated + n + rdamedia + + + volume + nc + rdacarrier + + + Geology + Wyoming + Wind River Range. + + + Wind River Range (Wyo.) + + + c-GenColl + QE181 + .A25 no. 35 + Copy 1 + PREM + +14marcxmlxml + 01219cem a22003731i 4500 + 5841254 + 20250607225233.8 + ad aanzn + 810429s1906 dcu e | eng + + 5841254 + + + 0 + cbc + premver + u + ncip + 19 + y-geogmaps + + + acquire + 1 shelf copy + policy default + + + ga37 2020-09-30 NEW INPUT + + + gs 07000309 + + + a + + + DLC + eng + rda + DLC + + + n-us-wy + + + G1201.C5 + U5 vol. 141 + + + 3701 + + + Darton, Nelson Horatio, + 1865-1948, + cartographer. + + + Bald mountain-Dayton folio, Wyoming. + + + Scales differ. + + + Washington, D.C. : + U. S. Geological Survey, + 1906. + + + 1 atlas (15, [1] pages, ll leaves of plates) : + maps ; + 55 x 47 cm + + + cartographic image + cri + rdacontent + + + unmediated + n + rdamedia + + + volume + nc + rdacarrier + + + Includes 7 maps. + + + Geology + Wyoming + Maps. + + + Atlases. + lcgft + + + Geological maps. + lcgft + + + Salisbury, Rollin D., + 1858-1922, + cartographer. + + + ATLAS MIG + + + c-G&M + G1201.C5 + U5 vol. 141 + Copy 1 + PREM + +15marcxmlxml + 01036cem a2200301 4500 + 5439589 + 20250607183231.8 + aj|canzn + 771116s1976 cau a 1 eng + + 5439589 + + + 7 + cbc + orignew + u + ncip + 19 + y-geogmaps + + + 77697338 + + + F63204 + U.S. Copyright Office + + + (DLC) 77697338 + + + DLC + DLC + DLC + + + G4264.L2 1976 + .J3 + + + 4264 + L2 + + + J & R Map Company. + + + Lander, Wyoming, big mountain country. + + + El Cajon, Ca. + [1976] + + + col. map + 44 x 24 cm. fold. to 22 x 10 cm. + + + Folded title: City map of Lander, Wyoming. + + + Includes index to points of interest, col. illus., and advertisements. + + + Map of "The best of the big mountain country," text, index, illus. (part col.), and advertisements on verso. + + + Scale not given. + + + Lander (Wyo.) + Maps. + + + AACR2 + + + c-G&M + G4264.L2 1976 + .J3 + Copy 1 + MAPS + +16marcxmlxml + 00937cam a2200301 4500 + 1259091 + 20250606191317.6 + 730711s1972 wyua s 000 0 eng + + 1259091 + + + 7 + cbc + orignew + 3 + ncip + 19 + y-gencatlg + + + LCAP batch update 2025-06-01-04:00: LCAPM-644 + + + 73621244 + + + (DLC) 73621244 + + + DLC + DLC + DLC + + + n-us-wy + + + Z733 + .W96 1969-1972 + + + 027.5787/19 + + + Wyoming State Library. + + + Serving Wyoming from mountain to plain. + + + Cheyenne + [1972?] + + + 33 p. + illus. + 28 cm. + + + text + txt + rdacontent + + + unmediated + n + rdamedia + + + volume + nc + rdacarrier + + + Its Report, + 1969-1972 + + + Wyoming State Library. + + + Wyoming State Library. + Report, + 1969-1972. + + + c-GenColl + Z733 + .W96 1969-1972 + Copy 1 + BOOKS + +17marcxmlxml + 01997cam a22004453i 4500 + 23994612 + 20250607132324.1 + 250116s2023 onc 000 1 eng d + + 23994612 + + + 7 + cbc + copycat + 2 + ncip + 20 + y-genrareb + + + acquire + 1 copy only regardless of location + policy default + + + he08 2025-01-22 + he08 2025-01-22 TW routine + + + LCAP batch update 2025-06-02-04:00: LCAPM-893 + + + 2024437196 + + + 9781335591173 + (paperback) + + + 1335591176 + (paperback) + + + (OCoLC)1399430928 + + + CGP + eng + rda + CGP + BDX + OCLCO + TDS + OCLCF + T7L + NLC + OCLCO + IHI + OCLCO + DLC + + + lccopycat + + + CPB Box no. 4529 vol. 14 + + + Rushdan, Juno, + author. + + + Wyoming mountain cold case / + Juno Rushdan. + + + Toronto, Ontario : + Harlequin Enterprises ULC, + 2023. + + + ©2023 + + + 251 pages ; + 17 cm. + + + text + txt + rdacontent + + + unmediated + n + rdamedia + + + volume + nc + rdacarrier + + + Harlequin intrigue ; + 2172 + + + Cowboy state lawmen + + + "Called to the scene of a killer's latest victim, Laramie PD chief Willa Nelson and Sheriff Daniel Clark must work together despite jurisdictional differences. But as their investigation leads to a cold case, Willa has to trust Daniel with the truth. As the bodies pile up and the pressure mounts, they find themselves facing more than one unstoppable killer..." -- Page [4] cover. + + + Man-woman relationships + Fiction. + + + Serial murder investigation + Fiction. + + + Serial murders + Fiction. + + + Police + Fiction. + + + Wyoming + Fiction. + + + Suspense fiction. + gsafd + + + Fiction. + lcgft + https://id.loc.gov/authorities/genreForms/gf2014026339 + + + Copyright Paperback Collection (Library of Congress) + DLC + + + Harlequin intrigue ; + 2172. + +18marcxmlxml + 01828cem a22004454a 4500 + 13691024 + 20250606211722.8 + aj aazaa + 040818s1990 wyua a s 0 eng + + 13691024 + + + 7 + cbc + orignew + u + ncip + 20 + n-geogmaps + + + ga23 2004-08-23 sent to CMT + + + LCAP batch update 2025-06-01-04:00: LCAPM-779, LCAPM-893 + + + 2004633111 + + + a + 24000 + + + a + 50000 + + + DLC + DLC + DLC + + + pcc + + + G4312.M35C5 1990 + D8 + + + 4312 + M35 + + + Duebendorfer, Ernest M. + + + Geologic map of the Cheyenne Belt, Medicine Bow Mountains, Wyoming ; + Structure map of the Cheyenne Belt, Medicine Bow Mountains, Wyoming / + Ernest M. Duebendorfer. + + + Geologic map of the Cheyenne Belt, Medicine Bow Mountains, Wyoming ; Structure map of the Cheyenne Belt, Medicine Bow Mountains, Wyoming + + + Scale 1:24,000. + + + Scale 1:50,000. + + + [Laramie, Wyo.] : + Geological Survey of Wyoming, + 1990. + + + 2 maps : + photocopies ; + 106 x 136 cm. and 58 x 83 cm. + + + cartographic image + cri + rdacontent + + + unmediated + n + rdamedia + + + sheet + nb + rdacarrier + + + Open file report / Geological Survey (U.S.); + 90-8 + + + Relief shown by contours. + + + Blue line print. + + + "Mapping complete in 1986." + + + Includes index map. + + + Geology + Medicine Bow Mountains (Colo. and Wyo.) + Maps. + + + Maps. + lcgft + https://id.loc.gov/authorities/genreForms/gf2011026387 + + + Geological Survey of Wyoming + + + Structure map of the Cheyenne Belt, Medicine Bow Mountains, Wyoming + + + Open-file report (Geological Survey (U.S.)) ; + 90-8 + +19marcxmlxml + 01866cas a2200433 a 4500 + 12300995 + 20250922140555.8 + 010205d1998199ucouar 0 0eng + + 2001201278 + + + AU@ + 000022256015 + + + (OCoLC)45849522 + + + DLC + eng + DLC + OCLCQ + OCLCF + OCLCO + OCLCA + OCLCL + + + pcc + + + n-us-wy + + + HD4976.W8 + S87 + + + 331.2/1/09787021 + 21 + + + Survey. + Wyoming compensation / + Mountain States Employers Council, Inc. + + + Wyoming compensation + + + Denver, Colo. : + The Council, + 1998- + + + v. ; + 28 cm. + + + Annual + + + 1998- + + + Wages + Wyoming + Statistics + Periodicals. + + + Employee fringe benefits + Wyoming + Statistics + Periodicals. + + + Wage surveys + Wyoming + Periodicals. + + + Employee fringe benefits. + fast + (OCoLC)fst00908971 + + + Wage surveys. + fast + (OCoLC)fst01169473 + + + Wages. + fast + (OCoLC)fst01169492 + + + Wyoming. + fast + (OCoLC)fst01204583 + https://id.oclc.org/worldcat/entity/E39PBJk4DBFyx99v9QWCjhMMfq + + + Periodicals. + fast + (OCoLC)fst01411641 + + + Statistics. + fast + (OCoLC)fst01423727 + + + Mountain States Employers Council. + https://id.oclc.org/worldcat/entity/E39QH7JmqgHjp3TWkVc4x3fPp6 + + + Survey. Wyoming compensation & personnel practices + 1099-6001 + (DLC) 98658107 + (OCoLC)39135854 + + + Survey. Wyoming compensation and personnel practices + (DLC) 2002204064 + (OCoLC)49715061 + + + DLC + + + 7 + cbc + serials + 2 + ncip + 20 + n-oclcserc + + + Acquire + 1 shelf copy + Policy default 02-12-01 + + + da06 02-12-01; sent to cat. tech. 02-12-01 + da61 2001-07-18 to BCCD + + + LCAP batch update 2025-06-01-04:00: LCAPM-644, LCAPM-893 + +20211.1bath.any=mountains and bath.any=wyoming20xmlmarcxml diff --git a/src/server/sources/fixtures/loc-similar-xyzzy-plugh-quux.xml b/src/server/sources/fixtures/loc-similar-xyzzy-plugh-quux.xml new file mode 100644 index 0000000..36567aa --- /dev/null +++ b/src/server/sources/fixtures/loc-similar-xyzzy-plugh-quux.xml @@ -0,0 +1,2 @@ + +1.101.1bath.any=xyzzy and bath.any=plugh and bath.any=quux20xmlmarcxml diff --git a/src/server/sources/fixtures/loc-similar-xyzzy-plugh.xml b/src/server/sources/fixtures/loc-similar-xyzzy-plugh.xml new file mode 100644 index 0000000..f10686c --- /dev/null +++ b/src/server/sources/fixtures/loc-similar-xyzzy-plugh.xml @@ -0,0 +1,2 @@ + +1.101.1bath.any=xyzzy and bath.any=plugh20xmlmarcxml diff --git a/src/server/sources/fixtures/ol-similar-artisan-flour-water-yeast-bread-pizza-salt.json b/src/server/sources/fixtures/ol-similar-artisan-flour-water-yeast-bread-pizza-salt.json new file mode 100644 index 0000000..bfe8e1f --- /dev/null +++ b/src/server/sources/fixtures/ol-similar-artisan-flour-water-yeast-bread-pizza-salt.json @@ -0,0 +1 @@ +{"numFound":3,"start":0,"numFoundExact":true,"num_found":3,"documentation_url":"https://openlibrary.org/dev/docs/api/search","q":"artisan flour water yeast bread pizza salt","offset":null,"docs":[{"author_name":["Ken Forkish"],"first_publish_year":2012,"key":"/works/OL16626586W","lcc":["TX-0769.00000000.F67 2012"],"title":"Flour Water Salt Yeast","subject":["Bread","COOKING / Courses & Dishes / Bread","COOKING / Methods / Baking","COOKING / Courses & Dishes / Pizza","Pizza","Cooking","nyt:advice-how-to-and-miscellaneous=2020-04-26","New York Times bestseller","Baking","U.s. cooking"]},{"author_name":["Rene Abbott"],"first_publish_year":2022,"key":"/works/OL28881815W","title":"Salt Flour Water Yeast"},{"author_name":["Maureen Padgett"],"first_publish_year":2021,"key":"/works/OL35877791W","title":"Element of Flour Water Salt and Yeast"}]} \ No newline at end of file diff --git a/src/server/sources/fixtures/ol-similar-artisan-flour-water-yeast-bread.json b/src/server/sources/fixtures/ol-similar-artisan-flour-water-yeast-bread.json new file mode 100644 index 0000000..4ccdf73 --- /dev/null +++ b/src/server/sources/fixtures/ol-similar-artisan-flour-water-yeast-bread.json @@ -0,0 +1 @@ +{"numFound":5,"start":0,"numFoundExact":true,"num_found":5,"documentation_url":"https://openlibrary.org/dev/docs/api/search","q":"artisan flour water yeast bread","offset":null,"docs":[{"author_name":["Ken Forkish"],"first_publish_year":2012,"key":"/works/OL16626586W","lcc":["TX-0769.00000000.F67 2012"],"title":"Flour Water Salt Yeast","subject":["Bread","COOKING / Courses & Dishes / Bread","COOKING / Methods / Baking","COOKING / Courses & Dishes / Pizza","Pizza","Cooking","nyt:advice-how-to-and-miscellaneous=2020-04-26","New York Times bestseller","Baking","U.s. cooking"]},{"author_name":["Maria Pizzarotti"],"first_publish_year":2020,"key":"/works/OL22285220W","title":"Italian Bread"},{"author_name":["Rene Abbott"],"first_publish_year":2022,"key":"/works/OL28881815W","title":"Salt Flour Water Yeast"},{"author_name":["Ken Forkish"],"first_publish_year":2022,"key":"/works/OL27849095W","title":"Evolutions in Bread"},{"author_name":["Maureen Padgett"],"first_publish_year":2021,"key":"/works/OL35877791W","title":"Element of Flour Water Salt and Yeast"}]} \ No newline at end of file diff --git a/src/server/sources/fixtures/ol-similar-artisan-flour-water-yeast.json b/src/server/sources/fixtures/ol-similar-artisan-flour-water-yeast.json new file mode 100644 index 0000000..6e8157b --- /dev/null +++ b/src/server/sources/fixtures/ol-similar-artisan-flour-water-yeast.json @@ -0,0 +1 @@ +{"numFound":5,"start":0,"numFoundExact":true,"num_found":5,"documentation_url":"https://openlibrary.org/dev/docs/api/search","q":"artisan flour water yeast","offset":null,"docs":[{"author_name":["Ken Forkish"],"first_publish_year":2012,"key":"/works/OL16626586W","lcc":["TX-0769.00000000.F67 2012"],"title":"Flour Water Salt Yeast","subject":["Bread","COOKING / Courses & Dishes / Bread","COOKING / Methods / Baking","COOKING / Courses & Dishes / Pizza","Pizza","Cooking","nyt:advice-how-to-and-miscellaneous=2020-04-26","New York Times bestseller","Baking","U.s. cooking"]},{"author_name":["Rene Abbott"],"first_publish_year":2022,"key":"/works/OL28881815W","title":"Salt Flour Water Yeast"},{"author_name":["Maria Pizzarotti"],"first_publish_year":2020,"key":"/works/OL22285220W","title":"Italian Bread"},{"author_name":["Maureen Padgett"],"first_publish_year":2021,"key":"/works/OL35877791W","title":"Element of Flour Water Salt and Yeast"},{"author_name":["Ken Forkish"],"first_publish_year":2022,"key":"/works/OL27849095W","title":"Evolutions in Bread"}]} \ No newline at end of file diff --git a/src/server/sources/fixtures/ol-similar-mountains-wyoming-trails-river-wind.json b/src/server/sources/fixtures/ol-similar-mountains-wyoming-trails-river-wind.json new file mode 100644 index 0000000..ecbf41d --- /dev/null +++ b/src/server/sources/fixtures/ol-similar-mountains-wyoming-trails-river-wind.json @@ -0,0 +1 @@ +{"numFound":3,"start":0,"numFoundExact":true,"num_found":3,"documentation_url":"https://openlibrary.org/dev/docs/api/search","q":"mountains wyoming trails river wind","offset":null,"docs":[{"first_publish_year":2017,"key":"/works/OL24163660W","title":"Beyond Trails in The Wind River Mountains of Wyoming"},{"author_name":["Ben Adkison"],"first_publish_year":2012,"key":"/works/OL19745445W","lcc":["GV-0199.42000000.W82W5617","GV-0199.42000000.W82 W5617 2018"],"title":"Hiking Wyoming's Wind River Range","subject":["Walking","Guidebooks","Backpacking","Hiking","Trails","Outdoor recreation","Mountaineering","Rock climbing","Wyoming, guidebooks"]},{"author_name":["Ron Adkison"],"first_publish_year":1996,"key":"/works/OL19548745W","lcc":["GV-0199.42000000.W82 W5617 1996","GV-0199.42000000.W82W5617 19"],"title":"I dispacci di Giovanni Michiel","subject":["Guidebooks","Hiking","Mountaineering","Trails","Wyoming, description and travel"]}]} \ No newline at end of file diff --git a/src/server/sources/fixtures/ol-similar-mountains-wyoming-trails-river.json b/src/server/sources/fixtures/ol-similar-mountains-wyoming-trails-river.json new file mode 100644 index 0000000..641edcd --- /dev/null +++ b/src/server/sources/fixtures/ol-similar-mountains-wyoming-trails-river.json @@ -0,0 +1 @@ +{"numFound":12,"start":0,"numFoundExact":true,"num_found":12,"documentation_url":"https://openlibrary.org/dev/docs/api/search","q":"mountains wyoming trails river","offset":null,"docs":[{"first_publish_year":2017,"key":"/works/OL24163660W","title":"Beyond Trails in The Wind River Mountains of Wyoming"},{"author_name":["Ben Adkison"],"first_publish_year":2012,"key":"/works/OL19745445W","lcc":["GV-0199.42000000.W82W5617","GV-0199.42000000.W82 W5617 2018"],"title":"Hiking Wyoming's Wind River Range","subject":["Walking","Guidebooks","Backpacking","Hiking","Trails","Outdoor recreation","Mountaineering","Rock climbing","Wyoming, guidebooks"]},{"first_publish_year":1984,"key":"/works/OL17664893M","title":"Beaver Trail","subject":["Beavers.","Nature trails -- Wyoming -- Muddy Mountain.","Muddy Mountain (Wyo.)"]},{"first_publish_year":1984,"key":"/works/OL17831114M","title":"Beaver Trail","subject":["Beavers.","Nature trails -- Wyoming -- Muddy Mountain.","Muddy Mountain (Wyo.)"]},{"first_publish_year":1984,"key":"/works/OL14918027M","title":"Beaver Trail","subject":["Beavers","Nature trails -- Wyoming -- Muddy Mountain","Muddy Mountain (Wyo.)"]},{"author_name":["Earle Crowe"],"first_publish_year":1960,"key":"/works/OL7524672W","title":"General Beale's sheep odessey [sic]","subject":["History","Sheep","Transportation"]},{"first_publish_year":1983,"key":"/works/OL14918025M","title":"Forest ecology/plant identification trail","subject":["Forest ecology -- Wyoming -- Muddy Mountain","Nature trails -- Wyoming -- Muddy Mountain"]},{"author_name":["Ron Adkison"],"first_publish_year":1996,"key":"/works/OL19548745W","lcc":["GV-0199.42000000.W82 W5617 1996","GV-0199.42000000.W82W5617 19"],"title":"I dispacci di Giovanni Michiel","subject":["Guidebooks","Hiking","Mountaineering","Trails","Wyoming, description and travel"]},{"author_name":["Cheryl Harness"],"first_publish_year":2006,"key":"/works/OL15964798W","lcc":["E--0444.00000000.T82 A73 2006","F--0880.00000000.H275 2006","E--0444.00000000.T82A73 2006"],"title":"The tragic tale of Narcissa Whitman and a faithful history of the Oregon Trail","subject":["Women missionaries","Frontier and pioneer life","Women pioneers","Overland journeys to the Pacific","Juvenile literature","Biography","History","African American women","Slaves","Underground railroad","Underground Railroad","African americans, juvenile literature","African americans","Tubman, harriet, 1822-1913","Tubman, harriet, 1822-1913, juvenile literature","Whitman, narcissa (prentiss), 1808-1847","Missionaries","Missionaries, juvenile literature","Frontier and pioneer life, juvenile literature","Overland journeys to the pacific","Overland journeys to the pacific, juvenile literature","Oregon national historic trail","Oregon national historic trail, juvenile literature","Pioneers","Oregon, history"]},{"author_name":["Robert A. Murray"],"first_publish_year":1970,"key":"/works/OL715107W","lcc":["F--0782.00000000.A7 M87"],"title":"Citadel on the Santa Fe Trail","subject":["Fortification","Frontier and pioneer life"]},{"author_name":["Jeff A. Nussbaumer"],"first_publish_year":2013,"key":"/works/OL24847889W","title":"RAD","subject":["Mountain biking","Guidebooks","Bicycle trails"]},{"author_name":["Kemp, James Furman"],"first_publish_year":1887,"key":"/works/OL33051801W","title":"[Collected works by James Furman Kemp.]"}]} \ No newline at end of file diff --git a/src/server/sources/fixtures/ol-similar-mountains-wyoming-trails.json b/src/server/sources/fixtures/ol-similar-mountains-wyoming-trails.json new file mode 100644 index 0000000..4267df0 --- /dev/null +++ b/src/server/sources/fixtures/ol-similar-mountains-wyoming-trails.json @@ -0,0 +1 @@ +{"numFound":33,"start":0,"numFoundExact":true,"num_found":33,"documentation_url":"https://openlibrary.org/dev/docs/api/search","q":"mountains wyoming trails","offset":null,"docs":[{"first_publish_year":2017,"key":"/works/OL24163660W","title":"Beyond Trails in The Wind River Mountains of Wyoming"},{"author_name":["James R. Wolf"],"first_publish_year":1976,"key":"/works/OL4107295W","lcc":["GV-0199.42000000.C84 W64 1991","GV-0199.42000000.C84 W64"],"title":"Guide to the Continental Divide Trail","subject":["Guidebooks","Hiking","Natural history"]},{"author_name":["William Robert Skinner"],"first_publish_year":1966,"key":"/works/OL38530872W","title":"Geologic evolution of the Beartooth Mountains, Montana and Wyoming","subject":["Ultrabasic rocks"]},{"author_name":["Marc Smith"],"first_publish_year":2007,"key":"/works/OL12277591W","lcc":["GV-0199.42000000.W82 M436 2007","GV-0199.42000000.W82 M436 2009"],"title":"Hiking Wyoming's Medicine Bow National Forest","subject":["Guidebooks","Hiking"]},{"author_name":["Jim Russell"],"first_publish_year":1962,"key":"/works/OL43017927W","lcc":["CT-0275.00000000.F728 R8","F--0595.00000000.F95 R87 1962"],"title":"Bob Fudge","subject":["Fudge, Bob, 1862-1933","Frontier and pioneer life--West (U.S.)","Cattle trails--West (U.S.)--History","Pioneers--West (U.S.)--Biography"]},{"author_name":["Keffer, Ken (Naturalist)"],"first_publish_year":2017,"key":"/works/OL20054997W","lcc":["GV-0199.42000000","GV-0199.42000000.W82 B533 2017"],"title":"Hiking Wyoming's Bighorn Mountains","subject":["Trails","Guidebooks","Hiking","Wyoming, guidebooks","Montana, guidebooks"]},{"first_publish_year":1984,"key":"/works/OL17664893M","title":"Beaver Trail","subject":["Beavers.","Nature trails -- Wyoming -- Muddy Mountain.","Muddy Mountain (Wyo.)"]},{"first_publish_year":1984,"key":"/works/OL17831114M","title":"Beaver Trail","subject":["Beavers.","Nature trails -- Wyoming -- Muddy Mountain.","Muddy Mountain (Wyo.)"]},{"first_publish_year":1984,"key":"/works/OL14918027M","title":"Beaver Trail","subject":["Beavers","Nature trails -- Wyoming -- Muddy Mountain","Muddy Mountain (Wyo.)"]},{"author_name":["Ben Adkison"],"first_publish_year":2012,"key":"/works/OL19745445W","lcc":["GV-0199.42000000.W82W5617","GV-0199.42000000.W82 W5617 2018"],"title":"Hiking Wyoming's Wind River Range","subject":["Walking","Guidebooks","Backpacking","Hiking","Trails","Outdoor recreation","Mountaineering","Rock climbing","Wyoming, guidebooks"]},{"author_name":["United States. National Park Service. Rocky Mountain Regional Office"],"first_publish_year":1981,"key":"/works/OL36989895W","title":"Mormon Pioneer National Historic Trail, Illinois-Iowa-Nebraska-Wyoming-Utah","subject":["Mormon Church"]},{"author_name":["Smith"],"first_publish_year":2017,"key":"/works/OL38965745W","title":"Hiking Wyoming's Medicine Bow National Forest"},{"first_publish_year":1981,"key":"/works/OL14089607M","title":"Mormon Pioneer National Historic Trail","subject":["Mormons -- West (U.S.) -- History.","Mormon Trail."]},{"first_publish_year":1983,"key":"/works/OL14918025M","title":"Forest ecology/plant identification trail","subject":["Forest ecology -- Wyoming -- Muddy Mountain","Nature trails -- Wyoming -- Muddy Mountain"]},{"author_name":["Bill Moeller","Jan Moeller"],"first_publish_year":1985,"key":"/works/OL30468W","lcc":["F--0597.00000000.M73 2001","F--0597.00000000 M73 2001","F--0597.00000000.M73 1985b","F--0597.00000000.M73 1985"],"title":"The Oregon Trail","subject":["Overland journeys to the Pacific","Frontier and pioneer life","Pictorial works","History","West (U.S.)","General","United States - 19th Century/Old West","Oregon National Historic Trail","Photo Techniques","Photography"]},{"author_name":["Cheryl Harness"],"first_publish_year":2006,"key":"/works/OL15964798W","lcc":["E--0444.00000000.T82 A73 2006","F--0880.00000000.H275 2006","E--0444.00000000.T82A73 2006"],"title":"The tragic tale of Narcissa Whitman and a faithful history of the Oregon Trail","subject":["Women missionaries","Frontier and pioneer life","Women pioneers","Overland journeys to the Pacific","Juvenile literature","Biography","History","African American women","Slaves","Underground railroad","Underground Railroad","African americans, juvenile literature","African americans","Tubman, harriet, 1822-1913","Tubman, harriet, 1822-1913, juvenile literature","Whitman, narcissa (prentiss), 1808-1847","Missionaries","Missionaries, juvenile literature","Frontier and pioneer life, juvenile literature","Overland journeys to the pacific","Overland journeys to the pacific, juvenile literature","Oregon national historic trail","Oregon national historic trail, juvenile literature","Pioneers","Oregon, history"]},{"author_name":["Earle Crowe"],"first_publish_year":1960,"key":"/works/OL7524672W","title":"General Beale's sheep odessey [sic]","subject":["History","Sheep","Transportation"]},{"author_name":["L. C. Bishop"],"first_publish_year":1978,"key":"/works/OL38855306W","title":"LaBonte, hunter, free trapper, trail blazer and mountain man of the Old West, 1825-1848"},{"author_name":["Ira Spring"],"first_publish_year":1982,"key":"/works/OL1856223W","lcc":["GV-0199.42000000.N69 S67 1982","GV-0199.42000000.N69S67 1982"],"title":"Northwest trails","subject":["Guidebooks","Hiking","Mountaineering","Wilderness areas","Trails"]},{"author_name":["Harvey Manning"],"first_publish_year":1991,"key":"/works/OL1980513W","lcc":["GV-0199.42000000.N69M363","GV-0199.42000000.N69 M363 1998","GV-0199.42000000.N69 M36 1991","GV-0199.42000000.N69M36 1991"],"title":"Hiking the great Northwest","subject":["Guidebooks","Hiking","Trails","Randonnee pedestre","Guides","Northwest, canadian, description and travel","Northwest, pacific, guidebooks"]},{"first_publish_year":1986,"key":"/works/OL23000159W","lcc":["F--0767.00000000.N2 N38 1986"],"title":"Natrona County, Wyoming, cemetery records","subject":["Genealogy","Registers of births","Cemeteries","Inscriptions"]},{"author_name":["Betty Starks Case"],"first_publish_year":2001,"key":"/works/OL26435389W","lcc":["F--0761.60000000.C37 2001"],"title":"This is Wyoming, live","subject":["History","Anecdotes"]},{"author_name":["Robert A. Murray"],"first_publish_year":1970,"key":"/works/OL715107W","lcc":["F--0782.00000000.A7 M87"],"title":"Citadel on the Santa Fe Trail","subject":["Fortification","Frontier and pioneer life"]},{"author_name":["Peter Jones"],"first_publish_year":2014,"key":"/works/OL27687240W","lcc":["GV-1061.22000000.C6 J64 2014","GV-1061.22000000.C6J64 2014"],"title":"The Best Front Range Trail Runs","subject":["Running","Trails","Colorado, guidebooks","Wyoming, guidebooks","Mountain running","Guidebooks"]},{"author_name":["Ron Adkison"],"first_publish_year":1996,"key":"/works/OL19548745W","lcc":["GV-0199.42000000.W82 W5617 1996","GV-0199.42000000.W82W5617 19"],"title":"I dispacci di Giovanni Michiel","subject":["Guidebooks","Hiking","Mountaineering","Trails","Wyoming, description and travel"]}]} \ No newline at end of file diff --git a/src/server/sources/fixtures/ol-similar-xyzzy-plugh-quux.json b/src/server/sources/fixtures/ol-similar-xyzzy-plugh-quux.json new file mode 100644 index 0000000..2bf68f5 --- /dev/null +++ b/src/server/sources/fixtures/ol-similar-xyzzy-plugh-quux.json @@ -0,0 +1 @@ +{"numFound":0,"start":0,"numFoundExact":true,"num_found":0,"documentation_url":"https://openlibrary.org/dev/docs/api/search","q":"xyzzy plugh quux","offset":null,"docs":[]} \ No newline at end of file diff --git a/src/server/sources/fixtures/ol-similar-xyzzy-plugh.json b/src/server/sources/fixtures/ol-similar-xyzzy-plugh.json new file mode 100644 index 0000000..90f25fd --- /dev/null +++ b/src/server/sources/fixtures/ol-similar-xyzzy-plugh.json @@ -0,0 +1 @@ +{"numFound":0,"start":0,"numFoundExact":true,"num_found":0,"documentation_url":"https://openlibrary.org/dev/docs/api/search","q":"xyzzy plugh","offset":null,"docs":[]} \ No newline at end of file diff --git a/src/server/sources/loc.ts b/src/server/sources/loc.ts index aa9da8e..81dfb9e 100644 --- a/src/server/sources/loc.ts +++ b/src/server/sources/loc.ts @@ -17,6 +17,8 @@ export interface Loc { byIsbn(isbn: string): Promise; byLccn(lccn: string): Promise; byTitle(title: string, author: string): Promise; + /** Records whose title, subjects or notes mention every keyword (the `bath.any` index). */ + byKeywords(keywords: string[]): Promise; } export function createLoc(deps: { @@ -99,5 +101,11 @@ export function createLoc(deps: { const query = surname ? `bath.title="${t}" and bath.author="${surname}"` : `bath.title="${t}"`; return sru(`loc-title:${title}|${author}`, query, 5); }, + byKeywords(keywords) { + const words = keywords.map((k) => k.replace(/[^\p{L}\p{N}]/gu, '')).filter(Boolean); + if (words.length === 0) return Promise.resolve([]); + const query = words.map((w) => `bath.any=${w}`).join(' and '); + return sru(`similar-loc:${words.join(' ')}`, query, 20); + }, }; } diff --git a/src/server/sources/marc.ts b/src/server/sources/marc.ts index 4c6c191..c3f6639 100644 --- a/src/server/sources/marc.ts +++ b/src/server/sources/marc.ts @@ -9,6 +9,8 @@ export interface MarcFields { meta: Partial; /** 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; @@ -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. */ diff --git a/src/server/sources/openlibrary.ts b/src/server/sources/openlibrary.ts index 1875707..3238c5a 100644 --- a/src/server/sources/openlibrary.ts +++ b/src/server/sources/openlibrary.ts @@ -95,7 +95,24 @@ export function parseSearch(body: string): SearchResult[] { }); } +/** One result of a keyword search: enough to judge what a book is about and where it is shelved. */ +export interface SimilarDoc { title: string; subtitle?: string; authors: string[]; subjects: string[]; lcc: string[]; year?: number } + +const SIMILAR_FIELDS = 'key,title,subtitle,author_name,subject,lcc,first_publish_year'; + +export function parseSimilar(body: string): SimilarDoc[] { + return docs(body).flatMap((d) => { + if (typeof d['title'] !== 'string' || !d['title'].trim()) return []; + const r: SimilarDoc = { title: d['title'].trim(), authors: uniq(strs(d['author_name'])), subjects: uniq(strs(d['subject'])), lcc: strs(d['lcc']) }; + if (typeof d['subtitle'] === 'string' && d['subtitle'].trim()) r.subtitle = d['subtitle'].trim(); + if (typeof d['first_publish_year'] === 'number') r.year = d['first_publish_year']; + return [r]; + }); +} + export interface OpenLibrary { + /** Keyword relevance search (all words must match); results carry their LC classification when Open Library has one. */ + similar(keywords: string[]): Promise; edition(isbn: string): Promise; work(isbn: string): Promise; search(title: string, author: string): Promise; @@ -116,6 +133,11 @@ export function createOpenLibrary(deps: { fetch: typeof fetch; cache: SourceCach return text; } return { + async similar(keywords) { + const q = keywords.join(' '); + const url = `https://openlibrary.org/search.json?${new URLSearchParams({ q, fields: SIMILAR_FIELDS, limit: '25' })}`; + return parseSimilar(await body(`similar-ol:${q}`, url, (t) => parseSimilar(t).length > 0)); + }, async edition(isbn) { const url = `https://openlibrary.org/api/books?bibkeys=ISBN:${isbn}&jscmd=data&format=json`; return parseEdition(await body(`ol-data:${isbn}`, url, (t) => parseEdition(t, isbn) !== null), isbn); diff --git a/src/shared/types.ts b/src/shared/types.ts index a6e8c92..054ee7a 100644 --- a/src/shared/types.ts +++ b/src/shared/types.ts @@ -1,6 +1,6 @@ export type Confidence = 'exact' | 'approximate' | 'manual'; export type Status = 'pending' | 'resolved' | 'needs_attention'; -export type Source = 'loc-isbn' | 'loc-lccn' | 'ol-edition' | 'loc-title' | 'ol-work' | 'manual'; +export type Source = 'loc-isbn' | 'loc-lccn' | 'ol-edition' | 'loc-title' | 'ol-work' | 'similar' | 'manual'; export interface Book { id: number; isbn13: string | null; lccn: string | null; title: string; subtitle: string | null; authors: string[]; diff --git a/src/web/actions.ts b/src/web/actions.ts new file mode 100644 index 0000000..ea6efdc --- /dev/null +++ b/src/web/actions.ts @@ -0,0 +1,43 @@ +import type { Book, SearchResult } from '../shared/types.ts'; +import { api } from './api.ts'; +import { setLastScan, upsertBook } from './live.ts'; +import { beepLow } from './sound.ts'; +import { showError } from './toast-store.ts'; + +/** ISBNs with a request in flight: one ISBN is never sent twice at the same time. */ +const inflight = new Map>(); + +/** Add a book by ISBN (from the camera or the entry box). The Last scan card shows what happened. */ +export function addByIsbn(isbn: string): Promise { + let p = inflight.get(isbn); + if (!p) { + p = (async () => { + try { + const r = await api.scan(isbn); + upsertBook(r.book); + setLastScan(r.book.id, r.duplicate); + } catch (e) { + beepLow(); + showError(`Could not add ${isbn}: ${(e as Error).message}`); + } + })(); + inflight.set(isbn, p); + void p.finally(() => inflight.delete(isbn)); + } + return p; +} + +function added(book: Book): void { + upsertBook(book); + setLastScan(book.id, false); +} + +export async function addByLccn(lccn: string): Promise { + try { added(await api.addLccn(lccn)); return true; } + catch (e) { beepLow(); showError(`Could not add ${lccn}: ${(e as Error).message}`); return false; } +} + +export async function addFromResult(r: SearchResult): Promise { + try { added(await api.fromSearch(r)); return true; } + catch (e) { beepLow(); showError(`Could not add "${r.title}": ${(e as Error).message}`); return false; } +} diff --git a/src/web/api.ts b/src/web/api.ts index 90c8e65..486ea3d 100644 --- a/src/web/api.ts +++ b/src/web/api.ts @@ -43,8 +43,17 @@ export const api = { request('GET', `/api/books?filter=${filter}&q=${encodeURIComponent(q)}`), patchBook: async (id: number, patch: BookPatch) => toBook(await request('PATCH', `/api/books/${id}`, patch)), deleteBook: (id: number) => request('DELETE', `/api/books/${id}`), + /** Fire and forget while the page is closing. */ + deleteBookOnUnload(id: number): void { + try { void fetch(`/api/books/${id}`, { method: 'DELETE', keepalive: true }).catch(() => {}); } catch { /* page is going away */ } + }, queueBook: async (id: number) => toBook(await request('POST', `/api/books/${id}/queue`)), retryBook: async (id: number) => toBook(await request('POST', `/api/books/${id}/retry`)), + confirmPrintOnUnload(ids: number[]): void { + try { + void fetch('/api/print/confirm', { method: 'POST', keepalive: true, headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ ids }) }).catch(() => {}); + } catch { /* page is going away */ } + }, confirmPrint: (ids: number[]) => request('POST', '/api/print/confirm', { ids }), getSettings: () => request('GET', '/api/settings'), putSettings: (s: Settings) => request('PUT', '/api/settings', s), diff --git a/src/web/bookstate.test.ts b/src/web/bookstate.test.ts index 75520ed..d0f6b49 100644 --- a/src/web/bookstate.test.ts +++ b/src/web/bookstate.test.ts @@ -1,19 +1,19 @@ import { test } from 'node:test'; import assert from 'node:assert/strict'; import type { Book } from '../shared/types.ts'; -import { elapsedText, pdfLabel, queueHeader, queueSplit, queueTabLabel, rowState, sessionSummary } from './bookstate.ts'; +import { elapsedText, printStatus, queueOrder, rowState } from './bookstate.ts'; function book(id: number, over: Partial): Book { return { id, isbn13: null, lccn: null, title: 'T' + id, subtitle: null, authors: [], publisher: null, year: null, subjects: [], callNumber: null, sortKey: null, confidence: null, source: null, dewey: null, status: 'pending', attentionReason: null, manualOverride: false, inQueue: true, - printedAt: null, createdAt: '', updatedAt: '', ...over, + printedAt: null, createdAt: `2026-01-01T00:00:0${id}Z`, updatedAt: '', ...over, }; } -const ready = (id: number) => book(id, { status: 'resolved', callNumber: 'QA76.73 .R87 K53 2018', sortKey: 'k' + id }); +const ready = (id: number, over: Partial = {}) => book(id, { status: 'resolved', callNumber: 'QA76.73 .R87 K53 2018', sortKey: 'k' + id, ...over }); const looking = (id: number) => book(id, {}); -const attention = (id: number) => book(id, { status: 'needs_attention', attentionReason: 'No match' }); +const attention = (id: number, over: Partial = {}) => book(id, { status: 'needs_attention', attentionReason: 'No match', ...over }); test('a pending book is "looking", never "no call number"', () => { assert.deepEqual(rowState(looking(1)), { kind: 'looking', note: null }); @@ -27,34 +27,28 @@ test('ready and attention states', () => { assert.equal(rowState(book(1, { status: 'resolved' })).kind, 'attention'); }); -test('session summary', () => { - assert.equal(sessionSummary([ready(1), ready(2), ready(3), looking(4)]), '4 scanned · 3 ready · 1 looking up'); - assert.equal(sessionSummary([ready(1)]), '1 scanned · 1 ready'); - assert.equal(sessionSummary([attention(1), attention(2), looking(3)]), '3 scanned · 1 looking up · 2 need attention'); - assert.equal(sessionSummary([]), '0 scanned'); +test('queue order: attention first, then newest first', () => { + const order = queueOrder([ready(1), attention(2), looking(3), ready(4), attention(0)]).map(b => b.id); + assert.deepEqual(order, [2, 0, 4, 3, 1]); }); -test('queue split ignores books that are not queued or need attention', () => { - const printed = { ...ready(9), inQueue: false }; - const q = queueSplit([ready(1), looking(2), attention(3), printed, ready(4)]); - assert.deepEqual(q.ready.map(b => b.id), [1, 4]); - assert.deepEqual(q.looking.map(b => b.id), [2]); +test('queue order leaves out books that are not queued, and ties go to the higher id', () => { + const same = '2026-02-02T00:00:00Z'; + const order = queueOrder([ready(1, { createdAt: same }), ready(2, { createdAt: same }), ready(3, { inQueue: false })]).map(b => b.id); + assert.deepEqual(order, [2, 1]); }); -test('queue labels', () => { - assert.equal(queueHeader(3, 1), '3 cards ready · 1 still looking up'); - assert.equal(queueHeader(1, 0), '1 card ready'); - assert.equal(queueHeader(0, 1), '0 cards ready · 1 still looking up'); - assert.equal(pdfLabel(3), 'Make PDF (3 cards)'); - assert.equal(pdfLabel(1), 'Make PDF (1 card)'); - assert.equal(pdfLabel(0), 'Make PDF'); - assert.equal(queueTabLabel(3, 1), 'Print queue (4)'); - assert.equal(queueTabLabel(0, 0), 'Print queue'); +test('print status counts ready cards and explains a disabled button', () => { + assert.deepEqual(printStatus([]), { ready: 0, looking: 0, label: 'Print cards', reason: 'Nothing to print yet' }); + assert.deepEqual(printStatus([looking(1), looking(2)]), { ready: 0, looking: 2, label: 'Print cards', reason: '2 still looking up' }); + assert.deepEqual(printStatus([ready(1)]), { ready: 1, looking: 0, label: 'Print 1 card', reason: null }); + const mixed = printStatus([ready(1), ready(2), looking(3), attention(4)]); + assert.equal(mixed.label, 'Print 2 cards'); + assert.equal(mixed.reason, '1 still looking up'); }); test('elapsed text', () => { - assert.equal(elapsedText(0), '0 s'); - assert.equal(elapsedText(59_900), '59 s'); + assert.equal(elapsedText(12_400), '12 s'); assert.equal(elapsedText(65_000), '1 min 05 s'); assert.equal(elapsedText(-5), '0 s'); }); diff --git a/src/web/bookstate.ts b/src/web/bookstate.ts index c4c5c42..e414397 100644 --- a/src/web/bookstate.ts +++ b/src/web/bookstate.ts @@ -13,46 +13,30 @@ export function rowState(book: Book): RowState { return { kind: 'attention', reason: book.attentionReason ?? 'This book needs a look.' }; } -const plural = (n: number, one: string, many: string) => `${n} ${n === 1 ? one : many}`; +/** Queued books: the ones needing attention first, then newest first. */ +export function queueOrder(books: Book[]): Book[] { + const rank = (b: Book) => (rowState(b).kind === 'attention' ? 0 : 1); + return books + .filter(b => b.inQueue) + .sort((a, b) => { + if (rank(a) !== rank(b)) return rank(a) - rank(b); + if (a.createdAt !== b.createdAt) return a.createdAt < b.createdAt ? 1 : -1; + return b.id - a.id; + }); +} -export function sessionSummary(books: Book[]): string { - let ready = 0, looking = 0, attention = 0; - for (const b of books) { - const s = rowState(b).kind; - if (s === 'ready') ready++; else if (s === 'looking') looking++; else attention++; +export interface PrintStatus { ready: number; looking: number; label: string; reason: string | null } + +/** What the print button says, and why it is disabled when it is. */ +export function printStatus(queue: Book[]): PrintStatus { + let ready = 0, looking = 0; + for (const b of queue) { + const k = rowState(b).kind; + if (k === 'ready') ready++; else if (k === 'looking') looking++; } - const parts = [`${books.length} scanned`]; - if (ready) parts.push(`${ready} ready`); - if (looking) parts.push(`${looking} looking up`); - if (attention) parts.push(`${attention} ${attention === 1 ? 'needs' : 'need'} attention`); - return parts.join(' · '); -} - -export interface QueueSplit { ready: Book[]; looking: Book[] } - -/** Queued books, split into the ones that can be printed now and the ones still being looked up. */ -export function queueSplit(books: Book[]): QueueSplit { - const ready: Book[] = [], looking: Book[] = []; - for (const b of books) { - if (!b.inQueue) continue; - const s = rowState(b).kind; - if (s === 'ready') ready.push(b); else if (s === 'looking') looking.push(b); - } - return { ready, looking }; -} - -export function queueHeader(ready: number, looking: number): string { - const head = plural(ready, 'card', 'cards') + ' ready'; - return looking ? `${head} · ${looking} still looking up` : head; -} - -export function pdfLabel(ready: number): string { - return ready ? `Make PDF (${plural(ready, 'card', 'cards')})` : 'Make PDF'; -} - -export function queueTabLabel(ready: number, looking: number): string { - const n = ready + looking; - return n ? `Print queue (${n})` : 'Print queue'; + const label = ready === 0 ? 'Print cards' : `Print ${ready} ${ready === 1 ? 'card' : 'cards'}`; + const reason = looking ? `${looking} still looking up` : ready === 0 ? 'Nothing to print yet' : null; + return { ready, looking, label, reason }; } /** "12 s", "1 min 05 s" */ diff --git a/src/web/camera.ts b/src/web/camera.ts new file mode 100644 index 0000000..90cd083 --- /dev/null +++ b/src/web/camera.ts @@ -0,0 +1,34 @@ +import { useEffect, useState } from 'preact/hooks'; + +/** What the Scan screen's camera tells the settings panel: which cameras exist, which is chosen, the stream size. */ +export interface CameraInfo { devices: { id: string; label: string }[]; deviceId: string; resolution: string } + +const CAMERA_KEY = 'camera'; +const readFlag = (k: string) => { try { return localStorage.getItem(k); } catch { return null; } }; +export const writeFlag = (k: string, v: string | null) => { + try { if (v === null) localStorage.removeItem(k); else localStorage.setItem(k, v); } catch { /* ignore */ } +}; +export { readFlag }; + +let info: CameraInfo = { devices: [], deviceId: readFlag(CAMERA_KEY) ?? '', resolution: '' }; +const listeners = new Set<() => void>(); + +export const getCamera = () => info; +export function updateCamera(patch: Partial): void { + info = { ...info, ...patch }; + listeners.forEach(l => l()); +} +export function chooseCamera(deviceId: string): void { + writeFlag(CAMERA_KEY, deviceId || null); + updateCamera({ deviceId }); +} + +export function useCamera(): CameraInfo { + const [, force] = useState(0); + useEffect(() => { + const l = () => force(n => n + 1); + listeners.add(l); + return () => { listeners.delete(l); }; + }, []); + return info; +} diff --git a/src/web/components/BookEditor.tsx b/src/web/components/BookEditor.tsx deleted file mode 100644 index 0bcde1e..0000000 --- a/src/web/components/BookEditor.tsx +++ /dev/null @@ -1,70 +0,0 @@ -import { useState } from 'preact/hooks'; -import type { Book } from '../../shared/types.ts'; -import { api } from '../api.ts'; -import { upsertBook, dispatch } from '../live.ts'; -import { parseYear } from '../year.ts'; - -export function BookEditor({ book, onClose }: { book: Book; onClose: () => void }) { - const [title, setTitle] = useState(book.title); - const [authors, setAuthors] = useState(book.authors.join('; ')); - const [publisher, setPublisher] = useState(book.publisher ?? ''); - const [year, setYear] = useState(book.year?.toString() ?? ''); - const [callNumber, setCallNumber] = useState(book.callNumber ?? ''); - const [msg, setMsg] = useState(''); - const [yearError, setYearError] = useState(''); - const [busy, setBusy] = useState(false); - - async function run(fn: () => Promise) { - setBusy(true); setMsg(''); - try { await fn(); } catch (e) { setMsg((e as Error).message); } - setBusy(false); - } - - const save = (ev: Event) => { - ev.preventDefault(); - const y = parseYear(year); - if (!y.ok) { setYearError('Enter the year as digits, for example 2018, or leave it empty.'); return; } - setYearError(''); - void run(async () => { - const patch: Record = { - title: title.trim(), - authors: authors.split(/[;\n]/).map(a => a.trim()).filter(Boolean), - publisher: publisher.trim() || null, - year: y.value, - }; - if (callNumber.trim() !== (book.callNumber ?? '')) patch.callNumber = callNumber.trim(); - upsertBook(await api.patchBook(book.id, patch)); - onClose(); - }); - }; - - return ( -
- - -
- - -
- {yearError ? : null} - - {book.attentionReason ?

{book.attentionReason}

: null} - {msg ? : null} -
- - - - - -
-
- ); -} diff --git a/src/web/components/BookRow.tsx b/src/web/components/BookRow.tsx new file mode 100644 index 0000000..0277710 --- /dev/null +++ b/src/web/components/BookRow.tsx @@ -0,0 +1,45 @@ +import type { Book } from '../../shared/types.ts'; +import { rowState } from '../bookstate.ts'; +import { CallNo } from './CallNo.tsx'; +import { StateMark, StateText } from './StateMark.tsx'; + +function Main({ book, showYear }: { book: Book; showYear: boolean }) { + const byline = [book.authors.join(', '), showYear ? book.year : null].filter(Boolean).join(' · '); + return ( + + {book.title} + {byline ? {byline} : null} + + + ); +} + +/** A queued book on the Scan screen: state, call number, title, and the actions that apply. */ +export function QueueRow({ book, onFix, onRemove }: { book: Book; onFix: () => void; onRemove: () => void }) { + const kind = rowState(book).kind; + return ( +
  • + + +
    + + {kind === 'attention' ? : null} + + +
  • + ); +} + +/** A book in the Library: the whole row opens the editor. */ +export function LibraryRow({ book, onOpen }: { book: Book; onOpen: () => void }) { + const kind = rowState(book).kind; + return ( +
  • + +
  • + ); +} diff --git a/src/web/components/BookState.tsx b/src/web/components/BookState.tsx deleted file mode 100644 index a701de9..0000000 --- a/src/web/components/BookState.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import type { Book } from '../../shared/types.ts'; -import { elapsedText, rowState } from '../bookstate.ts'; -import { lookupStartedAt, useNow } from '../live.ts'; - -const CheckIcon = () => ( - -); -const AlertIcon = () => ( - -); - -function Looking({ book }: { book: Book }) { - const now = useNow(true); - return ; -} - -/** The one label a book shows: Looking up… (spinner, seconds), Ready, or Needs attention. */ -export function StateLabel({ book }: { book: Book }) { - const s = rowState(book); - if (s.kind === 'looking') return ; - if (s.kind === 'ready') return Ready; - return Needs attention; -} diff --git a/src/web/components/CallNo.tsx b/src/web/components/CallNo.tsx index 763f051..dbfa328 100644 --- a/src/web/components/CallNo.tsx +++ b/src/web/components/CallNo.tsx @@ -1,13 +1,23 @@ import { cardLines, parseCallNumber } from '../../shared/callnumber.ts'; -export function CallNo({ value, approximate }: { value: string | null; approximate?: boolean }) { - if (!value) return No call number; +export const APPROX_TIP = 'Number borrowed from another edition'; +export const SIMILAR_TIP = 'Number borrowed from similar books'; + +/** A call number in two monospaced lines, the way it is printed on the card. `~` marks an approximate one. */ +export function CallNo({ value, approximate, source, large }: { value: string | null; approximate?: boolean; source?: string | null; large?: boolean }) { + const similar = source === 'similar'; + const tip = similar ? SIMILAR_TIP : APPROX_TIP; + const cls = 'callno' + (large ? ' callno-large' : ''); + if (!value) return –; const cn = parseCallNumber(value); const lines = cn ? cardLines(cn) : [value, '']; return ( - - {lines[0]}{approximate ? ~ : null} - {lines[1] || ' '} + + {lines[0]} + + {lines[1]} + {approximate || similar ? ~ : null} + ); } diff --git a/src/web/components/Editor.tsx b/src/web/components/Editor.tsx new file mode 100644 index 0000000..8973a59 --- /dev/null +++ b/src/web/components/Editor.tsx @@ -0,0 +1,266 @@ +import { useEffect, useState } from 'preact/hooks'; +import type { Book, SearchResult } from '../../shared/types.ts'; +import { api } from '../api.ts'; +import type { BookPatch } from '../api.ts'; +import { getBook, setLastScan, upsertBook, dispatch, useBooks } from '../live.ts'; +import { showToast } from '../toast-store.ts'; +import { splitTitleAuthor } from '../entry.ts'; +import { parseYear } from '../year.ts'; +import { rowState } from '../bookstate.ts'; +import { Panel } from './Panel.tsx'; +import { moveActive, ResultList } from './Results.tsx'; +import { Spinner } from './StateMark.tsx'; +import { composeNumber, findNeighbours } from '../shelve.ts'; + +/** `new` may carry what was typed in the entry box. */ +export type EditorTarget = { kind: 'edit'; id: number } | { kind: 'new'; title?: string; authors?: string }; + +const yearValue = (text: string) => { const y = parseYear(text); return y.ok ? y.value : null; }; +const splitAuthors = (text: string) => text.split(/[;\n]/).map(a => a.trim()).filter(Boolean); +/** A book that has not been found yet is titled with its ISBN or LCCN; that is not worth searching for. */ +const knownTitle = (b: Book) => (/^[\d\s-]+$/.test(b.title) ? '' : b.title); + +export function Editor({ target, onClose }: { target: EditorTarget; onClose: () => void }) { + useBooks(); // re-render when the book changes underneath + const book = target.kind === 'edit' ? getBook(target.id) : undefined; + const missing = target.kind === 'edit' && !book; + useEffect(() => { if (missing) onClose(); }, [missing]); + if (target.kind === 'edit' && !book) return null; + const fixing = !!book && rowState(book).kind === 'attention'; + return ( + + + + ); +} + +function EditorForm({ book, fixing, initial, onClose }: { + book: Book | undefined; fixing: boolean; initial?: { title?: string; authors?: string }; onClose: () => void; +}) { + const [title, setTitle] = useState(book ? knownTitle(book) || book.title : initial?.title ?? ''); + const [authors, setAuthors] = useState(book?.authors.join('; ') ?? initial?.authors ?? ''); + const [publisher, setPublisher] = useState(book?.publisher ?? ''); + const [year, setYear] = useState(book?.year?.toString() ?? ''); + const [callNumber, setCallNumber] = useState(book?.callNumber ?? ''); + const [picked, setPicked] = useState(null); + const [yearError, setYearError] = useState(''); + const [error, setError] = useState(''); + const [busy, setBusy] = useState(false); + const [confirming, setConfirming] = useState(false); + + async function run(fn: () => Promise) { + setBusy(true); setError(''); + try { await fn(); } catch (e) { setError((e as Error).message); } + setBusy(false); + } + + function save(ev: Event) { + ev.preventDefault(); + const y = parseYear(year); + if (!y.ok) { setYearError('Enter the year as digits, for example 2018, or leave it empty.'); return; } + setYearError(''); + void run(async () => { + const names = splitAuthors(authors); + if (!book) { + const created = await api.addManual({ + title: title.trim(), authors: names, + ...(y.value !== null ? { year: y.value } : {}), + ...(publisher.trim() ? { publisher: publisher.trim() } : {}), + ...(callNumber.trim() ? { callNumber: callNumber.trim() } : {}), + }); + upsertBook(created); setLastScan(created.id, false); + showToast(`Added "${created.title}"`); + onClose(); + return; + } + const patch: BookPatch = { title: title.trim(), authors: names, publisher: publisher.trim() || null, year: y.value }; + const numberChanged = callNumber.trim() !== (book.callNumber ?? ''); + if (numberChanged) patch.callNumber = callNumber.trim(); + let saved = await api.patchBook(book.id, patch); + // A result without a call number of its own: ask the sources again with the better details. + if (picked && picked.lcc.length === 0 && !numberChanged && !book.manualOverride) saved = await api.retryBook(book.id); + upsertBook(saved); + showToast(saved.status === 'pending' ? `Saved "${saved.title}". Looking up the call number.` : `Saved "${saved.title}"`); + onClose(); + }); + } + + function pick(r: SearchResult) { + setPicked(r); + setTitle(r.title); + setAuthors(r.authors.join('; ')); + setPublisher(r.publisher ?? ''); + setYear(r.year ? String(r.year) : ''); + if (r.lcc[0]) setCallNumber(r.lcc[0]); + } + + return ( +
    + {fixing && book ? ( + <> +

    {book.attentionReason ?? 'This book needs a look.'}

    + + + ) : null} + + +
    + + +
    + {yearError ? : null} + + composeNumber(neighbour, splitAuthors(authors), title, yearValue(year))} + onChoose={setCallNumber} /> + {error ? : null} + +
    + + {book ? ( + <> + + + + ) : null} +
    + + {book ? ( +
    + {confirming ? ( +
    + Delete this book? + + +
    + ) : ( + + )} +
    + ) : null} + + ); +} + +/** "Search for it": looks the book up by title (and author) so its details can be copied into the fields. */ +function FixSearch({ initial, onPick }: { initial: string; onPick: (r: SearchResult) => void }) { + const [text, setText] = useState(initial); + const [results, setResults] = useState(null); + const [active, setActive] = useState(-1); + const [busy, setBusy] = useState(false); + const [message, setMessage] = useState(''); + + async function search() { + const { title, author } = splitTitleAuthor(text); + if (!title) return; + setBusy(true); setMessage(''); setResults(null); setActive(-1); + try { + const found = await api.search(title, author); + setResults(found); + if (found.length === 0) setMessage('No matches. Edit the details by hand below.'); + } catch (e) { + setMessage(`The search failed: ${(e as Error).message}`); + } + setBusy(false); + } + useEffect(() => { if (initial) void search(); }, []); + + const choose = (r: SearchResult) => { onPick(r); setResults(null); setMessage('Details copied below. Check them, then save.'); }; + const open = !!results && results.length > 0; + + return ( + + ); +} + +/** "Shelve it with…": search the library for a book this one belongs next to, and borrow its class for the call number. */ +function ShelveWith({ exclude, compose, onChoose }: { exclude: number | undefined; compose: (neighbour: string) => string | null; onChoose: (n: string) => void }) { + const books = useBooks(); + const [text, setText] = useState(''); + const [active, setActive] = useState(-1); + const matches = findNeighbours(books.filter(b => b.id !== exclude), text); + const open = matches.length > 0; + const choose = (b: Book) => { + const n = b.callNumber ? compose(b.callNumber) : null; + if (!n) { showToast('Could not make a call number from that book'); return; } + onChoose(n); setText(''); setActive(-1); + showToast(`Call number set to ${n}. Check it, then save.`); + }; + return ( +
    + + = 0 ? `shelve-results-${active}` : undefined} + value={text} onInput={e => { setText(e.currentTarget.value); setActive(-1); }} + onKeyDown={e => { + if (open && (e.key === 'ArrowDown' || e.key === 'ArrowUp')) { e.preventDefault(); setActive(moveActive(e.key, active, matches.length)); } + else if (e.key === 'Enter') { e.preventDefault(); if (open && active >= 0) choose(matches[active]!); } + else if (e.key === 'Escape' && open) { e.preventDefault(); e.stopPropagation(); setText(''); } + }} /> + Pick a book this one belongs next to + {open ? ( +
      + {matches.map((b, i) => ( +
    • e.preventDefault()} onMouseMove={() => setActive(i)} onClick={() => choose(b)}> + {b.title} + {b.callNumber} +
    • + ))} +
    + ) : null} +
    + ); +} diff --git a/src/web/components/Panel.tsx b/src/web/components/Panel.tsx new file mode 100644 index 0000000..9082f5f --- /dev/null +++ b/src/web/components/Panel.tsx @@ -0,0 +1,20 @@ +import { useRef } from 'preact/hooks'; +import type { ComponentChildren } from 'preact'; +import { useDialog } from '../dialog.ts'; + +/** A side panel on wide windows and a full-width sheet on narrow ones, over a dimmed page. */ +export function Panel({ title, onClose, children }: { title: string; onClose: () => void; children: ComponentChildren }) { + const ref = useRef(null); + useDialog(ref, onClose, true); + return ( +
    { if (e.target === e.currentTarget) onClose(); }}> + +
    + ); +} diff --git a/src/web/components/Results.tsx b/src/web/components/Results.tsx new file mode 100644 index 0000000..c3471ea --- /dev/null +++ b/src/web/components/Results.tsx @@ -0,0 +1,36 @@ +import type { SearchResult } from '../../shared/types.ts'; + +/** Next highlighted index for an arrow key; -1 means nothing is highlighted. */ +export function moveActive(key: string, active: number, count: number): number { + if (count === 0) return -1; + if (key === 'ArrowDown') return active < count - 1 ? active + 1 : 0; + if (key === 'ArrowUp') return active > 0 ? active - 1 : count - 1; + return active; +} + +export interface Footer { label: string; onPick: () => void } + +/** Search results as a listbox. The input that owns it keeps focus and points at the highlighted option. */ +export function ResultList({ id, label, results, active, onPick, onHover, footer }: { + id: string; label: string; results: SearchResult[]; active: number; + onPick: (r: SearchResult) => void; onHover: (i: number) => void; footer?: Footer; +}) { + const keep = (e: Event) => e.preventDefault(); // a click must not take focus from the input + return ( +
      + {results.map((r, i) => ( +
    • onHover(i)} onClick={() => onPick(r)}> + {r.title} + {[r.authors.join(', '), r.year, r.publisher].filter(Boolean).join(' · ')} +
    • + ))} + {footer ? ( +
    • onHover(results.length)} onClick={footer.onPick}> + {footer.label} +
    • + ) : null} +
    + ); +} diff --git a/src/web/components/Settings.tsx b/src/web/components/Settings.tsx new file mode 100644 index 0000000..be02aa0 --- /dev/null +++ b/src/web/components/Settings.tsx @@ -0,0 +1,64 @@ +import { useEffect, useState } from 'preact/hooks'; +import { api } from '../api.ts'; +import { chooseCamera, useCamera } from '../camera.ts'; +import { showError, showToast } from '../toast-store.ts'; +import { Panel } from './Panel.tsx'; + +export function Settings({ onClose }: { onClose: () => void }) { + const cam = useCamera(); + const [x, setX] = useState('0'); + const [y, setY] = useState('0'); + const [loaded, setLoaded] = useState(false); + const [busy, setBusy] = useState(false); + + useEffect(() => { + api.getSettings() + .then(s => { setX(String(s.offsetXmm)); setY(String(s.offsetYmm)); setLoaded(true); }) + .catch(e => showError(`Could not load the printer settings: ${(e as Error).message}`)); + }, []); + + async function save(ev: Event) { + ev.preventDefault(); + setBusy(true); + try { + const s = await api.putSettings({ offsetXmm: Number(x) || 0, offsetYmm: Number(y) || 0 }); + setX(String(s.offsetXmm)); setY(String(s.offsetYmm)); + showToast('Printer alignment saved'); + } catch (e) { showError(`Could not save the alignment: ${(e as Error).message}`); } + setBusy(false); + } + + return ( + +
    +

    Camera

    + {cam.devices.length > 1 ? ( + + ) : null} +

    {cam.resolution ? `Stream resolution: ${cam.resolution}` : 'Stream resolution: shown while the camera is on.'}

    +
    + +
    +

    Printer alignment

    +
    + + +
    + +

    Print the calibration page on plain paper, hold it over a real sheet up to a light, and enter how far the lines are off, up to 10 mm.

    +
    +
    + ); +} diff --git a/src/web/components/StateMark.tsx b/src/web/components/StateMark.tsx new file mode 100644 index 0000000..f3015cd --- /dev/null +++ b/src/web/components/StateMark.tsx @@ -0,0 +1,39 @@ +import type { Book } from '../../shared/types.ts'; +import { elapsedText, rowState } from '../bookstate.ts'; +import { lookupStartedAt, useNow } from '../live.ts'; + +export const LABEL = { looking: 'Looking up…', ready: 'Ready', attention: 'Needs attention' } as const; + +export const CheckIcon = () => ( + +); +export const WarnIcon = () => ( + +); +export const Spinner = () =>