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>
17 lines
511 B
Python
17 lines
511 B
Python
"""`upsert`: a role stored as a pull stores it and then mapped, as the prep
|
|
stage after the pull maps it. For tests of what the feed, the gates and the
|
|
pages read, which are prep's values, not the raw ones `upsert_role` keeps."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from app import prep
|
|
from app.storage import Store
|
|
|
|
|
|
def upsert(store: Store, item: Any, subscription: Any = None) -> bool:
|
|
new = store.upsert_role(item, subscription)
|
|
prep.run(store, dupes=False)
|
|
return new
|