Mobile chat interface with conversational AI
onMessageSend() → Triggers API call to /api/v1/applications/intentonQuickAction() → Auto-fills input field with pre-defined textonEditIntent() → Opens modal for manual correctiononConfirmIntent() → Saves intent and navigates to CM02RESTful endpoint for intent capture and processing
/api/v1/applications/intentPOST /api/v1/applications/intent Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... Content-Type: application/json { "session_id": "sess_cm01_user123_20251222_143022", "user_id": "usr_olivia_thompson", "message": "I need £150,000 to expand my café to a second location in Manchester", "timestamp": "2025-12-22T14:30:22Z", "device_info": { "type": "mobile", "os": "iOS 17.2", "app_version": "2.4.1" } }
{
"request_id": "req_cm01_20251222_143023",
"status": "success",
"intent": {
"loan_amount": 150000,
"loan_amount_formatted": "£150,000",
"loan_purpose": "Business expansion - second location",
"business_context": "Café/restaurant business expanding to Manchester",
"location": "Manchester",
"use_case_category": "expansion"
},
"confidence": 0.95,
"confidence_breakdown": {
"amount_extraction": 0.98,
"purpose_detection": 0.96,
"context_understanding": 0.92
},
"next_steps": {
"action": "review_financial_data",
"screen": "CM02"
},
"processing_time_ms": 847,
"timestamp": "2025-12-22T14:30:23Z"
}
AI-powered intent analysis and natural language understanding
// Intent Analyzer Processing Pipeline 1. Text Preprocessing - Convert to lowercase - Remove special characters - Tokenization 2. Named Entity Recognition (NER) - Extract monetary amounts (£, GBP, pounds) - Identify business types (café, restaurant, shop) - Detect locations (Manchester, London, etc.) - Find time indicators (expanding, need, require) 3. Intent Classification - Loan purpose: [expansion, working_capital, equipment, property, refinancing] - Urgency: [immediate, planned, exploring] - Business stage: [startup, growth, established] 4. Confidence Scoring - Amount extraction confidence - Purpose detection confidence - Context understanding confidence - Combined weighted score 5. Structured Output Generation - Format extracted data into JSON - Add metadata and timestamps - Return to API layer
// Weighted confidence score confidence_score = ( amount_confidence × 0.40 + // Most critical purpose_confidence × 0.35 + // Very important context_confidence × 0.25 // Supporting detail ) // Example calculation: amount: 0.98 × 0.40 = 0.392 purpose: 0.96 × 0.35 = 0.336 context: 0.92 × 0.25 = 0.230 TOTAL: 0.958 (95.8%)
API Gateway, session management, and request routing
KEY: session:sess_cm01_user123_20251222_143022 VALUE: { "user_id": "usr_olivia_thompson", "screen": "CM01", "started_at": "2025-12-22T14:30:00Z", "last_activity": "2025-12-22T14:30:23Z", "conversation_history": [ {"role": "assistant", "message": "Hello! What brings you here?"}, {"role": "user", "message": "I need £150k..."} ], "device": {"type": "mobile", "os": "iOS"} } TTL: 1800 seconds (30 min)
Third-party services and APIs
Database operations and storage
INSERT INTO applications ( application_id, user_id, status, loan_amount, loan_purpose, business_context, confidence_score, session_id, created_at, updated_at ) VALUES ( 'app_20251222_143023_usr123', 'usr_olivia_thompson', 'intent_captured', 150000, 'Business expansion - second location', 'Café/restaurant business expanding to Manchester', 0.95, 'sess_cm01_user123_20251222_143022', '2025-12-22 14:30:23', '2025-12-22 14:30:23' );
{
"log_id": "log_cm01_20251222_143023",
"event_type": "intent_captured",
"screen": "CM01",
"user_id": "usr_olivia_thompson",
"application_id": "app_20251222_143023_usr123",
"timestamp": "2025-12-22T14:30:23Z",
"details": {
"raw_message": "I need £150,000 to expand my café...",
"extracted_intent": {
"amount": 150000,
"purpose": "expansion"
},
"confidence": 0.95,
"ai_agent": "Intent Analyzer v2.4",
"processing_time_ms": 847
},
"ip_address": "203.0.113.42",
"user_agent": "AINA-Mobile/2.4.1 (iOS 17.2)"
}
Total Processing Time: ~1.2 seconds (800ms AI + 400ms database/network)
AI unable to extract clear intent from user message
AI processing takes too long or service unavailable
Extracted amount outside acceptable range (£5K-£5M)
User sends too many requests in short time
Invalid or expired JWT token
Unable to save application record
User submits without typing anything
User types excessive text
| Field Name | Data Type | Description | Example Value |
|---|---|---|---|
| application_id | VARCHAR(50) | Primary key, unique identifier | app_20251222_143023_usr123 |
| user_id | VARCHAR(50) | Foreign key to users table | usr_olivia_thompson |
| status | ENUM | Application stage indicator | intent_captured |
| loan_amount | DECIMAL(12,2) | Requested loan amount in GBP | 150000.00 |
| loan_purpose | TEXT | Extracted purpose description | Business expansion - second location |
| business_context | TEXT | Additional business details | Café/restaurant business expanding to Manchester |
| confidence_score | DECIMAL(3,2) | AI confidence (0.00-1.00) | 0.95 |
| session_id | VARCHAR(100) | User session identifier | sess_cm01_user123_20251222_143022 |
| created_at | TIMESTAMP | Record creation time (UTC) | 2025-12-22 14:30:23 |
| updated_at | TIMESTAMP | Last update time (UTC) | 2025-12-22 14:30:23 |