Skip to content
peopleofproductPublic

About

Open-source financial data engine for India's DPI — statements→credit insights, ReBIT AA/ONDC/OCEN validators, multi-AA FIU client. Zero deps, zero egress.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

4 stars

Watchers

1 watching

Forks

Latest commit

 

History

74 Commits

Folders and files

Panini — the open financial-data layer for India's DPI

License: Apache-2.0 TypeScript Runtime deps Tests Maintained by People of Product™

Bank statements in — credit decisions out. Free, deterministic, and it never phones home.

Named after Acharya Pāṇini — the ancient architect of formal rule-based grammar — Panini is a zero-runtime-dependency TypeScript + Python engine that does what Indian fintechs currently pay vendors per-call for:

  • Extract messy bank statements — CSV, Excel, password-protected PDFs, SMS alerts, pluggable OCR
  • Normalize every narration through community-editable grammar rules — 14 dedicated bank grammars + generic & wallet archetypes, UPI/IMPS/NEFT/RTGS/ATM/POS/wallets, merchants, IFSC, VPA handles
  • Analyze deterministically — income, obligations, EMI, FOIR, cash flow, trends, bounce/round-trip/self-transfer risk signals — every claim carrying a rule ID + evidence
  • Flag fraud — the industry-standard indicator suite (circular flows, holiday cash deposits, RTGS-threshold gaming, round-figure clusters, gap months, salary anomalies, overdrawn days) plus multi-account consolidation: own-account transfers netted, A→B→A rotation cycles, inflated-turnover share. See docs/fraud-indicators.md
  • Parse income documents — payslips (label-preserved components + arithmetic check), ITR-V acknowledgements, and Form 26AS TDS entries — the income-verification leg beyond bank statements. See docs/income-documents.md
  • Validate against India's open-finance standards — the only public free validators for ReBIT AA payloads, the complete ONDC action surface, and the OCEN 4.0 loan lifecycle
  • Speak the AA protocol itself — consent lifecycle, Rahasya-compatible X25519/HKDF/AES-256-GCM decryption, and multi-AA orchestration (handle→AA routing, bounded parallel fan-out) in ~600 auditable lines
  • Run anywhere — server, edge, or entirely inside the browser: statement → BSA report with zero network calls

Just as Pāṇini's Aṣṭādhyāyī reduced a language to deterministic rules ~2500 years ago, Panini treats bank narrations as a grammar — not an AI problem. Fully free under Apache-2.0, forever.

Diagram: bank statements, payslips, ITR-V and 26AS, bank SMS and Account Aggregator data flow into Panini, an open-source normalization layer (extraction, integrity forensics, narration grammar engine, insights and fraud indicators), which outputs clean typed data with evidence to lenders, expense apps, reconciliation engines, FIUs and audit teams.

126 28 1,335 13 0
banks detectable bank layouts (CSV · XLSX · PDF · SMS) tests (1,122 TS + 213 Python) fraud indicators, with evidence runtime dependencies
Before and after Panini. Today: a lender, a fintech, an expense app, a reconciliation engine and an FIU each send data to per-report vendor APIs, paying per report, with data leaving their systems and flags they can't audit. With Panini: each runs Panini in-process on a shared community grammar corpus, so fixes propagate to everyone, there is no per-report fee, data never moves, and every flag has evidence rows.

🏗️ Core Architecture & Operational Topology

The platform isolates the parsing core from the optional self-hosted ops layer (rate limiting, metering, telemetry) to guarantee absolute privacy data sandboxing — everything is free and runs in memory on your host. Package-level topology lives in docs/operating-panini.md.

Document in → auditable credit-file out:

