# leerish/aml-risk-intelligence-platform architecture

> Architecture diagram of the GitHub repository leerish/aml-risk-intelligence-platform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/leerish/aml-risk-intelligence-platform
- Repository: https://github.com/leerish/aml-risk-intelligence-platform

## Overview

#### Purpose and Entry Points
This is a batch AML analytics pipeline that converts PaySim-style financial transactions into SQL Server warehouse tables and Power BI investigation/reporting views. Primary execution assets are the analytical notebook at `notebooks/AML-Analytics.ipynb`, the database loader at `src/data_to_sql.py`, and SQL warehouse logic in `sql/AML.sql`.

#### Source Data and Analytics Processing
Python/Pandas performs dataset preparation and derives customer- and transaction-level fraud signals. The notebook is the likely interactive development and analytics entry point; `src/data_to_sql.py` operationalizes loading processed outputs into SQL Server. Raw/processed data directories described in the README are not present in this tree, so input-data location is an external/runtime dependency.

#### Customer Risk Profiling
Customer behavior is aggregated into the `CustomerRisk` analytical model: transaction volume, frequency, average amount, fraud history/rate, and derived risk category/score. This customer-level entity is the primary boundary between raw transaction events and compliance-oriented case prioritization. Relevant implementation locations: `notebooks/AML-Analytics.ipynb`, `sql/AML.sql`.

#### Alert and High-Risk Detection
The pipeline creates an investigator-facing `AlertQueue` from risk-ranked customers and identifies suspicious, high-value transaction records in `HighRiskTransactions`. These stages reduce the broader customer/transaction population into a reviewable operational scope. Core logic is represented in `sql/AML.sql` and the analytics notebook at `notebooks/AML-Analytics.ipynb`.

#### Transaction and Trend Intelligence
Transaction-level aggregation produces `TransactionSummary`, including fraud concentration by channel/type, while time-series rollups produce `DailyTransactionMetrics` for fraud and alert trend monitoring. These warehouse-ready models support exposure analysis, anomaly/spike visibility, and dashboard filtering. Paths: `sql/AML.sql`, `notebooks/AML-Analytics.ipynb`.

#### Warehouse Boundary and Connectivity
Microsoft SQL Server is the persistent analytics warehouse and integration boundary between computation and BI. Python connects through SQLAlchemy and PyODBC; `src/data_to_sql.py` is the load boundary and `src/test_connection.py` provides connection validation. SQL-side transformations/schema definitions are centralized in `sql/AML.sql`.

#### Reporting and Runtime Environment
Power BI Desktop consumes the warehouse models through the packaged report at `dashboards/AML-Analtyics.pbix`; dashboard screenshots belong under `dashboards/screenshots`. The runtime is Python 3.10-oriented Conda with Pandas, SQLAlchemy, and PyODBC dependencies defined by `environment.yml` and `requirements.txt`. External services/infrastructure are the PaySim dataset source, a reachable SQL Server instance, and Power BI Desktop.

