Skip to Content
ProcessesTasksReportsBookingRoomsReportTask

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 revenue
  • total_room_fnb_net - Sum of all F&B revenue
  • total_room_other_net - Sum of all other revenue
  • total_room_net - Sum of all revenue
  • total_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 stay
  • room_guests_children - Maximum children across stay

Booking Flags

  • is_first_booking - True if nth_booking = 1
  • is_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_net
  • room_stay_date_fnb_net
  • room_stay_date_other_net
  • room_stay_date_total_net
  • room_stay_date_listing_rate_net
  • room_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 information
  • ProcessedReservationModel - Reservation details
  • ProcessedRoomModel - Daily room stay data

Provides

  • Writes to {chain_id}_booking_rooms database 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.

Last updated on