Skip to content

xfraga/homeless-report

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

# Homeless Report System

A web application for reporting and tracking homeless individuals to help connect them with support services. This system allows community members to submit reports with location data, health status, and urgency level, making it easier for social services to respond effectively.

## πŸ“‹ Project Overview

The Homeless Report System consists of:
- **Frontend**: A user-friendly web interface for submitting and viewing reports
- **Backend**: A RESTful API server for managing report data
- **In-memory storage**: Simple data persistence (can be upgraded to a database)

## πŸš€ Features

- βœ… Submit reports with location, GPS coordinates, health status, and urgency level
- βœ… Automatic geolocation support using browser GPS
- βœ… Real-time report viewing with color-coded urgency levels
- βœ… Responsive design for mobile and desktop
- βœ… RESTful API for report management
- βœ… Filter reports by urgency and status
- βœ… Statistics dashboard

## πŸ“ Project Structure

```
homeless-report/
β”œβ”€β”€ backend/
β”‚   └── server.js          # Express.js API server
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ index.html         # Main HTML page
β”‚   β”œβ”€β”€ style.css          # Styling
β”‚   └── main.js            # Frontend JavaScript logic
└── README.md              # This file
```

## πŸ› οΈ Installation

### Prerequisites

- Node.js (v14 or higher)
- npm (Node Package Manager)

### Backend Setup

1. Navigate to the backend directory:
   ```bash
   cd backend
   ```

2. Install dependencies:
   ```bash
   npm install express cors
   ```

3. Start the backend server:
   ```bash
   node server.js
   ```

   The server will start on `http://localhost:3000`

### Frontend Setup

1. Navigate to the frontend directory:
   ```bash
   cd frontend
   ```

2. Serve the frontend using any HTTP server. Options include:

   **Option 1: Using Python**
   ```bash
   # Python 3
   python -m http.server 8080
   
   # Python 2
   python -m SimpleHTTPServer 8080
   ```

   **Option 2: Using Node.js http-server**
   ```bash
   npx http-server -p 8080
   ```

   **Option 3: Using VS Code Live Server extension**
   - Install the "Live Server" extension in VS Code
   - Right-click on `index.html` and select "Open with Live Server"

3. Open your browser and navigate to:
   ```
   http://localhost:8080
   ```

## πŸ“– API Documentation

### Base URL
```
http://localhost:3000/api
```

### Endpoints

#### Health Check
```http
GET /api/health
```
Returns server health status and total report count.

#### Get All Reports
```http
GET /api/reports
```
Query Parameters:
- `urgency` (optional): Filter by urgency level (high, medium, low)
- `status` (optional): Filter by health status
- `limit` (optional): Limit number of results

#### Get Single Report
```http
GET /api/reports/:id
```
Returns a specific report by ID.

#### Create Report
```http
POST /api/reports
```
Request Body:
```json
{
  "location": "123 Main St, City",
  "latitude": "40.7128",
  "longitude": "-74.0060",
  "status": "minor_concern",
  "urgency": "medium",
  "description": "Person appears to need medical attention",
  "reporterName": "John Doe",
  "reporterContact": "[email protected]"
}
```

#### Update Report
```http
PUT /api/reports/:id
```
Request body: Same as POST

#### Delete Report
```http
DELETE /api/reports/:id
```
Deletes a specific report.

#### Get Statistics
```http
GET /api/stats
```
Returns aggregated statistics about all reports.

## 🎨 Usage

### Submitting a Report

1. Fill out the form with:
   - Location or address
   - GPS coordinates (or click "Get Current Location")
   - Health status
   - Urgency level
   - Additional details
   - Your contact information (optional)

2. Click "Submit Report"

3. The report will appear in the "Recent Reports" section

### Viewing Reports

Reports are displayed with color-coded urgency levels:
- πŸ”΄ **Red**: High urgency - Immediate help required
- 🟑 **Yellow**: Medium urgency - Needs assistance
- 🟒 **Green**: Low urgency - Informational

## πŸ”§ Configuration

### Backend Configuration

Edit `backend/server.js` to change:
- Port number (default: 3000)
- CORS settings
- Data storage (switch to database)

### Frontend Configuration

Edit `frontend/main.js` to change:
- API URL (line 2)
- Form validation rules
- UI behavior

## πŸš€ Deployment

### Backend Deployment

**Heroku:**
```bash
heroku create homeless-report-api
git push heroku main
```

**Other platforms:** Deploy as a standard Node.js application

### Frontend Deployment

**GitHub Pages / Netlify / Vercel:**
- Deploy the `frontend` folder
- Update `API_URL` in `main.js` to point to your deployed backend

## πŸ”’ Security Considerations

⚠️ **Important**: This is a development version with in-memory storage.

For production use:
1. Add authentication and authorization
2. Implement rate limiting
3. Add input validation and sanitization
4. Use a proper database (PostgreSQL, MongoDB)
5. Implement HTTPS
6. Add data encryption for sensitive information
7. Implement logging and monitoring

## 🀝 Contributing

Contributions are welcome! Please:
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Submit a pull request

## πŸ“ Future Enhancements

- [ ] Database integration (PostgreSQL/MongoDB)
- [ ] User authentication system
- [ ] Interactive map view of reports
- [ ] Email notifications to authorities
- [ ] Mobile app (React Native)
- [ ] Admin dashboard
- [ ] Report status updates
- [ ] Photo upload capability
- [ ] Integration with social services APIs

## πŸ“„ License

MIT License - Feel free to use this project for humanitarian purposes.

## πŸ†˜ Support

For issues or questions:
- Open an issue on GitHub
- Contact: [Your contact information]

## πŸ™ Acknowledgments

This project was created to help connect homeless individuals with support services and improve community response efforts.

---

**Remember**: Always approach homeless individuals with respect and dignity. This tool is meant to facilitate help, not surveillance.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published