Data model
Trip entities for B2B logistics (b2b-logistics) in crelio-app
Data model
This page covers B2B Collection logistics — b2b-logistics / B2BTrip. It does not document unrelated booking tables or other products outside this trip stack.
Lab feature (b2b_collection)
The product gate is stored on labFeatures as b2b_collection (boolean), keyed by lab via labForId. See Database schema — labFeatures for the table definition and how it fits with logistics tables on that page.
Trip (B2B logistics)
Table: Trip (admin.trip_management.models.core.trip.Trip)
| Column | Notes |
|---|---|
trip_type | B2B_TRIP (2) for B2B Collection logistics |
lab_user | Pickup person (DB column phlebotomist_id) |
lab | Lab |
status | TripStatusEnum — e.g. NOT_STARTED, STARTED, ENDED, CANCELLED |
home_collection | Nullable FK on the shared Trip row; B2B logistics rows leave it NULL and use B2BTrip manager rules (see Trip / B2BTrip in source) |
schedule_group | Recurring / series grouping |
Proxy: B2BTrip — start, end, cancel, queue_distance_calculation_task (Fusion webhook to …/trips/{id}/calculate-distance).
Related: TripLocation — stops on a trip; visiting-person and Firestore trail integrations for field execution.
Routes and locations
Route and location (stop) models live under admin.trip_management and are exposed via routes/… and location/… URL includes for each trip_type (including b2b-logistics). See admin/trip_management/urls/route_urls.py and location_urls.py for the authoritative schema.
For per-table columns, types, indexes, and FKs, see Database schema.
Organization (client context)
admin.organization.models.organization.Organization may carry client-level flags (e.g. paper-only preferences) used by other reports or booking flows—not part of the core B2B Collection trip model above.