# sairamsaladi/traffic-violation-reporter architecture

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

- Interactive diagram: https://gitdiagram.com/sairamsaladi/traffic-violation-reporter
- Repository: https://github.com/sairamsaladi/traffic-violation-reporter

## Overview

This is a Streamlit traffic-violation reporting application. A reporter authenticates, uploads an image, and submits it for plate detection and violation analysis; the app saves a report, looks up the vehicle owner, and emails them when an address is available. The graph separates authentication, image analysis, and reporting/notification responsibilities. README documents EC2 hosting, but the supplied source does not show deployment wiring; an import of redshift_utils in app.py also has no corresponding file in the tree and is omitted.

Main entry points: [`app.py`](https://github.com/sairamsaladi/traffic-violation-reporter/blob/main/app.py) (Streamlit app), [`aws_utils.py`](https://github.com/sairamsaladi/traffic-violation-reporter/blob/main/aws_utils.py) (Violation description), [`auth.py`](https://github.com/sairamsaladi/traffic-violation-reporter/blob/main/auth.py) (Login and registration), [`email_utils.py`](https://github.com/sairamsaladi/traffic-violation-reporter/blob/main/email_utils.py) (Email notification)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Reporter workflow"]
  node_streamlit_app["Streamlit app<br/>[app.py]"]
end

subgraph group_identity["Authentication"]
  node_cognito_login["Login and registration<br/>[auth.py]"]
  node_cognito["AWS Cognito"]
end

subgraph group_analysis["Image analysis"]
  node_plate_detection["Plate detection<br/>[aws_utils.py]"]
  node_image_labels["Image labeling<br/>[aws_utils.py]"]
  node_violation_description["Violation description<br/>[aws_utils.py]"]
  node_violation_classification["Violation classification<br/>[aws_utils.py]"]
  node_rekognition["AWS Rekognition"]
  node_bedrock["AWS Bedrock"]
end

subgraph group_reporting["Records and alerts"]
  node_record_storage[("Violation records<br/>[aws_utils.py]")]
  node_owner_lookup[("Owner lookup<br/>[aws_utils.py]")]
  node_dynamodb[("AWS DynamoDB")]
  node_email_sender["Email notification<br/>[email_utils.py]"]
  node_gmail["Gmail SMTP"]
end

node_reporter(("Reporter"))
node_ec2["Amazon EC2"]

node_reporter -->|"uses"| node_streamlit_app
node_streamlit_app -->|"authenticates through"| node_cognito_login
node_cognito_login -->|"registers and authenticates"| node_cognito
node_streamlit_app -->|"requests plate detection"| node_plate_detection
node_plate_detection -->|"detects text with"| node_rekognition
node_streamlit_app -->|"requests description"| node_violation_description
node_violation_description -->|"gets image labels"| node_image_labels
node_image_labels -->|"detects labels with"| node_rekognition
node_violation_description -->|"generates description with"| node_bedrock
node_streamlit_app -->|"classifies description"| node_violation_classification
node_violation_classification -->|"classifies with"| node_bedrock
node_streamlit_app -->|"saves violation"| node_record_storage
node_record_storage -->|"writes record"| node_dynamodb
node_streamlit_app -->|"looks up owner"| node_owner_lookup
node_owner_lookup -->|"reads owner record"| node_dynamodb
node_streamlit_app -->|"sends owner notice"| node_email_sender
node_email_sender -->|"sends via SMTP"| node_gmail
node_ec2 -.->|"hosts app"| node_streamlit_app

click node_streamlit_app "https://github.com/sairamsaladi/traffic-violation-reporter/blob/main/app.py"
click node_cognito_login "https://github.com/sairamsaladi/traffic-violation-reporter/blob/main/auth.py"
click node_plate_detection "https://github.com/sairamsaladi/traffic-violation-reporter/blob/main/aws_utils.py"
click node_image_labels "https://github.com/sairamsaladi/traffic-violation-reporter/blob/main/aws_utils.py"
click node_violation_description "https://github.com/sairamsaladi/traffic-violation-reporter/blob/main/aws_utils.py"
click node_violation_classification "https://github.com/sairamsaladi/traffic-violation-reporter/blob/main/aws_utils.py"
click node_record_storage "https://github.com/sairamsaladi/traffic-violation-reporter/blob/main/aws_utils.py"
click node_owner_lookup "https://github.com/sairamsaladi/traffic-violation-reporter/blob/main/aws_utils.py"
click node_email_sender "https://github.com/sairamsaladi/traffic-violation-reporter/blob/main/email_utils.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_streamlit_app toneBlue
class node_cognito_login,node_cognito toneAmber
class node_plate_detection,node_image_labels,node_violation_description,node_violation_classification,node_rekognition,node_bedrock toneMint
class node_record_storage,node_owner_lookup,node_dynamodb,node_email_sender,node_gmail toneRose
class node_reporter,node_ec2 toneIndigo
```

## Components

### Reporter workflow

- [Streamlit app](https://github.com/sairamsaladi/traffic-violation-reporter/blob/main/app.py): `app.py`

### Authentication

- [Login and registration](https://github.com/sairamsaladi/traffic-violation-reporter/blob/main/auth.py): `auth.py`
- **AWS Cognito**

### Image analysis

- [Plate detection](https://github.com/sairamsaladi/traffic-violation-reporter/blob/main/aws_utils.py): `aws_utils.py`
- [Image labeling](https://github.com/sairamsaladi/traffic-violation-reporter/blob/main/aws_utils.py): `aws_utils.py`
- [Violation description](https://github.com/sairamsaladi/traffic-violation-reporter/blob/main/aws_utils.py): `aws_utils.py`
- [Violation classification](https://github.com/sairamsaladi/traffic-violation-reporter/blob/main/aws_utils.py): `aws_utils.py`
- **AWS Rekognition**
- **AWS Bedrock**

### Records and alerts

- [Violation records](https://github.com/sairamsaladi/traffic-violation-reporter/blob/main/aws_utils.py): `aws_utils.py`
- [Owner lookup](https://github.com/sairamsaladi/traffic-violation-reporter/blob/main/aws_utils.py): `aws_utils.py`
- **AWS DynamoDB**
- [Email notification](https://github.com/sairamsaladi/traffic-violation-reporter/blob/main/email_utils.py): `email_utils.py`
- **Gmail SMTP**

### Other components

- **Reporter**
- **Amazon EC2**

## Connections

- Reporter → Streamlit app: uses (evidence: `README.md`)
- Streamlit app → Login and registration: authenticates through (evidence: `app.py`)
- Login and registration → AWS Cognito: registers and authenticates (evidence: `auth.py`)
- Streamlit app → Plate detection: requests plate detection (evidence: `app.py`)
- Plate detection → AWS Rekognition: detects text with (evidence: `aws_utils.py`)
- Streamlit app → Violation description: requests description (evidence: `app.py`)
- Violation description → Image labeling: gets image labels (evidence: `aws_utils.py`)
- Image labeling → AWS Rekognition: detects labels with (evidence: `aws_utils.py`)
- Violation description → AWS Bedrock: generates description with (evidence: `aws_utils.py`)
- Streamlit app → Violation classification: classifies description (evidence: `app.py`)
- Violation classification → AWS Bedrock: classifies with (evidence: `aws_utils.py`)
- Streamlit app → Violation records: saves violation (evidence: `app.py`)
- Violation records → AWS DynamoDB: writes record (evidence: `aws_utils.py`)
- Streamlit app → Owner lookup: looks up owner (evidence: `app.py`)
- Owner lookup → AWS DynamoDB: reads owner record (evidence: `aws_utils.py`)
- Streamlit app → Email notification: sends owner notice (evidence: `app.py`)
- Email notification → Gmail SMTP: sends via SMTP (evidence: `email_utils.py`)
- Amazon EC2 → Streamlit app: hosts app (evidence: `README.md`)
