Skip to content

Commit

Permalink
Merge 04e0bfa into a5a93f3
Browse files Browse the repository at this point in the history
  • Loading branch information
abegong committed Aug 7, 2019
2 parents a5a93f3 + 04e0bfa commit 7c87149
Show file tree
Hide file tree
Showing 17 changed files with 1,046 additions and 218 deletions.
52 changes: 30 additions & 22 deletions great_expectations/data_context/data_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from .util import NormalizedDataAssetName, get_slack_callback, safe_mmkdir

from great_expectations.exceptions import DataContextError, ConfigNotFoundError, ProfilerError
from great_expectations.render.types import RenderedDocumentContent

try:
from urllib.parse import urlparse
Expand All @@ -36,6 +37,11 @@
DefaultJinjaPageView,
DefaultJinjaIndexPageView,
)
from great_expectations.render.types import (
RenderedComponentContent,
RenderedSectionContent,
)



from .expectation_explorer import ExpectationExplorer
Expand Down Expand Up @@ -1625,7 +1631,7 @@ def render_full_static_site(self):
for source, generators in index_links_dict.items():
content_blocks = []

source_header_block = {
source_header_block = RenderedComponentContent(**{
"content_block_type": "header",
"header": source,
"styling": {
Expand All @@ -1634,20 +1640,20 @@ def render_full_static_site(self):
"classes": ["alert", "alert-secondary"]
}
}
}
})
content_blocks.append(source_header_block)

for generator, data_assets in generators.items():
generator_header_block = {
generator_header_block = RenderedComponentContent(**{
"content_block_type": "header",
"header": generator,
"styling": {
"classes": ["col-12", "ml-4"],
}
}
})
content_blocks.append(generator_header_block)

horizontal_rule = {
horizontal_rule = RenderedComponentContent(**{
"content_block_type": "string_template",
"string_template": {
"template": "",
Expand All @@ -1657,11 +1663,11 @@ def render_full_static_site(self):
"styling": {
"classes": ["col-12"],
}
}
})
content_blocks.append(horizontal_rule)

for data_asset, link_lists in data_assets.items():
data_asset_heading = {
data_asset_heading = RenderedComponentContent(**{
"content_block_type": "string_template",
"string_template": {
"template": "$data_asset",
Expand All @@ -1684,12 +1690,12 @@ def render_full_static_site(self):
"word-break": "break-all"
}
}
}
})
content_blocks.append(data_asset_heading)

expectation_suite_links = link_lists["expectation_suite_links"]
expectation_suite_link_table_rows = [
[{
[RenderedComponentContent(**{
"content_block_type": "string_template",
"string_template": {
"template": "$link_text",
Expand All @@ -1703,9 +1709,9 @@ def render_full_static_site(self):
}
}
}
}] for link_dict in expectation_suite_links
})] for link_dict in expectation_suite_links
]
expectation_suite_link_table = {
expectation_suite_link_table = RenderedComponentContent(**{
"content_block_type": "table",
"subheader": "Expectation Suites",
"table": expectation_suite_link_table_rows,
Expand All @@ -1718,12 +1724,12 @@ def render_full_static_site(self):
"classes": ["table", "table-sm", ],
}
},
}
})
content_blocks.append(expectation_suite_link_table)

validation_links = link_lists["validation_links"]
validation_link_table_rows = [
[{
[RenderedComponentContent(**{
"content_block_type": "string_template",
"string_template": {
"template": "$link_text",
Expand All @@ -1740,9 +1746,9 @@ def render_full_static_site(self):
}
}
}
}] for link_dict in validation_links
})] for link_dict in validation_links
]
validation_link_table = {
validation_link_table = RenderedComponentContent(**{
"content_block_type": "table",
"subheader": "Batch Validations",
"table": validation_link_table_rows,
Expand All @@ -1755,20 +1761,22 @@ def render_full_static_site(self):
"classes": ["table", "table-sm", ],
}
},
}
})
content_blocks.append(validation_link_table)

section = {
section = RenderedSectionContent(**{
"section_name": source,
"content_blocks": content_blocks
}
})
sections.append(section)

with open(os.path.join(self.data_doc_directory, "index.html"), "w") as writer:
writer.write(DefaultJinjaIndexPageView.render({
"utm_medium": "index-page",
"sections": sections
}))
writer.write(DefaultJinjaIndexPageView.render(
RenderedDocumentContent(**{
"utm_medium": "index-page",
"sections": sections
})
))

def profile_datasource(self,
datasource_name,
Expand Down
20 changes: 12 additions & 8 deletions great_expectations/jupyter_ux/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,12 @@ def display_column_expectations_as_section(
#TODO: Handle the case where zero evrs match the column name

document = render.renderer.ExpectationSuiteColumnSectionRenderer.render(column_expectation_list)
view = render.view.DefaultJinjaSectionView.render({
"section": document,
"section_loop": {"index": 1},
})
view = render.view.DefaultJinjaSectionView.render(
render.types.RenderedComponentContentWrapper(**{
"section": document,
"section_loop": {"index": 1},
})
)

if include_styling:
html_to_display = bootstrap_link_element+cooltip_style_element+view
Expand Down Expand Up @@ -264,10 +266,12 @@ def display_column_evrs_as_section(
#TODO: Handle the case where zero evrs match the column name

document = render.renderer.ProfilingResultsColumnSectionRenderer.render(column_evr_list)
view = render.view.DefaultJinjaSectionView.render({
"section": document,
"section_loop": {"index": 1},
})
view = render.view.DefaultJinjaSectionView.render(
render.types.RenderedComponentContentWrapper(**{
"section": document,
"section_loop": {"index": 1},
})
)

if include_styling:
html_to_display = bootstrap_link_element+cooltip_style_element+view
Expand Down

0 comments on commit 7c87149

Please sign in to comment.