Skip to content

GST Nirikshak - Turning Scattered Tax Data into Explainable Evidence

An offline analytics workbench for GST investigators: it brings more than ten kinds of tax, logistics, financial and legal data together on shared keys, so an officer can go from a first signal to a documented, explainable case in one place.

Data integration Graph analytics Explainable analytics Python · DuckDB Privacy by design AI-assisted development

Context: built in 2024 during my data analytics role in India’s indirect-tax administration, and handed over to the team before I left (see experience) · My role: creator and sole project lead, working under the guidance of senior authorities: idea, data research, specification, architecture, AI-assisted build and validation · The name: Nirikshak means “inspector” or “observer” in Hindi.

Network analysis inside the app on synthetic data: a ring of four units passing credit in a loop, two units with cancelled registrations, and the credit flowing to one beneficiary, with a legend explaining the shapes and colours.
Network analysis in the app: a circular-trading ring (orange) and two units with cancelled registrations (dashed borders) passing credit to one beneficiary (square). Every name and figure is synthetic.
25+input file formats from more than ten kinds of source
80explainable checks in 15 rule packs
12modules following the investigator’s workflow
507automated tests against synthetic data with known answers
~53klines of Python, idea to version 1.0 in 15 milestones
0outside network connections: fully offline

The challenge

GST produces rich data, but for an investigator building a case the pieces sit in separate portals, downloads and spreadsheets: returns, purchase statements, e-way bills, third-party reports, books, bank statements and a law that changes by notification. Joining them was manual, slow and hard to explain afterwards.

What I built

A desktop web application that runs entirely on the officer’s own PC. It recognises 25+ file formats, links them on shared keys in one case store, and runs reconciliations, screens, network and movement analysis and 80 rule-based checks, ending in ranked worklists, evidence-backed findings and reports.

My role

I took it from idea to a working, tested application: mapped the workflow, studied the data formats, wrote the build specification, designed the data model and architecture, built it in fifteen milestones with the AI coding assistants available at the time, ChatGPT (GPT-4) and GitHub Copilot, validated every module against synthetic data with known, planted problems, and handed it over to the team.

The result

A complete version 1.0, validated end to end on a synthetic demo zone with 20 cases and then handed over to the team for use before I left in 2024. Every figure traces back to its source rows, the rule that produced it and the legal provision, so a finding can be defended, not just displayed.

I ran GST Nirikshak as a project from start to finish: I proposed it, got it approved, worked out the requirements with the officers who would use it, wrote the specification, built it in fifteen planned milestones, proved it on synthetic data, prepared the team to use it, and handed it over before I left in August 2024.

Initiate2024 · proposal and approval
→
Plan2024 · workflow, spec, 15 milestones
→
Build2024 · milestone by milestone
→
Test and pilot2024 · 507 tests, demo zone
→
Train2024 · tour, manual, demo zone
→
Monitor2024 · milestone reviews, reporting
→
CloseAug 2024 · handover to the team
The full life cycle, owned end to end, under the guidance of senior authorities.

Owner

Creator and sole project lead: the idea, the specification, the plan, the build, the validation and the handover.

Sponsor and approval

Senior authorities approved the project and received progress reports; I worked under their guidance throughout.

Users and stakeholders

The investigating officers of the team who would use the workbench, and the senior authorities who would rely on its findings.

Decisions I owned

Scope and modules, the data model, the checks and their legal basis, the milestone plan, the quality bar of correct before complete, and the handover.

PhaseWhat I didOutput
InitiateSaw that building a case meant pulling evidence from many portals and spreadsheets by hand; proposed an offline workbench that links them; obtained approvalApproved proposal
PlanMapped the investigator’s workflow with the officers who do the work, studied the structure of every data source, wrote a build specification (version 3.1) with acceptance tests, and split the build into fifteen milestonesSpecification and milestone plan
BuildBuilt one milestone at a time with the AI coding assistants of 2024, ChatGPT (GPT-4) and GitHub Copilot, reviewing and integrating each milestone before the next beganTwelve working modules
Test and pilotBuilt a synthetic data generator with planted problems, 507 automated tests and a demo zone of 20 cases that exercises every module, and ran the whole workflow end to end on itProven against known answers
TrainPrepared a guided first-run tour, a How-to page, a manual built into the app and the demo zone, so the team could learn on safe dataA team ready to use it
Monitor and controlTracked progress milestone by milestone against the plan and kept senior authorities informedProgress visible at every milestone
Close and hand overHanded the application, its manual and its demo zone over to the team before I left in August 2024A working tool with its users

