# rvgonzales0426/crimemapper architecture

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

- Interactive diagram: https://gitdiagram.com/rvgonzales0426/crimemapper
- Repository: https://github.com/rvgonzales0426/crimemapper

## Overview

Crime Mapper is a role-gated crime-analysis dashboard for police officers. The main workflow is to sign in, browse and filter incident records, inspect their map and hotspot analyses, then organize related incidents into investigations and review linked persons. Separate capabilities provide dashboard summaries, Knox analysis, patrol zones, AI assistance, and administrator-managed roles. The README documents Supabase/PostGIS-backed analysis and Edge Function integrations; unsampled modules are represented only at the subsystem level.

Main entry points: [`src/lib/supabase.js`](https://github.com/rvgonzales0426/crimemapper/blob/main/src/lib/supabase.js) (Supabase Client), [`src/stores/incidents.js`](https://github.com/rvgonzales0426/crimemapper/blob/main/src/stores/incidents.js) (Incident Queries & KDE), [`src/views/HotspotMapView.vue`](https://github.com/rvgonzales0426/crimemapper/blob/main/src/views/HotspotMapView.vue) (Hotspot Map), [`src/router/index.js`](https://github.com/rvgonzales0426/crimemapper/blob/main/src/router/index.js) (Route & Access Guard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access &amp; Shell"]
  node_router["Route &amp; Access Guard<br/>[index.js]"]
  node_auth["Authentication &amp; Roles<br/>[auth.js]"]
  node_shell["Dashboard Shell<br/>[App.vue]"]
  node_admin["User &amp; Role Admin<br/>[AdminView.vue]"]
end

subgraph group_analysis["Incident Analysis"]
  node_incidentview["Incident Browser<br/>[IncidentsView.vue]"]
  node_incidentstore["Incident Queries &amp; KDE<br/>[incidents.js]"]
  node_dashboard["Dashboard Summaries<br/>[DashboardView.vue]"]
  node_hotspot["Hotspot Map<br/>[HotspotMapView.vue]"]
  node_knox["Knox Analysis<br/>[knox.js]"]
  node_patrol["Patrol Zones<br/>[patrol.js]"]
end

subgraph group_cases["Casework &amp; People"]
  node_investigations["Investigation Cases<br/>[investigations.js]"]
  node_casedetail["Case Detail &amp; Assistant"]
  node_assistantpanel["Ask AI Panel<br/>[AssistantPanel.vue]"]
  node_assistantstore["Assistant Requests<br/>[assistant.js]"]
  node_persons["Persons Index<br/>[persons.js]"]
end

subgraph group_platform["Data &amp; Integrations"]
  node_supabase["Supabase Client<br/>[supabase.js]"]
  node_database[("Supabase Database")]
  node_edgeassistant["Case Assistant Function<br/>[index.ts]"]
  node_edgeembed["Incident Embedding Function<br/>[index.ts]"]
  node_groq["Groq AI Service"]
  node_ingest["Incident Data Ingest<br/>[ingest.js]"]
end

node_officer(("Officer"))

node_officer -->|"opens pages"| node_router
node_router -->|"checks access"| node_auth
node_router -->|"renders routes"| node_shell
node_shell -->|"hosts view"| node_admin
node_admin -->|"reads identity"| node_auth
node_admin -->|"manages accounts"| node_supabase
node_incidentview -->|"requests incidents"| node_incidentstore
node_incidentstore -->|"queries incidents"| node_supabase
node_supabase -->|"reads and writes"| node_database
node_dashboard -->|"uses incident data"| node_incidentstore
node_hotspot -->|"loads map and KDE"| node_incidentstore
node_hotspot -->|"loads analysis"| node_knox
node_hotspot -->|"loads zones"| node_patrol
node_knox -->|"fetches Knox data"| node_supabase
node_patrol -->|"fetches patrol data"| node_supabase
node_casedetail -->|"loads case"| node_investigations
node_investigations -->|"stores casework"| node_supabase
node_investigations -->|"maps incident rows"| node_incidentstore
node_casedetail -->|"renders panel"| node_assistantpanel
node_assistantpanel -->|"submits questions"| node_assistantstore
node_assistantstore -->|"invokes function"| node_supabase
node_assistantstore -.->|"requests answers"| node_edgeassistant
node_edgeassistant -->|"generates responses"| node_groq
node_incidentview -->|"shows linked people"| node_persons
node_persons -->|"reads person records"| node_supabase
node_ingest -->|"loads incidents"| node_database
node_ingest -.->|"updates embeddings"| node_edgeembed
node_edgeembed -->|"stores embeddings"| node_database

click node_router "https://github.com/rvgonzales0426/crimemapper/blob/main/src/router/index.js"
click node_auth "https://github.com/rvgonzales0426/crimemapper/blob/main/src/stores/auth.js"
click node_shell "https://github.com/rvgonzales0426/crimemapper/blob/main/src/App.vue"
click node_admin "https://github.com/rvgonzales0426/crimemapper/blob/main/src/views/AdminView.vue"
click node_incidentview "https://github.com/rvgonzales0426/crimemapper/blob/main/src/views/IncidentsView.vue"
click node_incidentstore "https://github.com/rvgonzales0426/crimemapper/blob/main/src/stores/incidents.js"
click node_dashboard "https://github.com/rvgonzales0426/crimemapper/blob/main/src/views/DashboardView.vue"
click node_hotspot "https://github.com/rvgonzales0426/crimemapper/blob/main/src/views/HotspotMapView.vue"
click node_knox "https://github.com/rvgonzales0426/crimemapper/blob/main/src/stores/knox.js"
click node_patrol "https://github.com/rvgonzales0426/crimemapper/blob/main/src/stores/patrol.js"
click node_investigations "https://github.com/rvgonzales0426/crimemapper/blob/main/src/stores/investigations.js"
click node_casedetail "https://github.com/rvgonzales0426/crimemapper/blob/main/src/views/InvestigationDetailView.vue"
click node_assistantpanel "https://github.com/rvgonzales0426/crimemapper/blob/main/src/components/AssistantPanel.vue"
click node_assistantstore "https://github.com/rvgonzales0426/crimemapper/blob/main/src/stores/assistant.js"
click node_persons "https://github.com/rvgonzales0426/crimemapper/blob/main/src/stores/persons.js"
click node_supabase "https://github.com/rvgonzales0426/crimemapper/blob/main/src/lib/supabase.js"
click node_edgeassistant "https://github.com/rvgonzales0426/crimemapper/blob/main/supabase/functions/case-assistant/index.ts"
click node_edgeembed "https://github.com/rvgonzales0426/crimemapper/blob/main/supabase/functions/embed-incidents/index.ts"
click node_ingest "https://github.com/rvgonzales0426/crimemapper/blob/main/ingest.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_router,node_auth,node_shell,node_admin toneBlue
class node_incidentview,node_incidentstore,node_dashboard,node_hotspot,node_knox,node_patrol toneAmber
class node_investigations,node_casedetail,node_assistantpanel,node_assistantstore,node_persons toneMint
class node_supabase,node_database,node_edgeassistant,node_edgeembed,node_groq,node_ingest toneRose
class node_officer toneIndigo
```

## Components

### Access & Shell

- [Route & Access Guard](https://github.com/rvgonzales0426/crimemapper/blob/main/src/router/index.js): `src/router/index.js`
- [Authentication & Roles](https://github.com/rvgonzales0426/crimemapper/blob/main/src/stores/auth.js): `src/stores/auth.js`
- [Dashboard Shell](https://github.com/rvgonzales0426/crimemapper/blob/main/src/App.vue): `src/App.vue`
- [User & Role Admin](https://github.com/rvgonzales0426/crimemapper/blob/main/src/views/AdminView.vue): `src/views/AdminView.vue`

### Incident Analysis

- [Incident Browser](https://github.com/rvgonzales0426/crimemapper/blob/main/src/views/IncidentsView.vue): `src/views/IncidentsView.vue`
- [Incident Queries & KDE](https://github.com/rvgonzales0426/crimemapper/blob/main/src/stores/incidents.js): `src/stores/incidents.js`
- [Dashboard Summaries](https://github.com/rvgonzales0426/crimemapper/blob/main/src/views/DashboardView.vue): `src/views/DashboardView.vue`
- [Hotspot Map](https://github.com/rvgonzales0426/crimemapper/blob/main/src/views/HotspotMapView.vue): `src/views/HotspotMapView.vue`
- [Knox Analysis](https://github.com/rvgonzales0426/crimemapper/blob/main/src/stores/knox.js): `src/stores/knox.js`
- [Patrol Zones](https://github.com/rvgonzales0426/crimemapper/blob/main/src/stores/patrol.js): `src/stores/patrol.js`

### Casework & People

- [Investigation Cases](https://github.com/rvgonzales0426/crimemapper/blob/main/src/stores/investigations.js): `src/stores/investigations.js`
- [Case Detail & Assistant](https://github.com/rvgonzales0426/crimemapper/blob/main/src/views/InvestigationDetailView.vue): `src/views/InvestigationDetailView.vue`
- [Ask AI Panel](https://github.com/rvgonzales0426/crimemapper/blob/main/src/components/AssistantPanel.vue): `src/components/AssistantPanel.vue`
- [Assistant Requests](https://github.com/rvgonzales0426/crimemapper/blob/main/src/stores/assistant.js): `src/stores/assistant.js`
- [Persons Index](https://github.com/rvgonzales0426/crimemapper/blob/main/src/stores/persons.js): `src/stores/persons.js`

### Data & Integrations

- [Supabase Client](https://github.com/rvgonzales0426/crimemapper/blob/main/src/lib/supabase.js): `src/lib/supabase.js`
- **Supabase Database**
- [Case Assistant Function](https://github.com/rvgonzales0426/crimemapper/blob/main/supabase/functions/case-assistant/index.ts): `supabase/functions/case-assistant/index.ts`
- [Incident Embedding Function](https://github.com/rvgonzales0426/crimemapper/blob/main/supabase/functions/embed-incidents/index.ts): `supabase/functions/embed-incidents/index.ts`
- **Groq AI Service**
- [Incident Data Ingest](https://github.com/rvgonzales0426/crimemapper/blob/main/ingest.js): `ingest.js`

### Other components

- **Officer**

## Connections

- Officer → Route & Access Guard: opens pages (evidence: `src/router/index.js`)
- Route & Access Guard → Authentication & Roles: checks access (evidence: `src/router/index.js`)
- Route & Access Guard → Dashboard Shell: renders routes (evidence: `src/App.vue`)
- Dashboard Shell → User & Role Admin: hosts view (evidence: `src/App.vue`)
- User & Role Admin → Authentication & Roles: reads identity (evidence: `src/views/AdminView.vue`)
- User & Role Admin → Supabase Client: manages accounts
- Incident Browser → Incident Queries & KDE: requests incidents (evidence: `src/views/IncidentsView.vue`)
- Incident Queries & KDE → Supabase Client: queries incidents (evidence: `src/stores/incidents.js`)
- Supabase Client → Supabase Database: reads and writes (evidence: `src/lib/supabase.js`)
- Dashboard Summaries → Incident Queries & KDE: uses incident data (evidence: `src/views/DashboardView.vue`)
- Hotspot Map → Incident Queries & KDE: loads map and KDE (evidence: `src/views/HotspotMapView.vue`)
- Hotspot Map → Knox Analysis: loads analysis (evidence: `src/views/HotspotMapView.vue`)
- Hotspot Map → Patrol Zones: loads zones (evidence: `src/views/HotspotMapView.vue`)
- Knox Analysis → Supabase Client: fetches Knox data (evidence: `src/stores/knox.js`)
- Patrol Zones → Supabase Client: fetches patrol data (evidence: `src/stores/patrol.js`)
- Case Detail & Assistant → Investigation Cases: loads case (evidence: `src/views/InvestigationDetailView.vue`)
- Investigation Cases → Supabase Client: stores casework (evidence: `src/stores/investigations.js`)
- Investigation Cases → Incident Queries & KDE: maps incident rows (evidence: `src/stores/investigations.js`)
- Case Detail & Assistant → Ask AI Panel: renders panel (evidence: `src/views/InvestigationDetailView.vue`)
- Ask AI Panel → Assistant Requests: submits questions (evidence: `src/components/AssistantPanel.vue`)
- Assistant Requests → Supabase Client: invokes function (evidence: `src/stores/assistant.js`)
- Assistant Requests → Case Assistant Function: requests answers
- Case Assistant Function → Groq AI Service: generates responses
- Incident Browser → Persons Index: shows linked people (evidence: `src/views/IncidentsView.vue`)
- Persons Index → Supabase Client: reads person records (evidence: `src/stores/persons.js`)
- Incident Data Ingest → Supabase Database: loads incidents
- Incident Data Ingest → Incident Embedding Function: updates embeddings
- Incident Embedding Function → Supabase Database: stores embeddings
