Skip to content

Latest commit

 

History

History
326 lines (256 loc) · 9.34 KB

File metadata and controls

326 lines (256 loc) · 9.34 KB

Request Form Simplification - Complete

📋 Overview

Successfully simplified the PIN request creation process by removing unnecessary fields and updating service types to be more practical and volunteer-focused.

✅ Changes Implemented

1. Fields Removed ❌

Removed from database and forms:

  • category - Not needed, service_type is sufficient
  • priority - Let volunteers decide what's urgent
  • location_detail - Too specific, region is enough

Why these were removed:

  • Simplified user experience
  • Reduced cognitive load when creating requests
  • Service type alone describes what's needed
  • Volunteers can assess priority themselves

2. Fields Modified ✏️

Renamed:

  • location_cityregion
    • Now accepts Singapore-specific regions
    • Examples: Hougang, Sengkang, Bugis, Clementi, Tampines, Woodlands

Why renamed:

  • More relevant for Singapore context
  • Clearer for local volunteers
  • Matches how people think about locations

3. Fields Kept ✅

Required fields:

  • title - Short description (min 5 characters)
  • description - Detailed explanation (min 10 characters)
  • service_type - NOW REQUIRED (was optional)

Optional fields:

  • region - Where help is needed
  • requested_by_date - When help is needed by
  • image - Photo of the situation

4. Service Types - New Categories 🎯

Replaced generic categories with practical volunteer services:

  1. Companionship Visit - Social interaction, conversation, spending time
  2. Grocery Shopping - Help with grocery shopping, carrying items
  3. Meal Delivery - Deliver prepared meals or food
  4. Transportation - Give rides to appointments, errands
  5. Home Maintenance - Minor repairs, cleaning, household tasks
  6. Technology Help - Phone, computer, internet assistance
  7. Medical Escort - Accompany to doctor visits, medical appointments
  8. Reading/Writing Help - Assistance with letters, forms, bills, documents
  9. Pet Care - Walk dogs, feed pets, basic pet care
  10. Errands - General errands and tasks

Benefits of new service types:

  • ✅ Clear and specific
  • ✅ Easy for volunteers to understand
  • ✅ Actionable categories
  • ✅ Matches real-world volunteer activities
  • ✅ Covers common needs of elderly/vulnerable people

🗄️ Database Changes

SQL Commands to Run in Supabase Dashboard:

-- STEP 1: Remove unnecessary columns
ALTER TABLE requests 
DROP COLUMN IF EXISTS category;

ALTER TABLE requests 
DROP COLUMN IF EXISTS priority;

ALTER TABLE requests 
DROP COLUMN IF EXISTS location_detail;

-- STEP 2: Rename location_city to region
ALTER TABLE requests 
RENAME COLUMN location_city TO region;

-- STEP 3: Drop request_categories table (no longer needed)
DROP TABLE IF EXISTS request_categories CASCADE;

-- STEP 4: Add image_url column (if not already added)
ALTER TABLE requests 
ADD COLUMN IF EXISTS image_url TEXT;

Service Types Updated ✅

Status: Already updated in database

  • Old service types cleared
  • 10 new practical service types added
  • All active and ready to use

💻 Code Changes

Backend Files Modified:

  1. src/entity/request.py

    • Removed PRIORITY_* constants
    • Updated create_request() parameters
    • Removed category validation
    • Removed priority validation
    • Updated to use region instead of location_city
    • Made service_type required (not optional)
  2. src/controller/request/create_pin_new_request.py

    • Removed category validation
    • Removed priority field handling
    • Removed location_detail handling
    • Made service_type required
    • Updated to use region
    • Updated API documentation

Frontend Files Modified:

  1. src/app/pin/request/new/page.js (Create Request Form)

    • Removed category state
    • Removed priority state
    • Removed location_detail state
    • Added region state
    • Removed categories fetch
    • Updated form fields
    • Made service_type required with *
    • Simplified two-column layout
  2. src/app/pin/request/[id]/page.js (Request Detail View)

    • Removed category display
    • Removed priority display
    • Removed location_detail display
    • Added region display
    • Updated column layout (now 2 columns instead of complex grid)

📱 User Experience Changes

Before (Complex):

Title: *
Description: *
Category: * (8 options)
Service Type: (6 options)
Priority: (LOW, MEDIUM, HIGH, URGENT)
Location (City):
Location Details:
Requested By Date:

After (Simplified):

Title: *
Description: *
Service Type: * (10 practical options)
Region: (e.g., Hougang, Sengkang)
Requested By Date:
Image: (optional)

