GuestLoyaltyReportTask
The GuestLoyaltyReportTask generates a guest-focused report containing loyalty KPIs and behavioral flags for CRM and marketing purposes.
Overview
This report enables:
- Guest segmentation for marketing
- Loyalty program management
- Customer lifetime value analysis
- Re-engagement campaign targeting
Data Structure
Output Schema
Includes all loyalty metrics from ProcessedGuestModel:
Identity
guest_cluster_id- Unique guest identifier- Guest contact info (name, email, phone, address)
Loyalty Metrics
stays- Total completed stayslifetime_total_value- Total revenueavg_total_net_revenue_per_staytotal_stay_nightsstays_category- Loyalty tier (1, 2, 3, 4-7, 8-10, 11-20, 20+)returning_guest- Boolean flag
Booking Patterns
first_booking_date,last_booking_datefirst_check_in_date,last_check_in_dateavg_booking_windowproperties_visited- Comma-separated list
Behavioral Flag
guest_flag- Segmentation flag
The guest_flag column contains one of the following values assigned by the task based on booking and stay history:
GUEST_NO_BOOKING— guest has no bookingsGUEST_BOOKING_NO_STAY— guest has bookings but no recorded staysGUEST_BOOKING_LAST_365_DAYS— guest had a stay in the past 365 days
Deduplication and writing
Before writing the task drops duplicates and cleans up internal id fields:
dropDuplicates(['guest_cluster_id'])- drops
guest_id_ogandguest_idcolumns
Writes go to a curated table guest_loyalty (the code uses CuratedTables.GUEST_LOYALTY from etl_lib.data.enums) if write_to_catalog is True. This is a curated guest-level table suitable for CRM integrations and BI.
Related Reports
- DailyReportTask - Detailed transaction data
- BookingRoomsReportTask - Booking-level view
- GuestLoyaltyTask - Source of loyalty metrics
- ReportsTask - Parent orchestrator
Last updated on