AI-powered merchant intelligence copilot for a pan-African fintech — Python, Streamlit, Gemini tool-calling, custom router architecture, full test suite.
# AMIC — AxonPay Merchant Intelligence Copilot
Internal analytics + conversational copilot for AxonPay's Relationship Managers and
Credit Officers. Part of the same AxonPay universe as the Customer Churn Predictor —
same 4 markets, same currency/FX conventions.
## Architecture (router-based SPA, not Streamlit's native multipage)
```
app.py # Entry point — the ONLY file calling st.set_page_config/apply_theme
router.py # Central router — session-state-based navigation, sidebar order
views/
home.py # Dashboard landing
portfolio.py # Portfolio Overview — the only view with sidebar filters
merchant_explorer.py # Search-first merchant drill-down
cash_flow_forecast.py # Rolling avg + linear trend forecasting
copilot.py # AI chat, suggested prompts, dedicated tools
core/
data_loader.py # All data access — unchanged by this refactor
tools.py # LLM tool-calling layer — unchanged
copilot.py # Agent loop — unchanged
forecasting.py # Forecasting logic — unchanged
theme.py # Design tokens + global CSS
components.py # Reusable UI design system
exceptions.py / logging_config.py
scripts/ # Data generation + cleaning pipeline — unchanged
tests/
data/
assets/
```
**There is deliberately no `pages/` directory.** Streamlit auto-generates multipage
navigation from a `pages/` folder, and that auto-generated nav rendered above the brand
logo with no supported way to reorder it. Removing `pages/` and routing everything
through `st.session_state` (see `router.py`) is what makes the required
**Logo → Navigation → Filters** sidebar order possible at all — every other approach
would have meant fighting Streamlit's own layout with brittle CSS instead of just not
triggering it in the first place.
## Design System
`core/components.py` is the single source of reusable UI atoms — `page_header()`,
`card_container()`, `render_kp …