Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FlashAid - Emergency Medical Help App

Overview

FlashAid is a comprehensive emergency medical assistance application built using the MERN stack (MongoDB, Express.js, React.js, Node.js). The app connects people in medical emergencies with nearby volunteers and provides AI-powered first aid instructions.

🚨 Key Features

Core Functionality

  • SOS Emergency Button: One-click emergency request with automatic location detection
  • AI-Powered First Aid: Real-time first aid instructions via ChatGPT API integration
  • Volunteer Network: Connect with certified medical volunteers in your area
  • Real-time Notifications: Instant alerts to volunteers via Socket.IO
  • Location-based Matching: Automatic matching of emergency requests with nearby volunteers

User Management

  • Dual User Types: Regular users and medical volunteers
  • Comprehensive Profiles: Medical information, emergency contacts, certifications
  • Role-based Access: Different dashboards for users and volunteers
  • Secure Authentication: JWT-based authentication with password encryption

Medical Features

  • First Aid Knowledge Base: Searchable medical emergency procedures
  • Medical Profile Management: Blood type, allergies, medications, conditions
  • Emergency Contact System: Automatic notification of family/friends
  • Medical Certification Tracking: Volunteer qualifications and certifications

Community & Gamification

  • Volunteer Leaderboard: Recognition system for top helpers
  • Response Time Tracking: Performance metrics for volunteers
  • Success Rate Monitoring: Completion statistics and ratings
  • Points & Badges System: Gamified volunteer engagement

🏗️ Technical Architecture

Backend (Node.js/Express.js)

flashaid-backend/
├── server.js                 # Main server file with Socket.IO
├── package.json              # Dependencies and scripts
├── .env.example              # Environment variables template
└── src/
    ├── models/               # MongoDB schemas
    │   ├── User.js          # User model with medical info
    │   ├── EmergencyRequest.js  # Emergency request model
    │   ├── FirstAidGuide.js    # First aid guides model
    │   └── Leaderboard.js      # Volunteer rankings model
    ├── routes/               # API endpoints
    │   ├── auth.js          # Authentication routes
    │   ├── emergency.js     # Emergency handling routes
    │   ├── users.js         # User management routes
    │   ├── volunteers.js    # Volunteer-specific routes
    │   ├── firstAid.js      # First aid guides routes
    │   └── leaderboard.js   # Leaderboard routes
    ├── middleware/           # Custom middleware
    │   ├── auth.js          # JWT authentication
    │   ├── validation.js    # Request validation
    │   └── errorHandler.js  # Error handling
    └── utils/                # Utility functions
        ├── openai.js        # ChatGPT integration
        ├── notifications.js # Notification system
        └── validation.js    # Data validation helpers

Frontend (React.js)

flashaid-frontend/
├── package.json              # Dependencies and scripts
├── .env.example              # Environment variables template
├── public/                   # Static assets
└── src/
    ├── App.js               # Main app component with routing
    ├── index.js             # Entry point
    ├── components/           # Reusable UI components
    │   ├── Navbar/          # Navigation component
    │   └── UI/              # UI elements (buttons, spinners, etc.)
    ├── pages/                # Page components
    │   ├── HomePage.js      # Landing page with features
    │   ├── SOSPage.js       # Emergency request interface
    │   ├── LoginPage.js     # User authentication
    │   ├── RegisterPage.js  # User registration
    │   ├── DashboardPage.js # User dashboard
    │   ├── ProfilePage.js   # Profile management
    │   ├── FirstAidPage.js  # First aid guides browser
    │   ├── FirstAidGuidePage.js # Individual guide viewer
    │   ├── VolunteerDashboard.js # Volunteer interface
    │   ├── LeaderboardPage.js   # Volunteer rankings
    │   └── EmergencyRequestPage.js # Emergency details
    ├── context/              # React context for state management
    │   └── AuthContext.js   # Authentication state
    ├── services/             # API and external services
    │   ├── api.js           # Backend API calls
    │   └── socket.js        # Socket.IO client
    ├── hooks/                # Custom React hooks
    ├── utils/                # Utility functions
    └── styles/               # Global styles

🔧 Installation & Setup

Prerequisites

  • Node.js (v18+ recommended)
  • MongoDB (local or cloud instance)
  • OpenAI API key (for first aid instructions)

Backend Setup

  1. Clone and navigate to backend:

    cd flashaid-backend
  2. Install dependencies:

    npm install
  3. Environment Configuration:

    cp .env.example .env

    Configure the following variables in .env:

    PORT=5001
    MONGODB_URI=mongodb://localhost:27017/flashaid
    JWT_SECRET=your_super_secret_jwt_key_here
    JWT_EXPIRE=7d
    OPENAI_API_KEY=your_openai_api_key_here
    NODE_ENV=development
  4. Start the backend server:

    npm start
    # Server will run on http://localhost:5001

