Smartrouter AI/ML Integration
Scoping and effort estimation for integrating Athia's AI/ML platform into Deuna's payment routing service. No implementation in this phase — the goal is a clear, detailed effort estimate before committing to delivery.
Purpose
Assess the effort required to integrate Athia AI/ML into Deuna's payment routing. Produce a clear work breakdown and estimate before any implementation begins.
Phase 0 Deliverables
- Full schema & data understanding
- Effort estimate per workstream
- Risks and open questions resolved
- Recommended build order
Long-Term Success
- Measurable approval lift
- Stability during PSP outages
- Latency: p95 < 200ms
- Closed feedback/learning loop
✅ In Scope (Phase 0)
- Understand Deuna's data, schema, routing rules
- Assess Athia platform gaps vs. what's needed
- Size effort for P-01 through P-05 use cases
- Identify all dependencies, blockers, risks
🚫 Out of Scope (Phase 0)
- Any implementation or code delivery
- 3DS optimization (Phase 2)
- User-facing messaging (Phase 3)
- Installment optimization
Phase 0 — Assess Level of Effort In Progress
2 days · $6K budget · Started 2026-02-18
Nail down all the work required. Produce a detailed estimate with confidence before committing to delivery.
Phase 1 — Model in Production Pending
2 weeks · Core delivery
Model running in production for 2 processors with basic feature store. Target merchant: Volaris.
Phase 2 — Monitoring + Experimentation Pending
Week 3 · Add monitoring and integrate with A/B experimentation infrastructure.
Phase 3 — Drift Detection, CI/CD, Ramp-Up Pending
TBD · Drift detection, CI/CD pipeline, experiment ramp-up, additional model techniques.
| Name | Role |
|---|---|
| Pablo | CTO — Executive Sponsor |
| Israel | Data POC — Snowflake & Data Access |
| Farhan | Claude / LLM Access POC |
| Mark Walick | Product Management Lead |
| Name | Role |
|---|---|
| Rakesh | Engineering Lead |
| Naoki | Engineer |
Phase 1 Target Merchant: Volaris Decided 2026-02-19
Volaris selected over Cinépolis. Known PSPs: Worldpay (ID: 76), MIT (ID: 85), Elavon (cards), Amex (Amex cards) — 4 processors total with routing policies per currency. Cinépolis deferred: only shows Cybersource (a gateway), actual processor unknown.
Outage Detection & Failover
Detect PSP failures via persistent timeout codes. Auto fail-over and fail-back using random sampling of downed PSP to detect recovery.
Routing Optimizer
Optimize Deuna's existing static routing rules based on historical outcomes. Build on existing rules engine rather than starting from scratch.
Per-Transaction Route Selection
Rank top 3 payment processors per transaction in real time based on prior outcomes, card signals, and merchant context.
Message Manipulation
Toggle CIT/MIT, AVS, MCC variables in authorization request messages. Provide top 3 configuration recommendations per transaction.
Retry Optimization
Optimize when, how, and where to retry declined transactions. MIT/subs focused. Enterprise darktime reduction. Delayed retry based on processor reputation.
Connection
VLTAXPW-RMONTES
Database: PAYMENT_ML
Access: Read-only
ABTESTING Schema
Denormalized flat join of all views. Best starting point for EDA. No complex joins needed.
ALL_VIEWS_FLAT ALL_PAYMENT_EVENTS_FLAT
SOURCES Schema
15 clean views: orders, payments, attempts, events, user profiles, routing logs, merchant rules, airline data.
| View | Why It Matters | Use Cases |
|---|---|---|
VW_ATHENA_PAYMENT_ATTEMPT | Full retry chain per payment; processor, error codes, hard/soft decline, DYNAMIC_ROUTING_DETAIL JSON | P-03 P-05 |
VW_SMART_ROUTING_ATTEMPTS | Live routing engine log: algorithm type, latency, skip reasons — direct latency signal for p95 <200ms | P-01 P-02 |
VW_ROUTING_MERCHANT_RULE | Existing static rules engine — foundation for routing optimizer. SHADOW_MODE column suggests testing infrastructure exists. | P-02 |
ABTESTING.ALL_VIEWS_FLAT | Everything joined in one table — best for initial EDA | EDA |
| Feature Group | Key Columns | Use |
|---|---|---|
| Retry history | NUM_ATTEMPTS_ORDER, PREVIOUS_ORDER_ERROR_CODE, AVG_SEC_BETWEEN_PAYMENT_ATTEMPS | P-05 |
| Error signals | ERROR_CODE, ERROR_CATEGORY, HARD_SOFT | P-03, P-05 |
| Card signals | CARD_BIN, CARD_BRAND, BANK, CARD_COUNTRY | P-03 |
| User behavior | TARGET_USER_FRAUD_RATE_COHORT, TOTA_MINUTES_BROWSING, RFM values | P-03 |
| Message config | MCI_MSI_TYPE, ORDER_MCI_MSI_TYPE, PAYMENT_ATTEMPT_METHOD_TYPE | P-04 |
| Geo & Device | ORDER_COUNTRY_CODE, TARGET_USER_BROWSER, TARGET_USER_DEVICE | P-03 |
DATA-Athena-Snowflake
github.com/DUNA-E-Commmerce/DATA-Athena-Snowflake
⚠️ Key Finding
This is an LLM-powered analytics platform, not a training platform. It generates strategies via GPT-4o / Claude — it does not train ML models. All pattern detection uses hardcoded thresholds, not learned parameters.
What's Implemented
| Workflow | Status |
|---|---|
| Acceptance rate analysis | Done |
| Fraud card analysis | Done |
| Metrics anomaly detection | Done |
| Chatbot / data analyst | Done |
| Strategy generation director | Partial |
| Cost optimization | Early stage |
| Retry optimization | Missing |
Gaps Found
- No retry-specific workflow (P-05 gap)
- Strategy Director matcher has
exit()placeholder - Ranker node uses dummy prompts
- All thresholds hardcoded — no adaptive learning
- Limited error recovery / circuit breakers
🧪 Testing Coverage
| Layer | Coverage | Notes |
|---|---|---|
| Metrics layer | 70–80% | Well tested — 5 files |
| Deployment / config | 50–60% | Validation tests solid |
| Deep-dive utilities | 40–50% | Pareto, metric router, comparator |
| Route handlers (14) | 0% | Completely untested |
| Services (13) | 0% | Completely untested |
| Clients (Redis, Postgres) | 0% | Completely untested |
| Multi-agent core + 11 branches | ~5% | 1 manual test — not in pytest |
| Lambda / AgentCore entrypoints | 0% | 4 entrypoints — no tests |
Maturity: 2/5 — Immature. Only peripheral layers tested. The core product (multi-agent workflows) is essentially a black box — changes break silently. CI runs only isolated metrics + deployment tests, not the full suite.
athena-platform
github.com/DUNA-E-Commmerce/athena-platform
✅ Key Finding
This is a production-ready ML serving + A/B testing platform. Model registry, experiment management, and auto-winner selection are all built. The only missing piece is the automated training pipeline.
ML Inference Types (already in registry)
| Type | Maps To |
|---|---|
processor_selector | P-03 |
retry_predictor | P-05 |
retry_sequence | P-05 |
installment_optimizer | Out of scope |
Snowflake Tables
| Table | Status |
|---|---|
ATHIA_PREDICTIONS | Active |
ATHIA_FEEDBACK | Active |
ATHIA_TRAINING_DATASET | Active |
ATHIA_EXPERIMENT_LIFT | Active |
ATHIA_STAGE_OUTCOMES | Not deployed |
ATHIA_SESSION_SUMMARY | Not deployed |
A/B Experimentation — Auto-Winner Guardrails
Stats
p-value < 0.05
Min 1000 samples/variant
Min 7 days runtime
Lift
Min 1% absolute lift
Deterministic bucketing
SHA256(transaction_id)
Guardrails
≤10% latency regression
≥−5% revenue regression
Dry-run mode (safe default)
🧪 Testing Coverage
| Layer | Coverage | Notes |
|---|---|---|
| Domain services (44) | 44/44 | All have test files |
| Repositories (43) | ~43/43 | In-memory SQLite isolation |
| V1 REST handlers (18) | 15/18 (83%) | agent, workspaces, elements missing |
| Auth middleware | Tested | JWT + API key covered |
| V2 REST handlers (18) | 0/18 (0%) | Entire new API version untested |
| Bedrock client | 0% | Excluded from coverage config |
| auth, bedrock, element, workspace services | 0% | 4 domain services with no tests |
| Bootstrap / DI graph | Skipped | TODO: testcontainers |
Maturity: 3.5/5 — Solid foundation with a critical blind spot. Domain and repository layers well covered. V2 API (18 handlers) and Bedrock ML inference path are completely untested. CI threshold is only 20% and internal/clients/ is excluded from coverage entirely.
Testing Comparison — Both Repos
| Metric | DATA-Athena-Snowflake | athena-platform |
|---|---|---|
| Test functions | 421 | 777 |
| Test files | 28 | 126 |
| Est. coverage | ~18% | ~25–30% |
| Core product tested? | No — multi-agent core untested | Partial — V2 + Bedrock missing |
| CI enforced? | Partial (fragmented) | Yes — every PR |
| Coverage threshold | None enforced | 20% (too low; target: 65%) |
| Maturity | 2/5 — Immature | 3.5/5 — Functional |
Timeline (2 engineers)
Full delivery: 12–13 weeks
MVP (Stages 1–2 only): 5–6 weeks
1 engineer: ~21 weeks
Build Order
Stage 1 must complete before Stage 2. Stages 3–5 can overlap with late Stage 2.
Total Effort
~104.5d
100 tasks across 5 stages
| Stage | Gap | Category | Priority | Effort | Status |
|---|---|---|---|---|---|
| 1 – Foundation | G-02 Orchestration | Infrastructure | High | 8d | Not started |
| 1 – Foundation | G-08 Feature Store | ML Infra | High | 13.5d | Not started |
| 1 – Foundation | G-04 Data Validation | Data Quality | High | 7d | Not started |
| 2 – Automation | G-03 CI/CD Pipeline | DevOps | High | 9d | Not started |
| 2 – Automation | G-06 Deployment Automation | Automation | High | 7.5d | Not started |
| 2 – Automation | G-07 Model Registration | Automation | Medium | 5.5d | Not started |
| 2 – Automation | G-01 Automated Retraining | Automation | High | 10d | Not started |
| 3 – Governance | G-13 Versioning Workflow | Governance | High | 5d | Not started |
| 3 – Governance | G-10 Lineage Tracking | Governance | Medium | 6.5d | Not started |
| 3 – Governance | G-14 Rollback Capability | Reliability | High | 5d | Not started |
| 4 – Observability | G-05 Model Monitoring | Observability | High | 8d | Not started |
| 4 – Observability | G-09 Drift Detection | Observability | Medium | 7d | Not started |
| 5 – ML Quality | G-11 Hyperparameter Tuning | ML Quality | Medium | 5.5d | Not started |
| 5 – ML Quality | G-12 Algorithm Comparison | ML Quality | Medium | 7d | Not started |
Are ATHIA_PREDICTIONS / ATHIA_FEEDBACK tables populated in Deuna's Snowflake today?
Or only in Athia's internal environment? — Ask Israel
Are SageMaker endpoints live for processor_selector / retry_predictor?
Or are they placeholders only? — Rakesh to confirm
Is there a live model in MODEL_ARTIFACTS that Deuna's payment service is calling today?
Rakesh to confirm
What is the current payment volume through the routing engine?
Minimum 1,000 transactions per variant needed for A/B test statistical validity — Ask Israel
Who owns the athena-platform Go repo deployments?
Aidaptive or Deuna infra? Affects Phase 1 deployment planning — Clarify with Pablo
| Item | Owner | Status |
|---|---|---|
| Snowflake access — Rakesh | Israel (Deuna) | ✓ Done (2026-02-18) |
| Snowflake access — Naoki | Rakesh + Naoki | ✓ Done (2026-02-19) |
| Code / repo access — Rakesh | Pablo (Deuna) | ✓ Done (2026-02-19) |
| Claude / LLM access & budget | Pablo → Farhan | ✓ Done (2026-02-19) |
| Code / repo access — Naoki | TBD | Pending |
| Deuna corp accounts — Rakesh & Naoki | TBD | Pending |
| Claude Code credits — Rakesh & Naoki | — | Not needed |
| Deploy ATHIA_STAGE_OUTCOMES + ATHIA_SESSION_SUMMARY in Snowflake | Rakesh | Pending |
| Build retry_optimization_requested workflow | Rakesh | Pending |
| Date | Decision | Rationale | Made By |
|---|---|---|---|
| 2026-02-18 | Latency target updated: p95 <50ms → p95 <200ms | Revised from original SOW spec | Rakesh (w/ Pablo) |
| 2026-02-19 | Phase 1 target merchant set to Volaris (not Cinépolis) | Volaris has known PSPs (Worldpay ID:76, MIT ID:85, Elavon, Amex); Cinépolis only shows Cybersource gateway — processor unknown | Mark Walick |
| Version | Date | Notes | Download |
|---|---|---|---|
| v13 Latest | 2026-02-19 | Added testing coverage & architecture deep-dive for both repos | 📄 Open |
| v12 | 2026-02-19 | Latest export | 📄 Open |
| v11 | 2026-02-19 | Updated access status (Snowflake done for both, Claude LLM done), Volaris merchant decision, follow-up action items | 📄 Open |
| v10 | 2026-02-19 | Added full repo analysis: DATA-Athena-Snowflake + athena-platform findings, updated open questions | 📄 Open |
| v9 | 2026-02-18 | Added Next Steps section | 📄 Open |
| v8 | 2026-02-18 | Refocused Phase 0 as assessment-only with clear deliverables | 📄 Open |
| v7 | 2026-02-18 | Latest snapshot with improved formatting | 📄 Open |
| v6 | 2026-02-18 | Improved table formatting — fixed column overlaps | 📄 Open |
| v5 | 2026-02-18 | Updated project purpose to reflect scoping nature | 📄 Open |
| v4 | 2026-02-18 | Self-contained: includes project plan + teams + schema | 📄 Open |
| v3 | 2026-02-18 | Updated with TEAMS.md reference, Mark Walick correction | 📄 Open |
| v2 | 2026-02-18 | Updated with schema notes, stakeholders, todos | 📄 Open |
| v1 | 2026-02-18 | Initial export | 📄 Open |