Skip to content

kitessafikadu/resq

Repository files navigation

ResQ

ResQ is a real-time emergency coordination platform for heaalth facility teams. It is built to reduce the "third delay" by improving how staff detect, broadcast, assign, and resolve emergencies after a patient reaches a facility.

What This App Includes

  • Real-time emergency alerts with severity and workflow status tracking.
  • Role-aware dashboards for operations and administration.
  • Patient registration flow tied to triage context and room assignment.
  • Duty assignment management for shifts.
  • Firebase Authentication with Google sign-in.
  • Firestore-backed live updates and offline-friendly behavior.
  • AI voice alert generation (Gemini TTS) for broadcast workflows.
  • Lightweight health endpoint at /api/health.

Tech Stack

  • Next.js 15 (App Router)
  • React 19
  • TypeScript
  • Tailwind CSS 4
  • Firebase Auth + Firestore
  • Sonner (toasts), Lucide (icons), Motion (animation)
  • Google GenAI SDK (@google/genai) for voice alerts

Prerequisites

  • Node.js 20+ recommended
  • npm 10+
  • A Firebase project with Auth and Firestore enabled
  • A Gemini API key if you want text-to-speech voice alerts

Local Development

  1. Install dependencies:
npm install
  1. Create .env.local and add:
NEXT_PUBLIC_GEMINI_API_KEY=your_gemini_api_key
  1. Start the dev server:
npm run dev
  1. Open:
http://localhost:3000

Scripts

  • npm run dev - start development server
  • npm run build - build for production
  • npm run start - run production server
  • npm run lint - run TypeScript type check (tsc --noEmit)

Firebase Configuration Notes

The app currently imports Firebase config from firebase-applet-config.json directly in src/firebase.ts.

  • If you use a different Firebase project, replace values in firebase-applet-config.json.
  • Make sure Firestore rules in firestore.rules are deployed to your target project.
  • This app depends on these collections:
    • users
    • users_public
    • user_invitations
    • alerts
    • patients
    • duty_assignments

Auth and Role Model

  • Sign-in is Google-based.
  • Invites are created by admins in user_invitations using normalized email as doc ID.
  • On first login, invited users claim their profile and create users/{uid}.
  • Roles include: ADMIN, DOCTOR, NURSE, DISPATCHER, ANESTHETIST, MID_WIFER, NEONATAL_TEAM.

Offline and Reconnect Behavior

  • Firestore multi-tab IndexedDB persistence is enabled in the browser.
  • Offline mutations are queued in local storage and replayed when connectivity returns.
  • Cached user profile and queued actions are managed by src/services/offlineService.ts.

API

  • GET /api/health
    • Returns { status, timestamp, version, environment }

Troubleshooting

  • Voice alerts fail with missing key:

    • Ensure NEXT_PUBLIC_GEMINI_API_KEY exists in .env.local.
  • Firestore permission errors after login:

    • Verify your user has a valid role/profile document in users.
    • Confirm rules are deployed and match your active Firebase project.
  • Service worker caching issues in local dev:

    • Service worker registration is production-only (NODE_ENV === "production").

About

ResQ is a real-time emergency coordination prototype designed to reduce critical delays in hospital response systems, especially in low-resource healthcare settings. It addresses the "third delay", the delay in receiving timely and appropriate care after a patient arrives at a health facility

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors