From ba4e17fd3d97b5d2af2dd68649795517f6277202 Mon Sep 17 00:00:00 2001 From: Yuxuan Li <54911077+victoriali8023@users.noreply.github.com> Date: Thu, 4 Jan 2024 11:10:57 -0500 Subject: [PATCH] UI updates --- apps/home/routes.py | 10 ++++++---- apps/templates/design/config_summary/summary.html | 11 +++++------ .../design/covariates/covariate_main_effect.html | 6 +++--- .../covariates/covariate_tailored_effect.html | 2 +- .../design/intervention/intervention_option.html | 4 ++-- .../intervention/intervention_probability.html | 13 ++++++++++++- .../templates/design/projects/general_settings.html | 3 ++- apps/templates/includes/sidebar_project.html | 11 ++++++----- sql_data/heartstep.sql | 2 +- 9 files changed, 38 insertions(+), 24 deletions(-) diff --git a/apps/home/routes.py b/apps/home/routes.py index 0ee992e..9e3f216 100644 --- a/apps/home/routes.py +++ b/apps/home/routes.py @@ -411,21 +411,23 @@ def covariates_settings(setting_type, project_uuid, cov_id=None): menu_number=14, project_name=project_name, modified_on=modified_on, settings=settings, project_uuid=project_uuid, cov_id=cov_id) elif setting_type == "covariate_attributes": + cov_name = all_covariates.get(cov_id, {}).get("covariate_name") return render_template("design/covariates/covariate_attributes.html", segment="covariates", all_menus=all_menus, menu_number=14, project_name=project_name, modified_on=modified_on, - covariates_types=covariates_types, settings=settings, project_uuid=project_uuid, + covariates_types=covariates_types, cov_name=cov_name, settings=settings, project_uuid=project_uuid, cov_id=cov_id) elif setting_type == "covariate_main_effect": + cov_name = all_covariates.get(cov_id, {}).get("covariate_name") is_tailoring = project_details_obj.covariates.get(cov_id).get("tailoring_variable", "no") return render_template("design/covariates/covariate_main_effect.html", segment="covariates", formula=formula, all_menus=all_menus, menu_number=14, project_name=project_name, modified_on=modified_on, - is_tailoring=is_tailoring, settings=settings, project_uuid=project_uuid, cov_id=cov_id) + is_tailoring=is_tailoring, cov_name=cov_name, settings=settings, project_uuid=project_uuid, cov_id=cov_id) elif setting_type == "covariate_tailored_effect": formula = generate_formula(project_uuid=project_uuid, is_summary_page="no", add_red_note="yes", cov_id=cov_id, covariate_tailored_effect=True) - + cov_name = all_covariates.get(cov_id, {}).get("covariate_name") return render_template("design/covariates/covariate_tailored_effect.html", segment="covariates", formula=formula, all_menus=all_menus, menu_number=14, project_name=project_name, - modified_on=modified_on, settings=settings, project_uuid=project_uuid, cov_id=cov_id) + modified_on=modified_on, cov_name=cov_name, settings=settings, project_uuid=project_uuid, cov_id=cov_id) elif setting_type == "covariate_summary": tal_val = project_details_obj.covariates.get(cov_id).get("tailoring_variable", "no") is_tailoring = True diff --git a/apps/templates/design/config_summary/summary.html b/apps/templates/design/config_summary/summary.html index a9ef03a..340af40 100644 --- a/apps/templates/design/config_summary/summary.html +++ b/apps/templates/design/config_summary/summary.html @@ -60,10 +60,9 @@ }); }); - var low_bound = document.getElementById('configuration_note_low_bound').value; - var high_bound = document.getElementById('configuration_note_high_bound').value; - document.getElementById('configuration_note_low_bound').innerHTML = round(low_bound, 2); - document.getElementById('configuration_note_high_bound').innerHTML = round(high_bound, 2); + + + @@ -140,9 +139,9 @@
Input different possible tailoring variable values to see how the intervent The intervention probability will change (be personalized) as data accrues during the study but will never go below - {{settings.get("intervention_probability_lower_bound")|float*100}}% + {{settings.get("intervention_probability_lower_bound")|float}} or above - {{settings.get("intervention_probability_upper_bound")|float*100}}% + {{settings.get("intervention_probability_upper_bound")|float}} given the lower and upper bounds you set to the probability of sending Intervention Option A. diff --git a/apps/templates/design/covariates/covariate_main_effect.html b/apps/templates/design/covariates/covariate_main_effect.html index 1b3c18e..5d7f87f 100644 --- a/apps/templates/design/covariates/covariate_main_effect.html +++ b/apps/templates/design/covariates/covariate_main_effect.html @@ -20,7 +20,7 @@
-

Model Settings / Covariates / Main Effect

+

Model Settings / {{cov_name}} / Main Effect

@@ -36,7 +36,7 @@

Model Settings / Covariates / Main Effect

@@ -47,7 +47,7 @@

