This document explains how the appointment system works in Sauti, from the moment a survivor creates a report to scheduling and managing appointments with professionals.
The Sauti appointment system creates a seamless flow connecting survivors who need help with professionals who can provide support. The system includes automated matching, professional scheduling, and comprehensive appointment management.
What happens when a survivor creates a report:
-
Survivor fills out abuse report through the authenticated report form
- Incident details, urgency level, required services
- Contact preferences and consent information
- Location data (if consent given)
-
Report is saved to database with status
pending- Assigned unique
report_id - Marked as
ismatched: false - Status set to
match_status: pending
- Assigned unique
-
Automatic service matching begins
- System runs matching algorithm (
matchReportWithServices()) - Finds professionals with relevant support services
- Creates entries in
matched_servicestable
- System runs matching algorithm (
How the system connects survivors with professionals:
Report Created → Matching Algorithm → Matched Services → Professional Notifications
-
Algorithm analyzes report:
- Incident type (domestic_violence, sexual_assault, etc.)
- Required services (counseling, legal_aid, medical, etc.)
- Location/proximity (if location sharing enabled)
- Urgency level (high, medium, low)
-
Finds compatible professionals:
- Professionals with matching
service_types - Active support services in the database
- Geographic proximity (if applicable)
- Professionals with matching
-
Creates match records:
INSERT INTO matched_services ( report_id, service_id, match_status_type: 'pending', match_score )
-
Professionals receive notifications about potential matches
How professionals evaluate and respond to matches:
-
Professional views match in dashboard:
- Cases Tab shows pending matches
- Can see anonymized report details
- Incident description and required services
- Urgency indicators and match score
-
Professional must take action to accept:
- ⚡ "Meet Now" (Accept & Start): Immediately creates a confirmed appointment and opens the chat.
- 📅 "Schedule for Later" (Accept & Pick Time): Professional selects a future date/time via the scheduler.
- ❌ Decline: Not able to help (with optional reason).
-
When professional accepts:
- Crucial Rule: Acceptance is only finalized once an appointment is created.
- Match status changes to
accepted. - Privacy Unlock: Full survivor details (Name, Contact, History) are revealed. Prior to this, details are masked for survivor protection.
- Report marked as
ismatched: true.
Three ways appointments can be created:
- Professional clicks "Begin Support"
- Acceptance Choice Dialog opens:
- "Meet Now": Creates an immediate session (60 mins) for right now.
- "Schedule Later": Opens the enhanced scheduler.
- Appointment is created automatically as part of acceptance:
INSERT INTO appointments ( professional_id, survivor_id, matched_services, appointment_date, appointment_type, duration_minutes, status: 'confirmed', created_via: 'meet_now' | 'scheduled_acceptance' )
-
Professional shares public booking link:
/schedule/sauti-{professional-id} -
Anyone can visit and book directly:
- Professional profile and services shown
- Available time slots displayed
- Client information form
- Emergency contact collection
- Session type selection
-
Creates appointment with status
requested:- Professional must confirm before it's finalized
- Email notifications sent to both parties
- Professional sets up Cal.com link in settings
- Cal.com embedded in Scheduling tab
- Clients book through professional Cal.com system
- Appointments sync back to Sauti system
How appointments are managed once scheduled:
- View appointments in Dashboard → Appointments tab
- See appointment details: date, time, professional info
- Add to calendar: Google Calendar, Outlook, Yahoo, ICS download
- Send messages via integrated chat
- View appointment status: confirmed, requested, completed, cancelled
- View all appointments in Dashboard → Appointments tab
- Manage appointment details:
- Update status (confirm, complete, cancel, reschedule)
- Add professional notes (private, for record keeping)
- View survivor contact information
- Access related report details
- Calendar integration:
- Sync with Google Calendar automatically
- Add to any calendar provider
- Download ICS files
- Communication:
- Chat directly with survivor
- Call if phone number provided
Seamless calendar synchronization:
-
User connects Google Calendar:
- OAuth 2.0 authentication flow
- Secure token storage in database
- Automatic token refresh handling
-
Appointment calendar events:
- Automatically created in Google Calendar
- Include all relevant details
- Set appropriate reminders
- Update when appointment changes
- Multi-provider support: Google, Outlook, Yahoo, Apple
- ICS file generation for offline calendar apps
- Automatic sync when appointments change
- Smart conflict detection
- Timezone handling
How reports and appointments work together:
- Enhanced report cards show appointment status
- Visual indicators for appointment scheduling
- Direct links to related appointments
- Status tracking: shows appointment progress
Report Created → Matched → Accepted & Scheduled → Session Completed → Dual Completion Confirm → Archived
- Pending Match: Professionals see only Gender, Age Category, and Incident Type.
- Accepted Match: Full contact details and incident story are unlocked.
- A case is only fully "Closed" (Archived) when both the Professional and Survivor mark it as complete.
- If the Professional completes it first, they are immediately boosted in the matching algorithm for new cases, even while waiting for the survivor's final confirmation.
- Availability checking prevents double-booking
- Business hours enforcement (9 AM - 5 PM, weekdays)
- Duration-based scheduling (30-120 minute sessions)
- Conflict detection across all booking methods
- Internal dashboard for matched cases
- Public booking pages for direct scheduling
- Cal.com integration for professional workflows
- Mobile-responsive design for all interfaces
- Built-in chat system for secure messaging
- Email notifications for appointment updates
- Calendar reminders through Google Calendar
- Phone contact when provided
- Comprehensive dashboard for appointment management
- Professional notes for case documentation
- Status management with workflow controls
- Calendar synchronization with external systems
- Row-level security for data protection
- Secure authentication for all operations
- Encrypted token storage for calendar integration
- Privacy-compliant data handling
-- Key relationships
reports → matched_services → appointments
profiles (professional/survivor) → appointments
appointments → google_calendar_eventsPOST /api/appointments- Create appointment from matchPOST /api/appointments/public- Public booking creationPOST /api/calendar/create-event- Google Calendar integrationGET /api/auth/google-calendar/callback- OAuth handling
- Live appointment updates via Supabase subscriptions
- Automatic status synchronization
- Real-time availability checking
- Instant notification delivery
- Simple reporting process with clear forms
- Automatic matching - no additional action needed
- Easy appointment booking with multiple options
- Clear appointment management with calendar integration
- Secure communication with professionals
- Efficient match review with relevant information
- Flexible scheduling options for different workflows
- Comprehensive appointment management
- Professional notes for case tracking
- Calendar integration with existing systems
- Create a report describing your situation
- Wait for professional matches (usually within 24 hours)
- Professional will contact you to schedule appointment
- Use appointment management tools to track sessions
- Set up your support services in the dashboard
- Review incoming matches in the Cases tab
- Accept matches you can help with
- Schedule appointments using your preferred method
- Manage ongoing appointments and case notes
- Configure your availability preferences
- Connect Google Calendar for sync (optional)
- Set up Cal.com integration (optional)
- Share your public booking link with clients
- Customize appointment types and durations
- High-priority matching for urgent cases
- Emergency contact collection during booking
- Crisis intervention appointment types
- 24/7 availability options for critical cases
- Complete case history from report to resolution
- Professional notes for session tracking
- Follow-up scheduling for ongoing support
- Multi-session appointment management
Planned Features:
- SMS notifications for appointment reminders
- Video call integration (Zoom, Google Meet)
- Recurring appointment scheduling
- Advanced analytics for case outcomes
- Multi-language support for diverse communities
- Mobile app for enhanced accessibility
The Sauti appointment system creates a comprehensive support ecosystem that seamlessly connects survivors with professional help, ensuring no one falls through the cracks and everyone gets the support they need. 💙