chore: clarify duplicates filter settings copy - #273
Open
iabaako wants to merge 1 commit into
Open
Conversation
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors and rewrites the duplicates report Settings UI to better communicate what the “record filter” does, and to separate the missing-values toggle into its own section.
Changes:
- Split the settings UI into two bordered sections: Missing Values and Records to Include.
- Extracted the missing-values toggle into a new
_render_missing_as_duplicates_toggle()helper and threaded its value into the filter UI. - Updated button labels, captions, and widget help text to make the record-filter behavior clearer.
Suppressed comments (2)
src/datasure/checks/duplicates.py:747
- The toggle help text currently describes “missing values matched as a duplicate pair”, but this setting is only used when building the filter expression (
col_expr.is_null() | filter_expr). Update the help copy (and optionally the docstring) to reflect that it includes rows where the condition column is null when applying the filter.
missing_as_duplicates = st.toggle(
label="Consider missing values as duplicates",
value=default_missing_as_duplicates,
key="duplicates_missing_as_duplicates_key",
help=(
"If enabled, two records with a missing value in the same column "
"count as a duplicate pair. If disabled, missing values are never "
"matched as duplicates."
),
src/datasure/checks/duplicates.py:808
- The new UI copy/caption suggests “no filter applied” is possible, but
Condition Columnis ast.selectbox(options=data.columns)with no blank/None option, socondition_colis always truthy and theif not condition_col:caption + thereturn ... else {}branch are effectively unreachable. Add an explicit “no filter” option (e.g., empty string) so the default can truly be “all records” as described.
co1, co2, co3 = st.columns([0.3, 0.3, 0.4])
all_columns = data.columns
with co1:
condition_col = st.selectbox(
label="Condition Column",
options=all_columns,
key="duplicates_condition_col_key",
help=(
"Column used to decide which records are included, e.g. a "
"consent or interview-status column."
),
on_change=trigger_save,
kwargs={"state_name": TAB_NAME + "_condition_col"},
)
save_check_settings(settings_file, TAB_NAME, {"condition_col": condition_col})
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+214
to
+218
| st.subheader("Missing Values") | ||
| st.caption( | ||
| "Controls how duplicates are matched, not which records are checked." | ||
| ) | ||
| missing_as_duplicates = _render_missing_as_duplicates_toggle(settings_file) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Pull Request Summary 🚀
What does this PR do? 📝
Rewords and restructures the "Records to Include" settings section on the duplicates report page. Separates the "missing values as duplicates" toggle into its own "Missing Values" box, distinct from the record-filter controls, and clarifies the help text/captions for both.
Why is this change needed? 🤔
Users didn't understand what the filter section on the duplicates settings page does — specifically, that it scopes which records are checked for duplicates (e.g. only households with complete interviews or valid consent), as opposed to defining what counts as a duplicate. Grouping the missing-value toggle in the same box as the filter compounded the confusion, since that toggle affects duplicate matching logic, not record inclusion.
How was this implemented? 🛠️
_render_missing_as_duplicates_togglehelper, displayed in a separate bordered container titled "Missing Values" with a caption clarifying it affects matching, not scope.How to test or reproduce ? 🧪
Screenshots (if applicable) 📷
Not included — text/UI copy change, see reproduction steps above.
Checklist ✅