# mohamed-diaa-24/petrovision architecture

> Architecture diagram of the GitHub repository mohamed-diaa-24/petrovision, 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/mohamed-diaa-24/petrovision
- Repository: https://github.com/mohamed-diaa-24/petrovision

## Overview

PetroVision 360 is a petroleum-facility safety intelligence platform. Staff and managers use authenticated API workflows to manage cameras and review camera requests, respond to alerts and incidents, and coordinate through announcements and handovers; an AI service submits detections. Business services implement these operations over EF Core persistence, while JWT session validation and SignalR support secure access and live events. The README documents areas whose service implementations were not sampled; those are retained as product capabilities, with uncertain internal links omitted. The source index and excerpts support the specific service and persistence links shown.

Main entry points: [`src/PetroVision.DAL/Context/PetroVisionDbContext.cs`](https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.DAL/Context/PetroVisionDbContext.cs) (Application data context), [`src/PetroVision.BLL/Services/AuthService.cs`](https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.BLL/Services/AuthService.cs) (Authentication service), [`src/PetroVision.API/Program.cs`](https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.API/Program.cs) (API runtime), [`src/PetroVision.API/Controllers/AuthController.cs`](https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.API/Controllers/AuthController.cs) (Authentication API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and Identity"]
  node_auth_api["Authentication API<br/>[AuthController.cs]"]
  node_auth_logic["Authentication service<br/>[AuthService.cs]"]
  node_signup_api["Signup review API"]
  node_signup_logic["Signup review service"]
  node_agent_api["Agent management API"]
end

subgraph group_operations["Safety Operations"]
  node_camera_api["Camera management API"]
  node_camera_logic["Camera service<br/>[CameraService.cs]"]
  node_request_api["Camera requests API"]
  node_request_logic["Camera request service"]
  node_detection_api["Detection intake API"]
  node_alert_api["Alert response API"]
  node_incident_api["Incident management API"]
  node_dashboard_api["Dashboards and analytics<br/>[Controllers]"]
end

subgraph group_coordination["Team Coordination"]
  node_team_api["Announcements and handovers<br/>[Controllers]"]
  node_activity_api["Activity and audit views"]
  node_notes_logic["Notes service<br/>[NotesService.cs]"]
end

subgraph group_platform["Runtime and Persistence"]
  node_realtime["Real-time events<br/>[EventsHub.cs]"]
  node_api_runtime["API runtime<br/>[Program.cs]"]
  node_database[("Application data context")]
end

node_staff(("Staff and managers"))
node_ai(("AI service"))
node_sql[("SQL Server")]

node_staff -->|"signs in"| node_auth_api
node_auth_api -->|"delegates"| node_auth_logic
node_auth_logic -->|"reads and writes"| node_database
node_auth_logic -->|"sends reset email"| node_staff
node_staff -->|"requests review"| node_signup_api
node_signup_api -->|"delegates"| node_signup_logic
node_signup_logic -->|"reads and writes"| node_database
node_staff -->|"manages agents"| node_agent_api
node_agent_api -.->|"routes operations"| node_database
node_staff -->|"manages cameras"| node_camera_api
node_camera_api -->|"delegates"| node_camera_logic
node_camera_logic -->|"reads and writes"| node_database
node_staff -->|"reviews requests"| node_request_api
node_request_api -->|"delegates"| node_request_logic
node_request_logic -->|"reads and writes"| node_database
node_ai -->|"submits detections"| node_detection_api
node_staff -->|"responds to alerts"| node_alert_api
node_staff -->|"manages incidents"| node_incident_api
node_staff -->|"views dashboards"| node_dashboard_api
node_staff -->|"coordinates shifts"| node_team_api
node_team_api -.->|"uses notes service"| node_notes_logic
node_staff -->|"views activity"| node_activity_api
node_api_runtime -->|"maps hub"| node_realtime
node_api_runtime -.->|"configures data access"| node_database
node_database -->|"persists data"| node_sql

click node_auth_api "https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.API/Controllers/AuthController.cs"
click node_auth_logic "https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.BLL/Services/AuthService.cs"
click node_signup_api "https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.API/Controllers/SignupRequestsController.cs"
click node_signup_logic "https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.BLL/Services/SignupReviewService.cs"
click node_agent_api "https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.API/Controllers/AgentsController.cs"
click node_camera_api "https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.API/Controllers/CamerasController.cs"
click node_camera_logic "https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.BLL/Services/CameraService.cs"
click node_request_api "https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.API/Controllers/CameraRequestsController.cs"
click node_request_logic "https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.BLL/Services/CameraRequestService.cs"
click node_detection_api "https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.API/Controllers/DetectionsController.cs"
click node_alert_api "https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.API/Controllers/AlertsController.cs"
click node_incident_api "https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.API/Controllers/IncidentsController.cs"
click node_dashboard_api "https://github.com/mohamed-diaa-24/petrovision/tree/main/src/PetroVision.API/Controllers"
click node_team_api "https://github.com/mohamed-diaa-24/petrovision/tree/main/src/PetroVision.API/Controllers"
click node_activity_api "https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.API/Controllers/ActivityController.cs"
click node_notes_logic "https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.BLL/Services/NotesService.cs"
click node_realtime "https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.API/Hubs/EventsHub.cs"
click node_api_runtime "https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.API/Program.cs"
click node_database "https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.DAL/Context/PetroVisionDbContext.cs"

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_auth_api,node_auth_logic,node_signup_api,node_signup_logic,node_agent_api toneBlue
class node_camera_api,node_camera_logic,node_request_api,node_request_logic,node_detection_api,node_alert_api,node_incident_api,node_dashboard_api,node_sql toneAmber
class node_team_api,node_activity_api,node_notes_logic toneMint
class node_realtime,node_api_runtime,node_database toneRose
class node_staff,node_ai toneIndigo
```

## Components

### Access and Identity

- [Authentication API](https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.API/Controllers/AuthController.cs): `src/PetroVision.API/Controllers/AuthController.cs`
- [Authentication service](https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.BLL/Services/AuthService.cs): `src/PetroVision.BLL/Services/AuthService.cs`
- [Signup review API](https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.API/Controllers/SignupRequestsController.cs): `src/PetroVision.API/Controllers/SignupRequestsController.cs`
- [Signup review service](https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.BLL/Services/SignupReviewService.cs): `src/PetroVision.BLL/Services/SignupReviewService.cs`
- [Agent management API](https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.API/Controllers/AgentsController.cs): `src/PetroVision.API/Controllers/AgentsController.cs`

### Safety Operations

- [Camera management API](https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.API/Controllers/CamerasController.cs): `src/PetroVision.API/Controllers/CamerasController.cs`
- [Camera service](https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.BLL/Services/CameraService.cs): `src/PetroVision.BLL/Services/CameraService.cs`
- [Camera requests API](https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.API/Controllers/CameraRequestsController.cs): `src/PetroVision.API/Controllers/CameraRequestsController.cs`
- [Camera request service](https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.BLL/Services/CameraRequestService.cs): `src/PetroVision.BLL/Services/CameraRequestService.cs`
- [Detection intake API](https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.API/Controllers/DetectionsController.cs): `src/PetroVision.API/Controllers/DetectionsController.cs`
- [Alert response API](https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.API/Controllers/AlertsController.cs): `src/PetroVision.API/Controllers/AlertsController.cs`
- [Incident management API](https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.API/Controllers/IncidentsController.cs): `src/PetroVision.API/Controllers/IncidentsController.cs`
- [Dashboards and analytics](https://github.com/mohamed-diaa-24/petrovision/tree/main/src/PetroVision.API/Controllers): `src/PetroVision.API/Controllers`

### Team Coordination

- [Announcements and handovers](https://github.com/mohamed-diaa-24/petrovision/tree/main/src/PetroVision.API/Controllers): `src/PetroVision.API/Controllers`
- [Activity and audit views](https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.API/Controllers/ActivityController.cs): `src/PetroVision.API/Controllers/ActivityController.cs`
- [Notes service](https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.BLL/Services/NotesService.cs): `src/PetroVision.BLL/Services/NotesService.cs`

### Runtime and Persistence

- [Real-time events](https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.API/Hubs/EventsHub.cs): `src/PetroVision.API/Hubs/EventsHub.cs`
- [API runtime](https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.API/Program.cs): `src/PetroVision.API/Program.cs`
- [Application data context](https://github.com/mohamed-diaa-24/petrovision/blob/main/src/PetroVision.DAL/Context/PetroVisionDbContext.cs): `src/PetroVision.DAL/Context/PetroVisionDbContext.cs`

### Other components

- **Staff and managers**
- **AI service**
- **SQL Server**

## Connections

- Staff and managers → Authentication API: signs in
- Authentication API → Authentication service: delegates (evidence: `src/PetroVision.API/Controllers/AuthController.cs`)
- Authentication service → Application data context: reads and writes (evidence: `src/PetroVision.BLL/Services/AuthService.cs`)
- Authentication service → Staff and managers: sends reset email (evidence: `src/PetroVision.BLL/Services/AuthService.cs`)
- Staff and managers → Signup review API: requests review
- Signup review API → Signup review service: delegates
- Signup review service → Application data context: reads and writes (evidence: `src/PetroVision.BLL/Services/SignupReviewService.cs`)
- Staff and managers → Agent management API: manages agents
- Agent management API → Application data context: routes operations
- Staff and managers → Camera management API: manages cameras
- Camera management API → Camera service: delegates (evidence: `src/PetroVision.API/Controllers/CamerasController.cs`)
- Camera service → Application data context: reads and writes (evidence: `src/PetroVision.BLL/Services/CameraService.cs`)
- Staff and managers → Camera requests API: reviews requests
- Camera requests API → Camera request service: delegates (evidence: `src/PetroVision.API/Controllers/CameraRequestsController.cs`)
- Camera request service → Application data context: reads and writes (evidence: `src/PetroVision.BLL/Services/CameraRequestService.cs`)
- AI service → Detection intake API: submits detections
- Staff and managers → Alert response API: responds to alerts
- Staff and managers → Incident management API: manages incidents
- Staff and managers → Dashboards and analytics: views dashboards
- Staff and managers → Announcements and handovers: coordinates shifts
- Announcements and handovers → Notes service: uses notes service
- Staff and managers → Activity and audit views: views activity
- API runtime → Real-time events: maps hub (evidence: `src/PetroVision.API/Program.cs`)
- API runtime → Application data context: configures data access
- Application data context → SQL Server: persists data
