# gopi514-chand/smart-parking-and-vehicle-occupancy-system architecture

> Architecture diagram of the GitHub repository gopi514-chand/smart-parking-and-vehicle-occupancy-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system
- Repository: https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system

## Overview

#### Purpose and Entry Points
The repository combines a computer-vision parking-occupancy detector with an Android smart-parking client. The documented primary entry point is `app.py`, which processes surveillance imagery to count and visualize available versus occupied spaces. Android launches through activity classes declared around `SplashActivity.java`, `LoginActivity.java`, and `MainActivity.java`.

#### Vision Detection Pipeline
The Python detection workflow is coordinate-driven: parking-space rectangles are labeled, persisted as parking-position data, then individually processed to classify availability. `car_park_coordiante_generator copy.py` is the interactive coordinate-labeling stage; `app.py` is the runtime detection and annotated-result stage. This boundary separates lot calibration from repeated image analysis.

#### Parking-State Data and Simulation
Supporting Python scripts indicate a Firebase-backed or remotely synchronized parking-state workflow. `monitor_firebase.py` appears to observe backend changes, while `simulate_remote_booking.py` supplies remote booking/state simulation. `snapshot.py` likely captures state or imagery for processing. The precise schema is not visible, but these scripts form the bridge between computer-vision occupancy signals and application-facing parking availability.

#### Android Client Flow
The Android application provides authentication, parking discovery, location, and payment-oriented screens. `SplashActivity.java` initializes the client flow; `LoginActivity.java` and `RegisterActivity.java` handle account entry; `MainActivity.java` is the primary authenticated experience. `LocationActivity.java` and `PaymentActivity.java` represent location selection/navigation and payment completion boundaries.

#### Parking Domain and Presentation Model
Parking entities and RecyclerView adapters separate parking data from UI rendering. `ParkingLot.java` represents lots, `ParkingBox.java` represents individual parking units or displayable spot state, and `ParkingLotAdapter.java` / `ParkingSpotAdapter.java` render these structures. `NearbyParkingAdapter.java` supports a distinct nearby-lot listing. Corresponding layouts such as `item_nearby_parking.xml` and `item_parking_spot.xml` define the list/spot presentation boundary.

#### Booking, Status, and UI States
The client has dedicated dialogs for booking and detailed spot interaction: `dialog_book_now.xml`, `dialog_spot_details.xml`, and `dialog_search.xml`. Parking-state drawable resources encode the core availability vocabulary—`parking_spot_available.xml`, `parking_spot_occupied.xml`, and `parking_spot_reserved.xml`—allowing backend or vision-derived status to map directly into UI state.

#### Runtime and Infrastructure
The vision subsystem is Python/OpenCV-based, as documented in `README.md`, with an interactive desktop GUI for labeling and result visualization. The mobile subsystem is a Gradle Android application (`build.gradle`, `settings.gradle`) using Firebase configuration (`google-services.json`, `firebase.json`). Android platform configuration begins at `AndroidManifest.xml`; Firebase is the material external-service integration suggested by the repository artifacts.

