GST & P&L Extraction
The GST & P&L Extraction module is a core component of the LoanPilot engine. It leverages AI-driven OCR and analysis to parse complex financial documents, transforming unstructured PDF data into structured fiscal metrics used for credit underwriting and reconciliation.
Overview
The system processes three primary types of financial records:
- Financial Statements: Profit & Loss (P&L) statements and Balance Sheets.
- GST Returns: Business tax filings (GSTR-1, GSTR-3B).
- ITR: Income Tax Returns.
These extractions provide the foundation for the Reconciliation Engine, which automatically cross-references reported revenue against actual bank inflows.
Financial Statement Analysis
This endpoint extracts key performance indicators (KPIs) from Balance Sheets and P&L statements. It supports both current and historical data to identify trends in business growth and stability.
API Endpoint
POST /api/analyze/financial-statement
Request Parameters
| Field | Type | Description |
| :--- | :--- | :--- |
| documentId | UUID | The ID of the document already uploaded to storage. |
| applicationId | UUID | The associated loan application ID. |
| organizationId | UUID | The ID of the lender organization. |
| statementType | String | Must be one of: balance_sheet, profit_loss, or itr. |
| aiProvider | String | (Optional) Specify a specific AI model provider. |
Example Request
{
"documentId": "doc_12345",
"applicationId": "app_67890",
"organizationId": "org_555",
"statementType": "profit_loss"
}
Extracted Data Points
- Profit & Loss: Revenue, Cost of Goods Sold (COGS), Gross Profit, Operating Expenses, Depreciation, Interest, Taxes, and Net Income.
- Balance Sheet: Total Assets (Current & Fixed), Total Liabilities (Current & Long-term Debt), and Total Equity.
- Computed Ratios: The system automatically calculates financial health ratios including:
- Net Profit Margin
- Debt-to-Equity / Debt-to-Assets
- Current & Quick Ratios
- DSCR (Debt Service Coverage Ratio)
GST Returns Extraction
The GST module extracts monthly or quarterly filing data to verify business turnover and tax compliance.
API Endpoint
POST /api/analyze/gst-returns
This endpoint accepts two methods of input:
- JSON: Referencing an existing
documentIdfrom the storage service. - Multipart/FormData: For direct file uploads during the analysis phase.
Request Body (JSON)
| Field | Type | Description |
| :--- | :--- | :--- |
| applicationId | UUID | The associated loan application ID. |
| documentId | UUID | The ID of the document to analyze. |
Data Extraction Scope
The extraction focuses on:
- Total Outward Supplies: Verified revenue for the period.
- Total Inward Supplies: Business purchases and Input Tax Credits (ITC).
- Tax Liability: Payment history and compliance status.
Automated Reconciliation
Once Financial Statements and GST returns are processed, the system can trigger a reconciliation analysis. This compares the "declared" figures in tax and financial documents against the "actual" figures found in bank statements.
API Endpoint
POST /api/analyze/reconciliation
Usage
This endpoint requires only the applicationId. It aggregates data from the most recent:
- Bank Statement Analysis
- GST Returns Analysis
- Financial Statement Analysis (P&L)
{
"applicationId": "app_67890"
}
Output Logic
The reconciliation engine flags discrepancies in:
- Revenue Variance: If P&L revenue significantly exceeds GST-declared turnover.
- Banking Variance: If GST-declared turnover exceeds actual credits in the bank statement.
- Compliance Alignment: Ensuring the reporting periods across all documents align.
Data Integrity & Confidence
Every extraction includes a confidence_score and raw_ai_response.
- Confidence Score: A value from 0 to 1 indicating the AI's certainty of the extraction.
- Human-in-the-loop: High-variance discrepancies or low confidence scores (typically < 0.85) are flagged for manual review within the LoanPilot Dashboard.
Implementation Note
Analysis results are persisted in the following database tables:
financial_statement_analysisgst_returns_analysisreconciliation_analysis