# Financial Anomaly Detection

<figure><img src="/files/fCIC4riFG3SpXjUAiG29" alt=""><figcaption></figcaption></figure>

## Project Overview

This project demonstrates how to use Gaio DataOS to build an application that detects financial anomalies based on given financial transaction information.

Using this application, users are able to:

* Import financial transaction data
* Detect, classify, and view analytics&#x20;
* Insights regarding financial anomalies within their transactions.

***

## Development Steps

### 1. Data Extraction

<figure><img src="/files/0zMXdH4Z02WUBezxkcDL" alt=""><figcaption></figcaption></figure>

* Connects to **ClickHouse Cloud** or imports **CSV**
* Uses builder tasks in Gaio to:
  * Import data
  * Clean and transform data
* The import process ends in the flat table tb\_financial\_anomaly

***

### 2. Anomaly Detection

<figure><img src="/files/6MyzYM2Jhs4O4n2TRDzy" alt=""><figcaption></figcaption></figure>

Detection logic is split into SQL builders to identify:

* `Large Expense`
* `Duplicate Transaction`
* `After Hours Transaction`
* `Repeat Reimbursement`
* `Revenue Spike`
* `Refund Surge`

Each detected anomaly receives:

* A **severity score**
* A unique **`anomaly_id`**
* Enriched metadata

> 💡 **Note:** If multiple anomalies occur in the same transaction, each one receives a different `anomaly_id`.

Final consolidation into: **`detected_anomalies`**

***

### &#x20;3. Dashboards and Interfaces

#### 3.1 Suspicious Transactions Monitor

<figure><img src="/files/tDC43Ztc6lgm92w738Ie" alt=""><figcaption></figcaption></figure>

* Uses the detected\_anomalies and anomaly\_classification\_history tables.
* Analytics like count of anomalies, number of each classification type, and distribution of anomaly severity are created using Report tasks and displayed on the dashboard
* A set of filters is created using the Form task to allow a user to filter by date, transaction type, sector, category, and payment type
* There is also a flat table that shows most recent classifications and a table showing all anomalies that need to be classified
* Using the anomalies awaiting classification table, users can classify an anomaly or view more specific anomaly details by clicking on its ID.

***

#### 3.2 Anomaly Classification

<figure><img src="/files/LKVsmx829ncZEHsd6cKB" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/IvYyt3vQtSmVoyESk3rF" alt=""><figcaption></figcaption></figure>

* By clicking the leftmost icon in the anomalies awaiting classification table, users can classify an anomaly using the form task
* Some fields in the form will auto-complete with information from the chosen anomaly using parameters
* When the Form is submitted, the Update Anomaly Classification process will run, this process is comprised of two major parts:
  * Update task edits the current anomaly row in the detected\_anomalies table
  * Incremental builder task adds a new row with the anomaly and classification to the anomaly\_classification\_history table

***

#### 3.3 Anomaly Details

<figure><img src="/files/L6nzISq4ClgBAGNLH2yw" alt=""><figcaption></figcaption></figure>

* Clicking an `anomaly_id` opens a **dedicated dashboard**
* Tables used:
  * `detected_anomalies`
  * `tb_financial_anomaly`
* Uses parameters for dynamic filtering

Includes:

* Risk level card
* Insights based on anomaly type
* Charts:
  * Line chart (monthly averages)
  * Bar (by sector, category)
  * Pie (by customer/vendor)
* Transaction history table
* Styled using **HTML & CSS**

***

#### 3.4 Confirmed and Under Investigation Dashboards

<figure><img src="/files/lUpnxL5mfabXVXVxg6Q9" alt=""><figcaption></figcaption></figure>

* Two dedicated dashboards using `detected_anomalies`
* Show:
  * Confirmed anomalies
  * Pending anomalies
* Built with **Report Task**

***

### Technologies Used

* Visual ETL workflows in Gaio DataOS
* Temporary and Final Tables for data versioning
* Report and Content tasks to create adaptive, visually interesting dashboards
* Dynamic Dashboards with filters, graphs, and tables
* HTML and CSS for stylized and user-responsive dashboard elements
* Form Task to allow for anomaly classification without leaving the dashboard
* Parameters for data pass through enabling easy navigation of the dashboard

***

### &#x20;Expected Outcomes

* Faster development of anomaly detection logic
* Centralized monitoring dashboards
* Better financial control and audit tracking
* Secure access via permissioned users/groups

***

### Download this project

{% file src="/files/cVCgQPURoPrCyL4fmLZT" %}

{% file src="/files/kKdwuJosibZBIusEjlsU" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gaiodataos.com/use-cases/financial-anomaly-detection.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
