Skip to content
This repository was archived by the owner on Oct 13, 2025. It is now read-only.

Latest commit

 

History

History
201 lines (158 loc) · 5.87 KB

File metadata and controls

201 lines (158 loc) · 5.87 KB

DisasterWatch Features

This document outlines the main features of the DisasterWatch web application, including real-time alerts, interactive maps, user profiles, resource management, and the notification system.

Real-time Alerts

Overview

The application provides real-time alerts about natural disasters, allowing users to stay informed about ongoing events in their area.

Key Features

  • Live Updates: Alerts are updated in real-time as new information becomes available.
  • Filtering: Users can filter alerts by type, location, and severity.
  • Push Notifications: Users can opt-in to receive push notifications for critical alerts.

Implementation

// Example of fetching real-time alerts
const fetchAlerts = async () => {
  const response = await api.get('/alerts');
  setAlerts(response.data);
};

Interactive Maps

Overview

The application includes an interactive map that displays disaster zones and relevant information.

Key Features

  • Disaster Zones: Highlighted areas on the map indicate disaster zones.
  • User Location: Users can view their current location on the map.
  • Custom Markers: Custom markers for different types of disasters.

Implementation

// Example of rendering a map with disaster zones
const MapView = () => {
  return (
    <GoogleMap
      center={center}
      zoom={zoom}
    >
      {disasterZones.map(zone => (
        <Polygon
          key={zone.id}
          paths={zone.coordinates}
          options={{
            fillColor: zone.severity === 'high' ? 'red' : 'yellow',
            fillOpacity: 0.5,
            strokeColor: 'black',
            strokeWeight: 1
          }}
        />
      ))}
    </GoogleMap>
  );
};

User Profiles

Overview

Users can create and manage their profiles, including personal information and preferences.

Key Features

  • Profile Creation: Users can create a profile with personal details.
  • Profile Updates: Users can update their profile information at any time.
  • Preferences: Users can set preferences for notifications and alerts.

Implementation

// Example of updating user profile
const updateProfile = async (userData) => {
  const response = await api.put('/profile', userData);
  setUser(response.data);
};

Resource Management

Overview

The application allows users to manage resources related to disaster response and recovery.

Key Features

  • Resource Listing: Users can view a list of available resources.
  • Resource Allocation: Users can allocate resources to specific disaster zones.
  • Resource Tracking: Track the status and location of resources.

Implementation

// Example of fetching resources
const fetchResources = async () => {
  const response = await api.get('/resources');
  setResources(response.data);
};

Notification System

Overview

The application includes a notification system to keep users informed about important updates.

Key Features

  • Push Notifications: Users can receive push notifications for critical alerts.
  • In-App Notifications: Notifications are also displayed within the application.
  • Notification Preferences: Users can customize their notification settings.

Implementation

// Example of subscribing to push notifications
const subscribeToNotifications = async () => {
  const registration = await navigator.serviceWorker.ready;
  const subscription = await registration.pushManager.subscribe({
    userVisibleOnly: true,
    applicationServerKey: process.env.NEXT_PUBLIC_VAPID_PUBLIC_KEY
  });
  await api.post('/notifications/subscribe', subscription);
};

Additional Features

1. Offline Support

  • The application can function offline, allowing users to access critical information without an internet connection.

2. Responsive Design

  • The application is designed to be responsive, providing a seamless experience on both desktop and mobile devices.

3. Accessibility

  • The application adheres to accessibility guidelines, ensuring that all users can access and use the application effectively.

4. Analytics and Reporting

  • The application includes analytics and reporting features to track user engagement and application performance.

Future Enhancements

1. Enhanced Real-time Features

  • Integration with more data sources for real-time updates.
  • Advanced filtering and search capabilities.

2. User Engagement

  • Community features, such as user forums and shared resources.
  • Gamification elements to encourage user participation.

3. Integration with External Services

  • Integration with emergency services and disaster response organizations.
  • Support for third-party applications and APIs.

4. Advanced Analytics

  • Predictive analytics for disaster forecasting.
  • Customizable dashboards for data visualization.

Testing

Feature Tests

describe('Real-time Alerts', () => {
  it('should fetch alerts successfully', async () => {
    // Test alert fetching
  });

  it('should filter alerts by type', async () => {
    // Test alert filtering
  });
});

describe('Interactive Maps', () => {
  it('should render disaster zones correctly', () => {
    // Test map rendering
  });

  it('should update user location', () => {
    // Test location updates
  });
});

Troubleshooting

Common Issues

  1. Alert Notifications

    • Check notification settings
    • Verify push notification subscription
    • Ensure network connectivity
  2. Map Rendering

    • Check Google Maps API key
    • Verify map data sources
    • Clear browser cache
  3. Profile Updates

    • Check API responses
    • Verify user permissions
    • Review data validation

Getting Help

  • Check the Issues page
  • Create a new issue with detailed information
  • Join our Discord community for support