Skip to content

Commit

Permalink
Adds 'death certificate' as exception, if flagged in term search. Closes
Browse files Browse the repository at this point in the history
 #97.
  • Loading branch information
mikejcorey committed Jan 25, 2024
1 parent f59fd6f commit 754a2ed
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion apps/deed/management/commands/gather_image_hits.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def build_match_report(self, workflow, matching_keys):

report_df['num_terms'] = report_df['matched_terms'].apply(lambda x: len(x.split(',')))

# create special flag for exceptions like "occupied by any"
# create special flag for exceptions like "occupied by any" and "death certificate"
if 'occupied by any' in report_df.columns:
print(report_df['occupied by any'].apply(lambda x: self.split_or_1(x)))

Expand All @@ -95,6 +95,13 @@ def build_match_report(self, workflow, matching_keys):
else:
report_df['citizen_count'] = 0

if 'death certificate' in report_df.columns:
print(report_df['death certificate'].apply(lambda x: self.split_or_1(x)))

report_df.loc[~report_df['death certificate'].isna(), 'deathcert_count'] = report_df['death certificate'].apply(lambda x: self.split_or_1(x))
else:
report_df['deathcert_count'] = 0

# TODO: Put exceptions work here?

# Set bool_match to True, unless there's a suspect value or combination
Expand All @@ -106,6 +113,9 @@ def build_match_report(self, workflow, matching_keys):
report_df.loc[(report_df['num_terms'] == 1) & (report_df['citizen_count'] > 0), 'bool_match'] = False
report_df.loc[(report_df['num_terms'] == 1) & (report_df['citizen_count'] > 0), 'bool_exception'] = True

report_df.loc[(report_df['num_terms'] == 1) & (report_df['deathcert_count'] > 0), 'bool_match'] = False
report_df.loc[(report_df['num_terms'] == 1) & (report_df['deathcert_count'] > 0), 'bool_exception'] = True

report_df.drop(columns=term_columns.columns, inplace=True)
print(report_df)

Expand Down

0 comments on commit 754a2ed

Please sign in to comment.