minor edits

This commit is contained in:
2025-12-10 08:34:57 +01:00
parent ad00860fa1
commit b023d44934

View File

@@ -79,7 +79,8 @@ def _(all_tags_df, mo):
@app.cell
def _(all_tags_df, interview_select):
def _(all_tags_df, interview_select, mo):
mo.stop(not interview_select.value, mo.md("Select interview to continue"))
# filter all_tags_df to only the document = file_dropdown.value
df = all_tags_df.loc[all_tags_df['document'] == interview_select.value].copy()
return (df,)
@@ -164,7 +165,7 @@ def _(mo):
@app.cell
def _(df, pd):
def _(df, mo, pd):
# Expand rows that contain multiple contexts (comma-separated)
expanded_rows = []
@@ -201,28 +202,29 @@ def _(df, pd):
].copy()
manual_rows = sentiment_df[sentiment_df['manual_analysis']]
split_rows_editor = None
if not manual_rows.empty:
print(
f"⚠️ {len(manual_rows)} rows were created from multi-context splits. "
"See next cell for manual review."
)
# Filter for rows that need review. Manual analysis and the tag starts with 'VT -' or 'CT -'
rows_to_edit = sentiment_df[
(sentiment_df['manual_analysis'])
]
# Create data editor for split rows
split_rows_editor = mo.ui.data_editor(
rows_to_edit
).form(label="Update Sentiment / Manual Flag")
else:
print("✓ No multi-context rows found")
return (sentiment_df,)
@app.cell
def _(mo, sentiment_df):
# Filter for rows that need review. Manual analysis and the tag starts with 'VT -' or 'CT -'
rows_to_edit = sentiment_df[
(sentiment_df['manual_analysis'])
]
# Create data editor for split rows
split_rows_editor = mo.ui.data_editor(
rows_to_edit
).form(label="Update Sentiment / Manual Flag")
return rows_to_edit, split_rows_editor
return rows_to_edit, sentiment_df, split_rows_editor
@app.cell(hide_code=True)
@@ -244,7 +246,7 @@ def _(mo, rows_to_edit, split_rows_editor):
@app.cell
def _(mo, split_rows_editor):
# Capture the edited manual-analysis rows for validation
mo.stop(split_rows_editor.value is None, mo.md("Submit your changes."))
mo.stop(split_rows_editor.value is None, mo.md("Submit your sentiment analysis changes before continuing."))
reviewed_manual_rows = split_rows_editor.value
# Ensure all manual-analysis rows include a sentiment of -1, 0, or 1