Database Schema & Structure

Visual representation of the WootHealth database collections and their structure

📦 Users Database

Database ID: users — Contains all user-related collections

👤 users
  • userId string (ID) Unique Appwrite user ID
  • email string User email address
  • firstName string First name
  • lastName string Last name
  • phone string Phone number
  • createdAt string (datetime) Account creation timestamp
Sample Document
{
  "$id": "user_123",
  "userId": "auth_user_123",
  "email": "quadri@example.com",
  "firstName": "Quadri",
  "lastName": "Adekunle",
  "phone": "+234800000000",
  "createdAt": "2025-12-23 10:30:00"
}
📋 plans
  • userId string Owner of the plan
  • name string Plan name (e.g., Retail Quantum Plan)
  • monthlyPremium number Monthly premium in Naira
  • coveredMembers number Number of family members covered
  • nextRenewal string (date) Plan renewal date
  • planType string Coverage type (Individual/Family)
  • hmoId string HMO identifier
Sample Document
{
  "$id": "plan_456",
  "userId": "user_123",
  "name": "Retail Quantum Plan",
  "monthlyPremium": 34100,
  "coveredMembers": 4,
  "nextRenewal": "2025-01-10",
  "planType": "Family Coverage",
  "hmoId": "111076"
}
🏥 benefits
  • userId string User who has this benefit
  • planId string Associated plan ID
  • title string Benefit name (e.g., Hospital Care)
  • annualLimit number Annual coverage limit
  • used number Amount already used
Sample Document
{
  "$id": "benefit_789",
  "userId": "user_123",
  "planId": "plan_456",
  "title": "Hospital Care",
  "annualLimit": 5000000,
  "used": 450000
}
👥 enrollees
  • userId string Primary enrollee
  • dependentName string Name of dependent
  • relationship string Relationship (Spouse/Child/Parent)
  • dateOfBirth string (date) DOB of dependent
  • enrollmentStatus string Active/Pending/Inactive
Sample Document
{
  "$id": "enrollee_001",
  "userId": "user_123",
  "dependentName": "Jane Adekunle",
  "relationship": "Spouse",
  "dateOfBirth": "1985-06-15",
  "enrollmentStatus": "Active"
}
🏢 clients
  • companyName string Organization name
  • contactEmail string Company contact email
  • contactPhone string Contact phone number
  • employees number Number of employees covered
  • status string Active/Inactive
Sample Document
{
  "$id": "client_001",
  "companyName": "TechCorp Nigeria",
  "contactEmail": "hr@techcorp.ng",
  "contactPhone": "+234123456789",
  "employees": 250,
  "status": "Active"
}
💰 finance
  • userId string User associated with transaction
  • transactionType string Premium/Refund/Claim
  • amount number Transaction amount
  • transactionDate string (datetime) When transaction occurred
  • status string Pending/Completed/Failed
Sample Document
{
  "$id": "fin_001",
  "userId": "user_123",
  "transactionType": "Premium",
  "amount": 34100,
  "transactionDate": "2025-12-23 10:00:00",
  "status": "Completed"
}
🏥 providers
  • name string Provider name
  • specialization string Medical specialty
  • address string Facility address
  • phone string Contact number
  • status string Active/Inactive
📝 claims
  • userId string Claimant user ID
  • claimAmount number Claim amount requested
  • status string Submitted/Approved/Rejected
  • dateSubmitted string (date) Submission date
  • notes string Additional notes
💬 feedback
  • userId string User providing feedback
  • subject string Feedback topic
  • message string Feedback message
  • rating number (1-5) Satisfaction rating
  • submittedAt string (datetime) Submission timestamp
📅 appointments
  • appointmentId string (ID) Unique appointment identifier
  • patientId string Patient user ID
  • doctorId string Doctor user ID
  • scheduledAt datetime Appointment date and time
  • status enum pending/confirmed/cancelled/completed
  • roomId string 🔥 Auto-generated as 'room-{appointmentId}'
  • symptoms string Patient symptoms
