Skip to content

Commit

Permalink
add percentage invalid terms and fix percentage related to as and ct (#…
Browse files Browse the repository at this point in the history
…258)

Co-authored-by: Anita Caron <[email protected]>
  • Loading branch information
Anita Caron and anitacaron authored Aug 31, 2023
1 parent e3a75da commit 699c50f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/ccf_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,9 @@ def check_id(id):
as_invalid_term_percent = 0
ct_invalid_terms_percent = 0
if len(unique_terms) > 0:
as_invalid_term_percent = round((len(as_invalid_terms)*100)/len(unique_terms), 2)
ct_invalid_terms_percent = round((len(ct_invalid_terms)*100)/len(unique_terms), 2)
as_invalid_term_percent = round((len(as_invalid_terms)*100)/(len(as_valid_terms)+len(as_invalid_terms)), 2)
ct_invalid_terms_percent = round((len(ct_invalid_terms)*100)/(len(ct_valid_terms)+len(ct_invalid_terms)), 2)
invalid_terms_percent = round((len(as_invalid_terms)+len(ct_invalid_terms))*100/len(unique_terms), 2)

report_terms = {
'Table': '',
Expand All @@ -215,7 +216,8 @@ def check_id(id):
'AS_invalid_term_percent': [as_invalid_term_percent],
'CT_valid_term_number': [len(ct_valid_terms)],
'CT_invalid_term_number': [len(ct_invalid_terms)],
'CT_invalid_term_percent': [ct_invalid_terms_percent]
'CT_invalid_term_percent': [ct_invalid_terms_percent],
'invalid_terms_percent': [invalid_terms_percent]
}


Expand Down
4 changes: 3 additions & 1 deletion src/dashboard_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def add_color(report, report_type):
for row in report.itertuples():
report.at[row.Index, "AS_invalid_term_percent"] = check_number_n_get_color(row.AS_invalid_term_percent)
report.at[row.Index, "CT_invalid_term_percent"] = check_number_n_get_color(row.CT_invalid_term_percent)
report.at[row.Index, "invalid_terms_percent"] = check_number_n_get_color(row.invalid_terms_percent)
elif report_type == "relations":
for row in report.itertuples():
report.at[row.Index, "percent_invalid_AS-AS_relationship"] = check_number_n_get_color(row._3)
Expand All @@ -52,7 +53,8 @@ def get_reports(date):
"AS_invalid_term_percent": "% INVALID AS TERMS",
"CT_valid_term_number": "# VALID CT TERMS",
"CT_invalid_term_number": "# INVALID CT TERMS",
"CT_invalid_term_percent": "% INVALID CT TERMS"
"CT_invalid_term_percent": "% INVALID CT TERMS",
"invalid_terms_percent": "% INVALID TERMS"
}, inplace=True)
ter_report = add_link(ter_report)
ter_report_md = tsv2md(ter_report)
Expand Down

0 comments on commit 699c50f

Please sign in to comment.