Main entry points: [`sql/AML.sql`](https://github.com/leerish/aml-risk-intelligence-platform/blob/main/sql/AML.sql) (Warehouse SQL logic), [`dashboards/AML-Analtyics.pbix`](https://github.com/leerish/aml-risk-intelligence-platform/blob/main/dashboards/AML-Analtyics.pbix) (AML Analytics report), [`notebooks/AML-Analytics.ipynb`](https://github.com/leerish/aml-risk-intelligence-platform/blob/main/notebooks/AML-Analytics.ipynb) (AML analytics notebook), [`src/data_to_sql.py`](https://github.com/leerish/aml-risk-intelligence-platform/blob/main/src/data_to_sql.py) (SQL loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_analytics["Analytics Processing"]
  node_notebook["AML analytics notebook<br/>Pandas analytics"]
  node_loader["SQL loader<br/>Python ETL<br/>[data_to_sql.py]"]
  node_connection_test["Connection validation<br/>Python utility<br/>[test_connection.py]"]
end

subgraph group_warehouse["SQL Server Warehouse"]
  node_sql_logic["Warehouse SQL logic<br/>SQL schema &amp; transforms<br/>[AML.sql]"]
  node_sql_server[("SQL Server<br/>analytics warehouse")]
  node_customer_risk["CustomerRisk<br/>customer risk model"]
  node_alert_queue["AlertQueue<br/>investigator queue"]
  node_high_risk_tx["HighRiskTransactions<br/>suspicious transaction model"]
  node_transaction_summary["TransactionSummary<br/>channel/type aggregation"]
  node_daily_metrics["DailyTransactionMetrics<br/>time-series model"]
end

subgraph group_reporting["Investigation &amp; Reporting"]
  node_power_bi["AML Analytics report<br/>Power BI report<br/>[AML-Analtyics.pbix]"]
end

node_paysim[("PaySim dataset<br/>external data source")]

node_paysim -->|"raw transactions"| node_notebook
node_notebook -->|"processed outputs"| node_loader
node_loader -->|"loads via SQLAlchemy/PyODBC"| node_sql_server
node_connection_test -.->|"validates connectivity"| node_sql_server
node_sql_logic -->|"defines and transforms"| node_sql_server
node_notebook -->|"derives risk signals"| node_customer_risk
node_sql_logic -->|"builds"| node_customer_risk
node_customer_risk -->|"risk-ranked customers"| node_alert_queue
node_sql_logic -->|"identifies"| node_high_risk_tx
node_sql_logic -->|"aggregates"| node_transaction_summary
node_sql_logic -->|"rolls up"| node_daily_metrics
node_sql_server -->|"warehouse connection"| node_power_bi
node_alert_queue -->|"case prioritization"| node_power_bi
node_high_risk_tx -->|"transaction investigation"| node_power_bi
node_transaction_summary -->|"exposure analysis"| node_power_bi
node_daily_metrics -->|"trend monitoring"| node_power_bi

click node_notebook "https://github.com/leerish/aml-risk-intelligence-platform/blob/main/notebooks/AML-Analytics.ipynb"
click node_loader "https://github.com/leerish/aml-risk-intelligence-platform/blob/main/src/data_to_sql.py"
click node_connection_test "https://github.com/leerish/aml-risk-intelligence-platform/blob/main/src/test_connection.py"
click node_sql_logic "https://github.com/leerish/aml-risk-intelligence-platform/blob/main/sql/AML.sql"
click node_power_bi "https://github.com/leerish/aml-risk-intelligence-platform/blob/main/dashboards/AML-Analtyics.pbix"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_notebook,node_loader,node_connection_test toneBlue
class node_sql_logic,node_sql_server,node_customer_risk,node_alert_queue,node_high_risk_tx,node_transaction_summary,node_daily_metrics toneAmber
class node_power_bi toneMint
class node_paysim toneNeutral
```

## Components

### Analytics Processing

- [AML analytics notebook](https://github.com/leerish/aml-risk-intelligence-platform/blob/main/notebooks/AML-Analytics.ipynb): Pandas analytics · Interactive preparation and fraud-signal development entry point. · `notebooks/AML-Analytics.ipynb`
- [SQL loader](https://github.com/leerish/aml-risk-intelligence-platform/blob/main/src/data_to_sql.py): Python ETL · Operational boundary that loads processed outputs through SQLAlchemy and PyODBC. · `src/data_to_sql.py`
- [Connection validation](https://github.com/leerish/aml-risk-intelligence-platform/blob/main/src/test_connection.py): Python utility · `src/test_connection.py`

### SQL Server Warehouse

- [Warehouse SQL logic](https://github.com/leerish/aml-risk-intelligence-platform/blob/main/sql/AML.sql): SQL schema & transforms · Centralized warehouse definitions and SQL-side transformations. · `sql/AML.sql`
- **SQL Server**: analytics warehouse · Persistent integration boundary between analytics and BI.
- **CustomerRisk**: customer risk model · Customer behavior, fraud history, and derived risk score/category.
- **AlertQueue**: investigator queue · Risk-ranked customers reduced to a reviewable scope.
- **HighRiskTransactions**: suspicious transaction model · High-value suspicious transactions for investigation.
- **TransactionSummary**: channel/type aggregation · Fraud concentration by transaction channel and type.
- **DailyTransactionMetrics**: time-series model · Daily fraud and alert trends for spike monitoring.

### Investigation & Reporting

- [AML Analytics report](https://github.com/leerish/aml-risk-intelligence-platform/blob/main/dashboards/AML-Analtyics.pbix): Power BI report · Investigation and reporting views over warehouse models. · `dashboards/AML-Analtyics.pbix`

### Other components

- **PaySim dataset**: external data source · Runtime dependency; source files are outside the repository.

## Connections

- PaySim dataset → AML analytics notebook: raw transactions
- AML analytics notebook → SQL loader: processed outputs
- SQL loader → SQL Server: loads via SQLAlchemy/PyODBC
- Connection validation → SQL Server: validates connectivity
- Warehouse SQL logic → SQL Server: defines and transforms
- AML analytics notebook → CustomerRisk: derives risk signals
- Warehouse SQL logic → CustomerRisk: builds
- CustomerRisk → AlertQueue: risk-ranked customers
- Warehouse SQL logic → HighRiskTransactions: identifies
- Warehouse SQL logic → TransactionSummary: aggregates
- Warehouse SQL logic → DailyTransactionMetrics: rolls up
- SQL Server → AML Analytics report: warehouse connection
- AlertQueue → AML Analytics report: case prioritization
- HighRiskTransactions → AML Analytics report: transaction investigation
- TransactionSummary → AML Analytics report: exposure analysis
- DailyTransactionMetrics → AML Analytics report: trend monitoring
