From 9cd991d109742824afd54f77d61821942d10fbc3 Mon Sep 17 00:00:00 2001 From: Chuck McCallum Date: Fri, 8 Nov 2024 11:08:57 -0500 Subject: [PATCH] pull warning up to analysis panel. TODO: conditional --- dp_creator_ii/app/analysis_panel.py | 12 ++++++++++ dp_creator_ii/app/components/column_module.py | 23 ++++++++----------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/dp_creator_ii/app/analysis_panel.py b/dp_creator_ii/app/analysis_panel.py index b172e96..d63369f 100644 --- a/dp_creator_ii/app/analysis_panel.py +++ b/dp_creator_ii/app/analysis_panel.py @@ -7,6 +7,7 @@ from dp_creator_ii.utils.csv_helper import read_csv_ids_labels, read_csv_ids_names from dp_creator_ii.app.components.outputs import output_code_sample, demo_tooltip from dp_creator_ii.utils.templates import make_privacy_loss_block +from dp_creator_ii.app.components.column_module import col_widths def analysis_ui(): @@ -24,6 +25,17 @@ def analysis_ui(): [], ), ui.output_ui("columns_ui"), + ui.layout_columns( + [], + [ + ui.markdown( + "This simulation assumes a normal distribution " + "between the specified lower and upper bounds. " + "Your data file has not been read except to determine the columns." + ) + ], + col_widths=col_widths, + ), ui.markdown( "What is your privacy budget for this release? " "Values above 1 will add less noise to the data, " diff --git a/dp_creator_ii/app/components/column_module.py b/dp_creator_ii/app/components/column_module.py index d5e2499..c7c9ddf 100644 --- a/dp_creator_ii/app/components/column_module.py +++ b/dp_creator_ii/app/components/column_module.py @@ -10,6 +10,14 @@ default_weight = 2 +col_widths = { + # Controls stay roughly a constant width; + # Graph expands to fill space. + "sm": (4, 8), + "md": (3, 9), + "lg": (2, 10), +} + @module.ui def column_ui(): # pragma: no cover @@ -38,24 +46,11 @@ def column_ui(): # pragma: no cover ), ], [ - # TODO: This doesn't need to be repeated: could just go once at the top. - # https://github.com/opendp/dp-creator-ii/issues/138 - ui.markdown( - "This simulation assumes a normal distribution " - "between the specified lower and upper bounds. " - "Your data file has not been read except to determine the columns." - ), ui.output_plot("column_plot", height="300px"), # Make plot smaller than default: about the same size as the other column. output_code_sample("Column Definition", "column_code"), ], - col_widths={ - # Controls stay roughly a constant width; - # Graph expands to fill space. - "sm": (4, 8), - "md": (3, 9), - "lg": (2, 10), - }, + col_widths=col_widths, )