Complete index of CreditAI system technical documentation.
Also see: CONTRIBUTING.md · License & support · LLM OpenAI-compatible · llms.txt · version version.txt
ARCHITECTURE.md ⭐ Start here!
System overview in 3 levels:
- Application layers
- Simplified pipeline
- Main components (11 modules)
- Complete tech stack
- Design patterns
- Quality characteristics
Ideal for: Developers new to the project, architects, tech leads
architecture-pipeline.md 🔧 Complete technical documentation
Detailed decision pipeline phase by phase:
- INTAKE - Request reception
- REGULATORY - CRC/CIRBE
- EXTERNAL DATA - 11 data providers
- AI AGENTS - 6 specialized agents
- FEATURE ENGINEERING - Vector construction
- ML SCORING - Probability of default
- SOLVENCY - F1-F5 rules
- NARRATIVE AI - Local LLM
- DECISION - Consolidation and audit
Also includes:
- Manual Data Entry Pipeline
- Document Processing Pipeline (OCR + AI)
- Early Warning System
- Model Risk Management
- State diagram
- Folder structure
Ideal for: Developers implementing features, QA, DevOps
pipeline-diagram.mmd 📊 Visual diagram
Mermaid diagram of complete pipeline flow.
How to visualize:
- Copy content to mermaid.live
- Or use Mermaid extension in VS Code
- Or GitHub/GitLab render automatically
Ideal for: Presentations, onboarding, executive documentation
Configuration of all external integrations:
Regulatory:
- CRC (Banco de Portugal)
- CIRBE (Banco de España)
Data Providers:
- Yapily (Open Banking)
- Orbis / SABI (Financial)
- IES (Fiscal)
- Creditsafe (Credit)
- Moody's EDF (Risk)
- ESG (Sustainability)
- World-Check (AML)
- Citius (Judicial - manual only)
Includes:
- Modes: Stub vs Production
- Secrets configuration (Key Vault)
- Health checks
- Fallback policies
Ideal for: DevOps, environment configuration
document-processing.md 🆕 OCR + AI System
Complete guide for upload and automatic extraction system:
Features:
- PDF, PNG, JPG, TIFF upload
- OCR with Tesseract
- AI Parsing via OpenAI-compatible LLM
- Structured field extraction
- Integration with manual entry
Content:
- Architecture (TesseractOcrService + OpenAI-compatible LLM parsing)
- API endpoints (
/api/documents) - Supported formats
- Data sources (11 types)
- Configuration (Tesseract +
Llm:*/ ContextMemory) - Best practices
- Troubleshooting
Ideal for: Analysts (usage), developers (implementation)
- Analyst accesses Web UI → Login
- Menu "Requests" → "New Request"
- Fill form (applicant, amount, term)
- Submit → Automatic pipeline starts
- If manual data needed → notification
- Analyst fills form OR uploads document
- Pipeline resumes → decision generated
- Supervisor reviews → approves/rejects
- Audit log recorded → continuous monitoring
- Analyst has PDF/image document
- API POST
/api/documents/{requestId}/process - System executes OCR (Tesseract)
- LLM extracts fields (
POST /v1/chat/completions) - Returns JSON with structured fields
- Analyst reviews extracted fields
- Submits to manual entry
- Pipeline resumes automatically
- Credit approved and disbursed
- Background job executes every 60 min
- Re-queries CRC/CIRBE
- Re-calculates current score
- Detects degradation (PSI, PD, incidents)
- Creates alert if necessary
- Analyst reviews alert
- Decides action (continuous monitoring)
- Location:
tests/CreditAI.IntegrationTests/ - Total: 95 tests (6 new document processing)
- Coverage: >80% of critical pipeline
Main suites:
PipelineIntegrationTests- End-to-end pipelineIberianExpansionIntegrationTests- CRC/CIRBE routingCitiusManualDataIntegrationTests- Judicial dataDocumentProcessingIntegrationTests- OCR + AI parsingOperationalHealthTests- Health checksManualDataTests- Robust fallback
Execute:
dotnet test tests/CreditAI.IntegrationTests/- Location:
tests/CreditAI.ArchitectureTests/ - Validates dependency rules between layers
- Ensures Clean Architecture
- Development: ASP.NET Identity (local)
- Production: Entra ID (Azure AD)
- Roles: Analyst, Supervisor, Admin
- Policies: CreditRead, CreditWrite
- F1: High risk blocks (PD, incidents, sanctions)
- F2: Income/capacity validation
- F3: Structural checks
- F4: Market/sector risks
- F5: Model governance (PSI, approval)
- Immutable audit log (SHA-256 hash chain)
- Each action recorded with timestamp + actor
- Export: CSV, JSON
- Verifiable integrity
- On-premise LLM (
Llm:*or ContextMemory) + Tesseract - Zero data leakage to cloud
- GDPR compliant
- Tenant isolation (PostgreSQL RLS)
Development:
dotnet run --project src/CreditAI.Web
dotnet run --project src/CreditAI.APIProduction (Docker):
docker build -t creditai-api -f Dockerfile.api .
docker build -t creditai-web -f Dockerfile.web .
docker compose up -d# Create new migration
dotnet ef migrations add MigrationName \
-p src/CreditAI.Infrastructure \
-s src/CreditAI.API
# Apply to database
dotnet ef database update \
-p src/CreditAI.Infrastructure \
-s src/CreditAI.API# API
curl https://localhost:7257/health
# Integrations
curl https://localhost:7257/api/ops/health- Structured logging (JSON)
- Application Insights (optional)
- Correlation IDs for tracing
- Home: General KPIs, alerts, recent requests
- Requests: Request list, filters, status
- Manual Data: Pending data queue
- Model Registry: Models by segment, backtesting
- Risk Dashboard: PSI, drift, early warnings
- Audit Log: Search, export
- Pipeline: Average latency, throughput, success rate
- ML Models: AUC, Gini, Brier, PSI
- Data Quality: Completeness, freshness
- Early Warning: Alerts by severity
- Manual Data: Fallback rate, resolution time
Cause: API integration failed
Solution: Analyst fills manual form or uploads document
Cause: Encrypted document or low quality
Solution: Convert to high-resolution PNG, verify quality
Cause: Unknown document format
Solution: Direct manual entry, adjust prompt if necessary
Cause: Outdated model or drift
Solution: Check Model Registry, backtesting, PSI
Cause: Background job not running
Solution: Check EarlyWarningBatchHostedService logs
- The Clean Architecture - Uncle Bob
- Domain-Driven Design (DDD)
- SHAP (SHapley Additive exPlanations)
- ONNX Runtime
- ML.NET
- Banco de Portugal - Instrução 32/2018
- EBA Guidelines on ML/AI
- Basel III - Credit Risk
- LLM OpenAI-compatible — vLLM/ContextMemory
- Tesseract OCR
- ImageSharp
- ✅ Complete decision pipeline
- ✅ 11 integrations (Stub + Production modes)
- ✅ 6 AI Agents
- ✅ ML Scoring + SHAP
- ✅ Manual data entry
- ✅ OCR + AI document parsing
- ✅ Early Warning System
- ✅ Model Risk Management
- ✅ Immutable audit log
- 🔄 Azure Document Intelligence (advanced OCR)
- 🔄 Structured table extraction
- 🔄 Automatic document classification
- 🔄 Blazor interface for drag-and-drop upload
- 🔄 Multi-language (ES, EN, FR)
- 🔄 Signature recognition
- 🔄 Executive dashboard (BI)
- 🔄 API webhooks for external integrations
Before contributing, read:
- ARCHITECTURE.md - Understand the system
- architecture-pipeline.md - Technical details
- Existing code - Follow established patterns
- Tests - Create tests for new features
Pull Requests:
- Follow Clean Architecture
- Add integration tests
- Update relevant documentation
- Follow .NET conventions (EditorConfig)
- Issues: Create issue in repository
- Documentation: Consult docs/ folder
- Logs: Check Application Insights or local logs
- Health: Endpoint
/healthfor status
CreditAI v1.0 - AI-powered Credit Analysis System
© 2026 - Developed with .NET 9, Blazor, PostgreSQL, OpenAI-compatible LLM and ML.NET