# asmaa-mohamed-git/aismokingdetection architecture

> Architecture diagram of the GitHub repository asmaa-mohamed-git/aismokingdetection, 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/asmaa-mohamed-git/aismokingdetection
- Repository: https://github.com/asmaa-mohamed-git/aismokingdetection

## Overview

AISmokingDetection is a backend API for submitting video-processing jobs to an AI service, receiving detection callbacks, and managing incidents, evidence, and staff reviews. The principal workflow is job creation and AI submission, callback-driven incident/evidence recording, then staff review and retrieval through API endpoints. Persistent job, incident, evidence, and review state is modeled with Entity Framework. The source index and excerpts support the service and persistence links shown; the README is empty, and some implementation details are unsampled, so uncertain integrations are omitted or marked unverified.

Main entry points: [`Data/ApplicationDbContext.cs`](https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Data/ApplicationDbContext.cs) (Application database), [`Business/Services/ProcessingJobService.cs`](https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Business/Services/ProcessingJobService.cs) (Job service), [`Business/Services/AiJobSubmitter.cs`](https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Business/Services/AiJobSubmitter.cs) (AI submitter), [`Business/Services/EvidenceService.cs`](https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Business/Services/EvidenceService.cs) (Evidence service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and access"]
  node_job_api["Job API"]
  node_incident_api["Incident API"]
  node_evidence_api["Evidence API"]
  node_review_api["Review API"]
  node_callback_api["Callback API"]
  node_auth["API authentication"]
end

subgraph group_jobs["Job processing"]
  node_job_service["Job service"]
  node_ai_submitter["AI submitter<br/>[AiJobSubmitter.cs]"]
  node_job_monitor["Job monitor"]
  node_ai_options["AI options"]
  node_job_model["Processing job records<br/>[ProcessingJob.cs]"]
end

subgraph group_incidents["Incident review"]
  node_callback_service["Callback handler"]
  node_incident_service["Incident service<br/>[IncidentService.cs]"]
  node_review_service["Review service<br/>[ReviewService.cs]"]
  node_incident_model["Incident records<br/>[Incident.cs]"]
  node_review_model["Review records<br/>[ReviewHistory.cs]"]
end

subgraph group_data["Persistence and evidence"]
  node_evidence_service["Evidence service<br/>[EvidenceService.cs]"]
  node_evidence_storage["Local evidence storage"]
  node_evidence_model["Evidence records<br/>[Evidence.cs]"]
  node_database[("Application database")]
end

node_staff(("Staff client"))
node_ai(("AI service"))

node_staff -->|"creates jobs"| node_job_api
node_staff -->|"views incidents"| node_incident_api
node_staff -->|"retrieves evidence"| node_evidence_api
node_staff -->|"submits reviews"| node_review_api
node_job_api -->|"calls"| node_job_service
node_incident_api -->|"calls"| node_incident_service
node_evidence_api -->|"calls"| node_evidence_service
node_review_api -->|"calls"| node_review_service
node_ai -.->|"posts results"| node_callback_api
node_callback_api -->|"calls"| node_callback_service
node_job_service -->|"submits jobs"| node_ai_submitter
node_ai_submitter -.->|"sends jobs"| node_ai
node_job_monitor -->|"monitors jobs"| node_job_service
node_job_service -->|"reads and writes"| node_database
node_callback_service -->|"records callbacks"| node_database
node_incident_service -->|"reads and writes"| node_database
node_review_service -->|"records reviews"| node_database
node_evidence_service -->|"reads and writes"| node_database
node_database -->|"persists"| node_incident_model
node_database -->|"persists"| node_review_model
node_database -->|"persists"| node_evidence_model
node_database -->|"persists"| node_job_model
node_auth -->|"authenticates"| node_callback_api
node_job_service -->|"uses settings"| node_ai_options
node_ai_submitter -->|"uses settings"| node_ai_options
node_evidence_service -.->|"uses storage"| node_evidence_storage

click node_job_api "https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Controllers/ProcessingJobAPIController.cs"
click node_incident_api "https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Controllers/IncidentAPIController.cs"
click node_evidence_api "https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Controllers/EvidenceController.cs"
click node_review_api "https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Controllers/ReviewController.cs"
click node_callback_api "https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Controllers/AiCallbackController.cs"
click node_auth "https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Security/ApiKeyAuthentication.cs"
click node_job_service "https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Business/Services/ProcessingJobService.cs"
click node_ai_submitter "https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Business/Services/AiJobSubmitter.cs"
click node_job_monitor "https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Business/Background/JobMonitorService.cs"
click node_ai_options "https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Options/AiServiceOptions.cs"
click node_callback_service "https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Business/Services/AiCallbackService.cs"
click node_incident_service "https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Business/Services/IncidentService.cs"
click node_review_service "https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Business/Services/ReviewService.cs"
click node_incident_model "https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Model/Incident.cs"
click node_review_model "https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Model/ReviewHistory.cs"
click node_evidence_service "https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Business/Services/EvidenceService.cs"
click node_evidence_storage "https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Business/Services/LocalFileEvidenceStorage.cs"
click node_evidence_model "https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Model/Evidence.cs"
click node_job_model "https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Model/ProcessingJob.cs"
click node_database "https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Data/ApplicationDbContext.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_job_api,node_incident_api,node_evidence_api,node_review_api,node_callback_api,node_auth,node_staff toneBlue
class node_job_service,node_ai_submitter,node_job_monitor,node_ai_options,node_job_model toneAmber
class node_callback_service,node_incident_service,node_review_service,node_incident_model,node_review_model toneMint
class node_evidence_service,node_evidence_storage,node_evidence_model,node_database toneRose
class node_ai toneIndigo
```

## Components

### API and access

- [Job API](https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Controllers/ProcessingJobAPIController.cs): `Controllers/ProcessingJobAPIController.cs`
- [Incident API](https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Controllers/IncidentAPIController.cs): `Controllers/IncidentAPIController.cs`
- [Evidence API](https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Controllers/EvidenceController.cs): `Controllers/EvidenceController.cs`
- [Review API](https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Controllers/ReviewController.cs): `Controllers/ReviewController.cs`
- [Callback API](https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Controllers/AiCallbackController.cs): `Controllers/AiCallbackController.cs`
- [API authentication](https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Security/ApiKeyAuthentication.cs): `Security/ApiKeyAuthentication.cs`

### Job processing

- [Job service](https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Business/Services/ProcessingJobService.cs): `Business/Services/ProcessingJobService.cs`
- [AI submitter](https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Business/Services/AiJobSubmitter.cs): `Business/Services/AiJobSubmitter.cs`
- [Job monitor](https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Business/Background/JobMonitorService.cs): `Business/Background/JobMonitorService.cs`
- [AI options](https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Options/AiServiceOptions.cs): `Options/AiServiceOptions.cs`
- [Processing job records](https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Model/ProcessingJob.cs): `Model/ProcessingJob.cs`

### Incident review

- [Callback handler](https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Business/Services/AiCallbackService.cs): `Business/Services/AiCallbackService.cs`
- [Incident service](https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Business/Services/IncidentService.cs): `Business/Services/IncidentService.cs`
- [Review service](https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Business/Services/ReviewService.cs): `Business/Services/ReviewService.cs`
- [Incident records](https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Model/Incident.cs): `Model/Incident.cs`
- [Review records](https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Model/ReviewHistory.cs): `Model/ReviewHistory.cs`

### Persistence and evidence

- [Evidence service](https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Business/Services/EvidenceService.cs): `Business/Services/EvidenceService.cs`
- [Local evidence storage](https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Business/Services/LocalFileEvidenceStorage.cs): `Business/Services/LocalFileEvidenceStorage.cs`
- [Evidence records](https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Model/Evidence.cs): `Model/Evidence.cs`
- [Application database](https://github.com/asmaa-mohamed-git/aismokingdetection/blob/master/Data/ApplicationDbContext.cs): `Data/ApplicationDbContext.cs`

### Other components

- **Staff client**
- **AI service**

## Connections

- Staff client → Job API: creates jobs (evidence: `Controllers/ProcessingJobAPIController.cs`)
- Staff client → Incident API: views incidents (evidence: `Controllers/IncidentAPIController.cs`)
- Staff client → Evidence API: retrieves evidence
- Staff client → Review API: submits reviews (evidence: `Controllers/ReviewController.cs`)
- Job API → Job service: calls (evidence: `Controllers/ProcessingJobAPIController.cs`)
- Incident API → Incident service: calls (evidence: `Controllers/IncidentAPIController.cs`)
- Evidence API → Evidence service: calls (evidence: `Controllers/EvidenceController.cs`)
- Review API → Review service: calls (evidence: `Controllers/ReviewController.cs`)
- AI service → Callback API: posts results
- Callback API → Callback handler: calls (evidence: `Controllers/AiCallbackController.cs`)
- Job service → AI submitter: submits jobs (evidence: `Business/Services/ProcessingJobService.cs`)
- AI submitter → AI service: sends jobs
- Job monitor → Job service: monitors jobs (evidence: `Business/Background/JobMonitorService.cs`)
- Job service → Application database: reads and writes (evidence: `Business/Services/ProcessingJobService.cs`)
- Callback handler → Application database: records callbacks (evidence: `Business/Services/AiCallbackService.cs`)
- Incident service → Application database: reads and writes (evidence: `Business/Services/IncidentService.cs`)
- Review service → Application database: records reviews (evidence: `Business/Services/ReviewService.cs`)
- Evidence service → Application database: reads and writes (evidence: `Business/Services/EvidenceService.cs`)
- Application database → Incident records: persists (evidence: `Data/ApplicationDbContext.cs`)
- Application database → Review records: persists (evidence: `Data/ApplicationDbContext.cs`)
- Application database → Evidence records: persists (evidence: `Data/ApplicationDbContext.cs`)
- Application database → Processing job records: persists (evidence: `Data/ApplicationDbContext.cs`)
- API authentication → Callback API: authenticates
- Job service → AI options: uses settings (evidence: `Business/Services/ProcessingJobService.cs`)
- AI submitter → AI options: uses settings (evidence: `Business/Services/AiJobSubmitter.cs`)
- Evidence service → Local evidence storage: uses storage
