TaxResearch
Tax calculation engine
R$ 1.973.862.660,33
in tax credits identified
- SPED · EFD · XML
- Parser
- Tax theses
- SELIC + limits
- Amended filing
Problem
Companies overpay taxes, and recovery opportunities are buried in millions of lines of Brazilian tax filings (SPED, EFD) and e-invoice XML that nobody can audit by hand.
What I built
An engine that reads SPED, EFD-Contribuições, NF-e XML and eSocial, applies legally grounded theses (ICMS exclusion from the PIS/COFINS base, ICMS-ST, single-phase taxation, inputs, payroll taxes), adjusts by the SELIC rate, respects statutes of limitation and produces amended filings and calculation reports ready to file with the tax authority.
Engineering
- API and worker in the same binary (APP_ROLE): a heavy calculation never takes the API down
- Processing queue with resume, priorities and graceful shutdown
- Incremental recalculation via a dependency graph, with versioned calculations per thesis
- DuckDB and worker_threads for large XML and SPED volumes, with an event loop monitor
- Over 150 test suites guarding the tax rules