-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
79 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from shiny import App, ui | ||
|
||
from dp_creator_ii.app import analysis_panel, dataset_panel, results_panel | ||
|
||
|
||
app_ui = ui.page_bootstrap( | ||
ui.navset_tab( | ||
dataset_panel.dataset_ui(), | ||
analysis_panel.analysis_ui(), | ||
results_panel.results_ui(), | ||
id="top_level_nav", | ||
), | ||
title="DP Creator II", | ||
) | ||
|
||
|
||
def server(input, output, session): | ||
dataset_panel.dataset_server(input, output, session) | ||
analysis_panel.analysis_server(input, output, session) | ||
results_panel.results_server(input, output, session) | ||
|
||
|
||
app = App(app_ui, server) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from shiny import ui, reactive | ||
|
||
|
||
def analysis_ui(): | ||
return ui.nav_panel( | ||
"Perform Analysis", | ||
"TODO: Define analysis", | ||
ui.input_action_button("go_to_results", "Download results"), | ||
value="analysis_panel", | ||
) | ||
|
||
|
||
def analysis_server(input, output, session): | ||
@reactive.effect | ||
@reactive.event(input.go_to_results) | ||
def go_to_results(): | ||
ui.update_navs("top_level_nav", selected="results_panel") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from pathlib import Path | ||
import json | ||
from shiny import ui, reactive, render | ||
from dp_creator_ii import get_arg_parser | ||
|
||
|
||
def dataset_ui(): | ||
return ui.nav_panel( | ||
"Select Dataset", | ||
"TODO: Pick dataset", | ||
ui.output_text("csv_path_text"), | ||
ui.output_text("unit_of_privacy_text"), | ||
ui.input_action_button("go_to_analysis", "Perform analysis"), | ||
value="dataset_panel", | ||
) | ||
|
||
|
||
def dataset_server(input, output, session): | ||
args = get_arg_parser().parse_args() | ||
csv_path = reactive.value(args.csv_path) | ||
unit_of_privacy = reactive.value(args.unit_of_privacy) | ||
|
||
@render.text | ||
def csv_path_text(): | ||
return str(csv_path.get()) | ||
|
||
@render.text | ||
def unit_of_privacy_text(): | ||
return str(unit_of_privacy.get()) | ||
|
||
@reactive.effect | ||
@reactive.event(input.go_to_analysis) | ||
def go_to_analysis(): | ||
ui.update_navs("top_level_nav", selected="analysis_panel") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters