Skip to content

Commit

Permalink
[#158] Add type hints and tweak documentation for core.comparison.gen…
Browse files Browse the repository at this point in the history
…erate_comparison()
  • Loading branch information
riley-harper committed Oct 29, 2024
1 parent 0fd0552 commit c855921
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions hlink/linking/core/comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,23 @@ def _get_comp_leaf(comp: dict[str, Any], comp_leaves: list[dict[str, Any]]) -> N
return comp_leaves


def generate_comparisons(comp, features, id_col):
def generate_comparisons(
comp: dict[str, Any], features: list[dict[str, Any]], id_col: str
) -> str:
"""Creates the comparison SQL clause given a comparison and a list of comparison features.
Parameters
----------
comp: dictionary
comp:
the config dictionary containing the comparison definition
features: dictionary
the config dictionary containing the comparison features
id_col: string
features:
the config list containing the comparison features
id_col:
the id column
Returns
-------
A string of the sql clause to be used for comparison
filtering after blocking.
The sql clause to be used for comparison filtering after blocking.
"""
if comp != {}:
if "comp_a" in comp:
Expand Down
2 changes: 1 addition & 1 deletion hlink/tests/core/comparison_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def test_generate_comparisons_empty_input() -> None:
generate_comparisons() returns an empty string for empty input.
"""
comparisons = {}
features = {}
features = []
id_col = ""
assert generate_comparisons(comparisons, features, id_col) == ""

Expand Down

0 comments on commit c855921

Please sign in to comment.