Explain automatically detected filing values - #216
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Court prioritization currently conflates extraction guesses with location matching, which can incorrectly apply “(Recommended)” labeling to extraction-derived suggestions instead of the intended * marker.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the e-filing workflow UI to represent automatically detected (document-extracted) values with a compact * marker and provides an accessible, reusable help affordance (icon + modal) explaining what the marker means and that extraction can be wrong.
Changes:
- Replace extraction “(Recommended)” labeling with
*markers in dropdown prioritization and downstream saved display strings. - Add a shared help button and Bootstrap modal explaining the extraction marker, and surface it across relevant workflow pages.
- Mark extracted values on the final review page (case fields, parties, documents) and add test coverage for the new marker behavior.
File summaries
| File | Description |
|---|---|
| efile_app/efile/views/review.py | Computes extracted_markers to flag extracted values for the final review page. |
| efile_app/efile/views/case_lookup.py | Adjusts guessed court source to use extraction guesses only. |
| efile_app/efile/api/dropdown_views.py | Switches extraction matches to * marker; refines court prioritization logic for extraction vs location. |
| efile_app/efile/tests/test_review_submit_flow.py | Adds an integration-style assertion that extracted markers and modal copy appear on final review. |
| efile_app/efile/tests/test_filing_types_amount_in_controversy.py | Adds a unit test verifying dropdown option text uses * instead of “Recommended”. |
| efile_app/efile/templates/efile/workflow_base.html | Includes the extraction marker modal globally in the workflow layout. |
| efile_app/efile/templates/efile/review.html | Displays * markers next to extracted case/doc/party values and shows page-level help when relevant. |
| efile_app/efile/templates/efile/organize_documents.html | Shows extraction marker help when a guessed filing type is present. |
| efile_app/efile/templates/efile/extraction_review.html | Adds extraction marker help icon in the extracted document section header. |
| efile_app/efile/templates/efile/components/extraction_marker_modal.html | New reusable modal explaining the asterisk marker. |
| efile_app/efile/templates/efile/components/extraction_marker_help.html | New reusable help-icon button that opens the modal. |
| efile_app/efile/templates/efile/case_lookup.html | Adds page-level help text/icon when an extracted court suggestion exists. |
| efile_app/efile/static/js/organize-documents.js | Normalizes saved option text by stripping “(Recommended)” and * suffixes. |
| efile_app/efile/static/js/extraction-review.js | Normalizes saved/displayed option text while still rendering the * marker when applicable. |
| efile_app/efile/static/js/case-lookup.js | Normalizes saved court name to avoid persisting UI markers into stored text. |
| efile_app/efile/static/css/reorganized-flow.css | Styles the page help row, help icon button, and extraction section header layout. |
Review details
- Files reviewed: 16/16 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟡 Changes recommended
There are a couple of user-facing/behavioral issues identified in the changed hunks (including a misleading help message condition and a small inefficiency in the review view) that should be addressed before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
efile_app/efile/views/review.py:70
all_parties = list(parties)forces an immediate queryset evaluation but the list is only used once to buildparty_ids. You can iterate the existingpartiesqueryset directly here and drop the extra list allocation.
- Files reviewed: 18/18 changed files
- Comments generated: 1
- Review effort level: Lite
The court guess extracted from a document was compared to court codes with
an unanchored substring test, so a short county name inside a longer one
won: a document reading "McHenry County" put Henry County at the top of the
list and pre-selected it, with an asterisk claiming the document said so.
Williamson matched Will, Whiteside matched White, Crawford matched Ford.
Compare runs of whole words instead. Court codes drop the spaces inside a
county name ("stclair", "rockisland"), so a run of words is the smallest
unit worth comparing, and it also lets a real caption match: "Circuit Court
of Cook County, Illinois" now finds the Cook courts, where before it found
none and the case lookup page still promised an asterisk that was not there.
Where the guess names only the county, every division of that county
matches and none of them is what the document said, so leave them at the
top of the list unselected rather than filing the case in whichever one
sorts first. A guess that names the division still selects it.
Drop the Levenshtein fallback for the other dropdowns. At a threshold loose
enough to forgive a typo it also pairs unrelated options - "Motion" and
"Notice" are three edits apart - and the new marker turns that into a claim
about the filer's document. Substring matching still covers the near
misses that mattered ("Eviction" finds "Evictions").
Also:
- Reveal the case lookup asterisk help only once a court in the list
carries the marker.
- Require an exact match before marking a docket number as extracted: a
filer correcting 2026-CV-1234 to 2026-CV-123 has not left our guess in
place.
- Reword the modal now that several options can carry the marker.
- Fetch the review page's parties once instead of three times.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JCsBkAUTE8jxP4BrbPexAm
There was a problem hiding this comment.
🔵 Needs a closer look
The final-review document marker logic can incorrectly mark supporting documents as “detected from your document” even though extraction data is only sourced from the current lead document.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
efile_app/efile/views/review.py:83
draft.extracted_guessesis only sourced from the current lead document’s extraction, but this logic marks every document whosefiling_type_namematches the extracted filing type. If multiple documents share the same filing type, the review page will show*on supporting documents even though they were not the basis for the extraction, which can mislead filers.
- Files reviewed: 19/19 changed files
- Comments generated: 0 new
- Review effort level: Lite
Summary
Recommendedlabels with*markers in cascading choices.Matching accuracy (added after review)
Marking a value as "detected from your document" is a claim, so this PR also tightens the matching that decides which option gets the marker. This slightly broadens the original scope, but the old heuristics would have made the new marker say things that were not true.
in, so a short county name inside a longer one won: a document reading "McHenry County" put Henry County at the top of the list and pre-selected it. Williamson matched Will, Whiteside matched White, Crawford matched Ford. Court codes drop the spaces inside a county name (stclair,rockisland), so the comparison is now against runs of whole words. That also lets a real caption match — "Circuit Court of Cook County, Illinois" now finds the Cook courts, where before it matched none.efile/utils/str_dist.pyhad no other callers and is removed.2026-CV-1234to2026-CV-123has not left our guess in place, and the substring rule was still calling it automatically detected.Validation
uv run pytest -q— 664 passed.npm run test:unit— 43 passed.Screenshots
Screenshots are stored outside the repository in this public gist:
https://gist.github.com/nonprofittechy/68589d297e9072f1b27a9205b417de8d
🤖 Generated with Claude Code
https://claude.ai/code/session_01JCsBkAUTE8jxP4BrbPexAm