# brightprogrammer7/deepfakenews architecture

> Architecture diagram of the GitHub repository brightprogrammer7/deepfakenews, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/brightprogrammer7/deepfakenews
- Repository: https://github.com/brightprogrammer7/deepfakenews

## Overview

##### Project type and purpose
- This is a Python-based AI pipeline/service (no frontend), “AIHakikaNews,” whose goal is to scrape news data, process it via NLP, assess sentiment (“Feeling”), and detect fake news using a trained model.
- Key indicators:
- app.py entry point
- “Scraping” directory with raw data
- “NLP” for vectorization models
- “Feeling” for sentiment
- “FakeNews” for the classification model

##### File structure
- Top-level files:
- .gitignore, README.md, app.py, venv
- Major directories (each with its own __pycache__):
- Scraping: scraping.py + raw data files
- NLP: nlp.py + prebuilt models (bagOfWords, tfidf, word2vec)
- Feeling: feeling.py (sentiment analysis)
- FakeNews: fakeNews.py + SVC.model (fake news classifier)
- No frontend folder ⇒ this is a back-end processing service.

##### Extract insights from README

a. Main components
1. Data Ingestion (Scraping)
2. Data Storage (raw .txt/.csv files under Scraping/data & FakeNews/data.csv)
3. Preprocessing & Feature Extraction (NLP module)
4. Sentiment Analysis (Feeling module)
5. Fake News Detection (FakeNews module)
6. Orchestration/API Layer (app.py)
7. Environment (Python venv)
b. Relationships & interactions
- Scraper → raw data files
- Raw data → NLP preprocessing
- NLP outputs → two parallel branches:
– Feeling → sentiment score
– FakeNews → classification label
- app.py calls each module in sequence and aggregates results
c. Architectural patterns & principles
- Modular pipeline: each stage in its own directory
- Separation of concerns: scraping, preprocessing, sentiment, classification
- Reusable models: pretrained assets under NLP/models and FakeNews/SVC.model
d. Key technologies
- Python 3
- Libraries (inferred): scikit-learn (SVC, tfidf), gensim or similar for word2vec
- Local file I/O for data exchange

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Python Virtual Environment"
        ENV["Python Virtual Environment\n(venv)"]:::orchestration
        click ENV "https://github.com/brightprogrammer7/deepfakenews/tree/master/venv"
        ENV -->|starts| E["Orchestration/API Layer\n(app.py)"]:::orchestration
        click E "https://github.com/brightprogrammer7/deepfakenews/blob/master/app.py"

        E -->|calls| S["Scraping Service\n(Scraping/scraping.py)"]:::ingestion
        click S "https://github.com/brightprogrammer7/deepfakenews/blob/master/Scraping/scraping.py"

        S -->|writes raw files| RD1["fakeData.txt"]:::storage
        S -->|writes raw files| RD2["trueData.txt"]:::storage
        click RD1 "https://github.com/brightprogrammer7/deepfakenews/blob/master/Scraping/data/fakeData.txt"
        click RD2 "https://github.com/brightprogrammer7/deepfakenews/blob/master/Scraping/data/trueData.txt"

        RD1 -->|provides text| N["NLP Module\n(NLP/nlp.py)"]:::preprocessing
        RD2 -->|provides text| N
        click N "https://github.com/brightprogrammer7/deepfakenews/blob/master/NLP/nlp.py"

        subgraph "Preprocessing & Feature Extraction"
            MB[(bagOfWords.model)]:::storage
            MT[(tfidf.model)]:::storage
            MW[(word2vec.model)]:::storage
            click MB "https://github.com/brightprogrammer7/deepfakenews/blob/master/NLP/models/bagOfWords.model"
            click MT "https://github.com/brightprogrammer7/deepfakenews/blob/master/NLP/models/tfidf.model"
            click MW "https://github.com/brightprogrammer7/deepfakenews/blob/master/NLP/models/word2vec.model"
        end
        N -->|loads model| MB
        N -->|loads model| MT
        N -->|loads model| MW

        N -->|"features"| F1["Sentiment Analysis\n(Feeling/feeling.py)"]:::analysis
        click F1 "https://github.com/brightprogrammer7/deepfakenews/blob/master/Feeling/feeling.py"

        N -->|"features"| F2["Fake News Detection\n(FakeNews/fakeNews.py)"]:::analysis
        click F2 "https://github.com/brightprogrammer7/deepfakenews/blob/master/FakeNews/fakeNews.py"

        subgraph "Fake News Detection Artifacts"
            Msvc[(SVC.model)]:::storage
            DCsv[(data.csv)]:::storage
            click Msvc "https://github.com/brightprogrammer7/deepfakenews/blob/master/FakeNews/SVC.model"
            click DCsv "https://github.com/brightprogrammer7/deepfakenews/blob/master/FakeNews/data.csv"
        end
        F2 -->|loads model| Msvc
        F2 -->|reads data| DCsv

        F1 -->|returns sentiment score| E
        F2 -->|returns classification label| E
    end

    classDef ingestion fill:#CCE5FF,stroke:#0066CC;
    classDef storage fill:#FFF2CC,stroke:#CC9900;
    classDef preprocessing fill:#FFD8B1,stroke:#FF6600;
    classDef analysis fill:#D5E8D4,stroke:#82B366;
    classDef orchestration fill:#F2F2F2,stroke:#888888;
```
