From 85514fd225c518443dfd549542cb2c16b83550a2 Mon Sep 17 00:00:00 2001 From: Abe Date: Mon, 1 Jul 2019 15:23:40 -0700 Subject: [PATCH] Add popover to Number of observations --- .../render/renderer/other_section_renderer.py | 15 ++- .../render/view/templates/component.j2 | 17 ++- .../render/view/templates/page.j2 | 9 +- tests/render/fixtures/html_snapshot.html | 107 +++++++++--------- tests/render/test_default_jinja_view.py | 12 +- 5 files changed, 95 insertions(+), 65 deletions(-) diff --git a/great_expectations/render/renderer/other_section_renderer.py b/great_expectations/render/renderer/other_section_renderer.py index b87018d0e0b6..b0a35f4fd20a 100644 --- a/great_expectations/render/renderer/other_section_renderer.py +++ b/great_expectations/render/renderer/other_section_renderer.py @@ -54,7 +54,20 @@ def _render_dataset_info(cls, evrs, content_blocks): ) if row_count_evr != None: table_rows.append([ - "Number of observations", + { + "template": "Number of observations", + "params": {}, + "styling": { + "attributes": { + "data-toggle": "popover", + "data-trigger": "hover", + "data-placement": "top", + "data-content": "expect_table_row_count_to_be_between", + "container": "body", + } + + } + }, row_count_evr["result"]["observed_value"] ]) diff --git a/great_expectations/render/view/templates/component.j2 b/great_expectations/render/view/templates/component.j2 index 05a4c4df117f..25345864f9df 100644 --- a/great_expectations/render/view/templates/component.j2 +++ b/great_expectations/render/view/templates/component.j2 @@ -1,3 +1,8 @@ +{%- if section_loop is defined -%} + {%- set section_id = "section-"~section_loop.index -%} +{%- else -%} + {%- set section_id = None -%} +{%- endif -%} {% if content_block_loop is defined -%} {%- if section_loop is defined -%} {%- set content_block_id = "section-"~section_loop.index~"-content-block-"~content_block_loop.index -%} @@ -26,7 +31,7 @@ {% endif -%}
{% if "header" in content_block and content_block["content_block_type"] != "header" -%} -

+

{{ content_block["header"] | render_string_template }}

{% endif -%} @@ -64,12 +69,18 @@ vegaEmbed('#{{content_block_id}}-body', vlSpec, {actions: false}).then(result=>console.log(result)).catch(console.warn); {%- elif content_block["content_block_type"] == "table" -%} - +
{% for row in content_block["table_rows"] -%} {% set rowloop = loop -%} {% for cell in row -%} - + {% if cell is mapping and "styling" in cell -%} + {% set cell_styling = cell["styling"] | render_styling | replace("{{section_id}}", section_id) | replace("{{content_block_id}}", content_block_id) -%} + {% else -%} + {% set cell_styling = "" -%} + {% endif -%} + + {%- endfor -%} {%- endfor -%} diff --git a/great_expectations/render/view/templates/page.j2 b/great_expectations/render/view/templates/page.j2 index a15cb4555077..ad6b8ad94ed2 100644 --- a/great_expectations/render/view/templates/page.j2 +++ b/great_expectations/render/view/templates/page.j2 @@ -13,7 +13,7 @@ position: relative; } .container { - margin-top: 50px; + padding-top: 50px; } .sticky { position: -webkit-sticky; @@ -50,6 +50,9 @@ transition: .3s transform ease-in-out; } + .popover { + max-width: 100%; + } @@ -78,8 +81,8 @@ - - + + @@ -117,12 +120,12 @@

{{ cell | render_string_template }}{{ cell | render_string_template }}
- - - - - -
Number of variables12
Number of observations891
Missing cells866 (8.1%)
Duplicate rows0 (0.0%)
Total size in memory83.6 KiB
Average record size in memory96.1 B
+ Number of variables12 + Number of observations891 + Missing cells866 (8.1%) + Duplicate rows0 (0.0%) + Total size in memory83.6 KiB + Average record size in memory96.1 B
@@ -131,14 +134,14 @@

- - - - - - - -
Numeric5
Categorical5
Boolean1
Date0
URL0
Text (Unique)1
Rejected0
Unsupported0
+ Numeric5 + Categorical5 + Boolean1 + Date0 + URL0 + Text (Unique)1 + Rejected0 + Unsupported0
@@ -147,12 +150,12 @@

- - - - - -
Age has 177 (19.9%) missing valuesMissing
Cabin has a high cardinality: 148 distinct valuesWarning
Cabin has 687 (77.1%) missing valuesMissing
Fare has 15 (< 0.1%) zerosZeros
Parch has 678 (< 76.1%) zerosZeros
SibSp has 608 (< 68.2%) zerosZeros
+ Age has 177 (19.9%) missing valuesMissing + Cabin has a high cardinality: 148 distinct valuesWarning + Cabin has 687 (77.1%) missing valuesMissing + Fare has 15 (< 0.1%) zerosZeros + Parch has 678 (< 76.1%) zerosZeros + SibSp has 608 (< 68.2%) zerosZeros
@@ -161,11 +164,11 @@

- - - - -
expect_column_to_exist6
expect_column_mean_to_be_between1
expect_column_values_to_be_between1
expect_column_values_to_match_regex1
expect_column_values_to_be_in_set1
+ expect_column_to_exist6 + expect_column_mean_to_be_between1 + expect_column_values_to_be_between1 + expect_column_values_to_match_regex1 + expect_column_values_to_be_in_set1
@@ -186,10 +189,10 @@

- - - -
Mean446
Minimum1
Maximum891
Zeros (%)0.0%
+ Mean446 + Minimum1 + Maximum891 + Zeros (%)0.0%
@@ -221,10 +224,10 @@

- - - -
Mean446
Minimum1
Maximum891
Zeros (%)0.0%
+ Mean446 + Minimum1 + Maximum891 + Zeros (%)0.0%
@@ -256,10 +259,10 @@

- - - -
Mean446
Minimum1
Maximum891
Zeros (%)0.0%
+ Mean446 + Minimum1 + Maximum891 + Zeros (%)0.0%
@@ -292,10 +295,10 @@

- - - -
Mean446
Minimum1
Maximum891
Zeros (%)0.0%
+ Mean446 + Minimum1 + Maximum891 + Zeros (%)0.0%
@@ -326,10 +329,10 @@

- - - -
Mean446
Minimum1
Maximum891
Zeros (%)0.0%
+ Mean446 + Minimum1 + Maximum891 + Zeros (%)0.0%
@@ -360,10 +363,10 @@

- - - -
Mean446
Minimum1
Maximum891
Zeros (%)0.0%
+ Mean446 + Minimum1 + Maximum891 + Zeros (%)0.0%
@@ -384,8 +387,8 @@

- - + +