Six-stage pipeline: extract, forensics, rules-engine, insights, standards-schema, and bsa report. Entry points are browser, fiu-client, simulator and panini-py. Every claim carries a rule_id and evidence indices. The credit-file stack: application and UX, then the lender's own decisioning, then the Panini normalization band (extract, forensics, fraud suite, consolidation, conduct, income docs, report), then data rails (AA, bank documents, SMS). Vendors sell the normalization band per report; Panini provides open equivalents.
Package Role
@paniniapi/core Deterministic tokenizer + grammar-driven normalizer; optional self-hosted ops layer (rate limiting, metering, HTTP adapter).
@paniniapi/rules-engine Community-extendable JSON grammars — 14 Indian banks + wallet formats + generic archetypes — plus entity dictionaries (merchants, 90+ UPI handles, IFSC→bank) and a corpus coverage gate.
@paniniapi/standards-schema Zero-dependency validators for ReBIT v2.0 AA payloads (full FI-type matrix + consent request/artefact), the complete ONDC action surface (envelope, FIS search, catalog, order lifecycle, track/cancel/update), and OCEN 4.0 loan lifecycle (13-state status, disbursement, repayment schedule, eNACH, RBI KFS).
@paniniapi/extract Statement extraction — data-driven CSV/Excel layouts (28 layouts: banks, credit cards, UPI-app + merchant exports, generic — docs/bank-coverage.md), bank-name sniffing across ~126 banks (PSBs, SFBs, payments banks, co-ops, RRBs, foreign banks with India ops), credit-card + PhonePe UPI-app statements, caller-extensible extraFormatsDir, native zero-dependency XLSX reader (ZIP+XML internally, date serials → ISO), password-protected PDF unlock (RC4/AES Standard handler, per-bank password patterns), PDF text-layer parsing, bank SMS alerts, and a pluggable OCR provider seam.
@paniniapi/insights Deterministic credit-relevant analytics — income/salary detection, recurring obligations, EMI, FOIR, cash-flow summaries, bounce/round-trip/self-transfer risk signals, a 13-rule fraud-indicator suite + multi-account consolidation (internal-transfer netting, A→B→A cycles, inflated turnover — see docs/fraud-indicators.md), explainable evaluateScorecard scaffold, and a recurring-monitoring kernel (statementDiff, detectMonitoringEvents, runMonitorCycle — docs/monitoring.md). Every claim carries a rule ID + evidence indices.
@paniniapi/simulator Generative sandbox producing seeded, anomaly-injected ReBIT payloads and bank-layout statement files — feeds the extraction round-trip corpus gate.
@paniniapi/fiu-client Open FIU client for the AA ecosystem — consent lifecycle (build/parse/track — consentStatus + sweepConsents over a caller-owned store), X25519/ECDH ephemeral key exchange, AES-256-GCM FI decryption per the ReBIT spec (Rahasya-compatible), JWS artefact verification, multi-AA orchestration (community AA directory, handle→AA routing, bounded parallel fan-out), injectable transport, consent-notification validation, per-AA spec versioning, heartbeat probes. Zero deps; no implicit network calls. See docs/fiu-sandbox-certification.md and docs/aa-partner-readiness.md.
@paniniapi/forensics Deterministic document-integrity forensics — running-balance chain verification (one edited amount breaks every link), opening/closing reconciliation, PDF structural signals (incremental updates, editor producers, invisible/overlaid text), full CMS/PKCS#7 signature validation with caller trust stores, and AA ↔ document reconciliation (reconcileWithAa — diffs a claimed statement against the bank's own AA feed; fabricated or omitted rows are evidence-listed). Explainable signals, never a black-box score. See docs/statement-integrity.md + docs/aa-reconciliation.md.
@paniniapi/bsa BSA-in-a-box — statement files in, report out: extraction → narration enrichment → insights → deterministic JSON + Markdown report with per-file integrity verdicts. Includes the panini-bsa CLI (exits 3 on tamper evidence).
@paniniapi/browser Self-contained browser/edge bundles (ESM, CJS, IIFE) — narration parsing, CSV/SMS extraction and insights with all grammar/dictionary data inlined. Zero node: imports; nothing leaves the page.
panini-py/ Python port sharing the same grammar JSONs, extraction formats, and corpus — conformance-gated against the TypeScript corpus.
playground/ Self-contained browser playground (zero network calls) + npm run parse CLI.

