BookingRoomsReportTask
The BookingRoomsReportTask aggregates daily room data to the reservation level, producing one row per booking with summed revenues and nights.
Overview
This report provides reservation-level analysis by:
- Summing all nightly charges to booking totals
- Adding first/last booking flags
- Joining guest loyalty information
- Providing booking-level KPIs
Data Structure
Granularity
One row represents: A single reservation/booking
Example:
- Guest books room 101 from Jan 1-3 (2 nights)
- Daily report has 2 rows
- Booking report has 1 row with totals
Aggregated Metrics
Revenue Totals
total_room_rate_net- Sum of all room revenuetotal_room_fnb_net- Sum of all F&B revenuetotal_room_other_net- Sum of all other revenuetotal_room_net- Sum of all revenuetotal_room_listing_rate_net- Sum of listing rates (net)total_room_listing_rate_gross- Sum of listing rates (gross)
Guest Counts
room_guests_adults- Maximum adults across stayroom_guests_children- Maximum children across stay
Booking Flags
is_first_booking- True if nth_booking = 1is_last_booking- True if this is guest’s most recent booking
is_last_booking is computed by taking the maximum nth_booking across the guest cluster (guest_cluster_id) and comparing it against the current row; the task sets the flag to True for the most recent booking and False otherwise.
Incremental behavior
This task supports incremental updates by using ProcessedAddedRoomModel to circumscribe affected reservations. In incremental mode the task regenerates bookings impacted by the new/changed room rows and upserts them into booking_rooms using keys:
chain_id,property_id,res_id
If no added rooms are found the task will skip incremental writes.
Mandatory columns
The task programmatically ensures the presence of the following room fields and creates them as DoubleType columns with null default values if they are missing:
room_stay_date_rate_netroom_stay_date_fnb_netroom_stay_date_other_netroom_stay_date_total_netroom_stay_date_listing_rate_netroom_stay_date_listing_rate_gross
This avoids failures when older or minimalist sources don’t include the full revenue breakdown.
Models
Requires
ProcessedGuestModel- Guest and loyalty informationProcessedReservationModel- Reservation detailsProcessedRoomModel- Daily room stay data
Provides
- Writes to
{chain_id}_booking_roomsdatabase table
Write behavior
When writing to the database in incremental mode the task uses database_sink.upsert_chain_table to update only affected rows. Full writes use database_sink.write_chain_table and are controlled by write_to_catalog.
Related Reports
- DailyReportTask - Source of aggregated data
- GuestLoyaltyReportTask - Guest-focused view
- ReportsTask - Parent orchestrator