Skip to content

Reduce redundancy in rulemaking single page document listings#7057

Open
johnnyporkchops wants to merge 3 commits intodevelopfrom
feature/7041-handle-label-description-redundancy
Open

Reduce redundancy in rulemaking single page document listings#7057
johnnyporkchops wants to merge 3 commits intodevelopfrom
feature/7041-handle-label-description-redundancy

Conversation

@johnnyporkchops
Copy link
Copy Markdown
Contributor

@johnnyporkchops johnnyporkchops commented Mar 25, 2026

Summary (required)

  • Resolves Remove duplicate document descriptions in rulemaking template #7041

  • compare library filter : Compares two strings to determine if they are nearly identical or semantically similar using Python's built in difflib.SequenceMatcher:

    • This seems to work well for our document descriptions/labels with a similarity_ratio of threshold of .5. Meaning if the description and the label are >= 50% similar, we don't show it.
  • compare_commenter filter : compare the commenter name to doc_description  when one is  "lastname, firstname" and the other is  "firstname lastname."

  • Avoid repeating commenter.name | commenter.role in the entity listing for single commenter comments where it is already shown as the pdf link text above.

Required reviewers

one or two devs

Impacted areas of the application

Rulemaking single pages
new filters in filters.py

Screenshots

BEFORE:

2022-06-BEFORE
### AFTER: 2022-06-AFTER

Related PRs

#7054

How to test

  • Test pages confirm document description, labels and commenter names are not repeated verbatim or redundantly
  • On dev.fec.gov, you can see the item removed by filters in red and items retained by filter in green
  • Examples 2022-06, 2024-01, 2023-02

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 26, 2026

Codecov Report

❌ Patch coverage is 35.71429% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.82%. Comparing base (0b0d40e) to head (57fa8dd).

Files with missing lines Patch % Lines
fec/data/templatetags/filters.py 35.71% 9 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7057      +/-   ##
===========================================
- Coverage    78.91%   78.82%   -0.10%     
===========================================
  Files          255      255              
  Lines         6565     6579      +14     
===========================================
+ Hits          5181     5186       +5     
- Misses        1384     1393       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@patphongs patphongs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johnnyporkchops This looks good, I couldn't find any instances that this did not cover or was incorrect

@johnnyporkchops johnnyporkchops changed the title Don't show doc descriptions that are redundant with doc label Reduce redundancy in rulemaking single page document listings Mar 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Remove duplicate document descriptions in rulemaking template

2 participants