Reduction: 8 fields → 5 fields (37.5% fewer fields!)

🧪 Testing

Test the Updated Form:

  1. Start servers (already running):

  2. Login as PIN user:

    • Email: pin_user1@test.com
    • Password: password123
  3. Create a new request:

    • Title: "Need help with groceries"
    • Description: "I have difficulty carrying heavy items"
    • Service Type: Select "Grocery Shopping"
    • Region: Type "Hougang"
    • Requested By: Select a future date
    • Image: Upload a photo (optional)
    • Submit
  4. Verify:

    • Request created successfully
    • Shows service type clearly
    • Region displayed correctly
    • No category/priority fields

📊 API Changes

POST /api/requests

Old Request Body:

{
  "title": "Need help",
  "description": "...",
  "category": "Food",           ❌ REMOVED
  "service_type": "Delivery",   ✅ NOW REQUIRED
  "priority": "HIGH",            ❌ REMOVED
  "location_city": "Bangkok",    ❌ RENAMED
  "location_detail": "123...",   ❌ REMOVED
  "requested_by_date": "...",
  "image": "..."
}

New Request Body:

{
  "title": "Need help with groceries",
  "description": "I have difficulty carrying heavy items",
  "service_type": "Grocery Shopping",  ✅ REQUIRED
  "region": "Hougang",                  ✅ RENAMED
  "requested_by_date": "2025-12-31",
  "image": "data:image/jpeg;base64..."  (optional)
}

Response Format:

{
  "success": true,
  "data": {
    "id": 1,
    "pin_user_id": 39,
    "title": "Need help with groceries",
    "description": "I have difficulty carrying heavy items",
    "service_type": "Grocery Shopping",
    "region": "Hougang",
    "requested_by_date": "2025-12-31",
    "image_url": "/static/uploads/requests/...",
    "status": "ACTIVE",
    "created_at": "2025-11-06T14:30:00",
    "updated_at": "2025-11-06T14:30:00"
  },
  "message": "Request created successfully"
}

🎯 Benefits

For PIN Users:

  • ✅ Faster request creation (fewer fields)
  • ✅ Less confusing (no redundant fields)
  • ✅ Clear service types (know exactly what to pick)
  • ✅ Simpler decisions (no priority judgments)

For CSR Volunteers:

  • ✅ Clearer understanding of what's needed
  • ✅ Better service type categories
  • ✅ Can assess priority themselves
  • ✅ Region-based filtering easier

For Development:

  • ✅ Simpler database schema
  • ✅ Less validation logic
  • ✅ Easier to maintain
  • ✅ Better data quality (required service type)

🚀 Next Steps

Immediate (After DB Migration):

  1. Run SQL commands in Supabase Dashboard
  2. Test request creation thoroughly
  3. Verify old requests still display correctly
  4. Test CSR browse functionality

Future Enhancements:

  1. Region Dropdown: Convert region to dropdown with Singapore neighborhoods
  2. Service Type Icons: Add icons to service types for visual clarity
  3. Quick Templates: Pre-filled forms for common requests
  4. Request History: Show what service types are most common

📝 Files Created/Modified

New Files:

  • update_request_schema.py - Database migration script
  • update_service_types.py - Service types update script ✅ RAN
  • REQUEST_SIMPLIFICATION_COMPLETE.md - This document

Modified Files:

  • src/entity/request.py
  • src/controller/request/create_pin_new_request.py
  • src/app/pin/request/new/page.js
  • src/app/pin/request/[id]/page.js

Database:

  • Service types updated ✅ (10 new categories added)
  • Schema needs migration ⏳ (run SQL commands)

⚠️ Important Notes

  1. Backward Compatibility: Old requests with category/priority will still exist in database until you run the SQL migration. They won't break anything but won't display those fields.

  2. Data Loss: Running the SQL commands will permanently delete:

    • category column and all its data
    • priority column and all its data
    • location_detail column and all its data
    • request_categories table
  3. Irreversible: Make sure you're okay with losing this data before running the SQL.

  4. Service Type Now Required: Users MUST select a service type. This is good for data quality.

✨ Summary

Successfully simplified the request creation process from 8 fields to 5 fields, making it faster and less confusing for PIN users while maintaining all essential information. Service types are now practical, actionable categories that volunteers can easily understand and respond to.

Status:

  • ✅ Code updated and deployed
  • ✅ Service types updated in database
  • Awaiting SQL migration (run commands in Supabase Dashboard)

Date: November 6, 2025
Implemented By: GitHub Copilot
Requested By: Project Team
Impact: High - Major UX improvement