Frontend Setup

  1. Navigate to frontend:

    cd flashaid-frontend
  2. Install dependencies:

    npm install
  3. Environment Configuration:

    cp .env.example .env

    Configure the following variables in .env:

    REACT_APP_API_URL=http://localhost:5001
    REACT_APP_SOCKET_URL=http://localhost:5001
  4. Start the frontend server:

    npm start
    # Application will open at http://localhost:3000

Database Setup

  1. Start MongoDB:

    # If using local MongoDB
    mongod
    
    # Or use MongoDB Atlas cloud service
  2. Database will be automatically created when the backend starts

🚀 Usage Guide

For Emergency Users

  1. Registration/Login:

    • Create account with personal and medical information
    • Add emergency contacts and medical details
    • Set up blood type, allergies, medications
  2. Emergency Request:

    • Click the SOS button on dashboard or dedicated SOS page
    • Location is automatically detected
    • Describe the emergency situation
    • Receive immediate AI-powered first aid instructions
    • Volunteers are automatically notified
  3. Dashboard Features:

    • View emergency history
    • Access first aid guides
    • Manage profile and medical information
    • Track response times and outcomes

For Medical Volunteers

  1. Volunteer Registration:

    • Sign up with medical certifications
    • Specify areas of expertise
    • Set availability status
  2. Responding to Emergencies:

    • Receive real-time notifications
    • View emergency details and patient information
    • Respond to emergencies in your area
    • Mark requests as resolved
  3. Volunteer Dashboard:

    • Monitor active emergency requests
    • Track response history and performance
    • Toggle availability status
    • View leaderboard rankings

🔗 API Documentation

Authentication Endpoints

  • POST /api/auth/register - User registration
  • POST /api/auth/login - User login
  • GET /api/auth/profile - Get user profile
  • PUT /api/auth/profile - Update user profile

Emergency Endpoints

  • POST /api/emergency/create - Create emergency request
  • GET /api/emergency/:id - Get emergency details
  • POST /api/emergency/:id/respond - Volunteer response
  • PUT /api/emergency/:id/complete - Mark as resolved

First Aid Endpoints

  • GET /api/first-aid - Get all first aid guides
  • GET /api/first-aid/:id - Get specific guide
  • GET /api/first-aid/categories - Get guide categories
  • POST /api/first-aid/search - Search guides

Volunteer Endpoints

  • GET /api/volunteers/requests - Get volunteer requests
  • POST /api/volunteers/toggle-availability - Toggle status
  • GET /api/volunteers/stats - Get volunteer statistics

Leaderboard Endpoints

  • GET /api/leaderboard - Get volunteer rankings
  • GET /api/leaderboard/stats - Get leaderboard statistics

🔌 Real-time Features (Socket.IO)

Events

  • newEmergencyRequest - New emergency broadcast to volunteers
  • volunteerResponse - Volunteer accepts emergency
  • emergencyUpdate - Status updates for emergency
  • connectionStatus - User connection status

Rooms

  • volunteers - All active volunteers
  • emergency_{id} - Specific emergency participants

🛡️ Security Features

  • JWT Authentication: Secure token-based authentication
  • Password Encryption: bcrypt hashing for user passwords
  • Input Validation: Express-validator for request validation
  • CORS Protection: Configured cross-origin resource sharing
  • Rate Limiting: API rate limiting to prevent abuse
  • Environment Variables: Sensitive data in environment files

🧪 Testing

Backend Testing

cd flashaid-backend
npm test

Frontend Testing

cd flashaid-frontend
npm test

📱 Mobile Responsiveness

The application is fully responsive and works seamlessly on:

  • Desktop computers
  • Tablets
  • Mobile phones
  • Progressive Web App (PWA) capabilities

🔮 Future Enhancements

Planned Features

  • Video Call Integration: Direct video consultation with volunteers
  • Offline Mode: Basic first aid guides available offline
  • Multi-language Support: Internationalization for global use
  • Telemedicine Integration: Connect with professional medical services
  • Medical History Tracking: Comprehensive health record management
  • Insurance Integration: Connect with health insurance providers

Technical Improvements

  • Microservices Architecture: Scale individual components
  • Redis Caching: Improve performance with caching layer
  • Push Notifications: Mobile app with push notification support
  • Machine Learning: Predictive analytics for emergency response
  • Blockchain Integration: Secure medical record management

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🆘 Support

For support, please contact:

🙏 Acknowledgments

  • OpenAI for GPT API integration
  • Socket.IO for real-time communication
  • MongoDB for flexible data storage
  • React community for amazing UI components
  • Medical professionals who provided guidance on first aid procedures

⚠️ Disclaimer: FlashAid is designed to provide emergency assistance and first aid guidance. It is not a replacement for professional medical care. Always call emergency services (911, 112, etc.) for serious medical emergencies.** MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages