Prep stage: host words stored raw, mapped centrally in app/prep after every pull

upsert_role stores the host's own words (roles.*_host), the place texts
unresolved when they change, and the company key unresolved on insert, and
marks the role prep_due. app.prep maps seniority, employment, remote and
country through the host tables in app/prep/hosts, resolves places and
company aliases, lists unknown words in `unmapped`, remaps every open role
when the tables' fingerprint changes, and runs rebuild_dupes, which moves
out of the pull's settle. Migration 22 adds the columns and the table and
fills the host words from raw. Cascade: pull, prep, embed, score, enrich,
prep, embed, score, extract, score, summarise. `app prep [unmapped]
[--remap]`, /api/prep/unmapped and a fold on the Sources page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-30 11:19:22 +02:00
1 parent a66aac95cf
commit d04ceae7e0
31 files changed
+1468 -330

No files matched your search

+39 -2
View File
@@ -19,7 +19,9 @@
* Under the Follow form of Company boards, a fold lists what each reader
* declares (`/api/readers`): how its list arrives, where the text is, what
* it filters at the source, how it states places, and the robots.txt
* decision taken when it was built.
* decision taken when it was built. A second fold lists the host words no
* table in `app/prep/hosts` maps (`/api/prep/unmapped`), per field and
* host, most roles first; it is left out when there are none.
*/
(function () {
"use strict";
@@ -320,6 +322,38 @@
$("#board-form").after(fold);
}
/** The host words prep could not map, one row per field and host. */
function renderUnmapped(words) {
if (!words.length) return;
const groups = new Map();
for (const w of words) {
const key = `${w.field} · ${w.host || "no host"}`;
if (!groups.has(key)) groups.set(key, []);
groups.get(key).push(w);
}
const fold = document.createElement("details");
fold.className = "prune";
fold.id = "unmapped";
const summary = document.createElement("summary");
summary.textContent = `Host words no table maps (${words.length})`;
const list = document.createElement("div");
list.className = "srows";
for (const [key, found] of groups) {
const row = document.createElement("div");
row.className = "srow";
const name = document.createElement("span");
name.className = "name";
name.textContent = key;
const sub = document.createElement("span");
sub.className = "sub";
sub.textContent = found.map((w) => `${w.word} ${w.roles}`).join(" · ");
row.append(name, sub);
list.appendChild(row);
}
fold.append(summary, list);
($("#readers") || $("#board-form")).after(fold);
}
// ------------------------------------------------------ one section shown
// Sources shows one section: the one the fragment names or contains, or the
@@ -360,7 +394,10 @@
document.addEventListener("DOMContentLoaded", async () => {
if (!$("#searches-list")) return;
if ($("#board-form")) api("/api/readers").then(renderReaders, () => {});
if ($("#board-form")) {
api("/api/readers").then(renderReaders, () => {})
.then(() => api("/api/prep/unmapped")).then(renderUnmapped, () => {});
}
try {
await load();
} catch (err) {