List unlinked places and unmapped words under Sources, fix them in code with the unmapped skill

Settings > Sources > Unmapped shows the place texts no place resolves, with
their roles' countries and companies, and the host words no table maps, and
copies both as text. Prep fingerprints places.seed(), so a town or spelling
added to the code is seeded and every open role is mapped again at the next
prep. app prep unlinked lists the places on the command line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-30 13:06:22 +02:00
1 parent ae978594b4
commit 06ff9f549b
13 files changed
+313 -43

No files matched your search

+16 -5
View File
@@ -8,7 +8,7 @@
app agents list|prompt
app stages [extract|summarise on|off]
app dupes
app prep [unmapped] [--remap]
app prep [unmapped|unlinked] [--remap]
app db init
`app job` queues the work on a queue of its own and drains it here, so a
@@ -162,9 +162,10 @@ def build_parser() -> argparse.ArgumentParser:
sub.add_parser("dupes", help="recompute which open roles are copies of one posting")
prep = sub.add_parser(
"prep", help="map the roles' host words and fold the copies, or list the unmapped words")
prep.add_argument("action", nargs="?", choices=["unmapped"],
help="list the host words no table maps, instead of running")
"prep", help="map the roles' host words and fold the copies, or list what is unmapped")
prep.add_argument("action", nargs="?", choices=["unmapped", "unlinked"],
help="list the host words no table maps, or the place texts no "
"place resolves, instead of running")
prep.add_argument("--remap", action="store_true",
help="map every role again, closed ones included")
@@ -679,7 +680,9 @@ def run_dupes(args: argparse.Namespace) -> int:
def run_prep(args: argparse.Namespace) -> int:
"""`app prep`: the prep stage now (`app.prep.run`), printing what it did
as JSON; `--remap` maps every role again. `app prep unmapped` lists the
host words no table maps, per field and host, most roles first."""
host words no table maps, per field and host, most roles first; `app
prep unlinked` the place texts of open roles no place resolves, with the
countries and companies of their roles."""
from app import prep
from app.storage import Store
@@ -692,6 +695,14 @@ def run_prep(args: argparse.Namespace) -> int:
for w in found:
print(f"{w['field']:11} {w['host'] or '(none)':16} {w['roles']:6} {w['word']}")
return 0
if args.action == "unlinked":
linked = store.unlinked_places()
if not linked:
print("every place text is linked")
for p in linked:
where = " ".join(f"{c or '-'}:{n}" for c, n in p["countries"][:3])
print(f"{p['roles']:6} {p['text'][:40]:40} {where:20} {', '.join(p['companies'])}")
return 0
print(json.dumps(prep.run(store, remap=args.remap)._asdict()))
return 0