# anushkag21/legal-aid-advisor architecture

> Architecture diagram of the GitHub repository anushkag21/legal-aid-advisor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/anushkag21/legal-aid-advisor
- Repository: https://github.com/anushkag21/legal-aid-advisor

## Overview

#### Purpose and top-level shape
This repository appears to be a legal-services application centered on a Django site, with separate UI areas for chat, legal knowledge, cases, lawyers, courts, and booking. It also contains a standalone legal-document summarizer service/prototype. The README provides no operational documentation, so behavior must be inferred from layout.

#### Primary entry points
- Django management and deployment entry points: `manage.py`, `chatbot_project/wsgi.py`, `chatbot_project/asgi.py`.
- Django configuration and root URL composition: `chatbot_project/settings.py`, `chatbot_project/urls.py`.
- The document summarizer has independent Python application entry points: `Legal_summarizer/Legal_summarizer/app3.py` and `Legal_summarizer/Legal_summarizer/app4.py`.

#### Django application shell and routing
The `chatbot_project` package is the host runtime. It configures installed applications, middleware, static handling, database, and URL routing; individual feature apps are expected to attach their routes under the project URL configuration.
- `chatbot_project/settings.py`
- `chatbot_project/urls.py`
- `chatbot_project/asgi.py`

Control flow is standard Django: HTTP request → root router → app router → view → template or response. Both WSGI and ASGI endpoints are present, allowing conventional synchronous deployment and an ASGI-capable server.

#### Frontend feature application
The `frontend` Django app owns the primary server-rendered legal-services experience. Its views and URL module connect pages to templates, while feature-specific browser JavaScript and CSS implement client behavior.
- `frontend/urls.py`
- `frontend/views.py`
- `frontend/templates/index.html`

Major presentation boundaries include booking, case, court, legal knowledge, lawyer, chat, and sign-in pages. Assets are organized by feature, e.g. `frontend/static/js/booking.js`, `frontend/static/js/chat.js`, and `frontend/static/css/knowledge.css`. This indicates browser behavior is primarily page-specific rather than a separately built SPA.

#### Chatbot application
The `chatbot` Django app isolates chat-specific request handling, persistence definitions, and routing from the broader frontend application.
- `chatbot/urls.py`
- `chatbot/views.py`
- `chatbot/models.py`

Its expected flow is chat-page/client JavaScript invoking chatbot routes, with views processing requests and potentially reading or writing chat-domain models. The available tree does not identify a specific LLM provider or remote chatbot service, so integrations should be verified in source before planning changes.

#### Legal document summarization subsystem
`Legal_summarizer/Legal_summarizer` is a separate Python subsystem with its own dependency manifest, environment file, static HTML, and upload workspace. It likely receives or selects a legal PDF, processes it through one of the app scripts, and presents a summary through static pages.
- `Legal_summarizer/Legal_summarizer/app3.py`
- `Legal_summarizer/Legal_summarizer/app4.py`
- `Legal_summarizer/Legal_summarizer/uploads/legal_documnet.pdf`

This subsystem is architecturally separate from Django: no shared package or route linkage is evident in the tree. Its upload directory is a filesystem boundary and should be treated as untrusted input/storage.

#### Persistence, static delivery, and operational boundaries
Django currently uses a checked-in SQLite database, indicating local or prototype-oriented persistence. App migrations exist but no generated migration files are shown beyond initialization.
- `db.sqlite3`
- `frontend/models.py`
- `chatbot/models.py`

Source static assets live under `frontend/static/`; `staticfiles/` is a collected static-output tree, including Django admin and app assets. The summarizer independently serves/uses `Legal_summarizer/Legal_summarizer/static/`. Environment files at root, chatbot, and summarizer levels suggest secrets or provider configuration may be split across subsystems; they should not be relied upon as a unified configuration model.

