# srajankulal27-aiml/fake-social-media-account-detection architecture

> Architecture diagram of the GitHub repository srajankulal27-aiml/fake-social-media-account-detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/srajankulal27-aiml/fake-social-media-account-detection
- Repository: https://github.com/srajankulal27-aiml/fake-social-media-account-detection

## Overview

This is a FastAPI-backed fake social-account risk classifier. Users submit one profile, paste profile text, upload a screenshot, or upload a CSV; the service parses or validates inputs, runs feature-engineered model inference, and returns labels, probabilities, risk tiers, and (for predictions) feature contributions. The repository also includes offline data preparation, model training and evaluation, dashboards, and SQLite prediction history. Some dashboard and batch wiring is documented but its implementation was not sampled, so those links rely on README statements.

Main entry points: [`app_api/main.py`](https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/app_api/main.py) (API and pages), [`src/predict.py`](https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/src/predict.py) (Inference and attribution), [`src/config.py`](https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/src/config.py) (Runtime configuration), [`src/train.py`](https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/src/train.py) (Model training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_api["API and pages<br/>[main.py]"]
  node_schemas["Input schemas<br/>[schemas.py]"]
  node_quickfill["Quick-fill parsing<br/>[quickfill.py]"]
  node_screenshot["Screenshot extraction<br/>[screenshot.py]"]
  node_frontend["Browser interactions<br/>[app.js]"]
  node_templates["Server-rendered views"]
end

subgraph group_ml["ML pipeline"]
  node_data["Raw data loading<br/>[data_loader.py]"]
  node_preprocess["Data cleaning<br/>[preprocessing.py]"]
  node_features["Feature engineering<br/>[features.py]"]
  node_training["Model training<br/>[train.py]"]
  node_evaluation["Model evaluation<br/>[evaluate.py]"]
  node_predictor["Inference and attribution<br/>[predict.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
  node_artifact["Trained model<br/>[best_model.joblib]"]
end

subgraph group_audit["Audit and results"]
  node_performance["Performance dashboard<br/>[performance.html]"]
  node_eda["EDA dashboard<br/>[eda.html]"]
  node_history[("Prediction history<br/>[database.py]")]
  node_result["Risk results<br/>[predict.html]"]
  node_batch["Batch results<br/>[batch.html]"]
end

node_user(("Analyst"))

node_user -->|"enters profile"| node_frontend
node_frontend -->|"submits requests"| node_api
node_api -->|"validates input"| node_schemas
node_api -->|"uses parser"| node_quickfill
node_api -->|"uses extraction"| node_screenshot
node_api -->|"runs inference"| node_predictor
node_predictor -->|"derives features"| node_features
node_predictor -->|"loads pipeline"| node_artifact
node_predictor -->|"returns prediction"| node_result
node_api -->|"serves batch flow"| node_batch
node_api -->|"renders pages"| node_templates
node_frontend -->|"requests extraction"| node_api
node_api -->|"reads and clears"| node_history
node_api -->|"logs predictions"| node_history
node_data -.->|"prepares records"| node_preprocess
node_preprocess -.->|"cleans training data"| node_training
node_training -->|"engineers features"| node_features
node_training -->|"saves selected model"| node_artifact
node_evaluation -->|"supplies metrics"| node_performance
node_api -->|"serves dashboard"| node_performance
node_api -->|"serves dashboard"| node_eda
node_config -->|"sets data paths"| node_data
node_config -->|"sets split settings"| node_preprocess
node_config -->|"sets model settings"| node_training
node_config -->|"sets model path"| node_predictor

click node_api "https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/app_api/main.py"
click node_schemas "https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/app_api/schemas.py"
click node_quickfill "https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/app_api/quickfill.py"
click node_screenshot "https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/app_api/screenshot.py"
click node_frontend "https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/app_api/static/js/app.js"
click node_templates "https://github.com/srajankulal27-aiml/fake-social-media-account-detection/tree/main/app_api/templates"
click node_data "https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/src/data_loader.py"
click node_preprocess "https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/src/preprocessing.py"
click node_features "https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/src/features.py"
click node_training "https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/src/train.py"
click node_evaluation "https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/src/evaluate.py"
click node_predictor "https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/src/predict.py"
click node_config "https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/src/config.py"
click node_artifact "https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/models/best_model.joblib"
click node_performance "https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/app_api/templates/performance.html"
click node_eda "https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/app_api/templates/eda.html"
click node_history "https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/src/database.py"
click node_result "https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/app_api/templates/predict.html"
click node_batch "https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/app_api/templates/batch.html"

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_api,node_schemas,node_quickfill,node_screenshot,node_frontend,node_templates toneBlue
class node_data,node_preprocess,node_features,node_training,node_evaluation,node_predictor,node_config,node_artifact toneAmber
class node_performance,node_eda,node_history,node_result,node_batch toneMint
class node_user toneIndigo
```

## Components

### Web application

- [API and pages](https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/app_api/main.py): `app_api/main.py`
- [Input schemas](https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/app_api/schemas.py): `app_api/schemas.py`
- [Quick-fill parsing](https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/app_api/quickfill.py): `app_api/quickfill.py`
- [Screenshot extraction](https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/app_api/screenshot.py): `app_api/screenshot.py`
- [Browser interactions](https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/app_api/static/js/app.js): `app_api/static/js/app.js`
- [Server-rendered views](https://github.com/srajankulal27-aiml/fake-social-media-account-detection/tree/main/app_api/templates): `app_api/templates`

### ML pipeline

- [Raw data loading](https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/src/data_loader.py): `src/data_loader.py`
- [Data cleaning](https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/src/preprocessing.py): `src/preprocessing.py`
- [Feature engineering](https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/src/features.py): `src/features.py`
- [Model training](https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/src/train.py): `src/train.py`
- [Model evaluation](https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/src/evaluate.py): `src/evaluate.py`
- [Inference and attribution](https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/src/predict.py): `src/predict.py`
- [Runtime configuration](https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/src/config.py): `src/config.py`
- [Trained model](https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/models/best_model.joblib): `models/best_model.joblib`

### Audit and results

- [Performance dashboard](https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/app_api/templates/performance.html): `app_api/templates/performance.html`
- [EDA dashboard](https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/app_api/templates/eda.html): `app_api/templates/eda.html`
- [Prediction history](https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/src/database.py): `src/database.py`
- [Risk results](https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/app_api/templates/predict.html): `app_api/templates/predict.html`
- [Batch results](https://github.com/srajankulal27-aiml/fake-social-media-account-detection/blob/main/app_api/templates/batch.html): `app_api/templates/batch.html`

### Other components

- **Analyst**

## Connections

- Analyst → Browser interactions: enters profile (evidence: `README.md`)
- Browser interactions → API and pages: submits requests (evidence: `README.md`)
- API and pages → Input schemas: validates input (evidence: `app_api/main.py`)
- API and pages → Quick-fill parsing: uses parser (evidence: `app_api/main.py`)
- API and pages → Screenshot extraction: uses extraction (evidence: `app_api/main.py`)
- API and pages → Inference and attribution: runs inference (evidence: `app_api/main.py`)
- Inference and attribution → Feature engineering: derives features (evidence: `src/predict.py`)
- Inference and attribution → Trained model: loads pipeline (evidence: `src/predict.py`)
- Inference and attribution → Risk results: returns prediction (evidence: `README.md`)
- API and pages → Batch results: serves batch flow (evidence: `README.md`)
- API and pages → Server-rendered views: renders pages (evidence: `README.md`)
- Browser interactions → API and pages: requests extraction (evidence: `README.md`)
- API and pages → Prediction history: reads and clears (evidence: `app_api/main.py`)
- API and pages → Prediction history: logs predictions (evidence: `README.md`)
- Raw data loading → Data cleaning: prepares records
- Data cleaning → Model training: cleans training data
- Model training → Feature engineering: engineers features (evidence: `src/train.py`)
- Model training → Trained model: saves selected model (evidence: `src/train.py`)
- Model evaluation → Performance dashboard: supplies metrics (evidence: `README.md`)
- API and pages → Performance dashboard: serves dashboard (evidence: `README.md`)
- API and pages → EDA dashboard: serves dashboard (evidence: `README.md`)
- Runtime configuration → Raw data loading: sets data paths (evidence: `src/data_loader.py`)
- Runtime configuration → Data cleaning: sets split settings (evidence: `src/preprocessing.py`)
- Runtime configuration → Model training: sets model settings (evidence: `src/train.py`)
- Runtime configuration → Inference and attribution: sets model path (evidence: `src/predict.py`)