Model Settings / Covariates / Main Effect


diff --git a/apps/templates/design/covariates/covariate_tailored_effect.html b/apps/templates/design/covariates/covariate_tailored_effect.html index 3c5bc1c..e6c1d13 100644 --- a/apps/templates/design/covariates/covariate_tailored_effect.html +++ b/apps/templates/design/covariates/covariate_tailored_effect.html @@ -20,7 +20,7 @@
-

Model Settings / Covariates / Tailored Effect

+

Model Settings / {{cov_name}} / Tailored Effect

diff --git a/apps/templates/design/intervention/intervention_option.html b/apps/templates/design/intervention/intervention_option.html index 14ac252..8eda12e 100644 --- a/apps/templates/design/intervention/intervention_option.html +++ b/apps/templates/design/intervention/intervention_option.html @@ -37,14 +37,14 @@

Intervention Settings / Intervention Options

Please read the explanation to make sure that you define them correctly.

+ Option A (tend to be more burdensome, e.g., Send an Activity Suggestion)
+ Option B (tend to be less burdensome, e.g., Do Nothing) diff --git a/apps/templates/design/intervention/intervention_probability.html b/apps/templates/design/intervention/intervention_probability.html index 0e2e2a8..8398543 100644 --- a/apps/templates/design/intervention/intervention_probability.html +++ b/apps/templates/design/intervention/intervention_probability.html @@ -3,7 +3,18 @@ {% block title %} Intervention - Probability {% endblock %} -{% block stylesheets %}{% endblock stylesheets %} +{% block stylesheets %} + +{% endblock stylesheets %} {% block content %} diff --git a/apps/templates/design/projects/general_settings.html b/apps/templates/design/projects/general_settings.html index 539393e..d4f46c3 100644 --- a/apps/templates/design/projects/general_settings.html +++ b/apps/templates/design/projects/general_settings.html @@ -96,7 +96,8 @@

General Settings / General Info

-

Please tell us the intervention component you are designing. The proximal +

Your study may have multiple intervention components. + Please tell us the intervention component you are designing. The proximal outcome is a short-term outcome that the intervention is intended to impact.