Data in many places

Returns, statements, e-way bills, third-party reports and legal notifications arrive as PDF, Excel, JSON, CSV and text, each in its own layout.

Manual matching

Comparing sales with tax paid, credit claimed with credit available, or goods billed with goods moved was done by hand in spreadsheets: slow and easy to get wrong.

Hard to explain

A figure in a report could not easily be traced back to its rows and its legal basis, so results were hard to repeat and harder to defend.

Networks hide in tables

Fake-invoice networks pass credit through chains and loops of firms. Seeing them needs graph analysis that spreadsheets cannot do.

Confidential by nature

Tax data is confidential, so cloud tools were not an option. Whatever helped had to run on the officer’s own machine.

  1. Understand the work. I mapped the investigator’s workflow from finding a lead to computing a demand, and the questions asked at each step.

  2. Study the data. I studied the structure of the returns, statements and reports the work depends on: their fields, layouts and how they relate. Structure only; no data was copied.

  3. Specify. I wrote a detailed build specification (version 3.1): the data model, every check with its legal basis, the screens, the security model and the acceptance tests.

  4. Build in milestones. I planned fifteen milestones and built the application one milestone at a time, using the AI coding assistants available in 2024, ChatGPT (GPT-4) and GitHub Copilot, under fixed rules for the shared code, privacy and testing. Each milestone was reviewed and integrated before the next began.

  5. Prove it. I built a synthetic data generator that plants known problems, 507 automated tests with expected values, and a demo zone of 20 cases that exercises every module.

  6. Hand it over. Once every module passed on synthetic data, I handed the application to the team for use, before my departure in August 2024.

Connecting the data: the heart of the project

Section titled “Connecting the data: the heart of the project”

The core idea is simple: clean every source into one case store and link it on a small set of shared keys. Once the keys line up, each analysis becomes a join instead of a manual hunt.

1 · Sources 10+ kinds, 25+ formats
Returns and purchase statements
Third-party reports
Goods movement
Registration data
Law: rates and rules by date
Books, bank and trade data
2 · Connect one case store
Recognise each file by its headings
Fingerprint it (SHA-256)
Clean, normalise, self-check
Link on shared keys in DuckDB
3 · Analyse explainable methods
Reconcile and match
Screen and benchmark against peers
Rule checks, law by date
Graph analysis
Movement feasibility
Estimates with stated assumptions
4 · Act what the officer gets
Ranked worklists
Explainable findings
Reports and annexures
Tax, interest and deadlines
Case tracking and reports
From scattered files to explainable findings: every source is cleaned into one case store and linked on shared keys.
Kind of sourceExamplesWhat it adds
Own returnsSales return, summary return with tax paid, annual returnWhat the business declares, month by month and for the year
Supplier statementsAuto-drafted purchase statements built from suppliers’ filingsThe credit the business is actually entitled to, invoice by invoice
Third-party reportsTax deducted by government buyers, e-commerce collections, income-tax statementsWhat others report paying the business: an independent check on turnover
Goods movementE-way bills, the public PIN code directoryWhether billed goods were plausibly moved
Registration dataRegistration details across the areaThe wider population, for screening and peer comparison
LawRates, exemptions, reverse charge, blocked credit, cess, each with its effective dateThe correct treatment on any given date, so checks are time-aware
Books and financeTrial balance, sales register, bank statementsTurnover in the books against the returns; money flows
TradeShipping bills and bills of entryExports and imports against refunds and credit claimed

