Home - martinmendozadev/StateForce GitHub Wiki

πŸ›‘οΈ StateForce Documentation

πŸš€ Introduction

πŸ“Œ What is StateForce?

StateForce is a state-level emergency resource management platform. It empowers public agencies to monitor, analyze, and optimize the availability and distribution of resources such as ambulances, rescue units, fire brigades, and hospital capacity in real time. Originally designed for the Centro Regulador de Urgencias MΓ©dicas (CRUM), it provides tools for improving responsiveness and coordination during emergency situations.

🎯 Objectives

StateForce aims to:

  1. Enhance operational efficiency by optimizing the allocation and utilization of emergency response resources.
    Example: Reduce emergency response times by up to 20% through better resource management.
  2. Provide real-time visibility of resource status and location via an intuitive dashboard.
    Example: Enable public agencies to track ambulances and rescue units with real state updates.
  3. Support strategic planning and operational decision-making with actionable insights derived from historical data and analytics.
    Example: Predict resource demand patterns based on usage trends.
  4. Adapt to diverse operational needs by allowing customization for different regions or types of emergency services.
    Example: Configure the system for use in urban areas or rural emergency networks.

πŸ” Scope

  • βœ… Included:

    • Registration and real-time tracking of emergency assets such as ambulances, rescue units, and hospital capacity.
    • Live monitoring dashboard and operational status views.
    • Resource utilization reporting and historical data export.
    • Role-based access control for user management.
  • ❌ Excluded:

    • Dispatch or intervention in emergency operations, as this is handled by separate systems.
    • Real-time communication with field units (e.g., radio or messaging systems).
    • Integration with third-party platforms beyond the defined APIs.

Note: The exclusions ensure that StateForce remains focused on resource management rather than duplicating functionalities of other specialized systems.


πŸ“‹ Requirements

βœ… Functional Requirements

  • Secure user authentication with email and Google OAuth integration.
  • Role-based access control (e.g., admin, guest).
  • Interactive dashboard for real-time monitoring and reporting.
  • Monthly summaries and performance analytics for decision-making.

βš™οΈ Non-Functional Requirements

  • Horizontal scalability to handle multiple states and thousands of assets simultaneously.
  • Real-time performance with sub-second latency for critical data updates.
  • Data security compliant with privacy laws and regulatory standards.
  • Customizable configurations to adapt to varying regional or organizational needs.

🧱 System Architecture

🧩 Stack Overview

  • Framework: Ruby on Rails (API + Views).
  • Database: PostgreSQL for reliable relational data management.
  • Real-time: Hotwire (Turbo + Stimulus) and Redis for instant updates.
  • Authentication: Devise with OmniAuth (Google OAuth).
  • Deployment: Heroku for cloud scalability and ease of management.

πŸ“Œ High-Level Diagram

For a detailed architectural overview, visit Architecture Diagram


πŸ“Š Dashboard Preview

ChatGPT Image 19 may 2025, 11_06_36 a m


πŸ—ƒοΈ Database Schema

Explore the complete schema and relationships here:
πŸ”— Database Wiki Page


🀝 Collaboration Guidelines

πŸ’‘ Best Practices

  • Follow Ruby Style Guide to maintain code quality and consistency.
  • Write clear, descriptive commit messages for every change.
  • Always include unit and integration tests for new features and critical fixes.
  • Keep pull requests small, focused, and accompanied by detailed documentation.