Repository navigation
feat(records): OpenSanctions as a records source, offline screening; fix crossref dropping every API hit - #153
Merged
Conversation
The adapter matches names offline against the bulk targets.simple.csv when it is present, otherwise via POST /match/default with the personal API key (environment only, withheld over Tor). Crossref's API and local checkers now call the adapter instead of their own HTTP and CSV code. Without a usable key no request is sent at all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016LaGpHLuSRHzGARb38X7YS
…cit bulk download openfoia search: an adapter that says offline=True is searched locally and never listed as contacted; rows get confidence only from an adapter's match_confidence(). records search/fetch -s opensanctions work offline from the bulk file, and 'records opensanctions-data --download' fetches it after a warning, verifying size and SHA-1 against the published index. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016LaGpHLuSRHzGARb38X7YS
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016LaGpHLuSRHzGARb38X7YS
This was referenced Nov 19, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OpenSanctions (sanctions lists, politically exposed persons) is now a records source. Before this it was reachable only inside
crossref.openfoia search,records search/fetch, and the agent and MCP search tools can all use it now, and it can screen names fully offline. Part of #55 and #66.Fixed: crossref dropped every OpenSanctions API result
Crossref called
GET /search/defaultand then discarded results withscore < 0.5. But results from/searchhave noscorefield (checked against the OpenAPI spec), so every API hit was dropped. A journalist screening names against sanctions lists through the API got "clean" every time.It now uses
POST /match/default, which returns a real 0–1 match score. This also helps privacy: the name goes in the request body, which OpenSanctions says it never logs, rather than a GET URL, which it keeps in logs for 90 days.What's new
openfoia/records/opensanctions.py, registered asopensanctions, with one code path shared by records and crossref.openfoia search --jsonrows from OpenSanctions carry that score asconfidence. No other source has a real score, so no other row has the field.records fetch <id> -s opensanctionsstores the entity in the active case.openfoia records opensanctions-data --downloadasks first, then downloads about 480 MB from data.opensanctions.org.openfoia searchlists OpenSanctions as "searched on this machine only, nothing sent" and asks for no confirmation. Crossref uses the file automatically.search.py:offlineandmatch_confidenceare optional hooks, read withgetattr, so no other adapter changes. A local source never counts as contacted, never needs consent or a Tor route, and its rows carryegress: "local".OPENFOIA_OPENSANCTIONS_API_KEY) and withheld over Tor. With no usable key, nothing is sent at all; before this, one request that was bound to fail still went out.Access terms (checked 2026-11-19)
/matchquery.Checks
tests/test_records_opensanctions.py. They include local search with HTTP clients set to fail, the warning listing in local mode, confidence appearing only on OpenSanctions rows, the key withheld over Tor, and download checks (aborting sends nothing, checksum mismatch, off-host index). The crossref and egress tests were updated to match.search.pychange myself. A source counts as local only when its adapter saysoffline is True, which happens only while it is answering from the file on disk.Open questions
Generated by Claude Code