# lakshith007/social-media-analysis architecture

> Architecture diagram of the GitHub repository lakshith007/social-media-analysis, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lakshith007/social-media-analysis
- Repository: https://github.com/lakshith007/social-media-analysis

## Overview

This repository is a social-media data extraction and analysis pipeline. Its apparent workflow is to fetch Firestore records, normalize them, enrich text with sentiment and emotion, then derive topics and trends. The README is only a title, so it documents no capabilities; stage relationships not directly shown in excerpts are marked unverified or omitted. The graph includes the visible extraction, normalization, analysis, and storage responsibilities, not deployment machinery.

Main entry points: [`extraction/extract.py`](https://github.com/lakshith007/social-media-analysis/blob/main/extraction/extract.py) (Collection extraction), [`extraction/normalize.py`](https://github.com/lakshith007/social-media-analysis/blob/main/extraction/normalize.py) (Record normalization), [`extraction/analyze_text.py`](https://github.com/lakshith007/social-media-analysis/blob/main/extraction/analyze_text.py) (Sentiment and emotion), [`extraction/analyze_topics.py`](https://github.com/lakshith007/social-media-analysis/blob/main/extraction/analyze_topics.py) (Topics and trends)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Data ingestion"]
  node_extractor["Collection extraction<br/>[extract.py]"]
  node_rawdata["Raw social data"]
  node_fireclient["Firestore client helper<br/>[firebase_client.py]"]
end

subgraph group_prep["Data preparation"]
  node_normalizer["Record normalization<br/>[normalize.py]"]
  node_processed["Processed records"]
end

subgraph group_analysis["Text analysis"]
  node_textanalysis["Sentiment and emotion<br/>[analyze_text.py]"]
  node_enriched["Enriched text"]
  node_topics["Topics and trends<br/>[analyze_topics.py]"]
  node_topicresults["Topic and trend outputs"]
end

node_operator(("Operator"))
node_firestore[("Firestore")]

node_operator -->|"runs"| node_extractor
node_extractor -->|"reads collections"| node_firestore
node_extractor -->|"writes JSON"| node_rawdata
node_rawdata -->|"loads raw data"| node_normalizer
node_normalizer -->|"writes records"| node_processed
node_processed -.->|"loads text inputs"| node_textanalysis
node_textanalysis -->|"writes analysis"| node_enriched
node_enriched -.->|"loads analysis input"| node_topics
node_topics -->|"writes JSON"| node_topicresults

click node_extractor "https://github.com/lakshith007/social-media-analysis/blob/main/extraction/extract.py"
click node_normalizer "https://github.com/lakshith007/social-media-analysis/blob/main/extraction/normalize.py"
click node_textanalysis "https://github.com/lakshith007/social-media-analysis/blob/main/extraction/analyze_text.py"
click node_topics "https://github.com/lakshith007/social-media-analysis/blob/main/extraction/analyze_topics.py"
click node_fireclient "https://github.com/lakshith007/social-media-analysis/blob/main/extraction/firebase_client.py"

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_extractor,node_rawdata,node_fireclient toneBlue
class node_normalizer,node_processed,node_firestore toneAmber
class node_textanalysis,node_enriched,node_topics,node_topicresults toneMint
class node_operator toneIndigo
```

## Components

### Data ingestion

- [Collection extraction](https://github.com/lakshith007/social-media-analysis/blob/main/extraction/extract.py): `extraction/extract.py`
- **Raw social data**
- [Firestore client helper](https://github.com/lakshith007/social-media-analysis/blob/main/extraction/firebase_client.py): `extraction/firebase_client.py`

### Data preparation

- [Record normalization](https://github.com/lakshith007/social-media-analysis/blob/main/extraction/normalize.py): `extraction/normalize.py`
- **Processed records**

### Text analysis

- [Sentiment and emotion](https://github.com/lakshith007/social-media-analysis/blob/main/extraction/analyze_text.py): `extraction/analyze_text.py`
- **Enriched text**
- [Topics and trends](https://github.com/lakshith007/social-media-analysis/blob/main/extraction/analyze_topics.py): `extraction/analyze_topics.py`
- **Topic and trend outputs**

### Other components

- **Operator**
- **Firestore**

## Connections

- Operator → Collection extraction: runs (evidence: `extraction/extract.py`)
- Collection extraction → Firestore: reads collections (evidence: `extraction/extract.py`)
- Collection extraction → Raw social data: writes JSON (evidence: `extraction/extract.py`)
- Raw social data → Record normalization: loads raw data (evidence: `extraction/normalize.py`)
- Record normalization → Processed records: writes records (evidence: `extraction/normalize.py`)
- Processed records → Sentiment and emotion: loads text inputs
- Sentiment and emotion → Enriched text: writes analysis (evidence: `extraction/analyze_text.py`)
- Enriched text → Topics and trends: loads analysis input
- Topics and trends → Topic and trend outputs: writes JSON (evidence: `extraction/analyze_topics.py`)
