---
# System prepended metadata

title: Fraud Detection System
tags: [FDS]

---

![](https://speed.ocbcnisp.co.id/login/image/logo_ocbc.png)

# Fraud Detection System
###### tags: `FDS`

![PostgreSQL](https://img.shields.io/badge/PostgreSQL-current-336791.svg?style=flat-square&logo=postgresql&heigth=200)

## FDS Engine
### Step 1: Rule Base - menyiapkan segala kebutuhan data statis untuk keperluan rule based

::: info 
:bulb: **Summary**

Database FDS menyimpan data black list, fraud list dan AML list yang ditarik oleh oozie/airflow secara bulanan. Data blacklist, fraudlist dan AML list diupload menggunakan ONe Big Data Uploader secara berkala (6 bulan sekali)
:::

-	**1.1** Batch scheduler black list
-	**1.2** Batch scheduler fraud list
-	**1.3** Batch scheduler AML list

```plantuml
@startuml
    entity OMD
    entity ONE_BIGDATA #red
    control AIRFLOW #blue
    database EXTDWH #green

    OMD->ONE_BIGDATA: Upload Data
    AIRFLOW->ONE_BIGDATA: Cek Update 
    ONE_BIGDATA-->AIRFLOW: NOK
    AIRFLOW-->KILL !!: Skip
    ONE_BIGDATA-->AIRFLOW: OK
    ONE_BIGDATA->AIRFLOW: Get Data
    AIRFLOW->>EXTDWH: Store Data
@enduml
```

```mermaid
sequenceDiagram
    
    participant OMD
    participant ONE_BIGDATA
    participant AIRFLOW
    participant EXTDWH

    %% this is a comment
    OMD->>ONE_BIGDATA: Upload Data
    AIRFLOW->>ONE_BIGDATA: Cek Update 
    ONE_BIGDATA-->>AIRFLOW: NOK
    AIRFLOW-->>KILL: Skip
    ONE_BIGDATA-->>AIRFLOW: OK
    ONE_BIGDATA->>AIRFLOW: Get Data
    AIRFLOW->>EXTDWH: Store Data
    Note right of AIRFLOW: Download Precalculated Store Data
```
```mermaid
gantt
    dateFormat  YYYY-MM-DD
    title       Adding GANTT diagram functionality to mermaid
    excludes    weekends


    section Section
    A task           :done, a1, 2022-10-01, 30d
    Another task     :active, a2, after a1  , 20d
    
    section Another
    Task in sec      :crit, b1, 2022-10-12  , 12d
    anther task      :b2, after b1, 24d
```

```sequence
Title: Batch scheduler Black List, Fraud List, AML List
participant OMD
participant ONE_BIGDATA
participant AIRFLOW
participant EXTDWH

OMD->ONE_BIGDATA: Upload Data
AIRFLOW->ONE_BIGDATA: Cek Update 
ONE_BIGDATA-->AIRFLOW: NOK
AIRFLOW-->KILL: Skip
ONE_BIGDATA-->AIRFLOW: OK
ONE_BIGDATA->AIRFLOW: Get Data
AIRFLOW->EXTDWH: Store Data
Note right of AIRFLOW: Download\n Precalculated \n Store Data
```


### Step 2: Realtime API - menyiapkan segala kebutuhan data dinamis yang real time (bisa lewat API/Kafka) untuk keperluan rule based/modelling

::: info 
:bulb: **Summary**

Database FDS menyimpan data yang real time dengan proses data stream menggunakan koneksi API to API atau Kafka Stream

FDS system perlu untuk menerima data dari behavior transaksi nasabah yang terjadi di ONe Mobile. Data-data transaksi real time diambil dari back service masing-masing transaction
:::

-	**2.1** Explore API **cekrekening.id**
```sequence
Title: Inquiry Bulk Data Cekrekening.id \n
participant CEKREKENING.ID
participant PROXY
participant OCP
participant AIRFLOW
participant FDS
participant EXTDWH

FDS->AIRFLOW: Register \nJob Scheduler
AIRFLOW->CEKREKENING.ID: Inquiry Data Rekening
AIRFLOW-->OCP: Call API
OCP-->PROXY: Tunnel
PROXY-->CEKREKENING.ID: Passing Request
CEKREKENING.ID->AIRFLOW: Response result
CEKREKENING.ID-->PROXY: Passing Response
PROXY-->OCP: Receive 
OCP-->AIRFLOW: By Pass
AIRFLOW->FDS: OK
AIRFLOW-->EXTDWH: Store Result
AIRFLOW->FDS: NOK
AIRFLOW-->KILL: Skip
```

```sequence
Title: Inquiry Single Data Cekrekening.id \n
participant CEKREKENING.ID
participant PROXY
participant OCP
participant AIRFLOW
participant FDS
participant EXTDWH
participant NEXT

FDS->EXTDWH: Inquiry \nExisting Data
EXTDWH-->FDS: Exists
Note right of FDS: Reject\nAllow\nHold
EXTDWH-->FDS: Not Exists
FDS->CEKREKENING.ID: Inquiry Data Rekening
FDS-->OCP: Call API
OCP-->PROXY: Tunnel
PROXY-->CEKREKENING.ID: Passing Request
CEKREKENING.ID->FDS: Response result
CEKREKENING.ID-->PROXY: Passing Response
PROXY-->OCP: Receive 
OCP-->FDS: By Pass
OCP->FDS: NOK
FDS->NEXT: Next Step
OCP->FDS: OK
Note right of FDS: Reject\nAllow\nHold
FDS-->EXTDWH: Store Data
FDS->NEXT: Next Step
```

```plantuml
@startuml
participant Participant as Foo
actor       Actor       as Foo1
boundary    Boundary    as Foo2
control     Control     as Foo3
entity      Entity      as Foo4
database    Database    as Foo5
collections Collections as Foo6
queue       Queue       as Foo7
Foo -> Foo1 : To actor 
Foo -> Foo2 : To boundary
Foo -> Foo3 : To control
Foo -> Foo4 : To entity
Foo -> Foo5 : To database
Foo -> Foo6 : To collections
Foo -> Foo7: To queue
@enduml
```

-	**2.2** Explore API device identity one mobile
**Data ONe Mobile; device id; internet banking, current date** 
-	**2.3** Explore API transaction one mobile
**Data-data transaksi; nominal, frekuensi, transaction method dll**

### Step 3: Modeling - menyiapkan segala kebutuhan precalculated table untuk melakukan modelling

::: info 
:bulb: **Summary**

Precalculated table merupakan table yang berisikan data historical yang sudah ditarik dan diolah untuk dijadikan acuan modelling

**Prerequisite: Model FDS harus sudah jadi** 
:::

-	**3.1** Membuat precalculated table dengan cara melakukan feature engineering parameter yang digunakan model 
-	**3.2** Membuat scheduler harian untuk update precalculated table

### Step 4: modelling dan realtime transaction checking

::: info 
:bulb: **Summary**

FDS system melakukan pengolahan modelling data nasabah yang sudah terkumpul untuk dapat memberikan respond balikan ke back service mengenai status transaksi nasabah
:::

-	**4.1** Menggabungkan data realtime transaksi ONe mobile dan precalculated table untuk dimasukkan ke dalam model
-	**4.2** Transaksi pada hari yang sama akan disimpan ke dalam database penampung dan digunakan sebagai data tambahan untuk modelling

### Step 5: response result dari modelling

::: info 
:bulb: **Summary**

Setelah FDS system melakukan pengolahan data, maka FDS system perlu untuk mengirimkan response balikan ke back service mengenai status transaksi nasabah
:::

-	**5.1** Allow: response to back end service, transaction can be proceed (existing flow success)
-	**5.2** Reject: response to back end service, transaction can’t be proceed (existing flow failed)
-	**5.3** Hold: response to back end service, transaction can/can’t be proceed (existing flow success/failed)