✨ Design Guarantees

  • Zero runtime dependencies. The parsing core is pure TypeScript — deterministic regex grammars and tokenizers only. No network calls, no ML models, no phone-home telemetry. Safe to embed inside on-prem or sandboxed environments.
  • Rules are data, not code. Bank-specific grammars live in standalone JSON files loaded at runtime; updating a bank's narration layout never requires touching the TypeScript engine.
  • Strictly typed. Strict TypeScript throughout — no any, unknown at external boundaries, exactOptionalPropertyTypes enabled.
  • PII isolation. The optional telemetry channel is opt-in only and its event type has structurally no field for raw narrations, counterparties, references, VPAs, or amounts.

� Security, Privacy & DPDP

Panini is architected so that sensitive financial data never has to leave your boundary — and that isn't a privacy policy promise, it's a code property:

Comparison: with a hosted parsing API the customer statement leaves your perimeter; with Panini running in-process the statement, the library and the output all stay inside your perimeter. Core packages contain no networking code.
  • Zero network calls, anywhere in the stack. No fetch/axios/socket in any library code path — the FIU client's transport is injected by you, so every outbound call is one you wrote. A grep -r "fetch\|http" packages/*/src is an audit a security team can run in a minute.
  • Zero runtime dependencies → near-zero supply-chain surface. No third-party code executes on your data. Every line that touches a bank statement is in this repo, in the open.
  • In-memory only. No writes to disk, no caching, no logging of payloads — statement bytes live and die inside your process. The browser bundle literally cannot persist or transmit anything.
  • Deterministic + auditable. Same input → same output, always. Every extracted field and every credit-relevant claim carries a rule ID and evidence indices — an auditor can replay how a conclusion was reached, not just what it was.
  • Secrets stay out. The AA directory ships endpoints, never credentials. The sandbox-certification runbook reads everything from environment variables; there is nothing to leak.

Why this matters under DPDP 2023

India's Digital Personal Data Protection Act makes the processor question expensive: any vendor that touches a bank statement on your behalf sits inside your compliance perimeter — data-processing agreements, purpose-limitation audits, breach-notification chains, cross-border transfer reviews. A library you run yourself is not a processor. Panini keeps the entire statement→insight pipeline inside your own infrastructure, so the vendor-data-processing surface simply doesn't exist. For FIUs — entities already carrying fiduciary-grade obligations over AA data — this is not a nice-to-have: it's the difference between "we vetted our vendor" and "there is no vendor."

What FIUs get beyond the price

  • Full customization ownership. Grammar rules, dictionaries, AA directory entries, schema validators — all editable JSON/TS in your fork. When a bank changes a narration format, you fix it in 20 minutes instead of filing a vendor ticket and waiting a sprint.
  • Contribution flywheel. Grammars and layouts you contribute back are maintained by the community forever — a bug fixed by one FIU benefits every FIU. This is how public infrastructure gets better: shared maintenance instead of per-vendor SLAs.
  • No renegotiation cliff. Per-call pricing punishes growth; a library's cost curve is flat at any volume. Scale your consent volume 10× — your parsing cost stays ₹0.

Honest limits — read before you deploy

  • Scoring: Panini emits evidence-backed facts and a transparent, JSON-declared scorecard engine — not a calibrated credit score. Your risk team owns the model (which RBI accountability rules require anyway). See docs/scorecard.md.
  • Operations: it's a pinned library, not a fork you maintain — but grammar vigilance is real. The cost answer and ops checklist live in docs/operating-panini.md.
  • Liability: Apache-2.0 — no SLA, no indemnity. The shield is auditability: replayable decisions, evidence on every claim, public CI-gated quality receipts. Deployment checklist: docs/accountability.md.
npm install
npm run build   # tsc -b (project references)
npm test        # jest — 662 tests across 35 suites

Parse a narration

import { parseBankNarration } from '@paniniapi/rules-engine';

parseBankNarration('NEFT-N3452618902-SALARY-OCTOBER 2026-TCS LTD');
// {
//   channel: 'NEFT',
//   type: 'CREDIT',
//   ref_no: 'N3452618902',
//   counterparty: 'TCS Ltd',
//   is_salary: true,
//   category: 'Income',
//   ...
// }

