# devanandhnagesh/trademark-arbitration-decision-support-system architecture

> Architecture diagram of the GitHub repository devanandhnagesh/trademark-arbitration-decision-support-system, 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/devanandhnagesh/trademark-arbitration-decision-support-system
- Repository: https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system

## Overview

Trademark DSS is a decision-support web application for Indian trademark arbitration disputes. An arbitrator submits dispute details in the browser; the API coordinates deterministic arbitrability analysis, landmark-case retrieval, LLM-generated legal analysis, and DOCX report assembly, then returns results for display. A separate lawyer-finder flow supports city search or browser geolocation. The README documents local vector retrieval and live IndiaKanoon lookup, LLM fallbacks, and Google Places fallback behavior. Some implementation details are unsampled, so those links are shown only where documented.

Main entry points: [`api/main.py`](https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/api/main.py) (Analysis API), [`agents/landmark_retrieval_agent.py`](https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/agents/landmark_retrieval_agent.py) (Landmark retrieval), [`frontend/form-handling.js`](https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/frontend/form-handling.js) (Case form), [`agents/lawyer_finder_agent.py`](https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/agents/lawyer_finder_agent.py) (Lawyer lookup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Intake and UI"]
  node_form["Case form<br/>[form-handling.js]"]
  node_results["Results display<br/>[results-display.js]"]
  node_api["Analysis API<br/>[main.py]"]
end

subgraph group_legal["Legal analysis"]
  node_arbitrability["Arbitrability engine"]
  node_classifier["Dispute classifier"]
  node_retrieval["Landmark retrieval"]
  node_case_registry[("Landmark registry<br/>[config.py]")]
  node_vector_store[("Local case index")]
  node_indiakanoon["IndiaKanoon"]
  node_llm_drafting["Legal drafting<br/>[gemini_agents.py]"]
  node_adversarial["Adversarial analysis"]
end

subgraph group_report["Reports"]
  node_report_generator["DOCX assembly"]
end

subgraph group_lawyers["Lawyer finder"]
  node_lawyer_ui["Lawyer search UI<br/>[lawyer-finder.js]"]
  node_lawyer_agent["Lawyer lookup"]
  node_places["Google Places"]
end

node_arbitrator(("Arbitrator"))
node_llm_services["LLM services"]
node_lawyer_search["Web search fallback"]

node_arbitrator -->|"enters facts"| node_form
node_form -->|"submits form"| node_api
node_api -->|"evaluates"| node_arbitrability
node_api -->|"retrieves cases"| node_retrieval
node_retrieval -->|"uses registry"| node_case_registry
node_retrieval -->|"searches locally"| node_vector_store
node_retrieval -.->|"fetches judgments"| node_indiakanoon
node_retrieval -->|"uses classifier"| node_classifier
node_api -->|"drafts sections"| node_llm_drafting
node_llm_drafting -.->|"calls with fallback"| node_llm_services
node_api -->|"generates analysis"| node_adversarial
node_adversarial -->|"uses Gemini"| node_llm_services
node_api -->|"assembles report"| node_report_generator
node_api -->|"returns results"| node_results
node_form -->|"displays response"| node_results
node_arbitrator -->|"requests lawyers"| node_lawyer_ui
node_lawyer_ui -->|"queries endpoints"| node_api
node_api -->|"looks up lawyers"| node_lawyer_agent
node_lawyer_agent -.->|"searches nearby"| node_places
node_lawyer_agent -.->|"returns fallback link"| node_lawyer_search

click node_form "https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/frontend/form-handling.js"
click node_results "https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/frontend/results-display.js"
click node_api "https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/api/main.py"
click node_arbitrability "https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/agents/arbitrability_agent.py"
click node_classifier "https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/agents/dispute_classifier.py"
click node_retrieval "https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/agents/landmark_retrieval_agent.py"
click node_case_registry "https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/config.py"
click node_llm_drafting "https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/agents/gemini_agents.py"
click node_adversarial "https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/agents/adversarial_legal_agent.py"
click node_report_generator "https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/agents/report_generator.py"
click node_lawyer_ui "https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/frontend/lawyer-finder.js"
click node_lawyer_agent "https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/agents/lawyer_finder_agent.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_form,node_results,node_api toneBlue
class node_arbitrability,node_classifier,node_retrieval,node_case_registry,node_vector_store,node_indiakanoon,node_llm_drafting,node_adversarial toneAmber
class node_report_generator toneMint
class node_lawyer_ui,node_lawyer_agent,node_places toneRose
class node_arbitrator,node_llm_services,node_lawyer_search toneIndigo
```

## Components

### Intake and UI

- [Case form](https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/frontend/form-handling.js): `frontend/form-handling.js`
- [Results display](https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/frontend/results-display.js): `frontend/results-display.js`
- [Analysis API](https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/api/main.py): `api/main.py`

### Legal analysis

- [Arbitrability engine](https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/agents/arbitrability_agent.py): `agents/arbitrability_agent.py`
- [Dispute classifier](https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/agents/dispute_classifier.py): `agents/dispute_classifier.py`
- [Landmark retrieval](https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/agents/landmark_retrieval_agent.py): `agents/landmark_retrieval_agent.py`
- [Landmark registry](https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/config.py): `config.py`
- **Local case index**
- **IndiaKanoon**
- [Legal drafting](https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/agents/gemini_agents.py): `agents/gemini_agents.py`
- [Adversarial analysis](https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/agents/adversarial_legal_agent.py): `agents/adversarial_legal_agent.py`

### Reports

- [DOCX assembly](https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/agents/report_generator.py): `agents/report_generator.py`

### Lawyer finder

- [Lawyer search UI](https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/frontend/lawyer-finder.js): `frontend/lawyer-finder.js`
- [Lawyer lookup](https://github.com/devanandhnagesh/trademark-arbitration-decision-support-system/blob/main/agents/lawyer_finder_agent.py): `agents/lawyer_finder_agent.py`
- **Google Places**

### Other components

- **Arbitrator**
- **LLM services**
- **Web search fallback**

## Connections

- Arbitrator → Case form: enters facts (evidence: `README.md`)
- Case form → Analysis API: submits form (evidence: `frontend/form-handling.js`)
- Analysis API → Arbitrability engine: evaluates (evidence: `api/main.py`)
- Analysis API → Landmark retrieval: retrieves cases (evidence: `api/main.py`)
- Landmark retrieval → Landmark registry: uses registry (evidence: `agents/landmark_retrieval_agent.py`)
- Landmark retrieval → Local case index: searches locally (evidence: `README.md`)
- Landmark retrieval → IndiaKanoon: fetches judgments (evidence: `README.md`)
- Landmark retrieval → Dispute classifier: uses classifier (evidence: `agents/landmark_retrieval_agent.py`)
- Analysis API → Legal drafting: drafts sections (evidence: `api/main.py`)
- Legal drafting → LLM services: calls with fallback (evidence: `README.md`)
- Analysis API → Adversarial analysis: generates analysis (evidence: `api/main.py`)
- Adversarial analysis → LLM services: uses Gemini (evidence: `agents/adversarial_legal_agent.py`)
- Analysis API → DOCX assembly: assembles report (evidence: `api/main.py`)
- Analysis API → Results display: returns results (evidence: `api/main.py`)
- Case form → Results display: displays response (evidence: `frontend/form-handling.js`)
- Arbitrator → Lawyer search UI: requests lawyers (evidence: `README.md`)
- Lawyer search UI → Analysis API: queries endpoints (evidence: `README.md`)
- Analysis API → Lawyer lookup: looks up lawyers (evidence: `api/main.py`)
- Lawyer lookup → Google Places: searches nearby (evidence: `README.md`)
- Lawyer lookup → Web search fallback: returns fallback link (evidence: `README.md`)
