Skip to content

abhiraamadiga/women-safety-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Women Safety Application

A comprehensive Flask-based safety application featuring AI assistance, safe route planning, instant SOS alerts, incident reporting, and anonymous community support. The application runs locally with HTTPS to enable secure browser permissions for location, microphone, camera, and notifications.

Features

SOS Center

  • One-tap emergency alerts with live GPS tracking
  • Automatic SMS notifications to emergency contacts
  • WhatsApp alert integration with tracking links
  • Voice and video recording during emergencies
  • Real-time location broadcasting every 60 seconds

Safe Routes

  • AI-powered route optimization based on crime density, street lighting, and population data
  • Interactive map with safety scores
  • Multiple route options with detailed safety metrics

Incident Reporting

  • Step-by-step guided questionnaire
  • AI-generated professional summaries using Google Gemini
  • Evidence upload support for photos, audio, video, and documents
  • Anonymous or identified reporting options
  • Export functionality for official documentation

Community Support

  • Anonymous story sharing platform
  • Peer support with reactions and comments
  • AI-powered emotional support chat
  • Safe space for sharing experiences

Fake Call Feature

  • AI-powered conversational fake calls using Google Gemini
  • Voice recognition for natural responses
  • Discreet escape from dangerous situations
  • Customizable caller names

Security and Privacy

  • HTTPS encryption with self-signed certificate for local development
  • Anonymous posting options
  • Secure data storage
  • User consent controls for data sharing

Installation

Prerequisites

  • Python 3.8 or higher
  • pip package manager

Setup Instructions

  1. Clone the repository:
git clone https://github.com/abhiraamadiga/women-safety-app.git
cd women-safety-app\women-safety-app
  1. Create and activate virtual environment:
python -m venv .venv
& .\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
  1. Install dependencies:
pip install -r requirements.txt
  1. Configure environment variables by creating a .env file:
GEMINI_API_KEY=your_gemini_api_key_here
GEMINI_MODEL=gemini-2.0-flash
GEMINI_API_VERSION=v1

# Optional SMS providers
FAST2SMS_API_KEY=your_fast2sms_key_here
TWILIO_ACCOUNT_SID=your_twilio_account_sid
TWILIO_AUTH_TOKEN=your_twilio_auth_token

SECRET_KEY=your-secret-key-here

Obtain a Gemini API key from Google AI Studio.

  1. Generate SSL certificate (if not present):
python generate_cert.py
  1. Start the server:
python app.py --https --https-port 5443
  1. Access the application at https://127.0.0.1:5443 and accept the security warning for the self-signed certificate.

Mobile Access

To access from a mobile device on the same WiFi network:

  1. Find your computer's IP address:
ipconfig
  1. Visit https://YOUR_IP:5443 on your mobile browser and accept the certificate warning.

Testing

# Check server health
curl.exe -k https://127.0.0.1:5443/api/health

# Verify AI integration
curl.exe -k https://127.0.0.1:5443/api/ai-status

Project Structure

women-safety-app/
├── app/
│   ├── __init__.py
│   ├── routes.py
│   ├── models.py
│   ├── auth_models.py
│   ├── route_optimizer.py
│   ├── data/
│   │   ├── bangalore_crimes.csv
│   │   ├── bangalore_lighting.csv
│   │   └── bangalore_population.csv
│   ├── templates/
│   ├── static/
│   └── uploads/
├── app.py
├── config.py
├── generate_cert.py
├── requirements.txt
└── instance/

Usage Guide

User Registration and Login

  1. Navigate to https://127.0.0.1:5443
  2. Create an account with email, phone, and password
  3. Complete optional profile information for enhanced safety features
  4. Grant browser permissions for location, notifications, microphone, and camera

SOS Emergency Alerts

  1. Access the SOS Center from the main navigation
  2. Add emergency contacts with names and phone numbers
  3. Activate SOS with a single tap when in danger
  4. System automatically:
    • Sends SMS alerts to all emergency contacts
    • Broadcasts live GPS location every 60 seconds
    • Provides WhatsApp sharing options
    • Records audio/video if enabled
  5. Deactivate SOS when safe

Safe Route Planning

  1. Navigate to Safe Routes section
  2. Enter your starting location and destination
  3. View multiple route options with safety scores based on:
    • Crime density data
    • Street lighting coverage
    • Population density
  4. Select preferred route and view on interactive map
  5. Provide feedback on route safety after use

