0% found this document useful (0 votes)
2 views14 pages

SDC Assignment 1

The document outlines a project proposal for a Crowd-Based Disaster Response Coordination System, emphasizing real-time information sharing and collaboration among users during emergencies. It details the system's design, including core classes like User, DisasterReport, HelpRequest, and Volunteer, along with their attributes and methods, and justifies the use of the Agile model for development. The implementation section showcases Python code that demonstrates the system's functionality and adherence to design principles such as inheritance and the Single Responsibility Principle.

Uploaded by

hifzanoor422
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views14 pages

SDC Assignment 1

The document outlines a project proposal for a Crowd-Based Disaster Response Coordination System, emphasizing real-time information sharing and collaboration among users during emergencies. It details the system's design, including core classes like User, DisasterReport, HelpRequest, and Volunteer, along with their attributes and methods, and justifies the use of the Agile model for development. The implementation section showcases Python code that demonstrates the system's functionality and adherence to design principles such as inheritance and the Single Responsibility Principle.

Uploaded by

hifzanoor422
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

DEPARTMENT OF SOFTWARE ENGINEERING

G.C UNIVERSITY, FAISALABAD

ASSIGNMENT #1
Subject: Software Construction & Development
Course Code: SDC-506
Instructor: Fiza Tariq

Team Members: Hifza Noor (232688)


2023-GCUF-01498
Muhammad Hassan (232663)
2023-GCUF-01476

Class: BS Software Engineering (6th Morning)

PROJECT TITLE
Crowd-Based Disaster Response Coordination System with Real-Time
Information Sharing

QUESTION 1: SYSTEM DESIGN &


PROCESS SELECTION
System Overview
Disasters such as floods, earthquakes, and fires create chaotic situations where timely
response is critical. Traditional disaster management systems often suffer from delays, lack of
coordination, and insufficient real-time data from affected areas.

This project proposes a web-based crowd-powered platform that enables citizens,


volunteers, and authorities to collaborate effectively during emergencies. The system allows
users to report disasters, request help, and share real-time updates, ensuring faster and more
efficient response.

This project introduces a real-time information sharing mechanism, where users


continuously update disaster conditions, making the system more dynamic, responsive, and
accurate than traditional solutions.
1. Core Classes Design (Detailed)
To design a scalable and modular disaster management system, Object-Oriented
Programming (OOP) concepts are applied. The following core classes are designed with
clearly defined attributes and responsibilities.

User Class
Description:

The User class represents all individuals interacting with the system, including victims,
citizens, volunteers, and administrators.

Attributes (Detailed):

 user_id (Integer): A unique identifier assigned to each user in the system


 name (String): Full name of the user
 email (String): Email address used for communication and login
 location (String): Current geographical location of the user
 role (String): Defines user type (e.g., "User", "Volunteer", "Admin")

Methods:

 report_disaster(): Allows the user to report a disaster event


 request_help(): Enables the user to request resources such as food or medical aid
 view_updates(): Displays real-time disaster updates

 DisasterReport Class
Description:

This class is responsible for storing and managing all disaster-related information submitted
by users.

Attributes (Detailed):

 report_id (Integer): Unique identifier for each disaster report


 disaster_type (String): Type of disaster (e.g., Flood, Earthquake, Fire)
 location (String): Area where the disaster occurred
 description (String): Detailed explanation of the situation
 image (String): Optional image path or URL for visual proof
 status (String): Current state of report ("Pending", "Verified", "Resolved")
 timestamp (DateTime): Time when the report was submitted

Methods:

 create_report(): Creates a new disaster report


 update_report(): Updates existing report information
 verify_report(): Allows admin to verify report authenticity

HelpRequest Class
Description:

This class handles requests made by users for essential resources during disasters.

Attributes (Detailed):

 request_id (Integer): Unique identifier for each help request


 user (Object): Reference to the user who created the request
 resource_type (String): Type of resource requested (Food, Water, Medical, Shelter)
 quantity (Integer): Amount of resource required
 urgency_level (String): Priority level (Low, Medium, High)
 status (String): Current state ("Pending", "In Progress", "Completed")
 location (String): Location where help is required

Methods:

 create_request(): Generates a new help request


 assign_volunteer(): Assigns a volunteer to fulfill request
 mark_completed(): Marks request as completed

 Volunteer Class (Inheritance)


Description:

The Volunteer class is a specialized version of the User class that provides assistance during
disasters.

