Building AREMS: An AI-powered Risk Emergency Management System
On March 28, 2025, central Myanmar was struck by a 7.7-magnitude earthquake, followed by a 6.4 aftershock. Bangkok was among the regions that felt the seismic waves.
During those moments, I didn’t know what to do or who to turn to. It was my first time experiencing anything like it. I wasn’t injured, but I was disoriented, anxious, and unsure how to proceed, and I know I wasn’t alone.
Emergency services were understandably overwhelmed, focused on people who were hurt and situations that were immediately life-threatening. But for millions of others who needed guidance, reassurance, or clear next steps, there was no obvious place to go.
That gap between chaos and clarity was what led me to begin building AREMS: an AI-powered Risk Emergency Management System.
This article provides an overview of the logic behind creating an AI-powered, cloud-native platform for fast emergency reporting, risk assessment, and useful guidance to the public and humanitarian responders during disasters.
System Architecture Overview
Built by integrating multiple Google Cloud services, AREMS relies on a Python-based Cloud Functions backend that serves as the central operations system. Delivers conversational emergency reporting and risk assessment across Telegram and Web platforms, backed by persistent database tracking for incidents and risk analysis data.
The system provides real-time guidance powered by an AI-integrated custom search knowledge base, enabling immediate access to information during crises.
Conversational Agent: Dialogflow CX Integration
The implementation features a hybrid flow, combining deterministic and generative features to handle emergency scenarios. The webhook architecture processes four distinct operational flows:
- Emergency reporting with multi-field data collection
- Risk assessment using hazard analysis algorithms
- Procedures for disaster response protocols
- Knowledge search powered by Vertex AI Search
The Dialogflow CX integration required precise handling of webhook tags, session management, and context preservation in conversations. The system automatically routes requests based on the detection of fulfillment Info, session Info, and page Info fields, ensuring seamless communication between the chat interfaces and backend logic.
Backend Logic: Cloud Functions Architecture
The Python Cloud Function webhook serves dual channels. The Telegram Bot and Dialogflow CX through intelligent request routing. The system analyzes User-Agent headers and request payload structures to determine the appropriate handler, enabling a unified codebase for multi-platform support.
Get Chidera Okoye’s stories in your inbox
Join Medium for free to get updates from this writer.
Key architectural decisions included:
- Enhanced logging infrastructure with structured debug markers for production diagnostics
- Regional endpoint configuration for Dialogflow CX’s us-central1 location
- Robust error handling with comprehensive traceback capture and user-friendly fallback responses
- Environment-based configuration management for secure data handling
- Real-time file processing supporting both photo and document uploads
Data Storage: Firestore Implementation
The Firestore implementation establishes organized collections to ensure data is queryable and persistent. This includes:
- User profiles with activity tracking and session state
- Emergency reports with unique incident IDs and structured metadata
- Risk assessments, storing computed scores, and recommendations
- Session state preserving conversational context across platforms
- Message archives enabling analytics and audit trails
The database schema supports programmatic access patterns optimized for analytics dashboards and real-time operational monitoring.
File Storage: Cloud Storage Integration
A centralized bucket organizes user uploads by user data, session data, and date hierarchies. The implementation handles unstructured data (photos, videos, documents, etc) with:
- Scalable path structures:
users/{chatid}/{username}/{date}/photos/{timestamp}.jpg
This ensures error-resilient upload processes with status code validation and automatic MIME type handling for diverse emergency documentation.
Knowledge Base: AI-Powered Search
The Discovery Engine integration transforms static disaster response documents into an intelligent, queryable knowledge base. The implementation leverages:
- Query expansion for improved recall on emergency terminology
- Spell correction handling crisis communication under stress
- AI-generated summaries synthesizing multiple source documents
The search functionality processes natural language questions about emergency procedures, evacuation plans, and safety guidelines, returning actionable guidance within seconds.
Key Functional Capabilities Delivered
Emergency Report Submission
The system implements multi-field collection of incident details, including type, location, severity, and contact information. Each submission receives a unique incident ID with Firestore persistence, followed by immediate confirmation and reference number delivery to the user.
Risk Assessment Engine
The hazard analysis computes risk scores using base hazard values multiplied by vulnerable group modifiers. The algorithm considers population density, area characteristics, and incident severity to generate context-aware, level-specific recommendations tailored to each scenario.
Intelligent Knowledge Search
Free-text guidance queries are processed through the AI Applications search engine, which indexes trusted disaster response documentation. The system returns AI-powered answers with source attribution, enabling users to verify information during critical decision-making moments.
File Handling System
The platform supports upload and storage of supporting incident documents and photos, organized automatically by user session. This capability enables first responders to share visual context, damage assessments, and critical documentation directly through the chat interface.
Conclusion
AREMS is a shift toward AI-powered Emergency Management. By combining the power of Google Cloud’s AI with a robust, modular architecture, AREMS ensures that when seconds count, the system is ready to provide the clarity and coordination required to save lives.
Note: AREMS is currently in active development