Main entry points: [`chatbot_project/urls.py`](https://github.com/anushkag21/legal-aid-advisor/blob/main/chatbot_project/urls.py) (Root URL router), [`chatbot_project/settings.py`](https://github.com/anushkag21/legal-aid-advisor/blob/main/chatbot_project/settings.py) (Project configuration), [`frontend/views.py`](https://github.com/anushkag21/legal-aid-advisor/blob/main/frontend/views.py) (Legal-services views), [`chatbot/urls.py`](https://github.com/anushkag21/legal-aid-advisor/blob/main/chatbot/urls.py) (Chat routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_django["Django legal-services site"]
  node_django_entry{{"Django entry points<br/>runtime entry<br/>[manage.py]"}}
  node_project_config["Project configuration<br/>Django config<br/>[settings.py]"]
  node_root_router["Root URL router<br/>Django router<br/>[urls.py]"]
  node_asgi{{"ASGI endpoint<br/>ASGI entry<br/>[asgi.py]"}}
  node_wsgi{{"WSGI endpoint<br/>WSGI entry<br/>[wsgi.py]"}}
  node_frontend_routes["Frontend routes<br/>Django router<br/>[urls.py]"]
  node_frontend_views["Legal-services views<br/>Django views<br/>[views.py]"]
  node_frontend_templates["Page templates<br/>server-rendered UI<br/>[index.html]"]
  node_frontend_assets["Feature static assets<br/>CSS and JavaScript"]
  node_chat_routes["Chat routes<br/>Django router<br/>[urls.py]"]
  node_chat_views["Chat handlers<br/>Django views<br/>[views.py]"]
  node_domain_models["Domain models<br/>Django models<br/>[models.py]"]
  node_sqlite[("SQLite database<br/>persistence<br/>[db.sqlite3]")]
end

subgraph group_summarizer["Document summarizer"]
  node_summarizer_apps{{"Summarizer applications<br/>Python apps<br/>[app3.py]"}}
  node_summarizer_ui["Summarizer static UI<br/>static HTML"]
  node_upload_workspace[("PDF upload workspace<br/>filesystem storage<br/>[legal_documnet.pdf]")]
end

node_browser(("Browser<br/>client"))

node_django_entry -->|"loads"| node_project_config
node_asgi -->|"loads"| node_project_config
node_wsgi -->|"loads"| node_project_config
node_project_config -->|"configures"| node_root_router
node_browser -->|"HTTP request"| node_root_router
node_root_router -->|"dispatches"| node_frontend_routes
node_root_router -->|"dispatches"| node_chat_routes
node_frontend_routes -->|"maps to"| node_frontend_views
node_frontend_views -->|"renders"| node_frontend_templates
node_frontend_templates -->|"HTML response"| node_browser
node_frontend_assets -->|"served to"| node_browser
node_browser -->|"chat requests"| node_chat_routes
node_chat_routes -->|"maps to"| node_chat_views
node_frontend_views -->|"uses"| node_domain_models
node_chat_views -->|"reads and writes"| node_domain_models
node_domain_models -->|"persists in"| node_sqlite
node_browser -.->|"uses independently"| node_summarizer_ui
node_summarizer_ui -->|"invokes"| node_summarizer_apps
node_summarizer_apps -->|"reads document"| node_upload_workspace

click node_django_entry "https://github.com/anushkag21/legal-aid-advisor/blob/main/manage.py"
click node_project_config "https://github.com/anushkag21/legal-aid-advisor/blob/main/chatbot_project/settings.py"
click node_root_router "https://github.com/anushkag21/legal-aid-advisor/blob/main/chatbot_project/urls.py"
click node_asgi "https://github.com/anushkag21/legal-aid-advisor/blob/main/chatbot_project/asgi.py"
click node_wsgi "https://github.com/anushkag21/legal-aid-advisor/blob/main/chatbot_project/wsgi.py"
click node_frontend_routes "https://github.com/anushkag21/legal-aid-advisor/blob/main/frontend/urls.py"
click node_frontend_views "https://github.com/anushkag21/legal-aid-advisor/blob/main/frontend/views.py"
click node_frontend_templates "https://github.com/anushkag21/legal-aid-advisor/blob/main/frontend/templates/index.html"
click node_chat_routes "https://github.com/anushkag21/legal-aid-advisor/blob/main/chatbot/urls.py"
click node_chat_views "https://github.com/anushkag21/legal-aid-advisor/blob/main/chatbot/views.py"
click node_domain_models "https://github.com/anushkag21/legal-aid-advisor/blob/main/frontend/models.py"
click node_sqlite "https://github.com/anushkag21/legal-aid-advisor/blob/main/db.sqlite3"
click node_summarizer_apps "https://github.com/anushkag21/legal-aid-advisor/blob/main/Legal_summarizer/Legal_summarizer/app3.py"
click node_upload_workspace "https://github.com/anushkag21/legal-aid-advisor/blob/main/Legal_summarizer/Legal_summarizer/uploads/legal_documnet.pdf"

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_django_entry,node_project_config,node_root_router,node_asgi,node_wsgi,node_frontend_routes,node_frontend_views,node_frontend_templates,node_frontend_assets,node_chat_routes,node_chat_views,node_domain_models,node_sqlite toneBlue
class node_summarizer_apps,node_summarizer_ui,node_upload_workspace toneAmber
class node_browser toneNeutral
```

## Components

### Django legal-services site

- [Django entry points](https://github.com/anushkag21/legal-aid-advisor/blob/main/manage.py): runtime entry · Management, WSGI, and ASGI deployment entry points. · `manage.py`
- [Project configuration](https://github.com/anushkag21/legal-aid-advisor/blob/main/chatbot_project/settings.py): Django config · Settings and root URL composition. · `chatbot_project/settings.py`
- [Root URL router](https://github.com/anushkag21/legal-aid-advisor/blob/main/chatbot_project/urls.py): Django router · `chatbot_project/urls.py`
- [ASGI endpoint](https://github.com/anushkag21/legal-aid-advisor/blob/main/chatbot_project/asgi.py): ASGI entry · `chatbot_project/asgi.py`
- [WSGI endpoint](https://github.com/anushkag21/legal-aid-advisor/blob/main/chatbot_project/wsgi.py): WSGI entry · `chatbot_project/wsgi.py`
- [Frontend routes](https://github.com/anushkag21/legal-aid-advisor/blob/main/frontend/urls.py): Django router · `frontend/urls.py`
- [Legal-services views](https://github.com/anushkag21/legal-aid-advisor/blob/main/frontend/views.py): Django views · Renders booking, cases, courts, knowledge, lawyers, chat, and sign-in pages. · `frontend/views.py`
- [Page templates](https://github.com/anushkag21/legal-aid-advisor/blob/main/frontend/templates/index.html): server-rendered UI · `frontend/templates/index.html`
- **Feature static assets**: CSS and JavaScript · Page-specific browser behavior and styling.
- [Chat routes](https://github.com/anushkag21/legal-aid-advisor/blob/main/chatbot/urls.py): Django router · `chatbot/urls.py`
- [Chat handlers](https://github.com/anushkag21/legal-aid-advisor/blob/main/chatbot/views.py): Django views · `chatbot/views.py`
- [Domain models](https://github.com/anushkag21/legal-aid-advisor/blob/main/frontend/models.py): Django models · Frontend and chat persistence definitions. · `frontend/models.py`
- [SQLite database](https://github.com/anushkag21/legal-aid-advisor/blob/main/db.sqlite3): persistence · Checked-in prototype-oriented database. · `db.sqlite3`

### Document summarizer

Standalone Python subsystem.

- [Summarizer applications](https://github.com/anushkag21/legal-aid-advisor/blob/main/Legal_summarizer/Legal_summarizer/app3.py): Python apps · Independent legal-document processing entry points. · `Legal_summarizer/Legal_summarizer/app3.py`
- **Summarizer static UI**: static HTML
- [PDF upload workspace](https://github.com/anushkag21/legal-aid-advisor/blob/main/Legal_summarizer/Legal_summarizer/uploads/legal_documnet.pdf): filesystem storage · Untrusted document input and storage boundary. · `Legal_summarizer/Legal_summarizer/uploads/legal_documnet.pdf`

### Other components

- **Browser**: client · Server-rendered pages with feature-specific JavaScript.

## Connections

- Django entry points → Project configuration: loads
- ASGI endpoint → Project configuration: loads
- WSGI endpoint → Project configuration: loads
- Project configuration → Root URL router: configures
- Browser → Root URL router: HTTP request
- Root URL router → Frontend routes: dispatches
- Root URL router → Chat routes: dispatches
- Frontend routes → Legal-services views: maps to
- Legal-services views → Page templates: renders
- Page templates → Browser: HTML response
- Feature static assets → Browser: served to
- Browser → Chat routes: chat requests
- Chat routes → Chat handlers: maps to
- Legal-services views → Domain models: uses
- Chat handlers → Domain models: reads and writes
- Domain models → SQLite database: persists in
- Browser → Summarizer static UI: uses independently
- Summarizer static UI → Summarizer applications: invokes
- Summarizer applications → PDF upload workspace: reads document
