From 32c7ef47cac005dfbc83dcffd7b28e0df90ccfb6 Mon Sep 17 00:00:00 2001 From: Simon Brugman Date: Fri, 8 Jul 2022 10:28:23 +0200 Subject: [PATCH] fix: prevent plot name collision that stops rendering (#238) Co-authored-by: Patil --- popmon/analysis/profiling/profiles.py | 7 +++++- .../templates/assets/js/custom-script.js | 2 +- popmon/visualization/templates/card.html | 22 +++++++++---------- popmon/visualization/templates/core.html | 5 +++++ popmon/visualization/templates/section.html | 8 ++----- 5 files changed, 25 insertions(+), 19 deletions(-) diff --git a/popmon/analysis/profiling/profiles.py b/popmon/analysis/profiling/profiles.py index fa660f52..2f9970e8 100644 --- a/popmon/analysis/profiling/profiles.py +++ b/popmon/analysis/profiling/profiles.py @@ -159,7 +159,12 @@ def profile_distinct(bin_labels, bin_counts): return len(np.unique(bin_labels[bin_counts > 0])) -@Profiles.register(key="fraction_of_true", description="", dim=1, htype="cat") +@Profiles.register( + key="fraction_of_true", + description="Compute fraction of 'true' (as in boolean) labels", + dim=1, + htype="cat", +) def profile_fraction_of_true(bin_labels, bin_counts): """Compute fraction of 'true' labels diff --git a/popmon/visualization/templates/assets/js/custom-script.js b/popmon/visualization/templates/assets/js/custom-script.js index 28afc936..873aa688 100644 --- a/popmon/visualization/templates/assets/js/custom-script.js +++ b/popmon/visualization/templates/assets/js/custom-script.js @@ -71,7 +71,7 @@ $("#toggleDescriptions").change(function() { } }); -var plotly_config = {scrollZoom: true, displaylogo: false, modeBarButtonsToRemove: ['lasso2d']} ; +var plotly_config = {scrollZoom: true, displaylogo: false, modeBarButtonsToRemove: ['lasso2d']}; const deepCopy = (inObject) => { diff --git a/popmon/visualization/templates/card.html b/popmon/visualization/templates/card.html index 27e0a4d4..0fbb6e00 100644 --- a/popmon/visualization/templates/card.html +++ b/popmon/visualization/templates/card.html @@ -14,29 +14,29 @@

{{metric.name | fmt_metric}}

{%- if metric.type in ['traffic_light', 'alert'] -%} {{ metric.plot }} {%- else -%} -
+
{%- include 'header.html' -%} {{ sections }} {%- include 'footer.html' -%} diff --git a/popmon/visualization/templates/section.html b/popmon/visualization/templates/section.html index 0ed8662f..7587a0a0 100644 --- a/popmon/visualization/templates/section.html +++ b/popmon/visualization/templates/section.html @@ -24,20 +24,17 @@

{{ section_title }}

{%- for feature in features -%}
{%- if feature.plots is mapping -%} - {%- for ref,plots in feature.plots.items() -%} - {%- set count = (plots|length + 1)*(loop.index - 1) -%} + {%- for ref, plots in feature.plots.items() -%}

{{ feature.titles.get(ref, ref) }}

{{ feature.descriptions[ref] }}
{%- for metric in plots -%} - {%- set plt = count + loop.index -%} {%- with metric=metric -%} {%- include 'card.html' -%} {%- endwith -%} @@ -47,7 +44,6 @@

{{ feature.titles.get(ref, ref) }}

{%- else -%}
{%- for metric in feature.plots -%} - {%- set plt = loop.index -%} {%- with metric=metric -%} {%- include 'card.html' -%} {%- endwith -%}