# saepulloh07/sivalidrg-0.0.1 architecture

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

- Interactive diagram: https://gitdiagram.com/saepulloh07/sivalidrg-0.0.1
- Repository: https://github.com/saepulloh07/sivalidrg-0.0.1

## Overview

SIVALIDRG supports medical-record coding and review: users navigate the authenticated web app to manage patients and documents, review coding cases, and inspect validation and agent results. The backend exposes the product APIs, while the AI service provides inference and multi-agent validation backed by database models. The source index supports the AI service’s internal calls, but no README or excerpt confirms how the backend invokes it; that integration is therefore not drawn.

Main entry points: [`Frontend/src/App.jsx`](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Frontend/src/App.jsx) (App routing), [`ai-service/app/routes/inference.py`](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/ai-service/app/routes/inference.py) (Inference endpoints), [`Backend/src/server.js`](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Backend/src/server.js) (API server), [`ai-service/app/agents/orchestrator.py`](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/ai-service/app/agents/orchestrator.py) (Validation orchestrator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_webapp["App routing<br/>[App.jsx]"]
  node_layout["Main layout<br/>[MainLayout.jsx]"]
  node_case_detail["Case review<br/>[CaseDetail.jsx]"]
  node_patient_pages["Patient management<br/>[Patients.jsx]"]
  node_document_pages["Document management<br/>[Documents.jsx]"]
  node_coding_pages["Coding cases<br/>[CodingCases.jsx]"]
  node_validation_page["Validation review<br/>[Validation.jsx]"]
  node_agents_page["Agent results<br/>[Agents.jsx]"]
  node_dashboard_page["Dashboard<br/>[Dashboard.jsx]"]
  node_api_client["API client<br/>[api.js]"]
  node_doc_processing["Document processing"]
end

subgraph group_backend["Backend API"]
  node_server["API server<br/>[server.js]"]
  node_auth_controller["Authentication<br/>[auth.controller.js]"]
  node_auth_middleware["JWT authorization<br/>[auth.js]"]
  node_patient_routes["Patient routes<br/>[patients.js]"]
  node_document_routes["Document routes<br/>[documents.js]"]
  node_coding_routes["Coding routes<br/>[coding.js]"]
  node_validation_routes["Validation routes<br/>[validation.js]"]
  node_dashboard_routes["Dashboard routes<br/>[dashboard.js]"]
  node_agent_routes["Agent routes<br/>[agents.js]"]
end

subgraph group_ai["AI inference"]
  node_ai_main["AI service entry<br/>[main.py]"]
  node_inference["Inference endpoints<br/>[inference.py]"]
  node_orchestrator["Validation orchestrator<br/>[orchestrator.py]"]
  node_mismatch["Mismatch checker"]
  node_icd_validator["ICD validator<br/>[icd_validator.py]"]
  node_checklist["Checklist agent<br/>[auto_checklist.py]"]
  node_ollama["Ollama client<br/>[ollama_client.py]"]
end

subgraph group_nlp["Clinical analysis"]
  node_entity_extractor["Entity extraction"]
  node_icd_matcher["ICD matching<br/>[icd_matcher.py]"]
  node_evidence_highlighter["Evidence highlighting"]
end

subgraph group_storage["Persistence"]
  node_backend_db[("Backend database<br/>[database.js]")]
  node_ai_db[("AI database session<br/>[database.py]")]
  node_models[("Clinical data models<br/>[models.py]")]
end

node_user(("Clinical user"))

node_user -->|"uses"| node_webapp
node_webapp -->|"routes through"| node_layout
node_webapp -->|"routes to"| node_case_detail
node_webapp -->|"routes to"| node_patient_pages
node_webapp -->|"routes to"| node_document_pages
node_webapp -->|"routes to"| node_coding_pages
node_webapp -->|"routes to"| node_validation_page
node_webapp -->|"routes to"| node_agents_page
node_webapp -->|"routes to"| node_dashboard_page
node_server -->|"dispatches auth"| node_auth_controller
node_server -->|"mounts routes"| node_patient_routes
node_server -->|"mounts routes"| node_document_routes
node_server -->|"mounts routes"| node_coding_routes
node_server -->|"mounts routes"| node_validation_routes
node_server -->|"mounts routes"| node_dashboard_routes
node_server -->|"mounts routes"| node_agent_routes
node_auth_controller -.->|"protected by"| node_auth_middleware
node_auth_middleware -->|"queries users"| node_backend_db
node_ai_main -->|"registers routes"| node_inference
node_ai_main -->|"initializes session"| node_ai_db
node_ai_main -->|"uses validation"| node_orchestrator
node_ai_main -->|"uses model client"| node_ollama
node_inference -->|"queries session"| node_ai_db
node_inference -->|"reads and writes"| node_models
node_inference -->|"extracts entities"| node_entity_extractor
node_inference -->|"matches codes"| node_icd_matcher
node_inference -->|"highlights evidence"| node_evidence_highlighter
node_inference -->|"runs validation"| node_orchestrator
node_inference -->|"calls model"| node_ollama
node_orchestrator -->|"runs checker"| node_mismatch
node_orchestrator -->|"runs validator"| node_icd_validator
node_orchestrator -->|"builds checklist"| node_checklist
node_ai_db -->|"initializes tables"| node_models

click node_webapp "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Frontend/src/App.jsx"
click node_layout "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Frontend/src/components/MainLayout.jsx"
click node_case_detail "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Frontend/src/pages/CaseDetail.jsx"
click node_patient_pages "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Frontend/src/pages/Patients.jsx"
click node_document_pages "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Frontend/src/pages/Documents.jsx"
click node_coding_pages "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Frontend/src/pages/CodingCases.jsx"
click node_validation_page "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Frontend/src/pages/Validation.jsx"
click node_agents_page "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Frontend/src/pages/Agents.jsx"
click node_dashboard_page "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Frontend/src/pages/Dashboard.jsx"
click node_api_client "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Frontend/src/services/api.js"
click node_doc_processing "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Frontend/src/hooks/useDocumentProcessing.js"
click node_server "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Backend/src/server.js"
click node_auth_controller "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Backend/src/services/auth-service/controller/auth.controller.js"
click node_auth_middleware "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Backend/src/middleware/auth.js"
click node_patient_routes "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Backend/src/routes/patients.js"
click node_document_routes "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Backend/src/routes/documents.js"
click node_coding_routes "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Backend/src/routes/coding.js"
click node_validation_routes "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Backend/src/routes/validation.js"
click node_dashboard_routes "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Backend/src/routes/dashboard.js"
click node_agent_routes "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Backend/src/routes/agents.js"
click node_backend_db "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Backend/src/config/database.js"
click node_ai_main "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/ai-service/app/main.py"
click node_inference "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/ai-service/app/routes/inference.py"
click node_orchestrator "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/ai-service/app/agents/orchestrator.py"
click node_mismatch "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/ai-service/app/agents/mismatch_checker.py"
click node_icd_validator "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/ai-service/app/agents/icd_validator.py"
click node_checklist "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/ai-service/app/agents/auto_checklist.py"
click node_entity_extractor "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/ai-service/app/nlp/entity_extractor.py"
click node_icd_matcher "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/ai-service/app/nlp/icd_matcher.py"
click node_evidence_highlighter "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/ai-service/app/nlp/evidence_highlighter.py"
click node_ollama "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/ai-service/app/utils/ollama_client.py"
click node_ai_db "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/ai-service/app/database.py"
click node_models "https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/ai-service/app/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_webapp,node_layout,node_case_detail,node_patient_pages,node_document_pages,node_coding_pages,node_validation_page,node_agents_page,node_dashboard_page,node_api_client,node_doc_processing,node_user toneBlue
class node_server,node_auth_controller,node_auth_middleware,node_patient_routes,node_document_routes,node_coding_routes,node_validation_routes,node_dashboard_routes,node_agent_routes toneAmber
class node_ai_main,node_inference,node_orchestrator,node_mismatch,node_icd_validator,node_checklist,node_ollama toneMint
class node_entity_extractor,node_icd_matcher,node_evidence_highlighter toneRose
class node_backend_db,node_ai_db,node_models toneIndigo
```

## Components

### Web application

- [App routing](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Frontend/src/App.jsx): `Frontend/src/App.jsx`
- [Main layout](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Frontend/src/components/MainLayout.jsx): `Frontend/src/components/MainLayout.jsx`
- [Case review](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Frontend/src/pages/CaseDetail.jsx): `Frontend/src/pages/CaseDetail.jsx`
- [Patient management](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Frontend/src/pages/Patients.jsx): `Frontend/src/pages/Patients.jsx`
- [Document management](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Frontend/src/pages/Documents.jsx): `Frontend/src/pages/Documents.jsx`
- [Coding cases](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Frontend/src/pages/CodingCases.jsx): `Frontend/src/pages/CodingCases.jsx`
- [Validation review](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Frontend/src/pages/Validation.jsx): `Frontend/src/pages/Validation.jsx`
- [Agent results](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Frontend/src/pages/Agents.jsx): `Frontend/src/pages/Agents.jsx`
- [Dashboard](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Frontend/src/pages/Dashboard.jsx): `Frontend/src/pages/Dashboard.jsx`
- [API client](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Frontend/src/services/api.js): `Frontend/src/services/api.js`
- [Document processing](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Frontend/src/hooks/useDocumentProcessing.js): `Frontend/src/hooks/useDocumentProcessing.js`

### Backend API

- [API server](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Backend/src/server.js): `Backend/src/server.js`
- [Authentication](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Backend/src/services/auth-service/controller/auth.controller.js): `Backend/src/services/auth-service/controller/auth.controller.js`
- [JWT authorization](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Backend/src/middleware/auth.js): `Backend/src/middleware/auth.js`
- [Patient routes](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Backend/src/routes/patients.js): `Backend/src/routes/patients.js`
- [Document routes](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Backend/src/routes/documents.js): `Backend/src/routes/documents.js`
- [Coding routes](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Backend/src/routes/coding.js): `Backend/src/routes/coding.js`
- [Validation routes](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Backend/src/routes/validation.js): `Backend/src/routes/validation.js`
- [Dashboard routes](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Backend/src/routes/dashboard.js): `Backend/src/routes/dashboard.js`
- [Agent routes](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Backend/src/routes/agents.js): `Backend/src/routes/agents.js`

### AI inference

- [AI service entry](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/ai-service/app/main.py): `ai-service/app/main.py`
- [Inference endpoints](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/ai-service/app/routes/inference.py): `ai-service/app/routes/inference.py`
- [Validation orchestrator](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/ai-service/app/agents/orchestrator.py): `ai-service/app/agents/orchestrator.py`
- [Mismatch checker](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/ai-service/app/agents/mismatch_checker.py): `ai-service/app/agents/mismatch_checker.py`
- [ICD validator](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/ai-service/app/agents/icd_validator.py): `ai-service/app/agents/icd_validator.py`
- [Checklist agent](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/ai-service/app/agents/auto_checklist.py): `ai-service/app/agents/auto_checklist.py`
- [Ollama client](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/ai-service/app/utils/ollama_client.py): `ai-service/app/utils/ollama_client.py`

### Clinical analysis

- [Entity extraction](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/ai-service/app/nlp/entity_extractor.py): `ai-service/app/nlp/entity_extractor.py`
- [ICD matching](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/ai-service/app/nlp/icd_matcher.py): `ai-service/app/nlp/icd_matcher.py`
- [Evidence highlighting](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/ai-service/app/nlp/evidence_highlighter.py): `ai-service/app/nlp/evidence_highlighter.py`

### Persistence

- [Backend database](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/Backend/src/config/database.js): `Backend/src/config/database.js`
- [AI database session](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/ai-service/app/database.py): `ai-service/app/database.py`
- [Clinical data models](https://github.com/saepulloh07/sivalidrg-0.0.1/blob/master/ai-service/app/models.py): `ai-service/app/models.py`

### Other components

- **Clinical user**

## Connections

- Clinical user → App routing: uses (evidence: `Frontend/src/App.jsx`)
- App routing → Main layout: routes through (evidence: `Frontend/src/App.jsx`)
- App routing → Case review: routes to (evidence: `Frontend/src/App.jsx`)
- App routing → Patient management: routes to (evidence: `Frontend/src/App.jsx`)
- App routing → Document management: routes to (evidence: `Frontend/src/App.jsx`)
- App routing → Coding cases: routes to (evidence: `Frontend/src/App.jsx`)
- App routing → Validation review: routes to (evidence: `Frontend/src/App.jsx`)
- App routing → Agent results: routes to (evidence: `Frontend/src/App.jsx`)
- App routing → Dashboard: routes to (evidence: `Frontend/src/App.jsx`)
- API server → Authentication: dispatches auth (evidence: `Backend/src/server.js`)
- API server → Patient routes: mounts routes (evidence: `Backend/src/server.js`)
- API server → Document routes: mounts routes (evidence: `Backend/src/server.js`)
- API server → Coding routes: mounts routes (evidence: `Backend/src/server.js`)
- API server → Validation routes: mounts routes (evidence: `Backend/src/server.js`)
- API server → Dashboard routes: mounts routes (evidence: `Backend/src/server.js`)
- API server → Agent routes: mounts routes (evidence: `Backend/src/server.js`)
- Authentication → JWT authorization: protected by
- JWT authorization → Backend database: queries users (evidence: `Backend/src/middleware/auth.js`)
- AI service entry → Inference endpoints: registers routes (evidence: `ai-service/app/main.py`)
- AI service entry → AI database session: initializes session (evidence: `ai-service/app/main.py`)
- AI service entry → Validation orchestrator: uses validation (evidence: `ai-service/app/main.py`)
- AI service entry → Ollama client: uses model client (evidence: `ai-service/app/main.py`)
- Inference endpoints → AI database session: queries session (evidence: `ai-service/app/routes/inference.py`)
- Inference endpoints → Clinical data models: reads and writes (evidence: `ai-service/app/routes/inference.py`)
- Inference endpoints → Entity extraction: extracts entities (evidence: `ai-service/app/routes/inference.py`)
- Inference endpoints → ICD matching: matches codes (evidence: `ai-service/app/routes/inference.py`)
- Inference endpoints → Evidence highlighting: highlights evidence (evidence: `ai-service/app/routes/inference.py`)
- Inference endpoints → Validation orchestrator: runs validation (evidence: `ai-service/app/routes/inference.py`)
- Inference endpoints → Ollama client: calls model (evidence: `ai-service/app/routes/inference.py`)
- Validation orchestrator → Mismatch checker: runs checker (evidence: `ai-service/app/agents/orchestrator.py`)
- Validation orchestrator → ICD validator: runs validator (evidence: `ai-service/app/agents/orchestrator.py`)
- Validation orchestrator → Checklist agent: builds checklist (evidence: `ai-service/app/agents/orchestrator.py`)
- AI database session → Clinical data models: initializes tables (evidence: `ai-service/app/database.py`)