Sample Document
{
  "$id": "appt_123",
  "appointmentId": "appt_123",
  "patientId": "user_456",
  "doctorId": "doctor_789",
  "scheduledAt": "2026-02-10T10:00:00Z",
  "status": "confirmed",
  "roomId": "room-appt_123",
  "symptoms": "Headache and fever"
}
💳 wallet
  • userId string Wallet owner user ID
  • balance float Current wallet balance (Naira)
  • hasActiveCard boolean Has saved payment card
  • lastUpdated datetime Last transaction timestamp
  • currency string Currency code (NGN)
Sample Document
{
  "$id": "wallet_001",
  "userId": "user_123",
  "balance": 25000.00,
  "hasActiveCard": true,
  "lastUpdated": "2026-02-06T08:30:00Z",
  "currency": "NGN"
}
💸 transactions
  • walletId string Associated wallet ID
  • userId string User ID
  • amount float Transaction amount
  • type enum credit/debit
  • title string Transaction title
  • subtitle string Transaction description
  • status enum pending/success/failed
  • reference string Unique transaction reference
Sample Document
{
  "$id": "txn_456",
  "walletId": "wallet_001",
  "userId": "user_123",
  "amount": 5000.00,
  "type": "credit",
  "title": "Wallet Top-up",
  "subtitle": "Payment successful",
  "status": "success",
  "reference": "TOPUP_user_123_1234567890"
}
📋 activeplans
  • userId string User with active plan
  • planId string Reference to plan
  • planType string Individual/Family/Corporate
  • startDate datetime Plan activation date
  • endDate datetime Plan expiry date
  • status enum active/expired/cancelled
  • autoRenew boolean Auto-renewal enabled
  • purchasedBy string Provider ID if company-purchased
Sample Document
{
  "$id": "active_plan_789",
  "userId": "user_123",
  "planId": "plan_456",
  "planType": "Family",
  "startDate": "2026-01-01T00:00:00Z",
  "endDate": "2026-12-31T23:59:59Z",
  "status": "active",
  "autoRenew": true,
  "purchasedBy": ""
}
📞 call_logs
  • appointmentId string Associated appointment
  • roomId string LiveKit room ID
  • patientId string Patient user ID
  • doctorId string Doctor user ID
  • startTime datetime Call start timestamp
  • endTime datetime Call end timestamp
  • duration integer Call duration in seconds
  • status enum completed/missed/cancelled
Sample Document
{
  "$id": "call_log_001",
  "appointmentId": "appt_123",
  "roomId": "room-appt_123",
  "patientId": "user_456",
  "doctorId": "doctor_789",
  "startTime": "2026-02-10T10:00:00Z",
  "endTime": "2026-02-10T10:25:00Z",
  "duration": 1500,
  "status": "completed"
}

Additional Collections

The following collections are also available in the Users database and follow similar patterns with userId references:

📋 tickets
Support/issue tickets
👔 employees
Employee records
💵 reimbursement
Reimbursement requests
✅ validations
Data validation rules
🔐 pa_codes
Prior Authorization codes
🏥 telemedicine_requests
Virtual consultation requests

📦 Providers Database

Database ID: providers — Separate database for provider management

🏥 providers
  • name string Provider/facility name
  • specialization string Medical specialty
  • address string Complete address
  • phone string Contact phone
  • email string Email address
  • latitude number Location latitude
  • longitude number Location longitude
Sample Document
{
  "$id": "provider_456",
  "name": "Ikeja Medical Center",
  "specialization": "General Hospital",
  "address": "123 Kodesho St, Ikeja",
  "phone": "+234700000000",
  "email": "info@ikejamedical.com",
  "latitude": 6.5833,
  "longitude": 3.3500
}

Data Model Relationships

Key Relationships:

  • 🔗 users has many plans (one-to-many via userId)
  • 🔗 plans has many benefits (one-to-many via planId)
  • 🔗 users has many enrollees (dependents via userId)
  • 🔗 users has many claims, feedback, tickets, etc.
  • 🔗 providers database is independent (separate from users database)

API Endpoint to Collection Mapping

Endpoint Database Collection
/plans users plans + benefits
/admin/overview users users, enrollees, clients, telemedicine_requests
/admin/users users users
/admin/enrollees users enrollees
/admin/clients users clients
/admin/benefits users benefits
/admin/finance users finance
/admin/providers providers providers
/admin/claims users claims
/providers providers providers (all collections)
/appointments users appointments
/wallet users wallet, transactions
/claims main claims
/plans main, users plans, activeplans