# ra6233525-oss/ip-sakti-intelligence-hub architecture

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

- Interactive diagram: https://gitdiagram.com/ra6233525-oss/ip-sakti-intelligence-hub
- Repository: https://github.com/ra6233525-oss/ip-sakti-intelligence-hub

## Overview

IP-SAKTI is a web application for Ayurveda practitioners, researchers, and businesses to explore legal and biodiversity compliance. Users enter through the React app and can ask grounded legal questions, assess a product, generate a compliance roadmap, search patents, or explore a curated legal knowledge graph; the frontend API client sends these requests to FastAPI. The backend also supports document ingestion into semantic search. The graph follows documented registrations, imports, and calls; several listed modules are stubs or unsampled, so uncertain links are omitted.

Main entry points: [`frontend/src/services/api.js`](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/frontend/src/services/api.js) (API client), [`backend/main.py`](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/main.py) (FastAPI application), [`frontend/src/App.jsx`](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/frontend/src/App.jsx) (Application routes), [`backend/routes/documents.py`](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/routes/documents.py) (Document ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Application routes<br/>[App.jsx]"]
  node_home["Home<br/>[Home.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_chatui["Legal assistant<br/>[Chat.jsx]"]
  node_riskui["Product risk<br/>[ProductRisk.jsx]"]
  node_roadmapui["Compliance roadmap"]
  node_patentui["Patent search<br/>[PatentSearch.jsx]"]
  node_graphui["Knowledge graph<br/>[KnowledgeGraph.jsx]"]
  node_client["API client<br/>[api.js]"]
end

subgraph group_api["API workflows"]
  node_server["FastAPI application<br/>[main.py]"]
  node_chatroute["Chat endpoint<br/>[chat.py]"]
  node_documents["Document ingestion<br/>[documents.py]"]
  node_product["Risk assessment<br/>[product.py]"]
  node_compliance["Roadmap generation<br/>[compliance.py]"]
  node_patents["Patent search<br/>[patents.py]"]
  node_knowledge["Curated graph<br/>[graph.py]"]
end

subgraph group_rag["Legal retrieval"]
  node_loader["Document loading<br/>[document_loader.py]"]
  node_chunker["Text chunking<br/>[text_chunker.py]"]
  node_store[("Vector store<br/>[vector_store.py]")]
  node_embeddings["Embeddings<br/>[embeddings.py]"]
  node_retriever["Legal retrieval<br/>[retriever.py]"]
  node_answers["Answer generation"]
end

subgraph group_state["Data storage"]
  node_db[("Relational database<br/>[connection.py]")]
  node_models["Domain records<br/>[models.py]"]
end

node_user(("Practitioner"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_chatui
node_app -->|"routes to"| node_riskui
node_app -->|"routes to"| node_roadmapui
node_app -->|"routes to"| node_patentui
node_app -->|"routes to"| node_graphui
node_chatui -->|"calls"| node_client
node_riskui -->|"calls"| node_client
node_roadmapui -->|"calls"| node_client
node_patentui -->|"calls"| node_client
node_graphui -->|"calls"| node_client
node_client -->|"posts chat"| node_chatroute
node_client -->|"posts assessment"| node_product
node_client -->|"posts roadmap"| node_compliance
node_client -->|"posts search"| node_patents
node_client -->|"gets graph"| node_knowledge
node_server -->|"registers"| node_chatroute
node_server -->|"registers"| node_documents
node_server -->|"registers"| node_product
node_server -->|"registers"| node_compliance
node_server -->|"registers"| node_patents
node_server -->|"registers"| node_knowledge
node_chatroute -->|"retrieves evidence"| node_retriever
node_chatroute -->|"generates response"| node_answers
node_retriever -->|"searches"| node_store
node_compliance -->|"searches citations"| node_store
node_product -->|"uses retrieval"| node_store
node_documents -->|"loads documents"| node_loader
node_documents -->|"chunks text"| node_chunker
node_documents -->|"adds chunks"| node_store
node_documents -->|"uses sessions"| node_db
node_store -->|"embeds text"| node_embeddings
node_server -->|"creates tables"| node_db
node_server -->|"loads models"| node_models
node_models -->|"uses base"| node_db

click node_app "https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/frontend/src/App.jsx"
click node_home "https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/frontend/src/pages/Home.jsx"
click node_dashboard "https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/frontend/src/pages/Dashboard.jsx"
click node_chatui "https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/frontend/src/pages/Chat.jsx"
click node_riskui "https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/frontend/src/pages/ProductRisk.jsx"
click node_roadmapui "https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/frontend/src/pages/ComplianceRoadmap.jsx"
click node_patentui "https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/frontend/src/pages/PatentSearch.jsx"
click node_graphui "https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/frontend/src/pages/KnowledgeGraph.jsx"
click node_client "https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/frontend/src/services/api.js"
click node_server "https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/main.py"
click node_chatroute "https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/routes/chat.py"
click node_documents "https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/routes/documents.py"
click node_product "https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/routes/product.py"
click node_compliance "https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/routes/compliance.py"
click node_patents "https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/routes/patents.py"
click node_knowledge "https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/routes/graph.py"
click node_loader "https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/rag/document_loader.py"
click node_chunker "https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/rag/text_chunker.py"
click node_store "https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/rag/vector_store.py"
click node_embeddings "https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/rag/embeddings.py"
click node_retriever "https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/rag/retriever.py"
click node_answers "https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/rag/answer_generator.py"
click node_db "https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/database/connection.py"
click node_models "https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/database/models.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_app,node_home,node_dashboard,node_chatui,node_riskui,node_roadmapui,node_patentui,node_graphui,node_client toneBlue
class node_server,node_chatroute,node_documents,node_product,node_compliance,node_patents,node_knowledge toneAmber
class node_loader,node_chunker,node_store,node_embeddings,node_retriever,node_answers toneMint
class node_db,node_models toneRose
class node_user toneIndigo
```

## Components

### Web application

- [Application routes](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Home](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/frontend/src/pages/Home.jsx): `frontend/src/pages/Home.jsx`
- [Dashboard](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Legal assistant](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/frontend/src/pages/Chat.jsx): `frontend/src/pages/Chat.jsx`
- [Product risk](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/frontend/src/pages/ProductRisk.jsx): `frontend/src/pages/ProductRisk.jsx`
- [Compliance roadmap](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/frontend/src/pages/ComplianceRoadmap.jsx): `frontend/src/pages/ComplianceRoadmap.jsx`
- [Patent search](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/frontend/src/pages/PatentSearch.jsx): `frontend/src/pages/PatentSearch.jsx`
- [Knowledge graph](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/frontend/src/pages/KnowledgeGraph.jsx): `frontend/src/pages/KnowledgeGraph.jsx`
- [API client](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### API workflows

- [FastAPI application](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/main.py): `backend/main.py`
- [Chat endpoint](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/routes/chat.py): `backend/routes/chat.py`
- [Document ingestion](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/routes/documents.py): `backend/routes/documents.py`
- [Risk assessment](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/routes/product.py): `backend/routes/product.py`
- [Roadmap generation](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/routes/compliance.py): `backend/routes/compliance.py`
- [Patent search](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/routes/patents.py): `backend/routes/patents.py`
- [Curated graph](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/routes/graph.py): `backend/routes/graph.py`

### Legal retrieval

- [Document loading](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/rag/document_loader.py): `backend/rag/document_loader.py`
- [Text chunking](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/rag/text_chunker.py): `backend/rag/text_chunker.py`
- [Vector store](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/rag/vector_store.py): `backend/rag/vector_store.py`
- [Embeddings](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/rag/embeddings.py): `backend/rag/embeddings.py`
- [Legal retrieval](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/rag/retriever.py): `backend/rag/retriever.py`
- [Answer generation](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/rag/answer_generator.py): `backend/rag/answer_generator.py`

### Data storage

- [Relational database](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/database/connection.py): `backend/database/connection.py`
- [Domain records](https://github.com/ra6233525-oss/ip-sakti-intelligence-hub/blob/main/backend/database/models.py): `backend/database/models.py`

### Other components

- **Practitioner**

## Connections

- Practitioner → Application routes: uses (evidence: `frontend/src/App.jsx`)
- Application routes → Home: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → Dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → Legal assistant: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → Product risk: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → Compliance roadmap: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → Patent search: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → Knowledge graph: routes to (evidence: `frontend/src/App.jsx`)
- Legal assistant → API client: calls (evidence: `frontend/src/pages/Chat.jsx`)
- Product risk → API client: calls (evidence: `frontend/src/pages/ProductRisk.jsx`)
- Compliance roadmap → API client: calls (evidence: `frontend/src/pages/ComplianceRoadmap.jsx`)
- Patent search → API client: calls (evidence: `frontend/src/pages/PatentSearch.jsx`)
- Knowledge graph → API client: calls (evidence: `frontend/src/pages/KnowledgeGraph.jsx`)
- API client → Chat endpoint: posts chat (evidence: `frontend/src/services/api.js`)
- API client → Risk assessment: posts assessment (evidence: `frontend/src/services/api.js`)
- API client → Roadmap generation: posts roadmap (evidence: `frontend/src/services/api.js`)
- API client → Patent search: posts search (evidence: `frontend/src/services/api.js`)
- API client → Curated graph: gets graph (evidence: `frontend/src/services/api.js`)
- FastAPI application → Chat endpoint: registers (evidence: `backend/main.py`)
- FastAPI application → Document ingestion: registers (evidence: `backend/main.py`)
- FastAPI application → Risk assessment: registers (evidence: `backend/main.py`)
- FastAPI application → Roadmap generation: registers (evidence: `backend/main.py`)
- FastAPI application → Patent search: registers (evidence: `backend/main.py`)
- FastAPI application → Curated graph: registers (evidence: `backend/main.py`)
- Chat endpoint → Legal retrieval: retrieves evidence (evidence: `backend/routes/chat.py`)
- Chat endpoint → Answer generation: generates response (evidence: `backend/routes/chat.py`)
- Legal retrieval → Vector store: searches (evidence: `backend/rag/retriever.py`)
- Roadmap generation → Vector store: searches citations (evidence: `backend/routes/compliance.py`)
- Risk assessment → Vector store: uses retrieval (evidence: `backend/routes/product.py`)
- Document ingestion → Document loading: loads documents (evidence: `backend/routes/documents.py`)
- Document ingestion → Text chunking: chunks text (evidence: `backend/routes/documents.py`)
- Document ingestion → Vector store: adds chunks (evidence: `backend/routes/documents.py`)
- Document ingestion → Relational database: uses sessions (evidence: `backend/routes/documents.py`)
- Vector store → Embeddings: embeds text (evidence: `backend/rag/vector_store.py`)
- FastAPI application → Relational database: creates tables (evidence: `backend/main.py`)
- FastAPI application → Domain records: loads models (evidence: `backend/main.py`)
- Domain records → Relational database: uses base (evidence: `backend/database/models.py`)
