Skip to content

Commit

Permalink
Add margin, and mock-up text (#57)
Browse files Browse the repository at this point in the history
* add a margin

* paste text from mockups
  • Loading branch information
mccalluc authored Oct 10, 2024
1 parent 1f02fa9 commit b98acd9
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 8 deletions.
3 changes: 3 additions & 0 deletions dp_creator_ii/app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from pathlib import Path

from shiny import App, ui

from dp_creator_ii.app import analysis_panel, dataset_panel, results_panel


app_ui = ui.page_bootstrap(
ui.head_content(ui.include_css(Path(__file__).parent / "css" / "styles.css")),
ui.navset_tab(
dataset_panel.dataset_ui(),
analysis_panel.analysis_ui(),
Expand Down
25 changes: 24 additions & 1 deletion dp_creator_ii/app/analysis_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,30 @@
def analysis_ui():
return ui.nav_panel(
"Define Analysis",
"TODO: Define analysis",
ui.markdown(
"Select numeric columns of interest in *TODO*, "
"and for each numeric column indicate the expected range, "
"the number of bins for the histogram, "
"and its relative share of the privacy budget."
),
ui.markdown(
"[TODO: Column selection]"
"(https://github.com/opendp/dp-creator-ii/issues/33)"
),
ui.markdown(
"What is your privacy budget for this release? "
"Values above 1 will add less noise to the data, "
"but have greater risk of revealing individual data."
),
ui.markdown(
"[TODO: Logarithmic slider]"
"(https://github.com/opendp/dp-creator-ii/issues/25)"
),
ui.markdown(
"## Preview\n"
"These plots assume a normal distribution for the columns you've selected, "
"and demonstrate the effect of different parameter choices."
),
ui.output_plot("plot_preview"),
"(This plot is only to demonstrate that plotting works.)",
ui.input_action_button("go_to_results", "Download results"),
Expand Down
7 changes: 7 additions & 0 deletions dp_creator_ii/app/css/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
body {
margin: 1em;
}

#top_level_nav {
margin-bottom: 1em;
}
4 changes: 4 additions & 0 deletions dp_creator_ii/app/dataset_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def dataset_ui():
"CSV path from either CLI or UI:",
ui.output_text("csv_path"),
"CSV fields:",
ui.markdown(
"How many rows of the CSV can one individual contribute to? "
'This is the "unit of privacy" which will be protected.'
),
ui.output_text("csv_fields"),
ui.input_numeric("contributions", "Contributions", args.contributions),
output_code_sample("unit_of_privacy_python"),
Expand Down
21 changes: 18 additions & 3 deletions dp_creator_ii/app/results_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,24 @@
def results_ui():
return ui.nav_panel(
"Download results",
"TODO: Download results",
ui.download_button("download_script", "Download script"),
ui.download_button("download_notebook_unexecuted", "Download notebook"),
ui.markdown(
"You can now make a differentially private release of your data. "
"This will lock the configuration you’ve provided on the previous pages."
),
ui.markdown("TODO: Button: “Download Report (.txt)” (implemented as yaml?)"),
ui.markdown("TODO: Button: “Download Report (.csv)"),
ui.markdown(
"You can also download code that can be executed to produce a DP release. "
"Downloaded code does not lock the configuration."
),
ui.download_button(
"download_script",
"Download Script (.py)",
),
ui.download_button(
"download_notebook_unexecuted",
"Download Notebook (.ipynb)",
),
value="results_panel",
)

Expand Down
8 changes: 4 additions & 4 deletions dp_creator_ii/tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

# TODO: Why is incomplete coverage reported here?
# https://github.com/opendp/dp-creator-ii/issues/18
def test_navigation(page: Page, app: ShinyAppProc): # pragma: no cover
pick_dataset_text = "TODO: Pick dataset"
perform_analysis_text = "TODO: Define analysis"
download_results_text = "TODO: Download results"
def test_app(page: Page, app: ShinyAppProc): # pragma: no cover
pick_dataset_text = "How many rows of the CSV"
perform_analysis_text = "Select numeric columns of interest"
download_results_text = "You can now make a differentially private release"

def expect_visible(text):
expect(page.get_by_text(text)).to_be_visible()
Expand Down

0 comments on commit b98acd9

Please sign in to comment.