Simplify: fix correctness bugs, dead code, and efficiency issues#14
Open
divij-sinha wants to merge 2 commits intomainfrom
Open
Simplify: fix correctness bugs, dead code, and efficiency issues#14divij-sinha wants to merge 2 commits intomainfrom
divij-sinha wants to merge 2 commits intomainfrom
Conversation
- Fix typo "probablistic" -> "probabilistic" in create_config (was silently disabling probabilistic matching for all interactive config users) - Fix sorted() bug: was sorting characters of concatenated schema names instead of sorting the two names as a list - Add SearchEngine module-level singleton to avoid re-instantiating the uszipcode DB connection on every cache miss - Vectorize get_matches_df with numpy fancy indexing; remove dead `top` param - Extract _load_bad_list() helper to replace two identical try/except blocks - Build schemas_by_name dict to replace O(n) list-comprehension lookups - Replace bare input() calls with Prompt.ask for consistency - Fix None-check order in clean_address state validation - Merge two sequential record.items() loops into one in clean_address - Remove dead code: unreachable return, no-op df=df, redundant else branches, predict_org if/else where both branches returned 0 - Update test fixture to reflect corrected probabilistic key spelling Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
main.py):sorted()was called on the concatenation of two schema name strings (sorting individual characters), causing incorrect deduplication of cross-schema link pairs — fixed tosorted([a, b])utils.py): typo"probablistic"meant the interactive config builder always set the wrong key, so probabilistic matching was never enabled via interactive setupcleaning_functions.py):SearchEngine()(uszipcode DB connection) was instantiated on every cache miss; moved to a module-level singletontfidf_utils.py): replaced Pythonforloop inget_matches_dfwith numpy vectorized indexing; removed deadtopparametermain.py): extracted_load_bad_list()helper to replace two identical try/except CSV loading blocks; builtschemas_by_namedict to replace repeated O(n) list-comprehension lookups; removed redundantelsebranchesutils.py): replaced bareinput()calls withPrompt.askfor consistency with the Rich abstraction used throughoutreturn,df = dfno-op,predict_orgif/else where both branches returned0, and a redundant schema lookupNone-check order inclean_address, merged two sequentialrecord.items()loopsTest plan
uv run pytest— all 32 tests passprobabilistic: Truewhen user answers yes🤖 Generated with Claude Code