Data Import Tools
The Data Import Tools enable bulk importing of customer, ride, and vehicle data from CSV files. This guide covers all import capabilities, file format requirements, and best practices for successful data migration.
Accessing Data Import Tools
Navigate to Admin > Database Tools to access the import interface.
Requirements:
- Admin access to the system
- Properly formatted CSV files
- Data that matches the expected schema
Overview
Available Import Types
| Import Type | Source | Purpose |
|---|---|---|
| Customers | CSV file | Import customer records |
| Rides | CSV file | Import ride history |
| Vehicles | JSON data | Import vehicle fleet |
| IoT Devices | JSON data | Import device inventory |
| Stripe Charges | CSV export | Import payment history |
Import Workflow
Prepare Your Data
Format your data file according to the specifications for each import type.
Upload the File
Use the import interface to upload your file through drag-and-drop or file browser.
Process the Data
The system processes your data synchronously or asynchronously depending on file size.
Verify Results
Use the import statistics and spot-check records to verify successful import.
Customer Import
Accessing Customer Import
In Database Tools, locate the "Customers Import" card and click to access.
CSV Format Requirements
Delimiter: Semicolon (;)
Required Columns:
ID- Unique identifier (becomesoriginal_id)
Supported Columns:
| Column Name | Description | Format |
|---|---|---|
| ID | Unique customer identifier | Text |
| Registration date | When customer signed up | ISO date |
| Name | Full name | Text |
| Email address | Text | |
| Phone country code | Country code | Text (e.g., "+1") |
| Phone number | Phone number | Text |
| Phone number is verified? | Verification status | TRUE/FALSE |
| Business account | Business account flag | TRUE/FALSE |
| Document ID | Document identifier | Text |
| Group ID | Customer group ID | Text |
| Subscribed for emails | Email opt-in | TRUE/FALSE |
| Language | Preferred language | Text (e.g., "en") |
| Device OS | Mobile device OS | Text |
| Device OS version | OS version | Text |
| App version | App version used | Text |
| Credit card saved? | Card on file flag | TRUE/FALSE |
| Wallet (USD) | Wallet balance | Decimal |
| Bonus (USD) | Bonus balance | Decimal |
| Balance (USD) | Total balance | Decimal |
| Debt (USD) | Outstanding debt | Decimal |
| Total rides | Ride count | Integer |
| Last ride | Last ride date | ISO date |
| Avg. feedback | Average rating | Decimal |
| Blocked | Is blocked | TRUE/FALSE |
Import Process
Small Files (< 4 MB):
- Click "Select File" or drag-and-drop
- Click "Import"
- Processing happens synchronously
- Results display immediately
Large Files (4+ MB):
- Upload initiates batch processing
- File is split into 500-row batches
- Progress tracked via import jobs
- Notification when complete
Import Results
After import completes, you'll see:
- Processed: Total rows read from file
- Imported: New records created
- Updated: Existing records updated
- Errors: Rows that failed to import
Error Details: First 10 errors shown with:
- Row number
- Customer ID (if available)
- Error message
Rides Import
Accessing Rides Import
In Database Tools, locate the "Rides Import" card and click to access.
CSV Format Requirements
Delimiter: Semicolon (;)
Key Columns:
| Column Name | Description | Format |
|---|---|---|
| ID | Unique ride identifier | Text |
| Subaccount | Subaccount name | Text |
| Start date | Ride start time | ISO datetime |
| End date | Ride end time | ISO datetime |
| Ride duration | Duration in minutes | Decimal |
| Pause duration | Pause time in minutes | Decimal |
| Ride distance (km) | Distance traveled | Decimal |
| Vehicle model ID | Model identifier | Text |
| Vehicle ID | Vehicle identifier | Text |
| Total cost (USD) | Ride cost | Decimal |
| User ID | Customer identifier | Text |
| User name | Customer name | Text |
| User email | Customer email | Text |
| Feedback | Rating given | Integer (1-5) |
| Comment | Customer comment | Text |
Additional Columns (50+ total):
- Zone IDs (parking, paid, no-parking, bonus, speed-limit, no-go)
- Location coordinates (start/end positions)
- Subscription details
- Pricing package info
- Dynamic pricing data
Import Behavior
The rides import automatically:
- Creates missing customers (if User ID provided)
- Creates missing vehicles (if Vehicle ID provided)
- Links rides to existing customers and vehicles
- Handles duplicate rides via upsert on ride ID
Import Results
After import:
- Check total counts in Database Statistics
- Verify customer and vehicle creation
- Review any error messages
Vehicle Import
Format
Vehicle import uses JSON format (not CSV):
[
{
"vehicle_number": "VH-001",
"iot_imei": "123456789012345",
"vin": "1HGBH41JXMN109186",
"vehicle_model": "Scooter Pro"
},
{
"vehicle_number": "VH-002",
"iot_imei": "123456789012346"
}
]
Required Fields
vehicle_number- Required - Unique identifier for the vehicle
Optional Fields
iot_imei- IoT device IMEI numbervin- Vehicle Identification Numbervehicle_model- Model name or ID- Additional fields as needed
Import Result
Returns per-vehicle results:
- Success or failure status
- Error message for failed rows
- Automatic linking to IoT devices by IMEI
IoT Device Import
Format
IoT device import uses JSON format:
[
{
"imei": "123456789012345",
"device_type": "Tracker",
"firmware_version": "2.1.0"
}
]
Required Fields
imei- Required - Device IMEI number
Linking to Vehicles
After import, devices can be linked to vehicles:
- Manually via vehicle edit
- Automatically if vehicle has matching IMEI
- Via PUT request to the API
Import Job Tracking
How Jobs Work
For large files and background imports:
- Job Created: System creates an
import_jobsrecord - Status: Processing: File is being parsed and imported
- Progress Updates: Rows processed count increases
- Completion: Status changes to
completedorcompleted_with_errors
Job Statuses
| Status | Description |
|---|---|
pending | Job created, waiting to start |
processing | Currently importing data |
completed | All rows imported successfully |
completed_with_errors | Import finished with some errors |
failed | Critical error stopped import |
Viewing Active Jobs
On the Stripe Import page, active jobs display with:
- Progress bar (processed/total rows)
- Status indicator
- Imported/Updated/Skipped/Error counts
- Start time and file name
Job Polling
The system polls every 2 seconds for job updates while you're on the import page.
Error Handling
Common Errors
| Error | Cause | Solution |
|---|---|---|
| "Duplicate ID" | Record already exists | Check for duplicates in source |
| "Invalid date format" | Date not in ISO format | Use YYYY-MM-DD or full ISO |
| "Required field missing" | Missing mandatory column | Add missing column to CSV |
| "Invalid number" | Non-numeric in number field | Fix data formatting |
Error Limits
- Processing stops after 100 consecutive errors
- First 10 error details shown in UI
- Full error log available in import job record
Handling Partial Imports
If import stops partway:
- Note the last successful row
- Fix errors in remaining rows
- Re-import only the remaining data
- Or clear and re-import everything
File Size Guidelines
| File Size | Processing Method | Timeout |
|---|---|---|
| < 4 MB | Synchronous | 60 seconds |
| 4-10 MB | Background batch | 300 seconds |
| 10+ MB | Streaming batch | 300 seconds |
Large File Tips
- Split very large files: Break into chunks of 50,000 rows
- Test first: Import a small sample before full import
- Off-peak hours: Run large imports during low-traffic periods
- Monitor progress: Watch the job status for issues
Large Import Strategy
For imports exceeding 100,000 records, consider breaking into multiple sessions with verification steps between each batch. This makes it easier to identify and resolve issues.
Staging Tables
How Staging Works
- CSV data loads into a staging table (e.g.,
users_import) - RPC function transforms and validates data
- Valid records upserted into main table
- Staging table cleared (or retained for audit)
Staging Tables
| Main Table | Staging Table |
|---|---|
| customers | users_import |
| rides | rides_import |
| vehicles | vehicles_import |
| stripe_charges | stripe_charges_import |
Best Practices
Before Import
- Backup existing data: Export current data first
- Validate CSV format: Check delimiter, encoding, headers
- Test with sample: Import 10-20 rows first
- Note current counts: Record statistics for comparison
During Import
- Don't navigate away: Stay on page for sync imports
- Monitor progress: Watch job status for large imports
- Note any errors: Screenshot or record error messages
After Import
- Verify counts: Check Database Statistics
- Spot check records: Review a few imported records
- Test functionality: Ensure imported data works correctly
- Document the import: Record what was imported and when
Data Transformation
Automatic Transformations
During import, data is automatically:
- Trimmed of whitespace
- Empty strings converted to NULL
- Dates parsed to timestamps
- Numbers parsed from strings
- Boolean strings (TRUE/FALSE/Yes/No) converted
Manual Preparation
Before import, ensure:
- No extra header rows
- Consistent date formats
- Valid email formats
- Phone numbers formatted consistently
- No special characters in IDs
Troubleshooting
File Upload Fails
Possible Causes:
- File too large
- Wrong file type
- Network timeout
Solutions:
- Reduce file size
- Ensure .csv extension
- Check network connection
Import Completes but No New Records
Possible Causes:
- All records already exist
- ID column maps to existing records
- Upsert updated instead of inserted
Solutions:
- Check for updates (not just inserts)
- Verify ID column values
- Review import statistics carefully
Many Records Failing
Possible Causes:
- Wrong delimiter (comma vs semicolon)
- Column name mismatch
- Data format issues
Solutions:
- Verify semicolon delimiter
- Check column headers exactly match
- Validate data formats
Delimiter Check
Levy Fleets imports use semicolon (;) as the delimiter, not comma. If you're exporting from Excel, make sure to save as "CSV UTF-8 (Semicolon delimited)" or convert your file before uploading.
What's Next?
- Super Admin Features - Learn about platform administration
- Stripe Data Sync - Import payment data from Stripe
- Quick Start Guide - Get started with fleet management
Import Complete
After successfully importing your data, verify everything is working correctly by spot-checking records and testing core functionality like ride creation and customer lookup.