Drivers, queue and screening
One drivers row per person, from lead to leaving, labelled by stage, with documents, addresses, contacts, platform accounts, notes and trainings as child rows. A queue ticket becomes at most one driver. Each background check is one round with its photos. A pool transfer moves either a driver or a car.
Scroll a wide diagram sideways to see all of it.
The driver record
Section titled “The driver record”Tables from elsewhere appear as names only: lead_sources, pools, profiles, vehicle_models.
erDiagram
drivers {
uuid id PK
uuid pool_id FK
uuid profile_id FK,UK
int legacy_id
text full_name
text phone
citext email
char(16) nik
date birth_date
text birth_place
text education
text occupation
uuid lead_source_id FK
text source_note
uuid referred_by_driver_id FK
ride_platform preferred_platform
uuid preferred_model_id FK
service_tier service_tier
driver_stage stage
timestamptz stage_changed_at
date on_leave_until
date registered_on
}
driver_documents {
uuid id PK
uuid driver_id FK
driver_doc_type doc_type
text doc_number
text storage_path
timestamptz verified_at
date expires_on
}
driver_addresses {
uuid id PK
uuid driver_id FK
address_kind kind
text street
int2 rt
int2 rw
text kelurahan_desa
text kecamatan
text kota_kabupaten
char(5) postal_code
}
driver_emergency_contacts {
uuid id PK
uuid driver_id FK
text full_name
text relationship
text phone
bool is_primary
}
driver_platform_accounts {
uuid id PK
uuid driver_id FK
ride_platform platform
text account_ref
platform_account_status status
timestamptz checked_at
uuid checked_by FK
}
driver_notes {
uuid id PK
uuid driver_id FK
uuid author_id FK
text body
note_source source
}
driver_trainings {
uuid id PK
uuid driver_id FK
training_kind kind
timestamptz scheduled_at
timestamptz attended_at
uuid trainer_id FK
training_result result
text note
}
pools ||--o{ drivers : "pool_id"
profiles |o--o| drivers : "profile_id"
lead_sources ||--o{ drivers : "lead_source_id"
drivers |o--o{ drivers : "referred_by_driver_id"
vehicle_models |o--o{ drivers : "preferred_model_id"
drivers ||--o{ driver_documents : "driver_id"
drivers ||--o{ driver_addresses : "driver_id"
drivers ||--o{ driver_emergency_contacts : "driver_id"
drivers ||--o{ driver_platform_accounts : "driver_id"
drivers ||--o{ driver_notes : "driver_id"
drivers ||--o{ driver_trainings : "driver_id"
The registration queue
Section titled “The registration queue”Tables from elsewhere appear as names only: drivers, lead_sources, pools.
erDiagram
queue_tickets {
uuid id PK
uuid pool_id FK
date queue_date
int2 ticket_no
text full_name
text phone
uuid lead_source_id FK
queue_status status
uuid driver_id FK,UK
uuid created_by FK
}
queue_events {
uuid id PK
uuid ticket_id FK
queue_action action
uuid actor_id FK
text note
timestamptz at
}
pools ||--o{ queue_tickets : "pool_id"
lead_sources |o--o{ queue_tickets : "lead_source_id"
drivers |o--o| queue_tickets : "driver_id"
queue_tickets ||--o{ queue_events : "ticket_id"
Background checks and pool transfers
Section titled “Background checks and pool transfers”Tables from elsewhere appear as names only: drivers, pools, vehicle_models, vehicles.
erDiagram
background_checks {
uuid id PK
uuid driver_id FK
check_kind kind
check_status status
date due_by
uuid surveyor_id FK
text guarantor_name
date scheduled_on
timestamptz decided_at
uuid decided_by FK
uuid recommended_model_id FK
text reject_reason
bool refund_admin_fee
}
background_check_photos {
uuid id PK
uuid check_id FK
check_photo_kind kind
text storage_path
timestamptz uploaded_at
}
pool_transfers {
uuid id PK
transfer_subject subject
uuid vehicle_id FK
uuid driver_id FK
uuid from_pool_id FK
uuid to_pool_id FK
text reason
transfer_status status
uuid requested_by FK
timestamptz requested_at
uuid decided_by FK
timestamptz decided_at
timestamptz completed_at
}
drivers ||--o{ background_checks : "driver_id"
vehicle_models |o--o{ background_checks : "recommended_model_id"
background_checks ||--o{ background_check_photos : "check_id"
vehicles |o--o{ pool_transfers : "vehicle_id"
drivers |o--o{ pool_transfers : "driver_id"
pools ||--o{ pool_transfers : "from_pool_id"
pools ||--o{ pool_transfers : "to_pool_id"