parseBankNarration('UPI/20261015/DR/826384910234/SWIGGY@okaxis/Cooking/');
// {
//   channel: 'UPI',
//   type: 'DEBIT',
//   merchant: 'Swiggy',           // dictionary-canonicalised
//   counterparty: 'Swiggy',
//   vpa: 'okaxis',
//   vpa_app: 'Google Pay',        // enrichment: PSP app behind the handle
//   vpa_bank: 'Axis Bank',        // enrichment: sponsor bank
//   merchant_canonical: 'Swiggy',
//   category: 'Food & Dining',
//   category_id: 'food_dining',      // stable taxonomy id
//   category_group: 'Essentials',    // taxonomy rollup group
//   category_source: 'keyword',      // grammar | keyword | merchant | mcc | none
//   counterparty_kind: 'merchant',   // merchant | self | unknown
//   ref_kind: 'rrn',                 // utr | rrn | cheque | ref | none
//   schema_version: 2,
//   confidence: 0.95,
//   ...
// }

Or use the raw engine for custom grammars:

import { Normalizer } from '@paniniapi/core';
import { loadBuiltinRuleSets, loadCategories } from '@paniniapi/rules-engine';

const normalizer = new Normalizer({
  ruleSets: loadBuiltinRuleSets(),
  categories: loadCategories(),
});
normalizer.normalize('UPI-SWIGGY-826384@okaxis-20261015-REV-DEBIT');

Extract transactions from a statement

import { extractStatement } from '@paniniapi/extract';

const statement = await extractStatement(csvText); // or PDF bytes, XLSX, SMS
// {
//   format: 'csv', bank: 'HDFC', layoutId: 'hdfc_statement',
//   accountMask: '1234',
//   transactions: [
//     { date: '2026-10-15', narration: 'UPI/40234...', direction: 'DEBIT',
//       amountPaise: 125000, balancePaise: 4523050, refNo: '402345678912' },
//     ...
//   ]
// }

// Password-protected statements — pass what you know; per-bank password
// patterns (formats/pdf-passwords.json) generate the candidates:
await extractStatement(pdfBytes, {
  credentials: { dob: '15-04-1990', name: 'Kapil Sharma' }, // or { passwords: ['…'] }
});

// XLSX works out of the box — a zero-dependency reader parses
// workbook/sharedStrings/styles internally (date serials → ISO dates).
// Corrupt or non-workbook archives degrade to warnings, never throws:
await extractStatement(xlsxBytes);

// You can still plug in SheetJS/exceljs via the provider seam if you
// need caller-controlled parsing, and scanned input uses the OCR seam:
import { createSheetJsProvider, createTesseractProvider } from '@paniniapi/extract';
await extractStatement(xlsxBytes, { spreadsheet: createSheetJsProvider(XLSX) });
await extractStatement(scannedPdf, { ocr: createTesseractProvider(tesseractWorker) });
// Word-level OCR boxes keep column anchoring — same table pipeline as a
// real text layer. Flat OCR text degrades to whitespace-split rows.

// For scans too degraded for one engine, the router escalates across
// tiers — local OCR → on-prem open-weight VLM → queue-priced batch TSP —
// and every result must pass verifyStatement's deterministic arithmetic
// gate (balance-chain, opening→closing reconciliation). Optional dual-
// engine consensus flags the exact cells two engines disagree on.
// See docs/ocr-playbook.md — "any eyes, proven numbers".

Credit-relevant insights

import { analyzeTransactions } from '@paniniapi/insights';

const report = analyzeTransactions(statement.transactions);
// report.income       — salary credits, employer sources, monthly average,
//                       regular/irregular consistency
// report.obligations  — recurring debits, EMI patterns, monthly obligation
// report.foir         — fixed-obligation-to-income ratio (null when income
//                       is undetected — never fabricated)
// report.cashflow     — totals, net, balance range, closing balance
// report.signals      — PANINI-RSK-* bounce / round-trip / self-transfer
//                       signals, each with evidence txn indices