diff --git a/apps/templates/includes/sidebar_project.html b/apps/templates/includes/sidebar_project.html index 345a817..4eae429 100644 --- a/apps/templates/includes/sidebar_project.html +++ b/apps/templates/includes/sidebar_project.html @@ -96,18 +96,19 @@ box-sizing: content-box; flex: 0 1 auto; - width: 30px; - height: 3px; - margin-right: 3px; - margin-left: 3px; + width: 12px; + height: 12px; + margin-right: 12px; + margin-left: 12px; text-indent: -999px; cursor: pointer; background-color: #5e72e4; background-clip: padding-box; border-top: 10px solid transparent; border-bottom: 10px solid transparent; - opacity: .5; + opacity: .4; transition: opacity 0.6s ease; + border-radius: 50%; } diff --git a/sql_data/heartstep.sql b/sql_data/heartstep.sql index eb53231..4d5dfda 100644 --- a/sql_data/heartstep.sql +++ b/sql_data/heartstep.sql @@ -1,4 +1,4 @@ INSERT INTO `users` (`id`, `username`, `email`, `password`) VALUES (1, 'mdot', 'contact@mdot.org', 0x356564306337643534323336313664313865633631623562326266393138386135373236326531623431616163363062396439373937626366633636386362316438393432623838613337303666343766303936376438363039626630363939653733316134663461633438656335316137643561633061313235663966323738386433356462373239313330326632343363333431303662303538323033353339343336663033623833613037336534313637356636343431646338396339); -INSERT INTO `projects` (`created_by`, `uuid`, `general_settings`, `intervention_settings`, `model_settings`, `covariates`, `project_status`, `algo_type`, `modified_on`, `created_on`) VALUES (1, 'demo-0001', '{\"study_name\": \"HeartSteps Demo\", \"study_description\": \"Practice with HeartSteps\", \"personalized_scenario\": \"I am using results from an MRT\", \"proximal_outcome_name\": \"(log) Next 30 min step count\", \"personalization_method\": \"ThompsonSampling\", \"intervention_component_name\": \"Activity suggestion\"}', '{\"update_day\": \"Daily\", \"condition_1\": \"Currently walking or running\", \"condition_2\": \"Finished an activity in the prev 90 min\", \"update_hour\": \"12:00am\", \"intervention_option_a\": \"Activity Suggestion\", \"intervention_option_b\": \"Do Nothing: No activity suggestion\", \"decision_point_frequency\": \"5\", \"decision_point_frequency_time\": \"Day\", \"intervention_probability_lower_bound\": \"0.1\", \"intervention_probability_upper_bound\": \"0.8\"}', '{\"intercept_prior_mean\": \"0\", \"max_proximal_outcome\": \"8.0\", \"min_proximal_outcome\": \"-0.69\", \"treatment_prior_mean\": \"0.13\", \"proximal_outcome_name\": \"(log) Next 30 min step count\", \"proximal_outcome_type\": \"Continuous\", \"intervention_component_name\": \"Activity suggestion\", \"intercept_prior_standard_deviation\": \"3.16\", \"treatment_prior_standard_deviation\": \"0.07\"}', '{\"2c201b1d-da6c-40e0-9b61-1da2ba81dfb1\": {\"covariate_name\": \"(log) Prior 30 min step count\", \"covariate_type\": \"Continuous\", \"covariate_max_val\": \"8.0\", \"covariate_min_val\": \"-0.69\", \"tailoring_variable\": \"no\", \"proximal_outcome_name\": \"(log) Next 30 min step count\", \"main_effect_prior_mean\": \"0\", \"intervention_component_name\": \"Activity suggestion\", \"main_effect_prior_standard_deviation\": \"3.16\"}, \"e96b404f-91c1-4f80-9228-96c6b4b2f594\": {\"covariate_name\": \"Location\", \"covariate_type\": \"Binary\", \"covariate_max_val\": \"1\", \"covariate_min_val\": \"0\", \"tailoring_variable\": \"yes\", \"covariate_meaning_0\": \"Home/Work\", \"covariate_meaning_1\": \"Unknown location\", \"proximal_outcome_name\": \"(log) Next 30 min step count\", \"main_effect_prior_mean\": \"0\", \"intervention_component_name\": \"Activity suggestion\", \"interaction_coefficient_prior_mean\": \"0\", \"main_effect_prior_standard_deviation\": \"3.16\", \"interaction_coefficient_prior_standard_deviation\": \"3.16\"}}', 0, 'algorithm_type', '2022-12-12 22:55:40', '2022-12-12 20:27:45'); +INSERT INTO `projects` (`created_by`, `uuid`, `general_settings`, `intervention_settings`, `model_settings`, `covariates`, `project_status`, `algo_type`, `modified_on`, `created_on`) VALUES (1, 'demo-0001', '{\"study_name\": \"HeartSteps Demo\", \"study_description\": \"Practice with HeartSteps\", \"personalized_scenario\": \"I am using results from an MRT\", \"proximal_outcome_name\": \"(log) Next 30 min step count\", \"personalization_method\": \"ThompsonSampling\", \"intervention_component_name\": \"Activity suggestion\"}', '{\"update_day\": \"Daily\", \"condition_1\": \"Currently walking or running\", \"condition_2\": \"Finished an activity in the prev 90 min\", \"update_hour\": \"12:00am\", \"intervention_option_a\": \"Activity Suggestion\", \"intervention_option_b\": \"Do Nothing: No activity suggestion\", \"decision_point_frequency\": \"5\", \"decision_point_frequency_time\": \"Day\", \"intervention_probability_lower_bound\": \"0.1\", \"intervention_probability_upper_bound\": \"0.8\"}', '{\"intercept_prior_mean\": \"0\", \"max_proximal_outcome\": \"8.0\", \"min_proximal_outcome\": \"-0.69\", \"treatment_prior_mean\": \"0.13\", \"proximal_outcome_name\": \"(log) Next 30 min step count\", \"proximal_outcome_type\": \"Continuous\", \"intervention_component_name\": \"Activity suggestion\", \"intercept_prior_standard_deviation\": \"3.16\", \"treatment_prior_standard_deviation\": \"0.07\", \"noise_scale\": \"3.16\", \"noise_degree_of_freedom\": \"5\"}', '{\"2c201b1d-da6c-40e0-9b61-1da2ba81dfb1\": {\"covariate_name\": \"(log) Prior 30 min step count\", \"covariate_type\": \"Continuous\", \"covariate_max_val\": \"8.0\", \"covariate_min_val\": \"-0.69\", \"tailoring_variable\": \"no\", \"proximal_outcome_name\": \"(log) Next 30 min step count\", \"main_effect_prior_mean\": \"0\", \"intervention_component_name\": \"Activity suggestion\", \"main_effect_prior_standard_deviation\": \"3.16\"}, \"e96b404f-91c1-4f80-9228-96c6b4b2f594\": {\"covariate_name\": \"Location\", \"covariate_type\": \"Binary\", \"covariate_max_val\": \"1\", \"covariate_min_val\": \"0\", \"tailoring_variable\": \"yes\", \"covariate_meaning_0\": \"Home/Work\", \"covariate_meaning_1\": \"Unknown location\", \"proximal_outcome_name\": \"(log) Next 30 min step count\", \"main_effect_prior_mean\": \"0\", \"intervention_component_name\": \"Activity suggestion\", \"interaction_coefficient_prior_mean\": \"0\", \"main_effect_prior_standard_deviation\": \"3.16\", \"interaction_coefficient_prior_standard_deviation\": \"3.16\"}}', 0, 'algorithm_type', '2022-12-12 22:55:40', '2022-12-12 20:27:45'); COMMIT; \ No newline at end of file