fixed for basic plots, filter active

This commit is contained in:
2026-02-03 02:19:47 +01:00
parent 5c39bbb23a
commit 38f6d8a87c
2 changed files with 23 additions and 19 deletions

View File

@@ -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}**:

View File

@@ -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