Files are recognised by their headings rather than fixed row positions, so the app copes with banner rows, merged headers and small layout changes.

GSTINPANPeriodInvoice + supplierVehicle + timePIN codeProduct code + dateName, address, phone (fuzzy)
KeyWhat it linksThe question it makes answerable
GSTINThe registration number across returns, e-way bills and third-party reportsDoes what the business declared match what others reported about it?
PANAll registrations of one business, and its income-tax dataIs one business spread across several registrations?
PeriodMonths and financial years across returns and booksIn which months does a gap appear, and is interest due?
Invoice + supplierThe purchase register against suppliers’ filingsWhich credit claims have no matching invoice, or are claimed twice?
Vehicle + timeE-way bills against movement recordsCould the goods on this bill actually have travelled?
PIN codeAddresses to approximate locationsIs the declared distance plausible for this route?
Product code + dateProducts to the law master and to peersWas the right rate applied on that date? Is a firm far out of line with its peers?
Name, address, phoneFuzzy matching across registrations and past casesAre supposedly independent firms actually linked? Was this lead already examined?

The app ships with a demonstration story. It shows how each extra source adds a layer of proof. All firms and figures are synthetic.

  1. Spot it. Population screens rank a group of closely linked new registrations at the top of the worklist, each with a score and the reasons behind it.

  2. Connect it. Supply links from returns, purchase statements and e-way bills become a network of 18 units. Graph search finds a ring of four firms passing credit in a loop and two firms with credit but no real purchases, all feeding one beneficiary (the picture at the top of this page). The analysis takes about a tenth of a second.

  3. Test it. The ring’s 95 e-way bills are tested for whether the goods could physically have moved: 36 consignments fail, and the tax on them is computed exactly, with a clearly labelled estimate for the bills not tested.

  4. Corroborate it. Financial records show money moving in a loop between two of the firms, matching the pattern in the network.

  5. Explain it. Each finding becomes an issue with its legal provision, its method (exact or estimate), its confidence and its source rows. The officer drafts the report with annexures; a supervisor approves it before it is registered.

  6. Act on it. For a related case, the app computes tax by month, interest day by day, payments already made, penalty options and the statutory deadlines.

Twelve modules follow the investigator’s workflow, from deciding whom to look at to computing a demand and reporting on it.

Lead generation

Loads a registration extract of hundreds of thousands of records in about 30 seconds, runs 11 explainable screens with product-code peer benchmarks and back-testing, and produces ranked worklists.

Return analysis

Reconciles sales with tax paid and credit claimed with credit available, month by month, with late-filing interest and an annual comparison across returns.

Invoice-level credit matching

Matches the purchase register with suppliers’ filings to find credit without an invoice, duplicate claims and suppliers who stopped filing.

Third-party data

Compares what government buyers and e-commerce operators reported with the business’s own return, alongside peers who work for the same buyers.

Law masters

Effective-dated rates, exemptions, reverse charge, blocked credit and cess, each with its notification: “what was the rate on this date”, and sweeps that list everyone affected by a change.

Sector playbooks and estimates

13 sector checklists, and estimates as ranges, proxies, peer-based or extrapolated figures, with every assumption shown and editable.

Network analysis

Builds a supply network and finds trading cycles, clusters, chain levels and credit flows, then draws the picture and the annexures.

Goods movement

Distances from PIN codes and vehicle-feasibility tests, with exact and extrapolated tax on goods that could not have moved.

Enrichers

A books-to-returns turnover bridge and links to income-tax statements, bank statements, customs data and job-work records.

Case reports

An evidence locker and legal library; drafts reports in the office’s own Word format with Excel annexures, with maker-checker approval.

Register and reporting

Replaces a spreadsheet register: dated events, follow-up ageing, reminder letters, management reports in existing layouts and a fuzzy duplicate check.

Demand computations

Tax by period, interest day by day, payments appropriated, penalty options, limitation dates and a deadline dashboard.

In tax enforcement, a number is only useful if it can be defended. The design follows from that.

Explainable by design

