Safe Yatra is a safe routes recommendation system focusing on women and child safety. This backend, built with FastAPI and MongoDB, provides endpoints for user management, incident reporting, safe route recommendation, and emergency alerts.
- app/config.py: Configuration settings.
- app/database/mongo.py: MongoDB connection setup.
- app/models/: Pydantic schemas for users, incidents, and routes.
- app/routes/: API endpoints for authentication, user, incident, and route operations.
- app/services/: Business logic for authentication, user management, incident handling, and route recommendation.
- app/utils/: Helper functions for Google API calls and security.
- app/main.py: FastAPI application entry point.
- Install dependencies:
pip install -r requirements.txt - Set environment variables for
MONGODB_URL,GOOGLE_MAPS_API_KEY, andJWT_SECRET. - Run the backend:
uvicorn app.main:app --reload - Access the Swagger UI at:
http://127.0.0.1:8000/docs
- Authentication:
/auth/login - User Management:
/users/register,/users/{user_id} - Incident Reporting:
/incidents/(POST),/incidents/(GET),/incidents/{incident_id} - Safe Route Recommendation:
/routes/(POST) - Emergency Services:
/routes/emergency/nearest,/routes/sos
- The ML model integration and Google API functions are placeholders for demonstration.
- Proper error handling and security enhancements are recommended for production.