Validate DPI payloads

import {
  validateAAProfile,
  validateFiData,
  validateAAConsentRequest,
  validateAAConsentArtefact,
  isOCENLoanApplication,
} from '@paniniapi/standards-schema';

const result = validateAAProfile(payload); // { valid, errors[] } — zero deps
validateFiData('MUTUAL_FUNDS', mfPayload); // FI-type-aware validation
validateAAConsentRequest(consentBody); // ReBIT ConsentDetail envelope

Generate sandbox traffic

npm run simulate -- --count=50 --seed=7 --anomaly-rate=0.2
npm run simulate -- --count=50 -o mocks.json --pretty

Streams deterministic ReBIT v2.0 FI profiles — including deliberate anomalies (truncated narrations, corrupt timestamps, dropped fields) for exercising client-side error handling.

Try it in the playground

npm run playground          # rebuilds playground/panini-web.js
# open playground/index.html — fully static, zero network calls

npm run parse -- 'UPI/P2M/123456789012/JOHN DOE@axisb/DR'
# → channel UPI, vpa axisb → CRED / Axis Bank

Python port (panini-py/)

The Python engine shares the same grammar JSONs and corpus fixtures as the TypeScript packages — parity is enforced by the conformance suite (84/84), not assumed:

from panini import parse_narration

parse_narration('UPI/20261015/DR/826384910234/SWIGGY@okaxis/Cooking/')
# → channel UPI, type DEBIT, vpa_app 'Google Pay', vpa_bank 'Axis Bank'
cd panini-py && python3 -m unittest discover tests   # corpus conformance gate

Entity dictionaries & corpus gate

packages/rules-engine/rules/entities/ holds community-editable datasets — merchant canonical names + aliases + MCC, 90+ UPI VPA handles → PSP app/sponsor bank (PhonePe, GPay, Paytm, CRED, WhatsApp Pay, BHIM, Navi, MobiKwik, super.money, Amazon Pay, Flipkart, bank-direct…), IFSC prefix → bank, and ISO 18245 MCC → category/description (POS narrations carrying MCC-5411 tokens resolve to Groceries, not Uncategorized). Ambiguous handles are never guessed — they resolve to null instead of a wrong attribution.

rules/corpus/ holds per-bank narration fixtures; tests/corpus.test.ts generates one test per sample, so grammar regressions fail CI.

When a bank changes its narration format overnight, you do not have to redeploy the engine: analyzeNarrationBatch compares a live batch against the corpus baseline (drift: true on collapse), panini-bsa doctor prints the unmatched shapes plus corpus-tested draft rules, and a hotfix is one JSON file in a loadRuleSets(dir) overlay directory. The full playbook is docs/rules-hotpatch.md.

Self-hostable ops layer

import { createPaniniHttpHandler, OpsProxy } from '@paniniapi/core';

app.post('/v1/parse', createPaniniHttpHandler(proxy));
// bearer token → rate-limit bucket → normalize → usage meter → JSON

🛠️ Development

npm run build          # strict project-reference build
npm test               # full monorepo suite
npm run lint           # eslint flat config
npm run format         # prettier

A pre-commit gate (scripts/pre-commit.sh, installed at .git/hooks/pre-commit) runs lint + tests before any commit finalizes.

🤝 Maintained by People of Product™

Project Panini is an open-source initiative by People of Product™ — the team behind Product City, built to empower professionals with leading tech capabilities and to make India's open-finance infrastructure more open for everyone.

Find us:

Contributions welcome — see CONTRIBUTING.md. Panini is free forever — if it saved your team money, you can support the maintainers.

Accuracy claims are public and reproducible — see benchmarks/BENCHMARKS.md (npm run bench).

License

Apache-2.0 — see LICENSE and NOTICE.

About

Open-source financial data engine for India's DPI — statements→credit insights, ReBIT AA/ONDC/OCEN validators, multi-AA FIU client. Zero deps, zero egress.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

4 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages