u/ibrahimsyed1

Built a localized tax data pipeline processing 150K fixed assets using Polars and DuckDB (feedback on business logic vectorization?)

Hey everyone,

I’m a recent B.Com Computer Applications graduate with a CS background, working on an end-to-end Tax Data Engineering vault (Project TTA).

I wanted to move away from standard Pandas iterative workflows and test how DuckDB + Polars handles complex, state-dependent corporate tax logic across 150,000 records.

What the pipeline does:

• Ingests 150k asset records directly from a local DuckDB vault emulating an SAP S/4HANA sub-ledger via zero-copy `.pl()` exports.

• Vectorizes non-linear statutory rules (e.g., Section 179 dollar-for-dollar phase-out caps, conditional ADS vs. GDS routing).

• Aggregates entity-level dates to evaluate whether Q4 additions breach a 40% threshold, dynamically flipping depreciation lookup matrices from Half-Year to Mid-Quarter conventions.

• Writes finalized arrays back to DuckDB with strict DECIMAL(18,4) casting for idempotency.

I recorded a raw technical walkthrough of the code and output tables: https://youtu.be/yvQlwaBQOvY

Repo: https://github.com/ibrahimworksfr-code

Would appreciate any feedback on how I can further optimize the Polars query plan or handle out-of-core streaming as I scale this to 5M ledger rows in Phase 2.

reddit.com
u/ibrahimsyed1 — 14 hours ago
▲ 2 r/tax

Automated MACRS, Section 179 Phase-Outs, and the 40% Mid-Quarter Rule for 150K assets in Python (Project Walkthrough)

Hi all,

Anyone who has worked on corporate fixed asset registers knows how messy Form 4562 calculations get once you hit thousands of assets across multiple subsidiaries.

I’m studying for the IRS Enrolled Agent (EA) exams and have a B.Com CA / CS background. As part of a portfolio project simulating Big 4 Tax Tech workflows, I built a Python engine (using Polars & DuckDB) that automates the 2026 cost-recovery waterfall for 150,000 assets:

  1. Bypasses accelerated depreciation for assets with <= 50% qualified business use (IRC §280F ADS Straight-Line routing).
  2. Calculates entity-level Section 179 phase-outs ($2.56M deduction / $4.09M phase-out ceiling).
  3. Detects if an entity placed >40% of its asset basis in service during Q4 to force the Mid-Quarter convention instead of the Half-Year convention.
  4. Handles 100% Bonus expensing with an IRC §168(k)(7) opt-out election for 15-Year property to test tabular MACRS 200%/150% declining balance schedules.

Video walkthrough explaining the tax logic & code: https://youtu.be/yvQlwaBQOvY

I'm moving into ASC 740 Schedule M-3 reconciliations next. Would love to hear how practitioners in corporate tax / tax technology handle these convention switches in enterprise tooling.

reddit.com
u/ibrahimsyed1 — 14 hours ago