# mallikarjun1520/tcs_hack architecture

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

- Interactive diagram: https://gitdiagram.com/mallikarjun1520/tcs_hack
- Repository: https://github.com/mallikarjun1520/tcs_hack

## Overview

This is an AI DevOps incident-analysis advisor. A user uploads a log through the browser; the API parses it, retrieves similar historical incidents, asks an LLM to produce a structured assessment, and returns the assessment and matches for display. A separate ingestion script embeds the incident corpus into persistent Chroma storage used by retrieval. The map follows the sampled runtime and ingestion code; the README is empty, and several listed modules were not sampled.

Main entry points: [`app/main.py`](https://github.com/mallikarjun1520/tcs_hack/blob/main/app/main.py) (Analyze endpoint), [`frontend/script.js`](https://github.com/mallikarjun1520/tcs_hack/blob/main/frontend/script.js) (Upload and results), [`ingest.py`](https://github.com/mallikarjun1520/tcs_hack/blob/main/ingest.py) (Corpus ingestion), [`app/services/retrieval.py`](https://github.com/mallikarjun1520/tcs_hack/blob/main/app/services/retrieval.py) (Similar incident search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_browser["Upload and results<br/>[script.js]"]
end

subgraph group_workflow["Analysis workflow"]
  node_api["Analyze endpoint<br/>[main.py]"]
  node_parser["Log parser<br/>[parser.py]"]
  node_llm["Incident reasoning<br/>[llm_service.py]"]
end

subgraph group_knowledge["Incident knowledge"]
  node_retrieval["Similar incident search<br/>[retrieval.py]"]
  node_embedder["Text embeddings<br/>[retrieval.py]"]
  node_store[("Incident vector store")]
  node_corpus["Incident corpus<br/>[incidents.json]"]
  node_ingest["Corpus ingestion<br/>[ingest.py]"]
  node_ingest_embedder["Ingestion embeddings<br/>[ingest.py]"]
end

node_user(("Incident analyst"))
node_groq["Groq LLM service"]

node_user -.->|"uploads log"| node_browser
node_browser -->|"posts file"| node_api
node_api -->|"parses upload"| node_parser
node_api -->|"searches matches"| node_retrieval
node_api -->|"requests analysis"| node_llm
node_retrieval -->|"encodes query"| node_embedder
node_retrieval -->|"queries vectors"| node_store
node_llm -->|"requests completion"| node_groq
node_api -->|"returns results"| node_browser
node_browser -->|"renders results"| node_browser
node_ingest -->|"reads incidents"| node_corpus
node_ingest -->|"encodes records"| node_ingest_embedder
node_ingest -->|"writes vectors"| node_store

click node_browser "https://github.com/mallikarjun1520/tcs_hack/blob/main/frontend/script.js"
click node_api "https://github.com/mallikarjun1520/tcs_hack/blob/main/app/main.py"
click node_parser "https://github.com/mallikarjun1520/tcs_hack/blob/main/app/services/parser.py"
click node_retrieval "https://github.com/mallikarjun1520/tcs_hack/blob/main/app/services/retrieval.py"
click node_embedder "https://github.com/mallikarjun1520/tcs_hack/blob/main/app/services/retrieval.py"
click node_store "https://github.com/mallikarjun1520/tcs_hack/tree/main/chroma_db"
click node_llm "https://github.com/mallikarjun1520/tcs_hack/blob/main/app/services/llm_service.py"
click node_corpus "https://github.com/mallikarjun1520/tcs_hack/blob/main/incidents.json"
click node_ingest "https://github.com/mallikarjun1520/tcs_hack/blob/main/ingest.py"
click node_ingest_embedder "https://github.com/mallikarjun1520/tcs_hack/blob/main/ingest.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_browser toneBlue
class node_api,node_parser,node_llm toneAmber
class node_retrieval,node_embedder,node_store,node_corpus,node_ingest,node_ingest_embedder toneMint
class node_user,node_groq toneIndigo
```

## Components

### User interface

- [Upload and results](https://github.com/mallikarjun1520/tcs_hack/blob/main/frontend/script.js): `frontend/script.js`

### Analysis workflow

- [Analyze endpoint](https://github.com/mallikarjun1520/tcs_hack/blob/main/app/main.py): `app/main.py`
- [Log parser](https://github.com/mallikarjun1520/tcs_hack/blob/main/app/services/parser.py): `app/services/parser.py`
- [Incident reasoning](https://github.com/mallikarjun1520/tcs_hack/blob/main/app/services/llm_service.py): `app/services/llm_service.py`

### Incident knowledge

- [Similar incident search](https://github.com/mallikarjun1520/tcs_hack/blob/main/app/services/retrieval.py): `app/services/retrieval.py`
- [Text embeddings](https://github.com/mallikarjun1520/tcs_hack/blob/main/app/services/retrieval.py): `app/services/retrieval.py`
- [Incident vector store](https://github.com/mallikarjun1520/tcs_hack/tree/main/chroma_db): `chroma_db`
- [Incident corpus](https://github.com/mallikarjun1520/tcs_hack/blob/main/incidents.json): `incidents.json`
- [Corpus ingestion](https://github.com/mallikarjun1520/tcs_hack/blob/main/ingest.py): `ingest.py`
- [Ingestion embeddings](https://github.com/mallikarjun1520/tcs_hack/blob/main/ingest.py): `ingest.py`

### Other components

- **Incident analyst**
- **Groq LLM service**

## Connections

- Incident analyst → Upload and results: uploads log
- Upload and results → Analyze endpoint: posts file (evidence: `frontend/script.js`)
- Analyze endpoint → Log parser: parses upload (evidence: `app/main.py`)
- Analyze endpoint → Similar incident search: searches matches (evidence: `app/main.py`)
- Analyze endpoint → Incident reasoning: requests analysis (evidence: `app/main.py`)
- Similar incident search → Text embeddings: encodes query (evidence: `app/services/retrieval.py`)
- Similar incident search → Incident vector store: queries vectors (evidence: `app/services/retrieval.py`)
- Incident reasoning → Groq LLM service: requests completion (evidence: `app/services/llm_service.py`)
- Analyze endpoint → Upload and results: returns results (evidence: `app/main.py`)
- Upload and results → Upload and results: renders results (evidence: `frontend/script.js`)
- Corpus ingestion → Incident corpus: reads incidents (evidence: `ingest.py`)
- Corpus ingestion → Ingestion embeddings: encodes records (evidence: `ingest.py`)
- Corpus ingestion → Incident vector store: writes vectors (evidence: `ingest.py`)