Attributes (Detailed):

 availability_status (Boolean): Indicates whether the volunteer is available


 assigned_tasks (List): List of tasks assigned to the volunteer
 skills (String): Skills such as medical aid, rescue, etc.

Methods:

 accept_task(): Accepts a help request


 update_status(): Updates progress of assigned tasks
 complete_task(): Marks task as completed

Inheritance:

The Volunteer class inherits all attributes and methods from the User class.
2. Relationships Between Classes
 A User creates DisasterReport
 A User creates HelpRequest
 A Volunteer handles HelpRequest
 An Admin (User role) verifies DisasterReport

Relationship Types:

 Association (User ↔ HelpRequest)


 Inheritance (User → Volunteer)
 Aggregation (Volunteer manages multiple requests)

3. UML Class Diagram


Explanation

The system follows an object-oriented design structure:

 User is the base class


 Volunteer inherits from User
 DisasterReport is associated with User
 HelpRequest connects User and Volunteer

This ensures:

 Reusability
 Maintainability
 Scalability

4. Process Model Selection


Selected Model: Agile Model

Justification:

 Disaster scenarios are dynamic and require flexibility


 Real-time information updates need continuous enhancement
 Requirements evolve during development
 User feedback is critical

Advantages:

 Iterative development
 Faster delivery
 Continuous improvement
 Better adaptability

5. Technology Stack
Frontend

 HTML, CSS, Bootstrap


 JavaScript

Backend

 Python (Flask / Django)

Database

 MySQL / PostgreSQL
Map Integration

 [Link] or Google Maps API

Optional Tools

 Firebase (for real-time updates)

_________________________________________________________________________

QUESTION 2: IMPLEMENTATION &


DESIGN PRINCIPLES
1. Python Implementation
from datetime import datetime

# -------------------------------
# USER CLASS
# -------------------------------
class User:
def __init__(self, user_id, name, email, location, role="User"):
self.user_id = user_id
[Link] = name
[Link] = email
[Link] = location
[Link] = role

