You are tasked with building a Disaster Prediction and Alert System API for a government agency. This API will predict potential disaster risks (such as floods, earthquakes, and wildfires) for specified regions and send alerts to affected communities. The system integrates with external APIs to gather real-time environmental data and uses a simple scoring algorithm to assess risk levels.
- Build the API: Implement each endpoint with the specified functionality.
- External API Integration: Set up integration with external environmental data sources for real-time data.
- Caching with Redis: Use Redis to cache environmental data and risk calculations to minimize redundant external API calls.
- Azure Deployment: Deploy the solution on Azure and provide a live demo.
- Error Handling: Manage scenarios like:
- Failed external API calls.
- Missing data from external sources.
- Regions with no available data.
- Messaging API Integration: Implement alert-sending functionality via a messaging API to notify people in high-risk regions.
- Logging: Track API usage and alerts for auditing purposes.
Backend: .Net Core
Database: Postgres, Redis
Server: Azure
Logs: Serilog integrate with Azure
Others: Notion, Github
Start Date: 15/10/24
End Date: 21/10/24
Github Repository: https://github.com/Tanachuns/dpa-api
Presentation Video: https://www.youtube.com/watch?v=pajlCtBEIAc
API Url: https://dpa.tanabythepond.dev
- Init project
- Setup CI/CD
- Setup Database
- Setup Logs Integrated with Azure
- Setup redis
- [POST] /api/regions
- [POST] /api/alert-settings
- [GET] /api/disaster-risks
- [POST] /api/alerts/send
- [GET] /api/alerts
- Weather: https://openweathermap.org/
- Earthquake: https://.usgs.gov/fdsnws/event/1/
- Messaging API: https://developers.line.biz/en/services/messaging-api/
Risk Criteria
- Flood: Raining rates
- EarthQuake: Magnitude
- Wildfire: 100 - Humidity + Temp
Risk Level
- Low = score < threshold / 3
- Mid = score < threshold * (2 / 3)
- High = score >= threshold
- Deploy Node.js ด้วย Azure App Service Plan, Azure Container Registry และ GitHub Action | by Ponggun | T. T. Software Solution | Medium
- A Comprehensive Guide to Configuring Logging with Serilog and Azure App Insights in .NET | by Shazni Shiraz | Ascentic Technology | Medium
- [C#] .netCore + redis caching | by Macus.y | Medium
- Tutorial: Containerize a .NET app
- Cache Strategies | Medium
- Enable Azure Monitor OpenTelemetry for .NET, Java, Node.js, and Python applications - Azure Monitor | Microsoft Learn
- https://www.youtube.com/watch?app=desktop&v=LW65eQ2SFJU
- C#/.NET guide | Docs (redis.io)