
Mortgage loan auditing application focused on California loans
Build a production-grade mortgage loan auditing application focused on California loans. Primary audit scope: 1. California Per Diem Interest validation 2. California Third-Party Fee validation
Prompt
Build a production-grade mortgage loan auditing application focused on California loans. Primary audit scope: 1. California Per Diem Interest validation 2. California Third-Party Fee validation Tech stack: * Backend: ASP.NET Core (.NET 8) * Database: SQLite * ORM: Entity Framework Core * OCR support for scanned PDFs * REST API architecture * JSON-based rule engine * Audit report generation Application requirements: 1. Document Upload * Allow upload of: * Loan Estimate (LE) * Closing Disclosure (CD) * Promissory Note * Settlement Statement * Escrow Instructions * Third-party invoices * Support PDF, image, and text files. * Store original documents. 2. Document Classification Automatically classify uploaded documents into: * Closing Disclosure * Note * Title Invoice * Appraisal Invoice * Flood Certification * Credit Report * Escrow Invoice 3. OCR and Data Extraction Extract: * Borrower name * Loan number * Property address * Loan amount * Interest rate * Closing date * Funding date * First payment date * Prepaid interest period * Per diem amount * Total prepaid interest * All third-party fees * Provider names * Invoice totals Output structured JSON. 4. California Per Diem Audit Rules Rule PD-001: Per diem = Loan Amount × Interest Rate ÷ 365 Rule PD-002: Total prepaid interest = Per diem × number of prepaid days Rule PD-003: Validate prepaid date range against closing date and first payment date. Rule PD-004: Flag variances greater than $1. Rule PD-005: Identify overcharges and undercharges. 5. California Third-Party Fee Audit Rules Audit these fee types: * Appraisal Fee * Credit Report Fee * Flood Certification Fee * Tax Service Fee * Escrow Fee * Title Fee * Recording Fee * Notary Fee * Courier Fee * Pest Inspection Fee Validation: * Each fee must have provider name * Each fee must match invoice * Detect duplicate fees * Detect missing invoices * Detect mismatched fee amounts * Flag affiliate-paid fees * Validate fee categorization 6. Database design Create tables: Loans LoanDocuments ExtractedFields AuditRules AuditFindings ThirdPartyFees Invoices AuditReports 7. API Endpoints POST /api/loan/upload POST /api/loan/extract POST /api/loan/audit GET /api/loan/{id} GET /api/loan/{id}/report GET /api/loan/{id}/findings 8. Audit Output Return: * PASS * WARNING * FAIL Example output: { "loanNumber": "CA-2026-001245", "findings": [ { "rule": "PD-001", "status": "FAIL", "expected": 80.14, "actual": 81.25, "variance": 1.11 } ] } 9. UI Create: * loan upload page * extracted data review page * audit findings page * downloadable audit report 10. Important design requirement Use hybrid architecture: * LLM only for extraction/classification * deterministic C# code for calculations and compliance logic Do NOT let AI decide pass/fail. All audit decisions must come from rule engine. Generate: * full project structure * Entity Framework models * API controllers * services * OCR integration * parsing engine * rule engine * SQLite migrations * sample test data * unit tests
A system prompt was added to support web rendering