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:
@@ -422,21 +422,33 @@ def match_group_card(
|
|||||||
f"{', '.join(differing_cols)}"
|
f"{', '.join(differing_cols)}"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Status
|
# Status + surviving rows preview
|
||||||
if len(checked) == 0:
|
if len(checked) == 0:
|
||||||
st.warning("Select at least one row to keep.")
|
st.warning("Select at least one row to keep.")
|
||||||
elif len(checked) == n_rows:
|
|
||||||
st.caption("Keeping all rows (no duplicates removed)")
|
|
||||||
elif len(checked) == 1:
|
|
||||||
st.caption(
|
|
||||||
f"Merging into Row {checked[0] + 1}, "
|
|
||||||
f"removing {n_rows - 1} row(s)"
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
st.caption(
|
if len(checked) == n_rows:
|
||||||
f"Keeping {len(checked)} rows, "
|
st.caption("Keeping all rows (no duplicates removed)")
|
||||||
f"removing {n_rows - len(checked)}"
|
elif len(checked) == 1:
|
||||||
)
|
st.caption(
|
||||||
|
f"Merging into Row {checked[0] + 1}, "
|
||||||
|
f"removing {n_rows - 1} row(s)"
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
st.caption(
|
||||||
|
f"Keeping {len(checked)} rows, "
|
||||||
|
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
|
# Confirm
|
||||||
def _on_confirm(
|
def _on_confirm(
|
||||||
|
|||||||
Reference in New Issue
Block a user