Skip to content

Humza-Aa/Ontario_Crime_Mapper

Repository files navigation

Ontario Crime Mapper

Project Logo

CrimeVue is a powerful web application that enables users to visualize and analyze real-time crime data. By scraping crime-related information from Twitter, the app provides an interactive map interface where users can explore crime incidents, access detailed crime information, and contribute to community safety efforts.

Directory Structure

  • Ontario-Crime-Mapper-Frontend/ocmf: Contains the frontend codebase for the Crime Mapper application built with Next.js.
  • Ontario-Crime-Mapper-Backend: Contains the backend codebase for the Crime Mapper application built with Node.js and Express.
  • Twitter_Scraper: Contains the Python scraper code used to collect real-time crime data from Twitter.

Tech Stack

  • Frontend: Next.js
  • Backend: Node.js, Express
  • Database: MongoDB
  • Scraper: Python

Features

  • Real-time Crime Data: Utilizes web scraping techniques to gather up-to-date crime data from Twitter, ensuring the accuracy and relevance of information.
  • Interactive Map Interface: Displays crime incidents on a user-friendly map, allowing users to navigate and explore crime hotspots and patterns.
  • Custom Marker Icons: Uses unique icons to represent different types of crimes, providing visual cues for easier interpretation and understanding.
  • Detailed Crime Information: Allows users to click on map markers to view comprehensive details about each crime incident, including location, date, time, and description.
  • Community Chat (Coming Soon): Facilitates user interactions and knowledge sharing through a chat feature, enabling users to connect, share safety tips, and discuss crime-related concerns.
  • Crime Reporting (Coming Soon): Empowers users to report crimes directly through the app, contributing to crime prevention efforts and assisting law enforcement agencies.

Markers on the Map

Crime Mapper utilizes different markers on the map to represent various types of crimes. Each marker is associated with a unique image icon, making it easy for users to identify the crime category at a glance. Here are the marker categories and their respective images:

  • Car Jacking Car Jacking Icon
  • Collision Collision Icon
  • Crowd Control Crowd Control Icon
  • Elopee Elopee Icon
  • Fire Fire Icon
  • Firearm Discharge Firearm Discharge Icon
  • Hazard Hazard Icon
  • Industrial Accident Industrial Accident Icon
  • Media Advisory Media Advisory Icon
  • Person Missing Person Missing Icon
  • Person With a Gun Person With a Gun Icon
  • Road Closures Road Closures Icon
  • Shooting Shooting Icon
  • Sound Of Gunshots Sound Of Gunshots Icon
  • Sudden Death Sudden Death Icon
  • Suspicious Incident Suspicious Incident Icon
  • Unknown Trouble Unknown Trouble Icon
  • Unknown Unknown Icon
  • Updates Updates Icon

Installation

  1. Clone the repository:

git clone https://github.com/Humza-Aa/Ontario_Crime-Mapper.git

  1. Navigate to the frontend directory:

cd Ontario-Crime-Mapper-Frontend/ocmf

  1. Install the frontend dependencies:

npm install

  1. Start the frontend server:

npm run dev

  1. Open your web browser and visit http://localhost:3000 to access the Crime Mapper frontend.

  2. For the backend, navigate to the backend directory:

cd Ontario-Crime-Mapper-Backend

  1. Install the backend dependencies:

npm install

  1. Create a .env file in the Ontario-Crime-Mapper-Backend directory and provide the following environment variables:

PORT=4000
MONGODB_LINK=your-mongodb-connection-string
MONGODB_USER=your-mongodb-username
MONGODB_PASS=your-mongodb-password
TOKENPASSWORD=your-access-token-password
REFRESHTOKENPASSWORD=your-refresh-token-password

  1. Start the backend server:

npm start

  1. For the Python scraper, navigate to the scraper directory:

cd Twitter_Scraper

  1. Set up a Python virtual environment (recommended):

python -m venv venv source venv/bin/activate

  1. Install the Python dependencies:

pip install -r requirements.txt

  1. Create a .env file in the Twitter_Scraper directory and provide the following environment variables:

MONGODB_USER=your-mongodb-username
MONGODB_PASS=your-mongodb-password
TW_USERNAME=your-twitter-username
TW_PASSWORD=your-twitter-password

Please note that you need to use the same MongoDB cluster credentials (MONGODB_USER and MONGODB_PASS) for both the backend and the Twitter scraper.

  1. Run the scraper:

python scraper.py

Contributing

Contributions are welcome! If you'd like to contribute to Crime Mapper, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and commit them with descriptive messages.
  4. Push your changes to your forked repository.
  5. Submit a pull request, clearly describing the changes you've made.

License

This project is licensed under the MIT License.

Contact

For any inquiries or feedback, please contact humzaaamir31@gmail.com.