def report_disaster(self, disaster_system, disaster_type,


description):
report = DisasterReport(
report_id=len(disaster_system.reports) + 1,
disaster_type=disaster_type,
location=[Link],
description=description,
reported_by=self
)
disaster_system.add_report(report)
print(f"[REPORT] {[Link]} reported {disaster_type} at
{[Link]}")

def request_help(self, disaster_system, resource_type, quantity,


urgency):
request = HelpRequest(
request_id=len(disaster_system.requests) + 1,
user=self,
resource_type=resource_type,
quantity=quantity,
urgency_level=urgency,
location=[Link]
)
disaster_system.add_request(request)
print(f"[REQUEST] {[Link]} requested {resource_type}")
def view_updates(self, disaster_system):
print("\n--- REAL-TIME UPDATES ---")
for report in disaster_system.reports:
print(report)

# -------------------------------
# VOLUNTEER CLASS (INHERITANCE)
# -------------------------------
class Volunteer(User):
def __init__(self, user_id, name, email, location):
super().__init__(user_id, name, email, location,
role="Volunteer")
self.assigned_tasks = []
[Link] = True

def accept_task(self, request):


if [Link]:
self.assigned_tasks.append(request)
[Link] = "In Progress"
request.assigned_volunteer = self
print(f"[VOLUNTEER] {[Link]} accepted request
{request.request_id}")
else:
print(f"{[Link]} is not available")

def complete_task(self, request):


if request in self.assigned_tasks:
[Link] = "Completed"
self.assigned_tasks.remove(request)
print(f"[COMPLETED] {[Link]} completed request
{request.request_id}")

# -------------------------------
# DISASTER REPORT CLASS
# -------------------------------
class DisasterReport:
def __init__(self, report_id, disaster_type, location, description,
reported_by):
self.report_id = report_id
self.disaster_type = disaster_type
[Link] = location
[Link] = description
self.reported_by = reported_by
[Link] = "Pending"
[Link] = [Link]()

def verify_report(self):
[Link] = "Verified"

def update_status(self, new_status):


[Link] = new_status

def __str__(self):
return (f"Report ID: {self.report_id} | Type:
{self.disaster_type} | "
f"Location: {[Link]} | Status: {[Link]}")
# -------------------------------
# HELP REQUEST CLASS
# -------------------------------
class HelpRequest:
def __init__(self, request_id, user, resource_type, quantity,
urgency_level, location):
self.request_id = request_id
[Link] = user
self.resource_type = resource_type
[Link] = quantity
self.urgency_level = urgency_level
[Link] = location
[Link] = "Pending"
self.assigned_volunteer = None

def mark_completed(self):
[Link] = "Completed"

def __str__(self):
return (f"Request ID: {self.request_id} | Resource:
{self.resource_type} | "
f"Urgency: {self.urgency_level} | Status: {[Link]}")

# -------------------------------
# REAL-TIME DISASTER SYSTEM (CORE)
# -------------------------------
class DisasterManagementSystem:
def __init__(self):
[Link] = []
[Link] = []
[Link] = []
[Link] = []

# Add user
def register_user(self, user):
[Link](user)

# Add volunteer
def register_volunteer(self, volunteer):
[Link](volunteer)

# Add disaster report


def add_report(self, report):
[Link](report)
self.notify_users(f"New disaster reported:
{report.disaster_type}")

# Add help request


def add_request(self, request):
[Link](request)
self.notify_volunteers(request)

# Real-time notification to users


def notify_users(self, message):
print(f"[ALERT USERS] {message}")

# Real-time notification to volunteers


def notify_volunteers(self, request):
print(f"[ALERT VOLUNTEERS] New request: {request.resource_type}")
for volunteer in [Link]:
if [Link]:
print(f" -> Notified {[Link]}")

# Admin verification
def verify_all_reports(self):
for report in [Link]:
report.verify_report()
print("[ADMIN] All reports verified")

# -------------------------------
# MAIN EXECUTION (DEMO)
# -------------------------------
if __name__ == "__main__":
system = DisasterManagementSystem()

# Create users
user1 = User(1, "Ali", "ali@[Link]", "Village A")
volunteer1 = Volunteer(2, "Ahmed", "ahmed@[Link]", "Nearby Area")

# Register
system.register_user(user1)
system.register_volunteer(volunteer1)

# User reports disaster


user1.report_disaster(system, "Flood", "Severe flooding in area")

# User requests help


user1.request_help(system, "Food", 5, "High")

# Volunteer accepts task


volunteer1.accept_task([Link][0])

# Complete task
volunteer1.complete_task([Link][0])

# Admin verifies reports


system.verify_all_reports()

# View updates
user1.view_updates(system)
Output:
2. Inheritance and Polymorphism
Inheritance:

Volunteer class inherits from User, enabling reuse of common attributes.

Polymorphism:

Different users perform different actions:

 User → request help


 Volunteer → provide help

# -------------------------------
# BASE CLASS
# -------------------------------
class User:
def __init__(self, user_id, name):
self.user_id = user_id
[Link] = name

def perform_role(self):
print(f"{[Link]} is a normal user")

# -------------------------------
# CHILD CLASS 1 (INHERITANCE)
# -------------------------------
class Volunteer(User):
def __init__(self, user_id, name, area):
super().__init__(user_id, name)
[Link] = area
# POLYMORPHISM (Method Overriding)
def perform_role(self):
print(f"{[Link]} is helping victims in {[Link]}")

# -------------------------------
# CHILD CLASS 2 (INHERITANCE)
# -------------------------------
class Admin(User):
def __init__(self, user_id, name):
super().__init__(user_id, name)

# POLYMORPHISM
def perform_role(self):
print(f"{[Link]} is verifying disaster reports")

# -------------------------------
# MAIN PROGRAM
# -------------------------------
u1 = User(1, "Ali")
v1 = Volunteer(2, "Ahmed", "Village A")
a1 = Admin(3, "Sara")

# POLYMORPHISM: same method, different behavior


users = [u1, v1, a1]

for user in users:


user.perform_role()
Output:

3. SOLID Principle
Single Responsibility Principle (SRP)

Each class performs a single task:

 User → user operations


 DisasterReport → disaster data
 HelpRequest → requests
 Volunteer → task handling

4. Unique Feature
Real-Time Information Sharing System
This system provides:

 Continuous updates from users


 Instant data reflection on the map
 Live alerts for volunteers

👉 This makes the system more efficient than traditional disaster systems.

CONCLUSION
The system is a scalable, modular, and efficient solution built using OOP principles and Agile
methodology. The integration of real-time data significantly enhances disaster response and
coordination.

“This system leverages crowd intelligence and real-time data sharing to improve
disaster response efficiency and resource allocation.”

You might also like