Skip to content

Commit

Permalink
[#141] Refactor core.transforms.generate_transforms().get_transforms()
Browse files Browse the repository at this point in the history
Now it no longer captures variables from the generate_transforms() function, so
we should be ready to move it up to the module level.
  • Loading branch information
riley-harper committed Jun 28, 2024
1 parent 94f0e8b commit 11a6b1a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions hlink/linking/core/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,11 @@ def union_list(list_a, list_b):
for feature_selection in not_skipped_feature_selections:
df_selected = parse_feature_selections(df_selected, feature_selection, is_a)

def get_transforms(name: str, is_a: bool) -> list[dict[str, Any]]:
def get_transforms(
feature_selections: list[dict[str, Any]], name: str, is_a: bool
) -> list[dict[str, Any]]:
to_process = []
for f in not_skipped_feature_selections:
for f in feature_selections:
if ("override_column_a" in f) and is_a:
pass
elif ("override_column_b" in f) and not is_a:
Expand All @@ -326,9 +328,9 @@ def get_transforms(name: str, is_a: bool) -> list[dict[str, Any]]:
return to_process

hh_transforms = [
get_transforms("attach_family_col", is_a),
get_transforms("related_individual_rows", is_a),
get_transforms("neighbor_aggregate", is_a),
get_transforms(not_skipped_feature_selections, "attach_family_col", is_a),
get_transforms(not_skipped_feature_selections, "related_individual_rows", is_a),
get_transforms(not_skipped_feature_selections, "neighbor_aggregate", is_a),
]
if any(hh_transforms):
attach_ts, related_ts, neighbor_ts = hh_transforms
Expand Down

0 comments on commit 11a6b1a

Please sign in to comment.