Skip to content

Commit

Permalink
Merge pull request #8 from GSA/lc/1271-update-standards-report
Browse files Browse the repository at this point in the history
#1271 - Forced the 'uswds_true_count' column to an integer in the Standard's report
  • Loading branch information
luke-at-flexion authored Dec 27, 2024
2 parents 977e89b + ff8af2b commit d91584b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion report_generators/standards.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def generate_report(self):
total_records=('target_url_agency_owner', 'size'),
title_count=('title', lambda x: (x.notna() & (x != '')).sum()),
description_count=('description', lambda x: (x.notna() & (x != '')).sum()),
uswds_true_count=('uswds_banner_heres_how', 'sum'),
uswds_true_count=('uswds_banner_heres_how', lambda x: int(x.sum())),
).reset_index()

result_df['title_not_empty_pct'] = round(result_df['title_count'] / result_df['total_records'] * 100, 2)
Expand All @@ -21,6 +21,7 @@ def generate_report(self):
'total_records': [sum(result_df['total_records'])],
'title_count': [sum(result_df['title_count'])],
'description_count': [sum(result_df['description_count'])],
'uswds_true_count': [sum(result_df['uswds_true_count'])],
'title_not_empty_pct': [round((sum(result_df['title_count'] / sum(result_df['total_records']))) * 100, 2)],
'description_not_empty_pct': [round((sum(result_df['description_count'] / sum(result_df['total_records']))) * 100, 2)],
'uswds_true_pct': [round((sum(result_df['uswds_true_count'] / sum(result_df['total_records']))) * 100, 2)],
Expand Down

0 comments on commit d91584b

Please sign in to comment.