Prepare filing PDFs, analyze originals, and require previews - #272
Merged
Merged
Conversation
nonprofittechy
force-pushed
the
feature/document-preparation-preview
branch
from
September 30, 2026 20:44
51a93d5 to
50a7cc8
Compare
…dant code Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Uploading an interactive PDF or Word document now produces a filing PDF before case review. Filers see the actual PDF.js preview, can download the preserved original, and are asked to check each filing PDF before pressing Continue. PDF preview has no confirmation checkboxes. Additional previews are available on Upload, Confirm filing, Check documents, Organize documents, Fees and interview handoff screens.
Closes #113.
Preparation behavior
pypdfdependency before flattening; preserve usable existing appearances.docx2python; binary DOC uses the converted PDF. Preserve recovery and review metadata through legacy document rebuilds and clean up both copies when appropriate.npm ciand in the Docker build.Regression hardening
Preview interaction and copy
Original document analysis
docx2python, including tables, Unicode, headers and notes, then use text evidence extraction. Retain AI opt-out for every format.DOCUMENT_EXTRACTION_MAX_TEXT_CHARS(100,000 by default), identify truncation on review, and prevent source replacement from committing stale analysis.Engine comparison
The corpus scan found 11 distinct filled PDFs / 22 pages in six local Docassemble repositories. LITEFile and raw Gotenberg accepted 11/11; PDFtk Java 3.3.3 accepted 10/11. Raster inspection exposed a limitation that text extraction missed: raw Gotenberg/QPDF renders multiline answers on one line when appearance streams are missing. The
pypdfrepair preserves their line breaks before Gotenberg flattens them. A Unicode stress case that could not be safely flattened is rejected with a recovery path.Also filled the official Vermont Small Claims Answer with synthetic names, a checked checkbox, a three-line answer and typed signature. Checked both prepared pages visually, then checked a four-page packet containing that answer and synthetic exhibits. No court submission was made. These results support the engine choice for this tested corpus; previews remain necessary for font/layout/accessibility changes.
Validation
Screenshots and the Axe result are stored only in the validation gist; screenshot files have been removed from the feature branch history.
Full evidence and reproduction commands: validation record.
Gist: https://gist.github.com/nonprofittechy/54857d2ed0b841a486dbf7a30b1ad915
Deployment and limits
Apply migration
0029, configureGOTENBERG_URLand optional basic auth credentials, and provide fonts used by court documents on Gotenberg. The Docker build includes preview assets; local development usesnpm ciinefile_app. Existing editable drafts without preparation metadata must pass preparation and preview; missing stored files must be replaced.Flattening can affect accessibility, links or annotations; tagged Word output is not a PDF/UA certification. The original stays available and the filer must check the filing copy. The corpus includes partially populated templates as well as synthetic stress cases, so continued validation against additional completed filings is useful. Existing npm audit findings in development/test dependencies are documented in the validation record.