Add App 3 initial implementation: classifier, catalog, indexer and GUI#1
Add App 3 initial implementation: classifier, catalog, indexer and GUI#1
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a246c127d0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| clave = str(parsed.get("clave_numerica") or "").strip() | ||
| if len(clave) != 50: | ||
| continue | ||
| records[clave] = FacturaRecord( |
There was a problem hiding this comment.
Preserve invoice record when same clave appears in another XML
This assignment overwrites any previously indexed record for the same clave, so when a client has both the invoice XML and a MensajeHacienda XML with the same key, whichever file is processed last wins. If MensajeHacienda is encountered after FacturaElectronica, the indexed row loses invoice fields like issuer, date, and totals, which leaves the UI with incomplete/incorrect invoice context for classification.
Useful? React with 👍 / 👎.
| ) | ||
| return None | ||
|
|
||
| dest_folder = client_folder / categoria / subcategoria / proveedor |
There was a problem hiding this comment.
Sanitize destination folder names before classifying PDFs
The destination path is built directly from user/catalog text (categoria, subcategoria, proveedor) without filesystem sanitization. In this flow proveedor is prefilled from XML issuer names, and names containing Windows-invalid characters (for example : or ?) will make mkdir/copy fail, while separators like / create unintended nested directories; both cases block or misroute real classifications.
Useful? React with 👍 / 👎.
Motivation
Description
app3/package with a bootstrapper that inserts legacy app folders intosys.pathsoAPP 1/APP 2modules can be reused.app3/config.pyand aFacturaRecorddataclass inapp3/core/models.py.CatalogManagerwith atomic JSON save/load andClassificationDBbacked byclasificacion.sqliteincluding anON CONFLICTupsert and SHA256 hashing/validation inapp3/core/classifier.py.FacturaIndexerto build invoice records fromXMLandPDFfolders,sessionresolution using existing profiles/settings, a Tkinter GUI (app3/gui/main_window.py) and amainentrypoint (app3/main.py); README updated with usage and status.Testing
tests/test_app3_core.pyandtests/conftest.pyexercising catalog atomic save/load andclassify_recordbehavior.pytestcoveringtests/test_app3_core.py::test_catalog_atomic_save_loadandtests/test_app3_core.py::test_classify_record_moves_pdf_and_registers, and both tests passed.Codex Task