Every figure traces back to its source rows, the rule that produced it and the legal provision. Each check states its method (exact, proxy or estimate) and its confidence. Estimates print their assumptions, and changing one recomputes the figure. Officers’ decisions on findings survive a re-run of the checks.

Private and tamper-evident

Fully offline: outside network connections are blocked while the app runs. Every imported file is fingerprinted, the audit log is hash-chained, backups are signed, and case packages are digitally sealed so any change shows. The web layer is hardened, and the app runs without admin rights.

Tested properly

A synthetic data generator plants known problems, so every check is tested against expected values: 507 automated tests, including property-based tests and performance benchmarks. No real taxpayer data in the code, tests or documentation.

Made to be used

A browser interface with light and dark themes, a guided first-run tour, a “How to” page, a 22-chapter manual built into the app, and a one-click demo zone of 20 synthetic cases for training and presentations.

A local web application: a Python server on the officer’s own PC and the normal browser as the interface. No internet, no cloud, no installation rights needed.

LayerToolsWhy
Analytics engineDuckDB (embedded SQL), PyArrowFast columnar analysis of large extracts on one PC, with no database server
Graph and matchingOwn graph algorithms, RapidFuzzTrading cycles, clusters and chain levels; fuzzy name and address matching
File handlingpython-calamine, pypdfium2, JSON and CSV readersReading returns and reports from Excel, PDF, JSON and CSV
Documentspython-docx, XlsxWriter, PillowReports, notices, annexures and network pictures in the office’s own formats
Web serverFastAPI, Uvicorn, Jinja2A testable server with server-rendered pages
InterfaceHTMX, Alpine.js, Tabulator, Cytoscape.jsInteractive tables and network pictures, all bundled locally
Securitycryptography (Ed25519), Argon2, SHA-256Signatures, sealed packages, passwords and file fingerprints
Qualitypytest, Hypothesis, pytest-socketUnit, property-based and offline-enforced tests
PackagingPyInstaller, portable buildRuns on locked-down Windows PCs without admin rights
AI assistanceChatGPT (GPT-4), GitHub CopilotDrafting and reviewing code, tests and documentation, always checked against the specification and the tests

I treated the project as a product. I started from the officers’ workflow and the shape of the data, wrote a specification precise enough to build and test against, and split it into fifteen milestones. I wrote it with the help of the AI coding assistants of the time, ChatGPT (GPT-4) and GitHub Copilot, under fixed rules for the shared code, privacy and testing, with one standard above all, correct before complete: every check needs expected values on synthetic data. I reviewed and integrated each milestone, packaged the result as one app with a guided tour, a manual and a demo zone, tested it end to end on synthetic data and then handed it to the team.

1 · Discoverworkflow and data formats
→
2 · Specifyspec v3.1: data model, checks, acceptance
→
3 · Build15 milestones with ChatGPT and GitHub Copilot
→
4 · Validateplanted problems, 507 tests, demo zone
→
5 · Hand overto the team, before I left in 2024
AreaSkills
Data analyticsReconciliation and variance analysis, anomaly screening, peer benchmarking, graph and network analysis, geospatial feasibility, estimation and extrapolation, back-testing, explainable analytics, fraud detection
Data engineeringData integration, multi-format ingestion (PDF, Excel, JSON, CSV), entity resolution and fuzzy matching, data modelling, SQL (DuckDB), PyArrow, data quality checks, data lineage, synthetic data generation
Domain and productGST and indirect tax, tax compliance analytics, requirements and specification, workflow design, milestone planning, user documentation, GovTech
Engineering and deliveryPython, FastAPI, HTMX, automated testing (pytest), security and privacy by design, offline-first architecture, AI-assisted development (ChatGPT, GitHub Copilot), Git

GST Nirikshak shows how I work with data: start from the decision someone has to make, find every source that bears on it, connect them on keys that hold up, and make every number explain itself.

The source code is private. A walkthrough on the synthetic demo data is available on request.

Data analytics Data integration Graph analytics Explainable analytics Fraud detection Python DuckDB FastAPI Privacy by design AI-assisted development GovTech