feat: add live surviving rows preview in match group editor

Shows a read-only preview of the output rows below the editor,
updating as checkboxes and column dropdowns are changed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-29 00:17:34 +00:00
parent e672488d50
commit f97b633d4c

View File

@@ -422,10 +422,11 @@ def match_group_card(
f"{', '.join(differing_cols)}"
)
# Status
# Status + surviving rows preview
if len(checked) == 0:
st.warning("Select at least one row to keep.")
elif len(checked) == n_rows:
else:
if len(checked) == n_rows:
st.caption("Keeping all rows (no duplicates removed)")
elif len(checked) == 1:
st.caption(
@@ -438,6 +439,17 @@ def match_group_card(
f"removing {n_rows - len(checked)}"
)
# Build preview of surviving rows with edits applied
checked_positions = [
i for i, idx in enumerate(group.row_indices)
if idx in checked
]
preview = edited.iloc[checked_positions].drop(
columns=["Keep"],
).reset_index(drop=True)
st.markdown("**Surviving rows preview:**")
st.dataframe(preview, use_container_width=True, hide_index=True)
# Confirm
def _on_confirm(
g=gid, indices=list(group.row_indices),