added data selector ui element

This commit is contained in:
2026-01-29 12:16:09 +01:00
parent 36d8bc4d88
commit 70719702ec
2 changed files with 83 additions and 73 deletions

View File

@@ -29,22 +29,45 @@ def _():
@app.cell @app.cell
def _(): def _(mo):
RESULTS_FILE = 'data/exports/OneDrive_2026-01-21/Soft Launch Data/JPMC_Chase Brand Personality_Quant Round 1_January 21, 2026_Soft Launch_Labels.csv' file_browser = mo.ui.file_browser(
initial_path="./data/exports", multiple=False, restrict_navigation=True, filetypes=[".csv"], label="Select 'Labels' File"
)
file_browser
return (file_browser,)
@app.cell
def _(Path, file_browser, mo):
mo.stop(file_browser.path(index=0) is None, mo.md("**⚠️ Please select a `_Labels.csv` file above to proceed**"))
# RESULTS_FILE = 'data/exports/OneDrive_2026-01-21/Soft Launch Data/JPMC_Chase Brand Personality_Quant Round 1_January 21, 2026_Soft Launch_Labels.csv'
RESULTS_FILE = Path(file_browser.path(index=0))
QSF_FILE = 'data/exports/OneDrive_2026-01-21/Soft Launch Data/JPMC_Chase_Brand_Personality_Quant_Round_1.qsf' QSF_FILE = 'data/exports/OneDrive_2026-01-21/Soft Launch Data/JPMC_Chase_Brand_Personality_Quant_Round_1.qsf'
# RESULTS_FILE
return QSF_FILE, RESULTS_FILE return QSF_FILE, RESULTS_FILE
@app.cell @app.cell
def _(JPMCSurvey, QSF_FILE, RESULTS_FILE): def _(RESULTS_FILE, mo):
mo.stop(not RESULTS_FILE.name.lower().endswith('labels.csv'), mo.md("**⚠️ Make sure you select a `_Labels.csv` file above**"))
return
@app.cell
def _(JPMCSurvey, QSF_FILE, RESULTS_FILE, mo):
S = JPMCSurvey(RESULTS_FILE, QSF_FILE) S = JPMCSurvey(RESULTS_FILE, QSF_FILE)
data_all = S.load_data() try:
data_all = S.load_data()
except NotImplementedError as e:
mo.stop(True, mo.md(f"**⚠️ {str(e)}**"))
return S, data_all return S, data_all
@app.cell(hide_code=True) @app.cell(hide_code=True)
def _(Path, RESULTS_FILE, data_all, mo): def _(Path, RESULTS_FILE, data_all, mo):
mo.md(f""" mo.md(f"""
---
# Load Data # Load Data
**Dataset:** `{Path(RESULTS_FILE).name}` **Dataset:** `{Path(RESULTS_FILE).name}`
@@ -71,19 +94,7 @@ def _(check_progress, data_all, duration_validation, mo):
@app.cell(hide_code=True) @app.cell(hide_code=True)
def _(mo): def _(mo):
mo.md(r""" mo.md(r"""
### ToDo: "straight-liner" detection and removal ### ⚠️ ToDo: "straight-liner" detection and removal
""")
return
@app.cell(hide_code=True)
def _(mo):
mo.md(r"""
---
# Data Filter
Use to select a subset of the data for the following analysis
""") """)
return return
@@ -91,7 +102,8 @@ def _(mo):
@app.cell(hide_code=True) @app.cell(hide_code=True)
def _(S, mo): def _(S, mo):
filter_form = mo.md(''' filter_form = mo.md('''
# Data Filter
{age} {age}
@@ -110,7 +122,15 @@ def _(S, mo):
income=mo.ui.multiselect(options=S.options_income, value=S.options_income, label="Select Income Group(s):"), income=mo.ui.multiselect(options=S.options_income, value=S.options_income, label="Select Income Group(s):"),
consumer=mo.ui.multiselect(options=S.options_consumer, value=S.options_consumer, label="Select Consumer Groups:") consumer=mo.ui.multiselect(options=S.options_consumer, value=S.options_consumer, label="Select Consumer Groups:")
).form() ).form()
filter_form mo.md(f'''
---
# Data Filter
{filter_form}
''')
return (filter_form,) return (filter_form,)
@@ -128,26 +148,15 @@ def _(S, data_all, filter_form, mo):
@app.cell(hide_code=True) @app.cell(hide_code=True)
def _(mo): def _(S, data, mo):
char_rank = S.get_character_ranking(data)[0]
mo.md(r""" mo.md(r"""
--- ---
# Analysis # Analysis
""")
return
@app.cell(hide_code=True)
def _(mo):
mo.md(r"""
## Character personality ranking ## Character personality ranking
""") """)
return
@app.cell
def _(S, data):
char_rank = S.get_character_ranking(data)[0]
return (char_rank,) return (char_rank,)
@@ -187,17 +196,12 @@ def _(S, calculate_weighted_ranking_scores, char_rank, mo):
@app.cell(hide_code=True) @app.cell(hide_code=True)
def _(mo): def _(S, data, mo):
v_18_8_3 = S.get_18_8_3(data)[0].collect()
mo.md(r""" mo.md(r"""
## Voice Ranking ## Voice Ranking
""") """)
return
@app.cell
def _(S, data):
v_18_8_3 = S.get_18_8_3(data)[0].collect()
# print(v_18_8_3.head())
return (v_18_8_3,) return (v_18_8_3,)
@@ -266,18 +270,8 @@ def _(S, mo, top3_voices):
return return
@app.cell(hide_code=True)
def _(mo):
mo.md(r"""
## Voice Speaking Style - Perception Traits
Here you can find the speaking styles and traits: [Speaking Style Traits Quantitative test design.docx](https://voicebranding-my.sharepoint.com/:w:/g/personal/phoebe_voicebranding_ai/IQBfM_Z8PF98Qalz4lzIbJ3RAUCdc7waB32HZXCj7k3xfo0?e=rtFd27)
""")
return
@app.cell @app.cell
def _(S, data, utils): def _(S, data, mo, utils):
ss_or, choice_map_or = S.get_ss_orange_red(data) ss_or, choice_map_or = S.get_ss_orange_red(data)
ss_gb, choice_map_gb = S.get_ss_green_blue(data) ss_gb, choice_map_gb = S.get_ss_green_blue(data)
@@ -289,6 +283,12 @@ def _(S, data, utils):
# print(_d.head()) # print(_d.head())
# print(choice_map) # print(choice_map)
ss_long = utils.process_speaking_style_data(ss_all, choice_map) ss_long = utils.process_speaking_style_data(ss_all, choice_map)
mo.md(r"""
## Voice Speaking Style - Perception Traits
Here you can find the speaking styles and traits: [Speaking Style Traits Quantitative test design.docx](https://voicebranding-my.sharepoint.com/:w:/g/personal/phoebe_voicebranding_ai/IQBfM_Z8PF98Qalz4lzIbJ3RAUCdc7waB32HZXCj7k3xfo0?e=rtFd27)
""")
return choice_map, ss_all, ss_long return choice_map, ss_all, ss_long
@@ -310,17 +310,17 @@ def _(S, mo, pl, ss_long):
@app.cell(hide_code=True) @app.cell(hide_code=True)
def _(mo): def _():
mo.md(r"""
## Voice Scale 1-10
""")
return return
@app.cell @app.cell
def _(S, data): def _(S, data, mo):
vscales = S.get_voice_scale_1_10(data)[0] vscales = S.get_voice_scale_1_10(data)[0]
# plot_average_scores_with_counts(vscales, x_label='Voice', width=1000) # plot_average_scores_with_counts(vscales, x_label='Voice', width=1000)
mo.md(r"""
## Voice Scale 1-10
""")
return (vscales,) return (vscales,)
@@ -334,10 +334,15 @@ def _(S, mo, vscales):
return return
@app.cell(hide_code=True)
def _():
return
@app.cell(hide_code=True) @app.cell(hide_code=True)
def _(mo): def _(mo):
mo.md(r""" mo.md(r"""
## Correlations Voice Speaking Styles <-> Voice Scale 1-10
""") """)
return return
@@ -345,19 +350,29 @@ def _(mo):
@app.cell(hide_code=True) @app.cell(hide_code=True)
def _(mo): def _(mo):
mo.md(r""" mo.md(r"""
""")
return
@app.cell
def _(choice_map, mo, ss_all, utils, vscales):
df_style = utils.process_speaking_style_data(ss_all, choice_map)
df_voice_long = utils.process_voice_scale_data(vscales)
joined_df = df_style.join(df_voice_long, on=["_recordId", "Voice"], how="inner")
# df_voice_long
mo.md(r"""
## Correlations Voice Speaking Styles <-> Voice Scale 1-10
Lets show how scoring better on these speaking styles correlates (or not) with better Voice Scale 1-10 evaluation. For each speaking style we show how the traits in these speaking styles correlate with Voice Scale 1-10 evaluation. This gives us a total of 4 correlation diagrams. Lets show how scoring better on these speaking styles correlates (or not) with better Voice Scale 1-10 evaluation. For each speaking style we show how the traits in these speaking styles correlate with Voice Scale 1-10 evaluation. This gives us a total of 4 correlation diagrams.
Example for speaking style green: Example for speaking style green:
- Trait 1: Friendly | Conversational | Down-to-earth - Trait 1: Friendly | Conversational | Down-to-earth
- Trait 2: Approachable | Familiar | Warm - Trait 2: Approachable | Familiar | Warm
- Trait 3: Optimistic | Benevolent | Positive | Appreciative - Trait 3: Optimistic | Benevolent | Positive | Appreciative
""")
return
@app.cell(hide_code=True)
def _(mo):
mo.md(r"""
### How to Interpret These Correlation Results ### How to Interpret These Correlation Results
Each bar represents the Pearson correlation coefficient (r) between a speaking style trait rating (1-5 scale) and the overall Voice Scale rating (1-10). Each bar represents the Pearson correlation coefficient (r) between a speaking style trait rating (1-5 scale) and the overall Voice Scale rating (1-10).
@@ -369,16 +384,6 @@ def _(mo):
| r < 0 (Red bars)| Negative correlation — voices rated higher on this trait tend to receive lower Voice Scale scores| | r < 0 (Red bars)| Negative correlation — voices rated higher on this trait tend to receive lower Voice Scale scores|
| r ≈ 0| No relationship — this trait doesn't predict Voice Scale ratings| | r ≈ 0| No relationship — this trait doesn't predict Voice Scale ratings|
""") """)
return
@app.cell
def _(choice_map, ss_all, utils, vscales):
df_style = utils.process_speaking_style_data(ss_all, choice_map)
df_voice_long = utils.process_voice_scale_data(vscales)
joined_df = df_style.join(df_voice_long, on=["_recordId", "Voice"], how="inner")
# df_voice_long
return df_style, joined_df return df_style, joined_df

View File

@@ -0,0 +1,5 @@
Running on Ct-105 for shared access:
```
uv run marimo edit --headless --port 8080 --host ct-105.tail44fa00.ts.net
```