Skip to content

Commit 22721cf

Browse files
committed
cleaned up the codebase from unnecessary logs and fixed some warnings from bokeh
1 parent c8cd591 commit 22721cf

5 files changed

Lines changed: 8 additions & 28 deletions

File tree

survey_dashboard/analysis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def prepare_data_research_field(
249249

250250
# now fill research area specifics
251251
for area in research_areas:
252-
area_counts = df[df[key2] == area][key]
252+
area_counts = df[df[key2] == area][key].copy()
253253
area_counts.replace(to_replace=True, value=xtick, inplace=True)
254254
area_counts.replace(to_replace=False, value=None, inplace=True)
255255
area_counts = area_counts.value_counts()

survey_dashboard/app.py

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,15 @@
1313
This app.py orchestrates the creation of the dashboard using the new modular structure.
1414
"""
1515

16-
print("Initializing HMC Survey Dashboard...")
17-
1816
# Import core components
1917
from survey_dashboard.core.data import DataProcessor
2018
from survey_dashboard.core.charts import ChartManager
2119

22-
# Import UI components
20+
# Import UI components
2321
from survey_dashboard.ui.widgets import WidgetFactory
2422
from survey_dashboard.ui.layout import LayoutManager
2523
from survey_dashboard.ui.callbacks import CallbackManager
2624

27-
print("Loading configuration and data...")
28-
2925
# Initialize core components
3026
data_processor = DataProcessor()
3127
chart_manager = ChartManager(data_processor)
@@ -35,8 +31,6 @@
3531
layout_manager = LayoutManager()
3632
callback_manager = CallbackManager(data_processor, chart_manager, widget_factory)
3733

38-
print("Creating widgets...")
39-
4034
# Create all widgets
4135
widgets = widget_factory.create_all_widgets()
4236
control_groups = widget_factory.get_control_groups(widgets)
@@ -45,8 +39,6 @@
4539
data_filters = widgets["global_filters"]["research_area"].value
4640
data_filters_method = widgets["global_filters"]["method"].value
4741

48-
print("Creating visualizations...")
49-
5042
# Create all visualizations using chart manager
5143
overview_charts = chart_manager.create_overview_charts(data_filters, data_filters_method)
5244
exploration_charts = chart_manager.create_exploration_charts(
@@ -63,8 +55,6 @@
6355
)
6456
methods_tools_tabs, wordcloud_panes = chart_manager.create_wordcloud_tabs(data_filters, data_filters_method)
6557

66-
print("Setting up callbacks...")
67-
6858
# Create update callbacks
6959
callbacks = callback_manager.create_update_callbacks(widgets)
7060

@@ -134,8 +124,6 @@ def bind_callbacks():
134124
"value"
135125
)
136126

137-
print("Creating layout...")
138-
139127
# Create complete layout
140128
layout = layout_manager.create_complete_layout(
141129
control_groups=control_groups,
@@ -149,13 +137,7 @@ def bind_callbacks():
149137
correlation_row = layout_manager.get_correlation_row()
150138
callback_manager.set_correlation_row(correlation_row)
151139

152-
print("Setting up template...")
153-
154140
# Setup template and make servable
155141
template = layout_manager.setup_template_variables(layout)
156142
bind_callbacks()
157-
158-
print("Dashboard ready! Making servable...")
159-
template = layout_manager.make_servable()
160-
161-
print("HMC Survey Dashboard initialized successfully!")
143+
template = layout_manager.make_servable()

survey_dashboard/core/data.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ def map_question_to_qkey(self, question: str, lang: str = LANGUAGE) -> list:
8585
clean_question = question.replace("★ ", "")
8686
key = HCS_QUESTIONS_REVERT[lang][clean_question]
8787
if key in HCS_MCList:
88-
print(f"Multiple Choice,{key}")
8988
# for multiple choice this is a list of subquestions
9089
key_s = key + "/"
9190
for key in HCS_colnamesDict.keys():

survey_dashboard/plots.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,18 @@ def rek_set_attr(obj: object, key: str, val:object) -> None:
184184
"""
185185
Recursively assigns to a given object and a key in dot notation a given value of any form
186186
187-
Example:
187+
Example:
188188
1.
189189
rek_set_attr(figure, title, 'my-title')
190190
figure.title= 'my-title'
191191
2.
192192
rek_set_attr(figure, axis.xaxis.label.size, 10)
193193
figure.axis.xaxis.label.size = 10
194194
"""
195+
# Skip legend properties if the plot has no legend
196+
if key.startswith('legend.') and hasattr(obj, 'legend') and not obj.legend:
197+
return
198+
195199
if not '.' in key:
196200
return setattr(obj, key, val)
197201
else:

survey_dashboard/ui/callbacks.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,10 @@ def _check_both_questions_compatible(self, question1_text, question2_text):
7373

7474
# Check if both are in the allowed list
7575
both_compatible = (key1 in corr_chart_allowed and key2 in corr_chart_allowed)
76-
77-
# Log validation result for debugging
78-
print(f"Correlation compatibility check: '{key1}' + '{key2}' = {both_compatible}")
79-
8076
return both_compatible
8177

8278
except Exception as e:
8379
# If we can't determine, hide correlation (safe default)
84-
print(f"Error checking correlation compatibility: {e}")
8580
return False
8681

8782
def update_chart(self, target, event, question_sel, f_choice, m_choice, q_filter, charttype):

0 commit comments

Comments
 (0)