Upgrade AI extraction with confidence signals and optional Python ML post-enrichment#84
Open
0xxy0 wants to merge 11 commits intovas3k:mainfrom
Open
Upgrade AI extraction with confidence signals and optional Python ML post-enrichment#840xxy0 wants to merge 11 commits intovas3k:mainfrom
0xxy0 wants to merge 11 commits intovas3k:mainfrom
Conversation
Agent-Logs-Url: https://github.com/Subhamsinghania18/TaxHacker/sessions/835b4d78-bd7d-4c75-a250-5e7ebfa307d0 Co-authored-by: Subhamsinghania18 <147546813+Subhamsinghania18@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Subhamsinghania18/TaxHacker/sessions/835b4d78-bd7d-4c75-a250-5e7ebfa307d0 Co-authored-by: Subhamsinghania18 <147546813+Subhamsinghania18@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Subhamsinghania18/TaxHacker/sessions/835b4d78-bd7d-4c75-a250-5e7ebfa307d0 Co-authored-by: Subhamsinghania18 <147546813+Subhamsinghania18@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Subhamsinghania18/TaxHacker/sessions/835b4d78-bd7d-4c75-a250-5e7ebfa307d0 Co-authored-by: Subhamsinghania18 <147546813+Subhamsinghania18@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Subhamsinghania18/TaxHacker/sessions/835b4d78-bd7d-4c75-a250-5e7ebfa307d0 Co-authored-by: Subhamsinghania18 <147546813+Subhamsinghania18@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Subhamsinghania18/TaxHacker/sessions/835b4d78-bd7d-4c75-a250-5e7ebfa307d0 Co-authored-by: Subhamsinghania18 <147546813+Subhamsinghania18@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Subhamsinghania18/TaxHacker/sessions/835b4d78-bd7d-4c75-a250-5e7ebfa307d0 Co-authored-by: Subhamsinghania18 <147546813+Subhamsinghania18@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Subhamsinghania18/TaxHacker/sessions/835b4d78-bd7d-4c75-a250-5e7ebfa307d0 Co-authored-by: Subhamsinghania18 <147546813+Subhamsinghania18@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Subhamsinghania18/TaxHacker/sessions/835b4d78-bd7d-4c75-a250-5e7ebfa307d0 Co-authored-by: Subhamsinghania18 <147546813+Subhamsinghania18@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Subhamsinghania18/TaxHacker/sessions/835b4d78-bd7d-4c75-a250-5e7ebfa307d0 Co-authored-by: Subhamsinghania18 <147546813+Subhamsinghania18@users.noreply.github.com>
Upgrade AI extraction with confidence signals and optional Python ML post-enrichment
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.
Summary
This PR introduces a low-disruption AI/ML upgrade to TaxHacker’s invoice/receipt analysis flow by adding a lightweight post-processing stage and an optional Python-based enrichment hook.
The goal is to improve extraction quality and trustworthiness without changing the primary user workflow or adding significant runtime overhead.
What Changed
1. AI Enrichment Module
ai/enrichment.tstotal,convertedTotal, item totals)issuedAtdate format and warns on invalid/future datesconfidencescore (0..1)warningslistusedPythonEnricherflag2. Optional Python ML Sidecar Enrichment (Safe Fallback)
TAXHACKER_PYTHON_ENRICHER_CMDTAXHACKER_PYTHON_ENRICHER_ARGS(JSON array)TAXHACKER_PYTHON_ENRICHER_TIMEOUT_MSExecution behavior:
spawnwithshell: falsefor safer execution3. Analysis Contract Extension
AnalysisResultinai/analyze.tsto include:confidencewarningsusedPythonEnrichertokensUsedbehavior preserved4. UX Improvements (Unsorted Analyze Flow)
components/unsorted/analyze-form.tsxto display:components/forms/warning.tsx:5. Documentation & Config Updates
.env.examplewith optional Python enrichment variablesREADME.mdwith:Files Changed
ai/enrichment.ts(new)ai/analyze.tscomponents/unsorted/analyze-form.tsxcomponents/forms/warning.tsx(new).env.exampleREADME.mdWhy This Is a Good Fit
Validation
npm run build✅ Successfulnpm run lintcodeql_checker✅ No alerts foundRisk / Compatibility
Operational Notes
To enable Python enrichment in self-hosted environments, configure:
TAXHACKER_PYTHON_ENRICHER_CMDTAXHACKER_PYTHON_ENRICHER_ARGSTAXHACKER_PYTHON_ENRICHER_TIMEOUT_MSIf unset, the enrichment sidecar is automatically skipped.