Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalise the report generation for ROBOT report and FP3 and FP7 reports #124

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions util/create_report_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def main(args):
help='Output report HTML file')
parser.add_argument('limitlines',
type=int,
help='Parameter to limit lines', nargs='?', default=0)
help='Parameter to limit lines', nargs='?', default=50)
args = parser.parse_args()

context = json.load(args.context)['@context']
Expand All @@ -41,8 +41,9 @@ def main(args):

try:
report = pd.read_csv(args.report, sep="\t")
error_count_level = report["Level"].value_counts()
error_count_rule = report["Rule Name"].value_counts()
if "Level" in report.columns and "Rule Name" in report.columns:
error_count_level = report["Level"].value_counts()
error_count_rule = report["Rule Name"].value_counts()
except Exception:
print("No report")

Expand Down
12 changes: 6 additions & 6 deletions util/templates/report.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<div class="col-md-12">
<h1>{{ title }}</h1>
<p class="lead"><a href="{{ file }}">Download TSV</a></p>
{% if error_count_level.items() %}
<h3>Types of errors</h3>
<div class="report_summary"><table class="table">
<tr><th><b>Level</b></th><th><b>Number of errors</b></th></tr>
Expand All @@ -25,6 +26,7 @@
<p style="text-align:center; margin-top:-15px;">
<small>Click on any term to redirect to the term page.</small>
</p>
{% endif %}
<table class="table">
<tr>
<th><b>Row</b></th>
Expand All @@ -33,13 +35,11 @@
{% endfor %}
</tr>
{%- for row_index, row in contents.iterrows() -%}
<tr class={{ class_map[row['Level']]|default('table-active') }}>
<tr{% if error_count_level.items() %} class={{ class_map[row['Level']]|default('table-active') }}{% endif %}>
<td>{{ row_index }}</td>
<td>{{ row['Level'] }}
<td>{{ maybe_get_link(row['Rule Name'], context) }}</td>
<td>{{ maybe_get_link(row['Subject'], context) }}</td>
<td>{{ maybe_get_link(row['Property'], context) }}</td>
<td>{{ maybe_get_link(row['Value']|replace("nan", ""), context) }}</td>
{%- for col in row %}
<td>{{ maybe_get_link(col|replace("nan", ""), context) }}</td>
{%- endfor %}
</tr>
{% endfor -%}
</table>
Expand Down
Loading