{"id":19595901,"url":"https://github.com/innovativeinventor/precinct-matcher","last_synced_at":"2026-06-11T06:31:15.729Z","repository":{"id":135192450,"uuid":"336694306","full_name":"InnovativeInventor/precinct-matcher","owner":"InnovativeInventor","description":"Monadic election precinct matcher for gerrymandering data collection and research at MGGG.","archived":false,"fork":false,"pushed_at":"2021-04-18T20:30:22.000Z","size":105,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-26T14:45:22.020Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/InnovativeInventor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-07T03:44:37.000Z","updated_at":"2021-08-02T15:07:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"b7557c69-7b1e-4fe6-9725-a4bda2d82463","html_url":"https://github.com/InnovativeInventor/precinct-matcher","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/InnovativeInventor/precinct-matcher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InnovativeInventor%2Fprecinct-matcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InnovativeInventor%2Fprecinct-matcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InnovativeInventor%2Fprecinct-matcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InnovativeInventor%2Fprecinct-matcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/InnovativeInventor","download_url":"https://codeload.github.com/InnovativeInventor/precinct-matcher/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InnovativeInventor%2Fprecinct-matcher/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34186385,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T08:49:15.879Z","updated_at":"2026-06-11T06:31:15.702Z","avatar_url":"https://github.com/InnovativeInventor.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## (monadic) Precinct Matcher\nMatching election data to shapefiles is hard.\nIt is usually context-dependent and implemented on a project-by-project basis.\nIt also sometimes involves some manual labor.\nThis attempts to make life easier for everyone who has to deal with precinct matching.\n\n## Install\n\n``` bash\npip install pmatcher\n```\n## Benchmarks (on real data)\nVEST releases its precincts with VTD codes and county FIPS codes.\nTo validate this approach, I ran the matcher on known, good data.\n\nResults (in % accuracy):\n``` \nExact match 0.9444831591173054\nInsensitive match 0.9444831591173054\nInsensitive normalized match 0.9932636469221835\nAggressive insensitive normalized match 0.9983739837398374\n```\n\n## Implemented Methods\n- `matcher.default()`\nApplies exact, insensitive, normalized, and weighted_manual in that order.\nAll batteries included!\n\n- `matcher.exact()`\nMatches exact strings.\n\n- `matcher.insensitive()`\nMatches strings (case-insensitive).\n\n- `matcher.insensitive_normalized()`\nMatches strings with special characters removed (e.g.`()`, `#`, `-`).\n\n- `matcher.weighted_manual()`\nUses a weighted levenshtein algorithm.\nFirst looks for token-distance, followed by token word distance for tiebreaking.\n\n### Saving and loading progress\n- `matcher.save_progress(\"progress.json\")`\nSaves progress/mapping to a json file.\n\n- `matcher.load_progress(\"progress.json\")`\nLoads progress/mapping from a json file.\n\n## Example usage\n\n``` python\nfrom pmatcher import PrecinctMatcher\nmatcher = PrecinctMatcher(list_1, list_2)\nmapping = matcher.default()\n```\n\n``` python\nfrom pmatcher import PrecinctMatcher\nmatcher = PrecinctMatcher(list_1, list_2)\nmatcher.exact()\nmatcher.insensitive()\nmatcher.insensitive_normalized()\nmatcher.insensitive_normalized(aggressive=True)\nmapping = matcher.weighted_manual()\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finnovativeinventor%2Fprecinct-matcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finnovativeinventor%2Fprecinct-matcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finnovativeinventor%2Fprecinct-matcher/lists"}