import marimo __generated_with = "0.19.2" app = marimo.App(width="medium") with app.setup: import marimo as mo import polars as pl from pathlib import Path from validation import check_progress, duration_validation, check_straight_liners from utils import JPMCSurvey, combine_exclusive_columns, calculate_weighted_ranking_scores import utils from speaking_styles import SPEAKING_STYLES @app.cell def _(): 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 _(file_browser): mo.stop(file_browser.path(index=0) is None, mo.md("**⚠️ Please select a `_Labels.csv` file above to proceed**")) 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' return QSF_FILE, RESULTS_FILE @app.cell def _(QSF_FILE, RESULTS_FILE): S = JPMCSurvey(RESULTS_FILE, QSF_FILE) try: data_all = S.load_data() except NotImplementedError as e: mo.stop(True, mo.md(f"**⚠️ {str(e)}**")) return S, data_all @app.cell(hide_code=True) def _(): mo.md(r""" --- # Load Data **Dataset:** `{Path(RESULTS_FILE).name}` **Responses**: `{data_all.collect().shape[0]}` """) return @app.cell def _(S, data_all): sl_ss_max_score = 5 sl_v1_10_max_score = 10 _ss_all = S.get_ss_green_blue(data_all)[0].join(S.get_ss_orange_red(data_all)[0], on='_recordId') _sl_ss_c, sl_ss_df = check_straight_liners(_ss_all, max_score=sl_ss_max_score) _sl_v1_10_c, sl_v1_10_df = check_straight_liners( S.get_voice_scale_1_10(data_all)[0], max_score=sl_v1_10_max_score ) mo.md(f""" # Data Validation {check_progress(data_all)} {duration_validation(data_all)} ## Speaking Style - Straight Liners {_sl_ss_c} ## Voice Score Scale 1-10 - Straight Liners {_sl_v1_10_c} """) return @app.cell def _(data_all): # # Drop any Voice Scale 1-10 responses with straight-lining, using sl_v1_10_df _responseId values # records_to_drop = sl_v1_10_df.select('Record ID').to_series().to_list() # data_validated = data_all.filter(~pl.col('_recordId').is_in(records_to_drop)) # mo.md(f""" # Dropped `{len(records_to_drop)}` responses with straight-lining in Voice Scale 1-10 evaluation. # """) data_validated = data_all return (data_validated,) @app.cell(hide_code=True) def _(): return @app.cell def _(data_validated): data = data_validated data.collect() return @app.cell(hide_code=True) def _(): mo.md(r""" --- # Introduction (Respondent Demographics) """) return @app.cell(hide_code=True) def _(): mo.md(r""" --- # Brand Character Results """) return @app.cell(hide_code=True) def _(): mo.md(r""" --- # Spoken Voice Results """) return if __name__ == "__main__": app.run()