The CrowdSense project is now properly organized with clear separation between production code, simulation code, utilities, and web components.
CrowdSense/
├── 📂 core/ # 🎯 MAIN APPLICATION LOGIC
│ ├── crowdsense_enhanced.py # Enhanced disaster detection system
│ ├── anomaly_detection.py # Smart anomaly detection (Z-score/EWMA)
│ ├── location_extraction.py # NER and geocoding for locations
│ ├── database.py # SQLite database operations
│ └── scheduler.py # Background task scheduling
│
├── 📂 simulation/ # 🧪 SIMULATION & TESTING
│ ├── simulation.py # Disaster simulation engine
│ ├── crowdsense_simulation.py # Simulation-enabled system
│ └── trigger_disaster.py # Manual disaster triggers
│
├── 📂 utils/ # 🔧 UTILITY FUNCTIONS
│ ├── config.py # Configuration and environment
│ ├── alert.py # SMS alert functionality
│ ├── logging_config.py # Structured logging and metrics
│ └── check_sms_status.py # SMS troubleshooting tools
│
├── 📂 web/ # 🌐 WEB INTERFACE
│ └── hackathon_app/ # Flask web dashboard
│ ├── app.py # Production web app
│ ├── app_simulation.py # Simulation web app
│ └── templates/ # HTML templates
│ ├── index.html # Production dashboard
│ └── index_simulation.html # Simulation dashboard
│
├── 📄 main.py # 🚀 Main application entry point
├── 📄 crowdsense.py # 🌐 Production disaster detection
├── 📄 simulate.py # 🧪 Easy simulation interface
├── 📄 run.py # ⚡ Quick start script
├── 📄 README.md # 📖 Comprehensive documentation
└── 📄 requirements.txt # 📦 Python dependencies
# Single analysis with real Twitter/News APIs
python crowdsense.py
# Full web dashboard with real data
python main.py web# Quick disaster simulation
python simulate.py earthquake
python simulate.py flood --severity severe
# Interactive simulation mode
python simulate.py -i
# Web dashboard with simulation controls
python main.py simulation# Test all components
python main.py test
# Test background monitoring
python main.py background
# Quick start (defaults to web mode)
python run.pycrowdsense_enhanced.py: Main disaster detection logic with real APIsanomaly_detection.py: Statistical anomaly detection algorithmslocation_extraction.py: NER-based location extraction and geocodingdatabase.py: SQLite database operations and data managementscheduler.py: Background task scheduling and management
simulation.py: Disaster scenario engine and Twitter API simulationcrowdsense_simulation.py: Enhanced system with simulation supporttrigger_disaster.py: Command-line disaster scenario triggers
config.py: Environment variables and configuration managementalert.py: SMS alert functionality with carrier filtering fixeslogging_config.py: Structured logging and metrics collectioncheck_sms_status.py: SMS troubleshooting and testing tools
app.py: Flask web application for production useapp_simulation.py: Flask web application with simulation controls- Templates: HTML templates for dashboard interfaces
- 🎯 Clear Separation: Production vs. simulation code clearly separated
- 📦 Modular Design: Each component has a specific responsibility
- 🔄 Easy Maintenance: Changes to one module don't affect others
- 🧪 Better Testing: Simulation code isolated for testing purposes
- 📚 Improved Documentation: Each directory has a clear purpose
- 🚀 Easy Deployment: Production code (
core/) can be deployed separately
All modules properly import from their organized locations:
- Core modules import from
core.* - Simulation modules import from
simulation.* - Utilities import from
utils.* - Web modules import from
web.*
- Production Development: Work in
core/directory - Simulation Development: Work in
simulation/directory - Web Development: Work in
web/directory - Configuration Changes: Update
utils/config.py - Testing: Use
simulate.pyormain.py test
The project is now enterprise-ready with proper structure and separation of concerns! 🎉