Skip to content

hayyaanraza/Tourist-Safety-Prototype

Repository files navigation

Smart Tourist Safety Monitoring & Incident Response System

A comprehensive Flutter application designed for hackathon demonstration, featuring real-time location tracking, geo-fencing, AI-powered anomaly detection, and a police dashboard for monitoring tourist safety.

๐Ÿš€ Features

For Tourists

  • Digital Tourist ID Registration: Complete KYC process with Aadhaar/Passport verification
  • Real-time Location Tracking: Continuous GPS monitoring with 1-2 second updates
  • Geo-fencing Alerts: Automatic alerts when entering high-risk zones
  • AI Anomaly Detection: Detects prolonged inactivity (5+ minutes)
  • Panic Button: One-tap emergency alert system
  • Blockchain-style ID: SHA256 hashed unique identifiers

For Police/Law Enforcement

  • Real-time Dashboard: Live monitoring of all registered tourists
  • Alert Management: Real-time alert notifications with location data
  • Tourist Tracking: Complete tourist information and location history
  • Alert Resolution: Mark alerts as resolved with officer attribution

๐Ÿ—๏ธ Architecture

Frontend

  • Flutter: Cross-platform mobile and web application
  • Material Design 3: Modern, accessible UI components
  • Real-time Updates: StreamBuilder for live data synchronization

Backend

  • Firebase Authentication: User management and security
  • Cloud Firestore: NoSQL database for real-time data storage
  • Firebase Core: Cross-platform Firebase integration

Key Components

  • Location Service: GPS tracking and geo-fencing logic
  • Firebase Service: Database operations and user management
  • AI Anomaly Detection: Simple inactivity detection algorithm
  • High-Risk Zone Management: Predefined dangerous areas

๐Ÿ“ฑ Screenshots

Tourist App

  • Login/Registration screens
  • KYC information collection
  • Main dashboard with panic button
  • Location tracking status
  • Safety tips and information

Police Dashboard

  • Real-time tourist monitoring
  • Alert management interface
  • Location tracking visualization
  • Alert resolution workflow

๐Ÿ› ๏ธ Installation & Setup

Prerequisites

  • Flutter SDK (3.0+)
  • Firebase project
  • Android Studio / Xcode (for mobile development)
  • Web browser (for police dashboard)

1. Clone the Repository

git clone <repository-url>
cd travel-safe

2. Install Dependencies

flutter pub get

3. Firebase Setup

Create Firebase Project

  1. Go to Firebase Console
  2. Create a new project named "travel-safe"
  3. Enable Authentication and Firestore Database

Configure Android

  1. Add Android app with package name: com.example.travel_safe
  2. Download google-services.json
  3. Replace android/app/google-services.json with your file

Configure iOS

  1. Add iOS app with bundle ID: com.example.travelSafe
  2. Download GoogleService-Info.plist
  3. Replace ios/Runner/GoogleService-Info.plist with your file

Configure Web

  1. Add Web app
  2. Copy Firebase configuration
  3. Update web/firebase-config.js with your config

Update Firebase Options

  1. Run flutterfire configure (if you have FlutterFire CLI)
  2. Or manually update lib/firebase_options.dart with your configuration

4. Enable Firebase Services

Authentication

  1. Go to Authentication > Sign-in method
  2. Enable "Email/Password" provider

Firestore Database

  1. Go to Firestore Database
  2. Create database in "test mode"
  3. Set up security rules (for production)

5. Run the Application

Mobile (Android/iOS)

flutter run

Web (Police Dashboard)

flutter run -d chrome

๐Ÿ”ง Configuration

High-Risk Zones

Edit lib/models/high_risk_zone.dart to customize:

  • Zone locations (latitude/longitude)
  • Zone radius (in meters)
  • Risk levels and warnings
  • Zone descriptions

Location Tracking

Modify lib/services/location_service.dart to adjust:

  • Update frequency (currently 1-2 seconds)
  • Inactivity threshold (currently 5 minutes)
  • Permission handling

AI Anomaly Detection

Customize detection logic in lib/services/location_service.dart:

  • Inactivity detection algorithm
  • Alert triggering conditions
  • Time thresholds

๐Ÿ“Š Data Models

Tourist

{
  id: "blockchain_hash",
  userId: "firebase_auth_uid",
  email: "user@example.com",
  fullName: "John Doe",
  phoneNumber: "+1234567890",
  idNumber: "123456789012",
  idType: "aadhaar",
  tripItinerary: "Travel plans...",
  emergencyContacts: ["+1234567890"],
  location: {
    latitude: 28.6139,
    longitude: 77.2090,
    timestamp: "2024-01-01T00:00:00Z"
  },
  createdAt: "2024-01-01T00:00:00Z",
  lastUpdated: "2024-01-01T00:00:00Z"
}

Alert

{
  id: "alert_hash",
  userId: "firebase_auth_uid",
  alertType: "panic|geo-fence|prolonged-inactivity",
  description: "Alert description",
  location: { /* location data */ },
  timestamp: "2024-01-01T00:00:00Z",
  isResolved: false,
  resolvedBy: "officer_id",
  resolvedAt: "2024-01-01T00:00:00Z"
}

๐Ÿ”’ Security Features

  • Firebase Authentication: Secure user authentication
  • Blockchain-style IDs: SHA256 hashed unique identifiers
  • Location Privacy: User consent for location tracking
  • Data Encryption: Firebase handles data encryption
  • Permission Management: Granular location permissions

๐Ÿšจ Alert Types

1. Geo-fence Alert

  • Trigger: User enters high-risk zone
  • Data: Zone information, user location, timestamp
  • Action: Immediate notification to police dashboard

2. Prolonged Inactivity Alert

  • Trigger: No location updates for 5+ minutes
  • Data: Last known location, inactivity duration
  • Action: Alert sent to police dashboard

3. Panic Button Alert

  • Trigger: User presses panic button
  • Data: Current location, user information
  • Action: Immediate high-priority alert

๐ŸŒ API Endpoints

Firestore Collections

  • tourists: Tourist profiles and location data
  • alerts: Safety alerts and incident reports

Real-time Listeners

  • Tourist location updates
  • New alert notifications
  • Alert status changes

๐Ÿงช Testing

Unit Tests

flutter test

Integration Tests

flutter test integration_test/

Manual Testing

  1. Register a new tourist account
  2. Complete KYC information
  3. Test location tracking
  4. Trigger panic button
  5. Monitor police dashboard

๐Ÿš€ Deployment

Android

flutter build apk --release

iOS

flutter build ios --release

Web

flutter build web --release

๐Ÿ“ˆ Performance Considerations

  • Location Updates: Optimized for 1-2 second intervals
  • Battery Usage: Efficient GPS tracking
  • Data Usage: Minimal Firestore operations
  • Real-time Sync: Optimized for low latency

๐Ÿ”ฎ Future Enhancements

  • Push Notifications: Real-time alert notifications
  • Offline Support: Local data caching
  • Multi-language: Internationalization support
  • Advanced AI: Machine learning for anomaly detection
  • Integration: Emergency services API integration
  • Analytics: Usage and safety metrics

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ†˜ Support

For support and questions:

  • Create an issue in the repository
  • Contact the development team
  • Check the documentation

๐Ÿ† Hackathon Notes

This project was designed for hackathon demonstration with:

  • Complete end-to-end functionality
  • Real-time data synchronization
  • Professional UI/UX design
  • Scalable architecture
  • Comprehensive documentation

Perfect for showcasing modern mobile development, real-time systems, and safety technology integration.


Built with โค๏ธ for tourist safety and peace of mind

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published