Filing Incident Reports

  1. Access Incident Report from the main menu
  2. Complete the guided questionnaire:
    • Incident type and category
    • Location and date/time details
    • Involved parties information
    • Impact assessment
    • Additional context
  3. Upload supporting evidence (photos, audio, video, documents)
  4. Generate AI-powered professional summary
  5. Choose to report anonymously or with identification
  6. Export report as PDF for official use

Community Support

  1. Visit the Community Support section
  2. Share your story anonymously or with username
  3. Read and react to other community posts
  4. Add supportive comments to help others
  5. Access AI-powered emotional support chat for immediate assistance

Fake Call Feature

  1. Navigate to Fake Call section
  2. Configure caller name and relationship
  3. Activate fake call when needed
  4. Engage in AI-powered natural conversation
  5. Use as a discreet exit strategy from uncomfortable situations

Managing Emergency Contacts

  1. Go to Emergency Contacts in settings
  2. Add contact name and phone number
  3. Verify contact information
  4. Edit or remove contacts as needed
  5. Contacts receive automatic alerts during SOS activation

Settings and Preferences

  1. Access Settings from user menu
  2. Update personal information and profile photo
  3. Configure anonymity preferences for community posts
  4. Manage data sharing consent for authorities
  5. Set data retention preferences

API Configuration

Gemini configuration is read from environment variables via .env (no keys in code). See Quick Start step 2.

Security Notes

⚠️ For Production Deployment:

  1. Move API key to environment variables
  2. Use HTTPS
  3. Add rate limiting
  4. Implement proper database storage
  5. Add user authentication (if needed)
  6. Change SECRET_KEY in config

Troubleshooting

Server Won't Start

# Common fixes
# 1) Ensure venv is activated and deps are installed
& .\.venv\Scripts\Activate.ps1; pip install -r requirements.txt

# 2) If port 5443 in use, kill previous Python processes
Get-Process -Name python -ErrorAction SilentlyContinue | Stop-Process

Gemini API Errors

  • Verify GEMINI_API_KEY is set and valid
  • Ensure .env is in the women-safety-app folder
  • Confirm model/version: GEMINI_MODEL=gemini-2.0-flash, GEMINI_API_VERSION=v1

File Upload Issues

  • Ensure app/uploads/evidence/ directory exists
  • Check file size (max 16MB)
  • Allowed formats: png, jpg, jpeg, gif, mp3, wav, m4a, mp4, mov, pdf

Stop the Server

Press Ctrl+C in the terminal running the Flask app.

Next Steps

  • Add database integration (SQLite/PostgreSQL)
  • Implement persistent storage for posts
  • Add export to PDF feature
  • Implement search/filter on community wall
  • Add email notifications (optional)
  • Deploy to cloud platform

SOS Alerts (SMS + WhatsApp)

The SOS Center can notify your emergency contacts immediately:

  • WhatsApp: On SOS activation, a modal opens with a Share button (choose multiple recipients) and per-contact WhatsApp buttons. This requires you to tap to send (WhatsApp does not allow fully automatic sending without the Business API).
  • SMS: The server can send real SMS automatically using Fast2SMS or Twilio if configured. If not configured, it logs a mock send to app/uploads/sos/logs/sms_log.json.

Enable real SMS via Twilio (Windows PowerShell):

$env:TWILIO_ACCOUNT_SID = "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
$env:TWILIO_AUTH_TOKEN = "your_auth_token"
$env:TWILIO_FROM_NUMBER = "+1XXXXXXXXXX"  # Your Twilio SMS-enabled number in E.164 format

Then install dependencies and run the app:

cd "c:\Users\abhi1\OneDrive\Desktop\women-safety\women-safety-app"
..\.venv\Scripts\python.exe -m pip install -r requirements.txt
..\.venv\Scripts\python.exe app.py

Notes:

  • For Twilio, store contact numbers in E.164 (e.g., +9198XXXXXXXX). For Fast2SMS, store 10-digit Indian numbers.
  • If provider calls fail, the app still logs the message and shows it in the console and sms_log.json so you can send manually.
  • WhatsApp Business Cloud API requires Facebook Business verification and approved templates; not enabled by default in this project.

Support Resources (Placeholder)

  • National Helpline: 123-456
  • Local Support Center: 987-654
  • Emergency Services: 911

About

Women Safety App with Safe Routes, Incident Reporting, and SOS Features

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors