# devtamin04/lawgic--l-gpt6.7--vaic2026 architecture

> Architecture diagram of the GitHub repository devtamin04/lawgic--l-gpt6.7--vaic2026, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/devtamin04/lawgic--l-gpt6.7--vaic2026
- Repository: https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026

## Overview

LAWGIC turns legal documents and public discussion into a shared legal knowledge graph, then exposes cited legal answers, time-aware search, graph exploration, and misinformation trends through an API and dashboard. The legal-data stages are parsing, entity extraction, graph loading, and amendment diffing; the discourse stages classify posts, link claims to provisions, assess misunderstandings, and surface trends. The graph connection/schema form the internal persistence layer. The README documents capabilities beyond the sampled excerpts; those are represented at subsystem level where exact runtime wiring is not evidenced.

Main entry points: [`backend/graph/connection.py`](https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/graph/connection.py) (Graph connection), [`frontend/static/app.js`](https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/frontend/static/app.js) (Dashboard UI), [`backend/api/main.py`](https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/api/main.py) (API application), [`backend/api/qa_endpoint.py`](https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/api/qa_endpoint.py) (Cited Q&A and search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_legal_ingestion["Legal ingestion"]
  node_parser["Legal parser<br/>[parser.py]"]
  node_extractor["Entity extraction<br/>[extractor.py]"]
end

subgraph group_legal_graph["Legal knowledge graph"]
  node_loader["Graph loader<br/>[loader.py]"]
  node_diffing["Amendment diffing<br/>[diffing.py]"]
  node_graph_schema["Graph schema<br/>[schema.py]"]
  node_graph_connection["Graph connection<br/>[connection.py]"]
end

subgraph group_discourse["Discourse intelligence"]
  node_classifier["Topic classifier<br/>[classifier.py]"]
  node_linker["Claim-law linker<br/>[linker.py]"]
  node_query_norm["Query normalization<br/>[query_norm.py]"]
  node_embeddings["Semantic retrieval<br/>[embeddings.py]"]
  node_misinformation["Misinfo and trends<br/>[misinformation.py]"]
  node_pipeline["Discourse pipeline<br/>[run_pipeline.py]"]
end

subgraph group_product_api["API and dashboard"]
  node_api_main["API application<br/>[main.py]"]
  node_qa["Cited Q&amp;A and search<br/>[qa_endpoint.py]"]
  node_dashboard_api["Dashboard API"]
  node_documents_api["Documents API"]
  node_graph_api["Graph API<br/>[graph_endpoint.py]"]
  node_law_api["Law API<br/>[law_endpoint.py]"]
  node_frontend["Dashboard UI<br/>[app.js]"]
end

node_legal_sources["Legal documents"]
node_social_sources["Public posts"]
node_neo4j[("Neo4j")]
node_llm["LLM client<br/>[llm.py]"]
node_user(("User"))

node_legal_sources -->|"parsed into"| node_parser
node_legal_sources -->|"entities extracted"| node_extractor
node_parser -->|"structured documents"| node_loader
node_extractor -->|"enriched data"| node_loader
node_loader -->|"writes through"| node_graph_connection
node_graph_schema -->|"defines graph"| node_graph_connection
node_graph_connection -->|"reads and writes"| node_neo4j
node_diffing -->|"reads and updates"| node_graph_connection
node_social_sources -->|"provides posts"| node_pipeline
node_pipeline -->|"classifies posts"| node_classifier
node_pipeline -->|"links claims"| node_linker
node_pipeline -->|"assesses and clusters"| node_misinformation
node_classifier -.->|"classifies with"| node_llm
node_linker -->|"normalizes retrieval"| node_query_norm
node_linker -->|"retrieves candidates"| node_embeddings
node_linker -.->|"ranks with"| node_llm
node_misinformation -.->|"assesses with"| node_llm
node_api_main -->|"dispatches"| node_qa
node_api_main -->|"dispatches"| node_dashboard_api
node_api_main -->|"dispatches"| node_documents_api
node_api_main -->|"dispatches"| node_graph_api
node_api_main -->|"dispatches"| node_law_api
node_qa -->|"normalizes question"| node_query_norm
node_qa -->|"retrieves legal basis"| node_graph_connection
node_qa -.->|"generates answer"| node_llm
node_dashboard_api -->|"reads dashboard data"| node_graph_connection
node_documents_api -->|"reads documents"| node_graph_connection
node_graph_api -->|"reads graph data"| node_graph_connection
node_law_api -->|"queries law"| node_graph_connection
node_frontend -->|"requests answers and search"| node_qa
node_frontend -->|"loads dashboard"| node_dashboard_api
node_frontend -->|"requests documents"| node_documents_api
node_frontend -->|"explores graph"| node_graph_api
node_frontend -->|"requests legal data"| node_law_api
node_user -->|"uses dashboard"| node_frontend

click node_parser "https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/ingestion/parser.py"
click node_extractor "https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/ingestion/extractor.py"
click node_loader "https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/graph/loader.py"
click node_diffing "https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/graph/diffing.py"
click node_graph_schema "https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/graph/schema.py"
click node_graph_connection "https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/graph/connection.py"
click node_classifier "https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/discourse/classifier.py"
click node_linker "https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/discourse/linker.py"
click node_query_norm "https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/discourse/query_norm.py"
click node_embeddings "https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/discourse/embeddings.py"
click node_misinformation "https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/discourse/misinformation.py"
click node_pipeline "https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/scripts/run_pipeline.py"
click node_llm "https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/core/llm.py"
click node_api_main "https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/api/main.py"
click node_qa "https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/api/qa_endpoint.py"
click node_dashboard_api "https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/api/dashboard_endpoint.py"
click node_documents_api "https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/api/documents_endpoint.py"
click node_graph_api "https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/api/graph_endpoint.py"
click node_law_api "https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/api/law_endpoint.py"
click node_frontend "https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/frontend/static/app.js"

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_parser,node_extractor,node_llm,node_user toneBlue
class node_loader,node_diffing,node_graph_schema,node_graph_connection,node_neo4j toneAmber
class node_classifier,node_linker,node_query_norm,node_embeddings,node_misinformation,node_pipeline toneMint
class node_api_main,node_qa,node_dashboard_api,node_documents_api,node_graph_api,node_law_api,node_frontend toneRose
class node_legal_sources,node_social_sources toneIndigo
```

## Components

### Legal ingestion

- [Legal parser](https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/ingestion/parser.py): `backend/ingestion/parser.py`
- [Entity extraction](https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/ingestion/extractor.py): `backend/ingestion/extractor.py`

### Legal knowledge graph

- [Graph loader](https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/graph/loader.py): `backend/graph/loader.py`
- [Amendment diffing](https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/graph/diffing.py): `backend/graph/diffing.py`
- [Graph schema](https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/graph/schema.py): `backend/graph/schema.py`
- [Graph connection](https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/graph/connection.py): `backend/graph/connection.py`

### Discourse intelligence

- [Topic classifier](https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/discourse/classifier.py): `backend/discourse/classifier.py`
- [Claim-law linker](https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/discourse/linker.py): `backend/discourse/linker.py`
- [Query normalization](https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/discourse/query_norm.py): `backend/discourse/query_norm.py`
- [Semantic retrieval](https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/discourse/embeddings.py): `backend/discourse/embeddings.py`
- [Misinfo and trends](https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/discourse/misinformation.py): `backend/discourse/misinformation.py`
- [Discourse pipeline](https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/scripts/run_pipeline.py): `scripts/run_pipeline.py`

### API and dashboard

- [API application](https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/api/main.py): `backend/api/main.py`
- [Cited Q&A and search](https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/api/qa_endpoint.py): `backend/api/qa_endpoint.py`
- [Dashboard API](https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/api/dashboard_endpoint.py): `backend/api/dashboard_endpoint.py`
- [Documents API](https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/api/documents_endpoint.py): `backend/api/documents_endpoint.py`
- [Graph API](https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/api/graph_endpoint.py): `backend/api/graph_endpoint.py`
- [Law API](https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/api/law_endpoint.py): `backend/api/law_endpoint.py`
- [Dashboard UI](https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/frontend/static/app.js): `frontend/static/app.js`

### Other components

- **Legal documents**
- **Public posts**
- **Neo4j**
- [LLM client](https://github.com/devtamin04/lawgic--l-gpt6.7--vaic2026/blob/main/backend/core/llm.py): `backend/core/llm.py`
- **User**

## Connections

- Legal documents → Legal parser: parsed into
- Legal documents → Entity extraction: entities extracted
- Legal parser → Graph loader: structured documents
- Entity extraction → Graph loader: enriched data
- Graph loader → Graph connection: writes through
- Graph schema → Graph connection: defines graph
- Graph connection → Neo4j: reads and writes
- Amendment diffing → Graph connection: reads and updates
- Public posts → Discourse pipeline: provides posts
- Discourse pipeline → Topic classifier: classifies posts
- Discourse pipeline → Claim-law linker: links claims
- Discourse pipeline → Misinfo and trends: assesses and clusters
- Topic classifier → LLM client: classifies with
- Claim-law linker → Query normalization: normalizes retrieval
- Claim-law linker → Semantic retrieval: retrieves candidates
- Claim-law linker → LLM client: ranks with
- Misinfo and trends → LLM client: assesses with
- API application → Cited Q&A and search: dispatches
- API application → Dashboard API: dispatches
- API application → Documents API: dispatches
- API application → Graph API: dispatches
- API application → Law API: dispatches
- Cited Q&A and search → Query normalization: normalizes question
- Cited Q&A and search → Graph connection: retrieves legal basis
- Cited Q&A and search → LLM client: generates answer
- Dashboard API → Graph connection: reads dashboard data
- Documents API → Graph connection: reads documents
- Graph API → Graph connection: reads graph data
- Law API → Graph connection: queries law
- Dashboard UI → Cited Q&A and search: requests answers and search
- Dashboard UI → Dashboard API: loads dashboard
- Dashboard UI → Documents API: requests documents
- Dashboard UI → Graph API: explores graph
- Dashboard UI → Law API: requests legal data
- User → Dashboard UI: uses dashboard
