From 38f6d8a87c20031f76952ac7f90206edb940a297 Mon Sep 17 00:00:00 2001 From: Luigi Maiorano Date: Tue, 3 Feb 2026 02:19:47 +0100 Subject: [PATCH] fixed for basic plots, filter active --- 03_quant_report.py | 22 +++++++++++----------- 04_PPTX_Update_Images.py | 20 ++++++++++++-------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/03_quant_report.py b/03_quant_report.py index 62067c2..b8f642c 100644 --- a/03_quant_report.py +++ b/03_quant_report.py @@ -127,7 +127,7 @@ def _(): @app.cell def _(S, data_validated): demographics = S.get_demographics(data_validated)[0].collect() - demographics + # demographics return (demographics,) @@ -135,7 +135,7 @@ def _(S, data_validated): def _(demographics): # Demographics where 'Consumer' is null demographics_no_consumer = demographics.filter(pl.col('Consumer').is_null())['_recordId'].to_list() - demographics_no_consumer + # demographics_no_consumer return (demographics_no_consumer,) @@ -184,7 +184,7 @@ def _(S): {filter_form} ''') - return + return (filter_form,) @app.cell @@ -194,15 +194,15 @@ def _(): @app.cell -def _(data_validated): - # mo.stop(filter_form.value is None, mo.md("**Please submit filter above to proceed**")) - # _d = S.filter_data(data_validated, age=filter_form.value['age'], gender=filter_form.value['gender'], income=filter_form.value['income'], ethnicity=filter_form.value['ethnicity'], consumer=filter_form.value['consumer']) +def _(S, data_validated, filter_form): + mo.stop(filter_form.value is None, mo.md("**Please submit filter above to proceed**")) + _d = S.filter_data(data_validated, age=filter_form.value['age'], gender=filter_form.value['gender'], income=filter_form.value['income'], ethnicity=filter_form.value['ethnicity'], consumer=filter_form.value['consumer']) - # # Stop execution and prevent other cells from running if no data is selected - # mo.stop(len(_d.collect()) == 0, mo.md("**No Data available for current filter combination**")) - # data = _d + # Stop execution and prevent other cells from running if no data is selected + mo.stop(len(_d.collect()) == 0, mo.md("**No Data available for current filter combination**")) + data = _d - data = data_validated + # data = data_validated data.collect() return (data,) @@ -769,7 +769,7 @@ def _(S, joined_scale): data=joined_scale, style_color=_style, style_traits=_traits, - title=f"Correlation: Speaking Style {_style} and Voice Ranking Points", + title=f"Correlation: Speaking Style {_style} and Voice Scale 1-10", ) _content += f""" #### Speaking Style **{_style}**: diff --git a/04_PPTX_Update_Images.py b/04_PPTX_Update_Images.py index bdbde06..6825954 100644 --- a/04_PPTX_Update_Images.py +++ b/04_PPTX_Update_Images.py @@ -24,12 +24,16 @@ def _(): TAG_SOURCE = Path('data/reports/Perception-Research-Report_2-2.pptx') TAG_TARGET = Path('data/reports/Perception-Research-Report_2-2_tagged.pptx') TAG_IMAGE_DIR = Path('figures/2-2-26') - return TAG_IMAGE_DIR, TAG_SOURCE, TAG_TARGET + return TAG_IMAGE_DIR, TAG_SOURCE @app.cell -def _(TAG_IMAGE_DIR, TAG_SOURCE, TAG_TARGET): - utils.update_ppt_alt_text(ppt_path=TAG_SOURCE, image_source_dir=TAG_IMAGE_DIR, output_path=TAG_TARGET) +def _(TAG_IMAGE_DIR, TAG_SOURCE): + utils.update_ppt_alt_text( + ppt_path=TAG_SOURCE, + image_source_dir=TAG_IMAGE_DIR, + # output_path=TAG_TARGET + ) return @@ -43,20 +47,20 @@ def _(): @app.cell def _(): - REPLACE_SOURCE = Path('data/reports/Perception-Research-Report_2-2_tagged.pptx') - REPLACE_TARGET = Path('data/reports/Perception-Research-Report_2-2.pptx') + REPLACE_SOURCE = Path('data/reports/Perception-Research-Report_2-2.pptx') + REPLACE_TARGET = Path('data/reports/Perception-Research-Report_2-2_updated.pptx') NEW_IMAGES_DIR = Path('figures/2-2-26') - return NEW_IMAGES_DIR, REPLACE_SOURCE, REPLACE_TARGET + return NEW_IMAGES_DIR, REPLACE_SOURCE @app.cell -def _(NEW_IMAGES_DIR, REPLACE_SOURCE, REPLACE_TARGET): +def _(NEW_IMAGES_DIR, REPLACE_SOURCE): # get all files in the image source directory and subdirectories results = utils.pptx_replace_images_from_directory( REPLACE_SOURCE, # Source presentation path, NEW_IMAGES_DIR, # Source directory with new images - REPLACE_TARGET # Output path (optional, defaults to overwrite) + # REPLACE_TARGET # Output path (optional, defaults to overwrite) ) return