Main entry points: [`MainActivity.java`](https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/MainActivity.java) (Parking Home), [`firebase.json`](https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/firebase.json) (Firebase), [`ParkingLot.java`](https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/ParkingLot.java) (Parking Domain Models), [`app.py`](https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/app.py) (Occupancy Detector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_vision["Vision Pipeline"]
  node_coordinate_generator["Lot Coordinate Labeler<br/>Python calibration tool"]
  node_parking_positions[("Parking Position Data<br/>spot coordinates")]
  node_vision_app["Occupancy Detector<br/>Python/OpenCV runtime<br/>[app.py]"]
  node_snapshot["Snapshot Capture<br/>Python capture script<br/>[snapshot.py]"]
end

subgraph group_mobile["Android Client"]
  node_android_manifest["Android App Configuration<br/>Android platform entry"]
  node_splash["Splash Screen<br/>Android activity"]
  node_auth["Authentication<br/>Android activities<br/>[LoginActivity.java]"]
  node_main["Parking Home<br/>Android activity<br/>[MainActivity.java]"]
  node_parking_models["Parking Domain Models<br/>Android models<br/>[ParkingLot.java]"]
  node_parking_lists["Parking Lists<br/>RecyclerView adapters"]
  node_location["Location Selection<br/>Android activity"]
  node_booking_dialogs["Booking &amp; Spot Dialogs<br/>Android dialog layouts"]
  node_payment["Payment<br/>Android activity"]
  node_status_drawables["Spot Status UI<br/>Android drawables"]
end

subgraph group_backend["State Synchronization"]
  node_remote_simulator["Remote Booking Simulator<br/>Python simulation script"]
  node_firebase_monitor["Firebase State Monitor<br/>Python sync observer"]
  node_firebase[("Firebase<br/>external backend<br/>[firebase.json]")]
end

node_coordinate_generator -->|"labels"| node_parking_positions
node_snapshot -->|"provides imagery"| node_vision_app
node_parking_positions -->|"defines spots"| node_vision_app
node_vision_app -->|"publishes occupancy"| node_firebase
node_remote_simulator -->|"simulates bookings"| node_firebase
node_firebase -->|"state changes"| node_firebase_monitor
node_android_manifest -->|"launches"| node_splash
node_splash -->|"unauthenticated flow"| node_auth
node_auth -->|"authenticated entry"| node_main
node_firebase -->|"availability and booking state"| node_main
node_main -->|"uses"| node_parking_models
node_parking_models -->|"renders"| node_parking_lists
node_main -->|"selects location"| node_location
node_main -->|"opens"| node_booking_dialogs
node_booking_dialogs -->|"confirms booking"| node_payment
node_parking_models -->|"maps spot state"| node_status_drawables
node_status_drawables -->|"visualizes"| node_parking_lists

click node_coordinate_generator "https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/car_park_coordiante_generator%20copy.py"
click node_vision_app "https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/app.py"
click node_snapshot "https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/snapshot.py"
click node_remote_simulator "https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/simulate_remote_booking.py"
click node_firebase_monitor "https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/monitor_firebase.py"
click node_firebase "https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/firebase.json"
click node_android_manifest "https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/AndroidManifest.xml"
click node_splash "https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/SplashActivity.java"
click node_auth "https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/LoginActivity.java"
click node_main "https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/MainActivity.java"
click node_parking_models "https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/ParkingLot.java"
click node_parking_lists "https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/ParkingLotAdapter.java"
click node_location "https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/LocationActivity.java"
click node_booking_dialogs "https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/dialog_book_now.xml"
click node_payment "https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/PaymentActivity.java"
click node_status_drawables "https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/parking_spot_available.xml"

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_coordinate_generator,node_parking_positions,node_vision_app,node_snapshot toneBlue
class node_android_manifest,node_splash,node_auth,node_main,node_parking_models,node_parking_lists,node_location,node_booking_dialogs,node_payment,node_status_drawables toneAmber
class node_remote_simulator,node_firebase_monitor,node_firebase toneMint
```

## Components

### Vision Pipeline

Python/OpenCV parking occupancy workflow.

- [Lot Coordinate Labeler](https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/car_park_coordiante_generator%20copy.py): Python calibration tool · Interactively labels parking-space rectangles. · `car_park_coordiante_generator copy.py`
- **Parking Position Data**: spot coordinates · Persisted rectangles used for repeated detection.
- [Occupancy Detector](https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/app.py): Python/OpenCV runtime · Classifies spots and renders annotated availability results. · `app.py`
- [Snapshot Capture](https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/snapshot.py): Python capture script · Supplies imagery or state for processing. · `snapshot.py`

### Android Client

Smart-parking application flow and presentation.

- [Android App Configuration](https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/AndroidManifest.xml): Android platform entry · Declares the client application and activities. · `AndroidManifest.xml`
- [Splash Screen](https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/SplashActivity.java): Android activity · Initializes the client flow. · `SplashActivity.java`
- [Authentication](https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/LoginActivity.java): Android activities · Login and registration account entry. · `LoginActivity.java`
- [Parking Home](https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/MainActivity.java): Android activity · Primary authenticated parking experience. · `MainActivity.java`
- [Parking Domain Models](https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/ParkingLot.java): Android models · ParkingLot and ParkingBox represent lots and individual spots. · `ParkingLot.java`
- [Parking Lists](https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/ParkingLotAdapter.java): RecyclerView adapters · Renders lots, spots, and nearby parking listings. · `ParkingLotAdapter.java`
- [Location Selection](https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/LocationActivity.java): Android activity · Location and navigation boundary. · `LocationActivity.java`
- [Booking & Spot Dialogs](https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/dialog_book_now.xml): Android dialog layouts · Booking, spot-detail, and search interactions. · `dialog_book_now.xml`
- [Payment](https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/PaymentActivity.java): Android activity · Payment completion boundary. · `PaymentActivity.java`
- [Spot Status UI](https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/parking_spot_available.xml): Android drawables · Available, occupied, and reserved visual states. · `parking_spot_available.xml`

### State Synchronization

Firebase-backed availability and booking state.

- [Remote Booking Simulator](https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/simulate_remote_booking.py): Python simulation script · Generates remote booking or parking-state changes. · `simulate_remote_booking.py`
- [Firebase State Monitor](https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/monitor_firebase.py): Python sync observer · Observes backend parking-state changes. · `monitor_firebase.py`
- [Firebase](https://github.com/gopi514-chand/smart-parking-and-vehicle-occupancy-system/blob/main/firebase.json): external backend · Shared parking availability and booking integration. · `firebase.json`

## Connections

- Lot Coordinate Labeler → Parking Position Data: labels
- Snapshot Capture → Occupancy Detector: provides imagery
- Parking Position Data → Occupancy Detector: defines spots
- Occupancy Detector → Firebase: publishes occupancy
- Remote Booking Simulator → Firebase: simulates bookings
- Firebase → Firebase State Monitor: state changes
- Android App Configuration → Splash Screen: launches
- Splash Screen → Authentication: unauthenticated flow
- Authentication → Parking Home: authenticated entry
- Firebase → Parking Home: availability and booking state
- Parking Home → Parking Domain Models: uses
- Parking Domain Models → Parking Lists: renders
- Parking Home → Location Selection: selects location
- Parking Home → Booking & Spot Dialogs: opens
- Booking & Spot Dialogs → Payment: confirms booking
- Parking Domain Models → Spot Status UI: maps spot state
- Spot Status UI → Parking Lists: visualizes
