A real-time weather and disaster alert system that provides timely and localized severe weather notifications. This system integrates weather data from Weatherbit, push notifications via OneSignal, interactive maps with Google Maps & Geolocation APIs, and robust analytics powered by Pandas. The mobile app is built using React Native with NativeWind CSS and deployed for demos via the Expo Go app.
- Overview
- Features
- Tech Stack
- Architecture Diagram
- Development Environment Setup
- Technical Challenges & Solutions
- Testing
- Contributing
- License
The Real-Time Weather and Disaster Alert System is designed to:
- Fetch and process severe weather data in real time using the Weatherbit API.
- Deliver instant push notifications using OneSignal.
- Provide an interactive map interface with Google Maps & Geolocation APIs for hyper-localized alerts.
- Allow users to share alerts with friends and family.
- Process engagement data using Pandas for analytical insights.
- Description: Integrates Weatherbit API to fetch severe weather data, filter relevant alerts, and make them available via a RESTful Flask backend.
- User Benefit: Ensures timely and actionable weather alerts for local residents to take necessary precautions.
- Description: Uses OneSignal to deliver real-time push notifications to users' devices.
- User Benefit: Provides immediate alerts and safety instructions during severe weather events.
- Description: Leverages Google Maps and Geolocation APIs to display alerts on an interactive map, filtering them based on user-defined proximity.
- User Benefit: Offers hyper-localized weather information to reduce noise and improve preparedness.
- Description: Enables users to share alerts with trusted contacts and manage their contact lists within the app.
- User Benefit: Enhances community safety by spreading critical information quickly.
- Description: Processes engagement logs using Pandas to generate key performance metrics and visual dashboards.
- User Benefit: Allows administrators and data analysts to monitor alert effectiveness and optimize the system based on real usage data.
- Frontend Framework: React Native with NativeWind CSS (for streamlined styling)
- Backend Technology: Flask (Python)
- Database: PostgreSQL
- APIs & Integrations:
- Weatherbit API (for severe weather data)
- Google Maps & Geolocation APIs (for interactive maps and location detection)
- OneSignal (for push notification delivery)
- Analytics & Data Processing: Pandas (Python)
- Testing & Quality Assurance:
- pytest (for API, unit, and integration tests)
- Detox (for end-to-end mobile app testing)
- Deployment:
- Frontend: Demo deployment via Expo Go app
- Backend: Flask application on EC2 instance
- CI/CD: GitHub Actions
- Testing: pytest, Detox
Below is a simplified diagram showing how different components of the system interact:
+----------------------------------+
| User Devices |
| (iOS/Android via Expo Go App) |
+---------------+------------------+
|
| (React Native App via Expo)
V
+----------------------------------+
| Frontend Layer |
| React Native with NativeWind |
+---------------+------------------+
|
| REST API Calls
V
+----------------------------------+
| Backend API Layer |
| (Flask Application) |
+---------------+------------------+
/ | \ \
/ | \ \
V V V V
+----------------+ +--------------+ +--------------+
| Weatherbit API | | OneSignal | | Google Maps |
| (Weather Data) | | (Push Notif.)| | & Geolocation|
+----------------+ +--------------+ +--------------+
\ | /
\ | /
V V V
+----------------------------------+
| PostgreSQL Database |
| (User Data, Alerts, Engagement |
| Logs, Preferences & History) |
+----------------------------------+
|
| Analytics Processing
V
+----------------------------------+
| Analytics Module |
| (Pandas Scripts) |
+----------------------------------+
-
Clone the Repository:
git clone <repository-url> cd project-directory
-
Create a Python Virtual Environment:
python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate
-
Install Dependencies:
pip install -r requirements.txt
-
Database Setup:
- Install PostgreSQL and create a new database (e.g.,
weather_alerts_db
). - Configure the connection settings in your configuration file (
config.py
or via environment variables). - Run migration scripts (using Alembic or Flask-Migrate).
- Install PostgreSQL and create a new database (e.g.,
-
Environment Variables:
- Create a
.env
file with variables such asWEATHERBIT_API_KEY
,ONESIGNAL_API_KEY
,GOOGLE_MAPS_API_KEY
, andDATABASE_URL
.
- Create a
pip install pytest pytest-flask
- Follow Detox documentation for simulator setup.
- Configure a CI pipeline (using GitHub Actions, CircleCI, etc.) to run tests automatically on each commit.
- Securely store your environment variables in your CI/CD tool.
-
Third-Party API Integration:
- Challenge: Handling rate limits, downtime, or latency issues with Weatherbit, OneSignal, and Google Maps.
- Solution: Implement robust error handling, retries, caching, and fallback mechanisms.
-
Real-Time Data Accuracy:
- Challenge: Keeping weather alerts updated in near real-time.
- Solution: Optimize polling frequency, consider webhooks, and apply event-driven updates when available.
-
Push Notification Reliability:
- Challenge: Timely delivery of push notifications across networks.
- Solution: Utilize OneSignal's retry features, monitor deliveries, and incorporate user feedback.
-
Geolocation and Map Rendering:
- Challenge: Variability in geolocation accuracy and smooth map performance.
- Solution: Use device-native geolocation APIs, test on various devices, and optimize map rendering with clustering techniques.
-
Data Volume and Analytics:
- Challenge: Efficient processing of large data volumes.
- Solution: Leverage Pandas for in-memory processing and optimize PostgreSQL queries with indexing.
-
Development & Testing Coordination:
- Challenge: Ensuring seamless collaboration and continuous integration.
- Solution: Follow Lean Agile principles with shift-left testing, daily stand-ups, and integrated automated tests.
-
Expo Demo Constraints:
- Challenge: Ensuring the app functions seamlessly within the Expo Go environment.
- Solution: Regularly test on Expo Go, use Expo debugging tools, and refer to the Expo documentation for environment-specific issues.
- Unit & Integration Testing:
Usepytest
for backend API endpoints and service layers. - End-to-End Testing:
Use Detox for React Native app flows. - Regression Testing:
Continuously run tests in your CI/CD pipeline to catch regressions. - Performance Testing:
Optionally use tools like Locust or JMeter for load testing critical endpoints.
-
Fork the Repository
-
Clone your Fork:
git clone <your-fork-url>
-
Create a Feature Branch:
git checkout -b feature/your-feature-name
-
Commit and Push your Changes
-
Create a Pull Request detailing your changes.
Please follow our code style guidelines and commit message conventions.
This project is licensed under the MIT License.
Happy coding! 🚀