What the data for this category looks like
Bus transit ledger data originates from on-board GPS terminals, IC card settlement systems, depot scheduling equipment, and passenger flow statistics terminals. The data update cycle is batch synchronization every 5 to 10 minutes. Multiple batches of detailed records can be generated per day. Each ledger entry includes fields such as route number, vehicle identification code, departure time, arrival time, passenger trips, driving mileage, and energy consumption value. Their units are: route number (no unit), string (vehicle ID), datetime format time, integer (trips), kilometers, kilowatt-hours, or liters. Some data must support custom field formats from different vendor devices. The overall document structure combines structured and time-series elements.
What constraints do these characteristics impose on the database and operations link
Multi-source heterogeneous data sources require the database to support multi-format data access and field mapping to avoid format conflicts during import. The high-frequency batch synchronization update rhythm generates a large number of connection requests in a short period. Reasonably configure the connection pool capacity to prevent resource exhaustion. Time-series ledger data requires indexes for commonly queried fields such as departure time and route number to support subsequent report aggregation calculations. Long-term retained ledger data must support hot and cold data separation storage to reduce storage costs and query latency for high-frequency queries. Report generation relies on rapid retrieval of historical data, so the database's read and write performance must match peak business requirements.
How to configure settings
| Configuration Item | Recommended Setting | Rationale |
|---|---|---|
MONGODB_URI | mongodb://fastgpt:****@db-host:27017/bus_report?replicaSet=rs0&authSource=admin | Adapts to multi-source heterogeneous bus ledger storage; replica set configuration ensures data high availability |
PG_URL | postgresql://fastgpt:****@db-host:5432/bus_meta?sslmode=require | Stores report metadata, aggregation rules, and historical report records; supports complex associated queries |
DB_MAX_LINK | 25–35 connections | Matches the peak batch synchronization every 5-10 minutes, prevents import failures caused by connection pool exhaustion |
REDIS_URL | redis://:****@cache-host:6379/0 | Caches high-frequency queried route passenger flow aggregation data, reduces repeated calculation load on the database |
| Composite index configuration | Create a composite index for the departure time and route number fields | Supports aggregation calculations by time range and route dimension during report generation |
Reference only; verify against the target FastGPT release and deployment documentation.
Three common misconfigurations
- Phenomenon: An error "field mismatch" is prompted when importing bus ledger Excel files. Cause: Field names exported by different vendor devices are not unified, causing the system to fail to automatically map to preset fields.
- Phenomenon: MongoDB returns a "connection timed out" error during batch synchronization. Cause: The
DB_MAX_LINKsetting value is lower than the number of connection requests during peak hours, and the connection pool is exhausted and cannot create new connections. - Phenomenon: The number of report data entries does not match the source data. Cause: No index is created for the departure time field, and the aggregate query scans the full table, causing some data to not be read correctly.
How to confirm the configuration is correct
- Run the database connection test script to verify that
MONGODB_URIandPG_URLcan read and write data normally. - View the real-time connection count of the database connection pool, and confirm that the connection count during peak hours does not exceed the
DB_MAX_LINKsetting value. - Generate a single-route report for the past 7 days, and verify the field completeness of the generated results against the source data.
- Check the Redis cache update log to confirm that the refresh frequency of high-frequency aggregate data meets business requirements.
The configuration values provided are common starting points and should be evaluated against the reader's own samples.
Question material comes from public community discussions. Configuration values are common starting points and should be measured against your own samples. Verified on 2026-09-28.