Inspiration## Inspiration
During natural disasters in Bangladesh like severe floods or cyclones, one of the biggest challenges is the chaotic flow of emergency communication. People send distress messages through SMS, social media, or hotline channels, but these messages are usually unstructured and filled with noise. Rescue teams and coordinators waste critical time manually reading, sorting, and extracting locations or urgency levels from massive volumes of text. This inspired us to build the Local Disaster Response Bot—an intelligent backend system designed to bridge the gap between victims and rescue coordinators instantly.
What it does
The application provides a robust API endpoint (/process-emergency) built with FastAPI. When an unstructured emergency message is sent (for example, stating a crisis in a specific region), the system leverages OpenAI's GPT-4o-mini model to analyze the text and parse it into a clean, standardized JSON format.
It automatically extracts:
- Location: The exact area where help is needed (e.g., Sylhet).
- Emergency Type: Categorizes the crisis (e.g., Flood, Cyclone, Medical, Food Shortage, Rescue).
- Urgency Level: Evaluates priority (High, Medium, Low).
- Summary: Generates a clear, concise English summary tailored specifically for rapid rescue dispatch teams.
How we built it
- Backend Framework: Built using FastAPI for high performance and automatic interactive API documentation.
- Data Validation: Utilized Pydantic models to enforce strict request schemas and ensure data integrity.
- AI Processing: Integrated the OpenAI API (
gpt-4o-mini) using enforcedjson_objectresponse formatting to guarantee structured and parsable intelligence. - Environment & Testing: Developed and tested seamlessly using Google Colab, Uvicorn, and FastAPI's
TestClientfor instant endpoint verification.
Challenges we ran into
One of the primary challenges was handling unstructured, mixed-language local distress inputs and forcing the LLM to output consistently structured JSON schemas without breaking. We solved this by carefully engineering the system prompt and using OpenAI’s native JSON response formatting constraints, combined with Pydantic validation on the FastAPI side. Another hurdle was running and testing asynchronous backend routes smoothly inside a cloud notebook environment, which we resolved by implementing FastAPI's TestClient and nest_asyncio.
What we learned
We gained deep practical experience in building production-ready asynchronous Python APIs with FastAPI, structuring robust prompt templates for precise data extraction, and handling automated triage workflows for humanitarian technology applications.
What's next for Local Disaster Response Bot
- Integrating a real-time database (such as PostgreSQL or MongoDB) to log and track incoming emergency cases.
- Building a live dashboard web interface for rescue coordinators to visualize affected areas on a map.
- Adding multilingual support for various regional dialects to make distress reporting even more accessible.
What it does
How we built it
Challenges we ran into
Accomplishments that we're proud of
What we learned
What's next for Local Disaster Response Bot
Built With
- fastapi
- google-colab
- openai
- pydantic
- python
- uvicorn
Log in or sign up for Devpost to join the conversation.