6. Runtime View
Scenario 1: CRESI Calculation Flow
User Goal: Lender submits a valuation request and receives a sentiment-adjusted appraisal.
Sequence Diagram
Step-by-Step Breakdown
| Step | Component | Action | Duration | Error Handling |
|---|---|---|---|---|
| 1 | WebApp | User fills form, submits | <1s | Client-side validation |
| 2 | APIGateway | JWT validation, rate limit check | <50ms | 401 Unauthorized or 429 Too Many Requests |
| 3 | Smitty | Retrieve historical weights from Memory Bank | <100ms | Fallback to default weights |
| 4 | CRESI | Parallel fetch 6 layer data sources | <5s | Timeout 30s, fallback to cached data |
| 5 | CRESI | Normalize and weight layer scores | <100ms | N/A (deterministic calculation) |
| 6 | Smitty | Generate human-readable explanation | <500ms | Return raw scores if explanation fails |
| 7 | APIGateway | Async store valuation in Memory Bank | <200ms | Retry queue if DB unavailable |
| 8 | WebApp | Render results dashboard | <500ms | Retry button if render fails |
Total Latency: 6-10 seconds (target: <10s for 95th percentile)
Scenario 2: Weight Optimization (Nightly Batch)
Goal: Smitty learns from previous day's valuation outcomes to improve future predictions.
Sequence Diagram
Weight Update Logic
# Pseudocode for weight optimization
def optimize_weights(outcomes, current_weights, learning_rate=0.01):
mape = calculate_mape(outcomes)
for layer in ['macro', 'micro', 'geo', 'capital', 'demo', 'events']:
gradient = calculate_gradient(layer, outcomes)
new_weight = current_weights[layer] - learning_rate * gradient
# Constraints
new_weight = max(0.05, new_weight) # Minimum 5% weight
# Normalize to sum to 1.0
weights = normalize_weights(new_weights)
return weights
Outcome Data Requirements:
- Actual market outcome (sale price, lease rate, occupancy)
- Time between valuation and outcome (typically 3-12 months)
- Prediction confidence at time of valuation
MAPE Alert Thresholds:
- Green: MAPE < 5% (excellent)
- Yellow: MAPE 5-10% (acceptable)
- Red: MAPE > 10% (investigate layer data sources)
Scenario 3: Layer Data Fetch Timeout Handling
Problem: External API (e.g., CoStar) times out during CRESI calculation.
Sequence Diagram
Fallback Strategy:
| Data Freshness | Confidence Impact | Action |
|---|---|---|
| < 1 day | No impact (100%) | Use cached data as-is |
| 1-7 days | -10% confidence | Apply staleness discount |
| 7-30 days | -25% confidence | Warn user of stale data |
| > 30 days | Fail layer | Exclude layer from calculation, notify admin |
Circuit Breaker:
- After 3 consecutive timeouts: Mark API as degraded
- Switch to cache-only mode for 15 minutes
- Send PagerDuty alert to on-call engineer
- Auto-recovery after successful API call
Scenario 4: Explainable AI Report Generation
Goal: Generate regulatory-compliant explanation of how sentiment score was calculated.
Data Flow
Explanation Components
1. Layer Contribution Table:
Layer Score Weight Contribution Importance
───────────────────────────────────────────────────────────────────
Macro-Economic +15 0.25 +3.75 High
Micro-Economic -5 0.30 -1.50 High
Geopolitical +2 0.10 +0.20 Low
Capital Markets +20 0.20 +4.00 High
Demographics +8 0.10 +0.80 Medium
Current Events +5 0.05 +0.25 Low
───────────────────────────────────────────────────────────────────
FINAL SCORE: +7.50 (Bullish sentiment)
2. Plain English Narrative:
"The CREstimate.ai sentiment score for this Chicago office property is +7.5 (slightly bullish). This is driven primarily by strong capital markets conditions (investor appetite for office assets remains high) and positive macro-economic trends (GDP growth, declining interest rates). However, local micro-economic factors are negative due to rising vacancy rates in the Chicago CBD submarket. The model confidence is 82%, indicating high reliability of this prediction."
3. SHAP Values Visualization:
- Waterfall chart showing each layer's push/pull on final score
- Feature importance ranking
- Comparison to historical average for this asset type/location
4. Regulatory Compliance Metadata:
- Data sources cited (with timestamps)
- Model version and training date
- Weight optimization history
- Confidence interval calculation method
Performance Characteristics
Latency Targets
| Operation | Target | P95 | P99 | Notes |
|---|---|---|---|---|
| Full valuation | <10s | 8s | 12s | Includes all 6 layers |
| Single layer fetch | <2s | 1.5s | 3s | Individual API call |
| Weight optimization | <5min | 3min | 10min | Nightly batch |
| Explanation generation | <500ms | 400ms | 1s | Post-calculation |
| Cache lookup | <50ms | 30ms | 100ms | Redis in-memory |
Throughput Targets
| Metric | Target | Notes |
|---|---|---|
| Concurrent users | 100 | Per instance |
| Valuations/hour | 500 | Peak load |
| API requests/sec | 50 | Rate limit per client |
| Cache hit rate | >80% | For layer data |
Failure Modes
| Failure | Detection | Recovery | SLA Impact |
|---|---|---|---|
| Single layer timeout | 30s timeout | Use cached data | No impact if cache hit |
| All layers timeout | 3 consecutive failures | Circuit breaker, alert | Degraded service |
| Memory Bank unavailable | Health check failure | Queue valuations, retry | No immediate impact (async) |
| Weight optimizer crash | Cron job failure | Use previous weights | No immediate impact (daily batch) |
For component details, see Building Block View. For deployment infrastructure, see Deployment View.