ワンクリックで
audit-er-results
Audit entity resolution match results for quality — analyze coverage, false positives, and false negatives
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Audit entity resolution match results for quality — analyze coverage, false positives, and false negatives
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Use when a Serve-product data concept — EO activation, Serve engagement/MAU, People Served, the onboarding funnel, Serve Amplitude events, hygiene filters — needs to resolve to its governed metric, table, column, or definition before a query is written. Not for running analyses (that is the analytics-process skill).
Use when a Win-product data concept — engagement, activation, outcomes/win rate, viability, segmentation, Amplitude events, joins, PMF/satisfaction — needs to resolve to its governed metric, table, column, or definition before a query is written. Not for running analyses (that is the analytics-process skill).
Use when planning, executing, reviewing, or calibrating a product analysis, or when asked a product data question that should become one (the entry runbook routes by product — Win and Serve today). For the data facts themselves, use the product's knowledge skill (win-analytics-knowledge or serve-analytics-knowledge).
Use when investigating a Databricks or dbt Cloud cost/usage increase, attributing spend across warehouses, clusters, jobs, models, and tests, or answering "what is driving our compute cost". Produces an interactive HTML cost dashboard from system tables.
Audit and quantify gp_api product campaigns that have no matching DDHQ election result, for a given election-date window. Classifies every unmatched candidacy into a definitive reason (never ran / race not present in DDHQ data / never made the ballot / product wrong-office or wrong-date / DDHQ omission / genuine matcher false-negative) using a deterministic SQL pre-pass against DDHQ staging plus a web-verification subagent fan-out, then writes an external aggregate summary CSV, an internal per-record detail CSV, and a confirmed-winners list. Use when asked to understand or quantify why product users tied to a 2026 (or later) campaign are not matched to election results, or to refresh the prior DDHQ miss audit.
Match an external or ad-hoc table (HubSpot export, lead list, P2V sample) to ICP flags or other reference data in Databricks. Use when you have a table of people or races and need to attach int__icp_offices flags (icp_office_win / icp_office_serve, voter_count, etc.) but the table only has emails, BallotReady race IDs, or position IDs, not the ICP join. Routes by which ID you have: email (two-hop via campaigns), race ID (two-hop via race staging), or position ID (direct join). General Databricks matching reference; not Win-pipeline specific.
| name | audit-er-results |
| description | Audit entity resolution match results for quality — analyze coverage, false positives, and false negatives |
| user_invocable | true |
After an ER match run, audit the results for match quality. Work from the
repo root directory. Default paths assume results/<entity-type>/ for
outputs. The --entity-type flag selects the config (candidacy_stage or
elected_official).
Run each step below sequentially. Read each output CSV after running the script, then interpret the results before moving to the next step.
If results already exist in the results directory, skip to Step 1. Otherwise,
run the match pipeline first. The --run-audit flag runs Steps 1-3
automatically after matching, but you should still interpret the outputs.
# Candidacy (from local CSV):
uv run python -m scripts.cli match --entity-type candidacy_stage --input data/input.csv
# Candidacy (from Databricks — the typical path):
uv run python -m scripts.cli match --entity-type candidacy_stage \
--input goodparty_data_catalog.dbt.int__er_prematch_candidacy_stages
# Elected officials:
uv run python -m scripts.cli match --entity-type elected_official \
--input goodparty_data_catalog.dbt.int__er_prematch_elected_officials
Requires DATABRICKS_HTTP_PATH env var for Databricks reads (see
scripts/databricks_io.py for auth details).
uv run python -m scripts.cli audit summary --entity-type candidacy_stage --results-dir results/candidacy_stage/
Read results/audit_summary.csv and interpret the terminal output. Flag:
When a new source has been added or an existing source shows anomalies, drill into that source specifically:
uv run python -m scripts.cli audit low-confidence --entity-type candidacy_stage --results-dir results/candidacy_stage/ --sample 20
This finds the 20 pairs closest to 0.5 match probability — the model's most
ambiguous decisions. Read results/audit_low_confidence.csv. For each pair:
Summarize your findings as:
uv run python -m scripts.cli audit false-negatives --entity-type candidacy_stage --results-dir results/candidacy_stage/ --sample 20
Read results/audit_false_negatives.csv. For each suspicious non-match:
Check the was_in_pairwise_predictions column. Note that the pairwise
predictions CSV contains only pairs that survived BOTH blocking AND the
post-prediction filters in scripts/pipeline.py. A pair that shows
was_in_pairwise_predictions = False may have been:
To distinguish these two cases, temporarily relax or remove the post-prediction filters and re-run, then check if the pair appears.
Per-provider singleton drill-down: Check the unmatched singleton count for each provider. If a provider has a high proportion of unmatched singletons (e.g. >30% unmatched), drill into that provider specifically. If the absolute number of unmatched records is small enough to review exhaustively (e.g. <500), do so rather than sampling — cross-reference each singleton against all other providers by state + election_date + last_name to find plausible matches that were missed. This catches false negatives that random sampling across all providers would miss, especially for smaller sources where a handful of missed matches significantly impacts the match rate.
Look for systematic patterns:
The post-prediction filters in pipeline.py are a common source of false
negatives, especially for new data sources. The filters include:
gamma_last_name > 0 AND (gamma_first_name > 0 OR gamma_email > 0 OR gamma_phone > 0)gamma_official_office_name > 0 OR locality-token-overlap —
requires either JW >= 0.75 OR a shared meaningful locality token between
office names. If a new source uses office name conventions that share
neither JW similarity nor locality tokens with existing sources, this
filter will drop those pairs.br_race_id but they differ, unless office names are similar (JW >= 0.88).
Note: elected officials config does NOT have the race ID filter.When investigating filter-caused false negatives:
cp -r results results_baseline)When proposing or testing changes to blocking rules, comparisons, or post-prediction filters, always verify that existing match quality is preserved:
# Compare pairwise predictions
baseline_pairs = set(zip(baseline_pw['unique_id_l'], baseline_pw['unique_id_r']))
new_pairs = set(zip(new_pw['unique_id_l'], new_pw['unique_id_r']))
lost = baseline_pairs - new_pairs # should be empty or near-empty
Check specifically:
Based on all steps above, compile actionable recommendations. Organize them as:
Blocking rule changes (pairs never generated):
Comparison/threshold changes (pairs generated but misscored):
Post-prediction filter changes (pairs scored but filtered out):
Data quality issues (fix upstream in the prematch dbt model):
Present these recommendations to the user and ask before making any changes.
If the user wants to proceed with changes, edit the entity config in
scripts/configs/candidacy.py or scripts/configs/elected_official.py for
comparisons, blocking rules, or post-prediction filters. Edit the dbt
prematch model for upstream data quality fixes.