@@ -90,6 +90,101 @@ flowchart LR
9090 API -->|JSON| FE
9191```
9292
93+ ## Connection Flow
94+
95+ ``` mermaid
96+ sequenceDiagram
97+ participant User
98+ participant FE as Frontend (React)
99+ participant API as Flask API (/api)
100+ participant Risk as Risk Scoring
101+ participant Graph as Graph Analysis
102+ participant Report as Report Generator
103+ participant Store as Firestore (optional)
104+ participant Neo4j as Neo4j (optional)
105+ participant CSV as CSV Data
106+
107+ User->>FE: Open app / Login
108+ FE->>API: GET /alerts (Bearer token)
109+ API->>Risk: Load scores
110+ Risk->>CSV: Read AlertScores.csv
111+ API-->>FE: Alerts JSON
112+
113+ User->>FE: Upload dataset (CSV/ZIP)
114+ FE->>API: POST /datasets/upload
115+ API->>CSV: Replace files
116+ API->>Risk: Re-run analysis
117+ API-->>FE: Upload OK
118+
119+ User->>FE: Create case
120+ FE->>API: POST /cases
121+ API->>Store: Create/Update case (if configured)
122+ API-->>FE: Case created (caseId)
123+
124+ User->>FE: Investigate person/case
125+ FE->>API: GET /graph/:personId
126+ API->>Graph: Build graph
127+ Graph->>Neo4j: Query (if available)
128+ Graph->>CSV: Synthesize fallback
129+ API-->>FE: Graph JSON
130+
131+ User->>FE: Generate report
132+ FE->>API: GET /report/:id
133+ API->>Report: Compile PDF
134+ Report->>Risk: Pull scores
135+ Report->>CSV: Fetch details
136+ API-->>FE: PDF (blob)
137+
138+ FE-->>User: Render views / Download report
139+ ```
140+
141+ ## Detailed Application Flow
142+
143+ ``` mermaid
144+ flowchart TD
145+ Start([User opens app]) --> AuthCheck[Auth check via AuthProvider]
146+ AuthCheck -->|Authenticated| GoDashboard[Route to /dashboard]
147+ AuthCheck -->|No auth| GoLogin[Route to /login]
148+
149+ subgraph Dashboard
150+ GoDashboard --> FetchAlerts[GET /alerts]
151+ FetchAlerts --> ShowAlerts[Render alerts & metrics]
152+ ShowAlerts --> ActionTriage[Open Triage]
153+ ShowAlerts --> ActionInvestigate[Open Investigation]
154+ ShowAlerts --> ActionReporting[Open Reporting]
155+ end
156+
157+ subgraph Triage
158+ ActionTriage --> CreateCase[POST /cases]
159+ CreateCase --> CaseCreated[(caseId)]
160+ CaseCreated --> NavWorkspace[Go to /workspace/:caseId]
161+ end
162+
163+ subgraph Investigation_Workspace
164+ ActionInvestigate --> LoadGraph[GET /graph/:personId]
165+ NavWorkspace --> LoadGraph
166+ LoadGraph --> ViewGraph[React Flow graph + details]
167+ ViewGraph --> UpdateNotes[PUT /cases/:id/notes]
168+ UpdateNotes --> NotesSaved[Notes persisted (Firestore/local)]
169+ end
170+
171+ subgraph Reporting
172+ ActionReporting --> GetReport[GET /report/:id]
173+ GetReport --> PDF[PDF blob]
174+ PDF --> Download[Trigger download]
175+ end
176+
177+ subgraph Settings_and_Datasets
178+ Settings[Open Settings] --> Upload[POST /datasets/upload (CSV/ZIP)]
179+ Upload --> Reanalyze[Run analysis]
180+ Reanalyze --> AlertsUpdated[Updated AlertScores.csv]
181+ AlertsUpdated --> FetchAlerts
182+ end
183+
184+ GoLogin --> LoginFlow[Login (Firebase/mock token)]
185+ LoginFlow --> AuthCheck
186+ ```
187+
93188Backend (Flask):
94189- Data loader with schema validation (CSVs under ` backend/generated-data/ ` ).
95190- Risk scoring (` services/risk_scoring.py ` ), AI summarizer, report generator, optional graph analyzer.
0 commit comments