Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🛡️ SafeZone Project

A community safety platform that visualizes high-risk areas using police data and allows users to submit location-verified reviews.

📂 Project Structure

app.py: The Backend (Flask). Handles data, verification, and fake review detection.

index.html: The Frontend. The map interface for users.

crime_data.csv: The Database. Generated automatically by the backend.

🚀 Setup Instructions

  1. Prerequisite

Ensure you have Python installed on your system.

  1. Backend Setup (One Time)

Open your terminal/command prompt in the project folder.

Create a Virtual Environment:

Windows: python -m venv venv

Mac/Linux: python3 -m venv venv

Activate the Environment:

Windows: venv\Scripts\activate

Mac/Linux: source venv/bin/activate

Install Dependencies:

pip install flask pandas flask-cors

  1. Run the Backend

With the environment active, start the server:

python app.py

You should see: Running on http://127.0.0.1:5000 Note: This will also create the crime_data.csv file automatically.

🌐 Frontend Setup

This project’s frontend is built using React and Vite for fast development and optimized builds.

📦 Prerequisites

Make sure you have the following installed: ->Node.js (v16+ recommended) ->npm

Navigate to frontend directory : cd frontend

Install depenencies : npm install

Start the server : npm run dev

Locate const SIMULATION = true; in App.jsx

Change it to false:

const SIMULATION = false;

(This tells the map to stop using fake browser data and connect to your running Python server.)

Open index.html in your web browser (Chrome/Edge/Firefox).

💡 How to Use

Mode A: 👀 View Safety

The map loads "Danger Zones" (Red Circles) from crime_data.csv.

Click on a circle to see the crime severity and description.

Follow the Green Line for the recommended safe path.

Mode B: 📢 Report Incident

Switch to the Report tab in the sidebar.

Click anywhere on the map to drop a pin.

Click "Check My GPS" (Allow browser permission).

Fill in the details and submit.

If you are >5km away, it will be rejected.

If valid, it saves to the CSV database.

⚠️ Troubleshooting

"Permission Denied" for GPS: Ensure you allow location access in your browser pop-up. If it fails, use the "Simulation" mode logic or test on a secure context (localhost).

Map not loading data: Ensure app.py is running in the background terminal.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages