# blueberryrush/prahari-mplads architecture

> Architecture diagram of the GitHub repository blueberryrush/prahari-mplads, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/blueberryrush/prahari-mplads
- Repository: https://github.com/blueberryrush/prahari-mplads

## Overview

PRAHARI is an MPLADS civic-intelligence prototype for public project exploration and official risk investigation. Its principal workflow moves from the command centre’s priority cases to a risk profile, evidence review, investigation assessment, field verification, and recorded feedback. The frontend also supports citizen map-based exploration and related risk, financial, duplicate, and bottleneck analysis. The backend exposes project and investigation APIs backed by database services. The README describes product capabilities beyond the sampled implementation; those branches are represented without inferring unshown call paths.

Main entry points: [`src/App.jsx`](https://github.com/blueberryrush/prahari-mplads/blob/main/src/App.jsx) (App Router), [`src/pages/official/InvestigationCentre.jsx`](https://github.com/blueberryrush/prahari-mplads/blob/main/src/pages/official/InvestigationCentre.jsx) (Investigation Centre), [`src/pages/official/OfficialDashboard.jsx`](https://github.com/blueberryrush/prahari-mplads/blob/main/src/pages/official/OfficialDashboard.jsx) (Command Centre), [`backend/main.py`](https://github.com/blueberryrush/prahari-mplads/blob/main/backend/main.py) (Backend API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and Navigation"]
  node_app["App Router<br/>[App.jsx]"]
  node_auth["Authentication<br/>[AuthContext.jsx]"]
  node_login["Login<br/>[LoginPage.jsx]"]
  node_citizen_portal["Citizen Portal"]
  node_project_explorer["Project Explorer"]
end

subgraph group_intelligence["Risk Intelligence"]
  node_command_centre["Command Centre"]
  node_risk_profile["Risk Profile<br/>[RiskProfile.jsx]"]
  node_risk_engine["Risk Analysis Engine<br/>[aiEngine.js]"]
  node_bottleneck_analysis["Bottleneck Analysis"]
  node_scoring["Backend Scoring<br/>[scoring.py]"]
  node_gemini["Gemini Service<br/>[gemini_service.py]"]
end

subgraph group_investigation["Investigation Workflow"]
  node_case_state["Case Workflow State<br/>[CaseContext.jsx]"]
  node_investigation_centre["Investigation Centre"]
  node_assignment["Case Assignment"]
  node_field_verification["Field Verification"]
  node_financial_verification["Financial Verification"]
  node_duplicate_verification["Duplicate Verification"]
end

subgraph group_data["Project Data Services"]
  node_mock_data["Prototype Records<br/>[mockData.js]"]
  node_api_client["API Client<br/>[client.js]"]
  node_backend_api["Backend API<br/>[main.py]"]
  node_database[("Project Database<br/>[database.py]")]
end

node_official(("Officials"))
node_citizens(("Citizens"))

node_official -->|"opens"| node_app
node_citizens -->|"opens"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_command_centre
node_app -->|"routes to"| node_citizen_portal
node_app -->|"routes to"| node_investigation_centre
node_login -->|"authenticates with"| node_auth
node_command_centre -->|"opens"| node_risk_profile
node_risk_profile -->|"uses analysis"| node_risk_engine
node_risk_engine -->|"reads records"| node_mock_data
node_command_centre -->|"manages cases"| node_case_state
node_case_state -->|"provides case state"| node_investigation_centre
node_investigation_centre -->|"renders"| node_assignment
node_investigation_centre -->|"supports field checks"| node_field_verification
node_investigation_centre -->|"supports assessment"| node_financial_verification
node_investigation_centre -->|"supports evidence review"| node_duplicate_verification
node_command_centre -.->|"offers analysis"| node_bottleneck_analysis
node_citizen_portal -->|"explores projects"| node_project_explorer
node_citizen_portal -->|"fetches projects"| node_api_client
node_case_state -->|"syncs decisions"| node_api_client
node_api_client -->|"requests data"| node_backend_api
node_backend_api -->|"reads and writes"| node_database
node_backend_api -.->|"uses scoring"| node_scoring
node_backend_api -.->|"optional AI service"| node_gemini
node_api_client -->|"fallback records"| node_mock_data

click node_app "https://github.com/blueberryrush/prahari-mplads/blob/main/src/App.jsx"
click node_auth "https://github.com/blueberryrush/prahari-mplads/blob/main/src/contexts/AuthContext.jsx"
click node_login "https://github.com/blueberryrush/prahari-mplads/blob/main/src/pages/LoginPage.jsx"
click node_citizen_portal "https://github.com/blueberryrush/prahari-mplads/blob/main/src/pages/citizen/CitizenDashboard.jsx"
click node_project_explorer "https://github.com/blueberryrush/prahari-mplads/blob/main/src/pages/citizen/ProjectExplorer.jsx"
click node_command_centre "https://github.com/blueberryrush/prahari-mplads/blob/main/src/pages/official/OfficialDashboard.jsx"
click node_risk_profile "https://github.com/blueberryrush/prahari-mplads/blob/main/src/pages/official/RiskProfile.jsx"
click node_risk_engine "https://github.com/blueberryrush/prahari-mplads/blob/main/src/data/aiEngine.js"
click node_mock_data "https://github.com/blueberryrush/prahari-mplads/blob/main/src/data/mockData.js"
click node_case_state "https://github.com/blueberryrush/prahari-mplads/blob/main/src/contexts/CaseContext.jsx"
click node_investigation_centre "https://github.com/blueberryrush/prahari-mplads/blob/main/src/pages/official/InvestigationCentre.jsx"
click node_assignment "https://github.com/blueberryrush/prahari-mplads/blob/main/src/components/investigation/InvestigationAssignmentModal.jsx"
click node_field_verification "https://github.com/blueberryrush/prahari-mplads/blob/main/src/components/investigation/GroundVerificationCapture.jsx"
click node_financial_verification "https://github.com/blueberryrush/prahari-mplads/blob/main/src/pages/official/FinancialVerification.jsx"
click node_duplicate_verification "https://github.com/blueberryrush/prahari-mplads/blob/main/src/pages/official/DuplicateVerification.jsx"
click node_bottleneck_analysis "https://github.com/blueberryrush/prahari-mplads/blob/main/src/pages/official/PredictiveBottleneck.jsx"
click node_api_client "https://github.com/blueberryrush/prahari-mplads/blob/main/src/api/client.js"
click node_backend_api "https://github.com/blueberryrush/prahari-mplads/blob/main/backend/main.py"
click node_database "https://github.com/blueberryrush/prahari-mplads/blob/main/backend/database.py"
click node_scoring "https://github.com/blueberryrush/prahari-mplads/blob/main/backend/services/scoring.py"
click node_gemini "https://github.com/blueberryrush/prahari-mplads/blob/main/backend/services/gemini_service.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_auth,node_login,node_citizen_portal,node_project_explorer toneBlue
class node_command_centre,node_risk_profile,node_risk_engine,node_bottleneck_analysis,node_scoring,node_gemini toneAmber
class node_case_state,node_investigation_centre,node_assignment,node_field_verification,node_financial_verification,node_duplicate_verification toneMint
class node_mock_data,node_api_client,node_backend_api,node_database toneRose
class node_official,node_citizens toneIndigo
```

## Components

### Access and Navigation

- [App Router](https://github.com/blueberryrush/prahari-mplads/blob/main/src/App.jsx): `src/App.jsx`
- [Authentication](https://github.com/blueberryrush/prahari-mplads/blob/main/src/contexts/AuthContext.jsx): `src/contexts/AuthContext.jsx`
- [Login](https://github.com/blueberryrush/prahari-mplads/blob/main/src/pages/LoginPage.jsx): `src/pages/LoginPage.jsx`
- [Citizen Portal](https://github.com/blueberryrush/prahari-mplads/blob/main/src/pages/citizen/CitizenDashboard.jsx): `src/pages/citizen/CitizenDashboard.jsx`
- [Project Explorer](https://github.com/blueberryrush/prahari-mplads/blob/main/src/pages/citizen/ProjectExplorer.jsx): `src/pages/citizen/ProjectExplorer.jsx`

### Risk Intelligence

- [Command Centre](https://github.com/blueberryrush/prahari-mplads/blob/main/src/pages/official/OfficialDashboard.jsx): `src/pages/official/OfficialDashboard.jsx`
- [Risk Profile](https://github.com/blueberryrush/prahari-mplads/blob/main/src/pages/official/RiskProfile.jsx): `src/pages/official/RiskProfile.jsx`
- [Risk Analysis Engine](https://github.com/blueberryrush/prahari-mplads/blob/main/src/data/aiEngine.js): `src/data/aiEngine.js`
- [Bottleneck Analysis](https://github.com/blueberryrush/prahari-mplads/blob/main/src/pages/official/PredictiveBottleneck.jsx): `src/pages/official/PredictiveBottleneck.jsx`
- [Backend Scoring](https://github.com/blueberryrush/prahari-mplads/blob/main/backend/services/scoring.py): `backend/services/scoring.py`
- [Gemini Service](https://github.com/blueberryrush/prahari-mplads/blob/main/backend/services/gemini_service.py): `backend/services/gemini_service.py`

### Investigation Workflow

- [Case Workflow State](https://github.com/blueberryrush/prahari-mplads/blob/main/src/contexts/CaseContext.jsx): `src/contexts/CaseContext.jsx`
- [Investigation Centre](https://github.com/blueberryrush/prahari-mplads/blob/main/src/pages/official/InvestigationCentre.jsx): `src/pages/official/InvestigationCentre.jsx`
- [Case Assignment](https://github.com/blueberryrush/prahari-mplads/blob/main/src/components/investigation/InvestigationAssignmentModal.jsx): `src/components/investigation/InvestigationAssignmentModal.jsx`
- [Field Verification](https://github.com/blueberryrush/prahari-mplads/blob/main/src/components/investigation/GroundVerificationCapture.jsx): `src/components/investigation/GroundVerificationCapture.jsx`
- [Financial Verification](https://github.com/blueberryrush/prahari-mplads/blob/main/src/pages/official/FinancialVerification.jsx): `src/pages/official/FinancialVerification.jsx`
- [Duplicate Verification](https://github.com/blueberryrush/prahari-mplads/blob/main/src/pages/official/DuplicateVerification.jsx): `src/pages/official/DuplicateVerification.jsx`

### Project Data Services

- [Prototype Records](https://github.com/blueberryrush/prahari-mplads/blob/main/src/data/mockData.js): `src/data/mockData.js`
- [API Client](https://github.com/blueberryrush/prahari-mplads/blob/main/src/api/client.js): `src/api/client.js`
- [Backend API](https://github.com/blueberryrush/prahari-mplads/blob/main/backend/main.py): `backend/main.py`
- [Project Database](https://github.com/blueberryrush/prahari-mplads/blob/main/backend/database.py): `backend/database.py`

### Other components

- **Officials**
- **Citizens**

## Connections

- Officials → App Router: opens (evidence: `README.md`)
- Citizens → App Router: opens (evidence: `README.md`)
- App Router → Login: routes to (evidence: `src/App.jsx`)
- App Router → Command Centre: routes to (evidence: `src/App.jsx`)
- App Router → Citizen Portal: routes to (evidence: `src/App.jsx`)
- App Router → Investigation Centre: routes to (evidence: `src/App.jsx`)
- Login → Authentication: authenticates with (evidence: `src/pages/LoginPage.jsx`)
- Command Centre → Risk Profile: opens (evidence: `README.md`)
- Risk Profile → Risk Analysis Engine: uses analysis (evidence: `src/pages/official/RiskProfile.jsx`)
- Risk Analysis Engine → Prototype Records: reads records (evidence: `src/data/aiEngine.js`)
- Command Centre → Case Workflow State: manages cases (evidence: `src/pages/official/OfficialDashboard.jsx`)
- Case Workflow State → Investigation Centre: provides case state (evidence: `src/contexts/CaseContext.jsx`)
- Investigation Centre → Case Assignment: renders (evidence: `src/pages/official/InvestigationCentre.jsx`)
- Investigation Centre → Field Verification: supports field checks (evidence: `README.md`)
- Investigation Centre → Financial Verification: supports assessment (evidence: `README.md`)
- Investigation Centre → Duplicate Verification: supports evidence review (evidence: `src/pages/official/InvestigationCentre.jsx`)
- Command Centre → Bottleneck Analysis: offers analysis
- Citizen Portal → Project Explorer: explores projects (evidence: `README.md`)
- Citizen Portal → API Client: fetches projects (evidence: `src/pages/citizen/CitizenDashboard.jsx`)
- Case Workflow State → API Client: syncs decisions (evidence: `src/contexts/CaseContext.jsx`)
- API Client → Backend API: requests data (evidence: `src/api/client.js`)
- Backend API → Project Database: reads and writes (evidence: `backend/main.py`)
- Backend API → Backend Scoring: uses scoring (evidence: `backend/main.py`)
- Backend API → Gemini Service: optional AI service (evidence: `backend/main.py`)
- API Client → Prototype Records: fallback records (evidence: `src/api/client.js`)
