Skip to main content

Documentation Index

Fetch the complete documentation index at: https://revrebel-sync-metrics-library.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Segment Model

Segment data is one of the first places hotel reporting starts to drift. PMS, CRS, RMS, finance, and BI tools all use segment logic, but they rarely agree on names, grouping, codes, or ledger treatment. Delightful. The Metrics segment model separates source-system segment values from the standardized commercial and finance structure. Source values are mapped once, then published into a production segment dimension that can be used consistently by pace, actuals, forecast, budget, pickup, and finance reporting.

How We View Segment Data

Segment is both a commercial lens and a financial reporting bridge. Commercial teams need segment logic to understand demand behavior, booking mix, pricing strategy, and pace. Finance needs segment logic to align production to ledger treatment, budget structure, and reporting rollups. Those needs overlap, but they are not always identical. The model keeps segment group, segment, and finance segment as separate controlled structures. That gives Metrics enough flexibility to support revenue strategy without breaking finance alignment or forcing every source system into one flat label.

Table Family

TablePurpose
lkp_segment_groupControlled list of high-level commercial segment groups.
lkp_segmentControlled list of standard commercial segments. Each segment belongs to a segment group.
lkp_finance_segmentControlled list of finance reporting segments.
map_segmentSource-to-standard mapping table used to classify source-system segment values.
dim_segmentProduction segment reference used by ingestion, facts, snapshots, and reporting.
vw_segmentEnriched view that joins the dimension to segment, group, and finance labels.

Lookup Tables

Lookup tables define controlled values. They should stay small, readable, and stable. The table name provides the context, so the columns can remain simple: code, name, description, and sort.

lkp_segment_group

Segment group defines the highest commercial rollup for standard segment reporting.

Columns

ColumnTypeDefinition
codeSTRINGStandard segment group code.
nameSTRINGSegment group display name.
descriptionSTRINGDefinition or usage notes for the segment group.
sortINT64Display order for reporting.
is_activeBOOLIndicates whether the segment group is active.
insert_dateDATEInsert date.
updated_dateDATEUpdated date.

Example Values

codenamedescriptionsort
TRANSIENTTransientIndividual transient demand not contracted as group or long-term business.10
GROUPGroupGroup blocks, meetings, events, and contracted group production.20
CONTRACTContractContracted or negotiated long-term production.30
OTHEROtherProduction that does not fit the primary commercial groups.90

lkp_segment

Segment defines the standard commercial segment used by Metrics. Each segment belongs to a segment group through segment_group_code.

Columns

ColumnTypeDefinition
codeSTRINGStandard segment code.
nameSTRINGSegment display name.
descriptionSTRINGDefinition or usage notes for the segment.
sortINT64Display order for reporting.
segment_group_codeSTRINGStandard segment group code. Joins to lkp_segment_group.code.
is_activeBOOLIndicates whether the segment is active.
insert_dateDATEInsert date.
updated_dateDATEUpdated date.

Example Values

codenamedescriptionsortsegment_group_code
BARBAR / RetailBest available or retail transient production.10TRANSIENT
DISCOUNTDiscountDiscounted transient production.20TRANSIENT
NEGOTIATEDNegotiatedNegotiated transient or corporate production.30TRANSIENT
GROUPGroupStandard group production.10GROUP
WHOLESALEWholesaleWholesale, tour, or net-rated production where applicable.40CONTRACT

lkp_finance_segment

Finance segment defines the segment structure used for finance, accounting, ledger reporting, or budget alignment. This is intentionally separate from lkp_segment. Commercial segment and finance segment often align, but when they do not, pretending they are the same usually creates reporting debt. And reporting debt always collects interest.

Columns

ColumnTypeDefinition
codeSTRINGStandard finance segment code.
nameSTRINGFinance segment display name.
descriptionSTRINGDefinition or usage notes for the finance segment.
sortINT64Display order for finance reporting.
is_activeBOOLIndicates whether the finance segment is active.
insert_dateDATEInsert date.
updated_dateDATEUpdated date.

Example Values

codenamedescriptionsort
TRANSIENTTransientFinance transient segment rollup.10
GROUPGroupFinance group segment rollup.20
CONTRACTContractFinance contract segment rollup.30
OTHEROtherOther finance segment rollup.90

map_segment

map_segment is the source-to-standard translation layer. It stores the segment value as it appears in a source system and maps it into the standard commercial and finance segment structures. The source fields use plain names because the table provides the context. Inside map_segment, system, code, name, and description refer to the source-system segment values.

Grain

property_code + system + code
If a source system does not provide a reliable segment code, the effective grain may use:
property_code + system + name

Columns

ColumnTypeDefinition
property_codeSTRINGProperty code.
systemSTRINGSource system providing the segment value.
codeSTRINGSource-system segment code.
nameSTRINGSource-system segment name or label.
descriptionSTRINGSource-system segment description, if supplied.
segment_codeSTRINGStandard commercial segment code. Joins to lkp_segment.code.
finance_segment_codeSTRINGStandard finance segment code. Joins to lkp_finance_segment.code.
gl_codeSTRINGGeneral ledger or guest ledger code associated with the mapped segment, when available.
is_activeBOOLIndicates whether the mapping is active.
insert_dateDATEInsert date.
updated_dateDATEUpdated date.

Working Field Alignment

Working FieldStandard FieldNotes
property_codeproperty_codeProperty code.
systemsystemSource system.
codecodeSource-system segment code.
namenameSource-system segment name.
descriptiondescriptionSource-system segment description.
segment_codesegment_codeStandard commercial segment code.
finance_segment_codefinance_segment_codeStandard finance segment code.
gl_codegl_codeGeneral ledger or guest ledger code.
is_activeis_activeActive mapping flag.
insert_dateinsert_dateInsert date.
updated_dateupdated_dateUpdated date.

dim_segment

dim_segment is the production segment reference table. It is generated from map_segment and the segment lookup tables. The dimension carries the single mapped source lookup value needed during processing:
map_segment_code
That value connects incoming cleaned data back to the source segment code that was mapped, while keeping the dimension focused on standardized commercial and finance structure.

Processing Logic

Incoming source files can resolve segments directly through dim_segment.map_segment_code:
LEFT JOIN metrics_core.dim_segment s
  ON incoming.property_code = s.property_code
 AND incoming.segment_code = s.map_segment_code
Once resolved, the pipeline writes the standard commercial segment code to the target table:
incoming source segment code → dim_segment.map_segment_code → dim_segment.segment_code → target.segment_code
The full source context remains in map_segment:
map_segment.system
map_segment.code
map_segment.name
map_segment.description

Columns

ColumnTypeDefinition
property_codeSTRINGProperty code.
map_segment_codeSTRINGSource segment code from map_segment.code. Used to resolve incoming source data.
segment_codeSTRINGStandard commercial segment code. Joins to lkp_segment.code.
segment_group_codeSTRINGStandard segment group code. Joins to lkp_segment_group.code. Usually inherited from lkp_segment.segment_group_code.
finance_segment_codeSTRINGStandard finance segment code. Joins to lkp_finance_segment.code.
gl_codeSTRINGGeneral ledger or guest ledger code associated with the segment, when available.
is_activeBOOLIndicates whether the segment reference is active.
insert_dateDATEInsert date.
updated_dateDATEUpdated date.

Build Logic

The production dimension should inherit segment_group_code from lkp_segment wherever possible.
SELECT
  m.property_code,
  m.code AS map_segment_code,
  m.segment_code,
  sg.code AS segment_group_code,
  m.finance_segment_code,
  m.gl_code,
  m.is_active,
  CURRENT_DATE() AS insert_date,
  CURRENT_DATE() AS updated_date
FROM metrics_core.map_segment m
LEFT JOIN metrics_core.lkp_segment s
  ON m.segment_code = s.code
LEFT JOIN metrics_core.lkp_segment_group sg
  ON s.segment_group_code = sg.code
This keeps group assignment controlled by the segment lookup instead of manually repeating the group in every mapped source row. One source row should not get to freelance the segment hierarchy.

vw_segment

vw_segment joins the production dimension to lookup labels and descriptions. This is the version reporting, QA, and exports should use when users need readable segment names.

Columns

ColumnSourceDefinition
property_codedim_segmentProperty code.
map_segment_codedim_segmentSource segment code used for ingestion lookup.
segment_codedim_segmentStandard commercial segment code.
segmentlkp_segment.nameStandard commercial segment name.
segment_descriptionlkp_segment.descriptionStandard commercial segment description.
segment_group_codedim_segmentStandard segment group code.
segment_grouplkp_segment_group.nameStandard segment group name.
segment_group_descriptionlkp_segment_group.descriptionStandard segment group description.
finance_segment_codedim_segmentStandard finance segment code.
finance_segmentlkp_finance_segment.nameFinance segment name.
finance_segment_descriptionlkp_finance_segment.descriptionFinance segment description.
gl_codedim_segmentGeneral ledger or guest ledger code.
sortINT64Display order for reporting.
is_activedim_segmentActive flag.

Relationship to Pace, Actuals, Forecast, Budget, and Finance

Segment-level source files should resolve against dim_segment during processing. The target metric table should store the standard segment code and any finance/GL values required by the table’s purpose. For example:
source file segment code
  → dim_segment.map_segment_code
  → dim_segment.segment_code
  → snap_pace_segment.segment_code
Target tables then use:
snap_pace_segment.segment_code
fact_actual_segment.segment_code
fact_pickup_segment.segment_code
fact_manual_plan.segment_code
fact_finance_gl.segment_code
The reporting layer can join to vw_segment to bring in segment name, group name, finance segment, and GL context.

Operating Notes

  1. lkp_segment_group, lkp_segment, and lkp_finance_segment define controlled values.
  2. lkp_segment.segment_group_code controls the commercial segment hierarchy.
  3. map_segment translates and governs source-system segment values before they are published into the production dimension.
  4. map_segment uses system, code, name, and description; it does not use the source_ prefix because the table context already makes those fields source-oriented.
  5. dim_segment carries map_segment_code as the single lookup back to the mapped source segment code.
  6. dim_segment.segment_group_code should be inherited from lkp_segment unless there is a specific, documented exception.
  7. Finance segment is separate from commercial segment on purpose. Sometimes finance and revenue strategy agree. Sometimes they have met, briefly, in a hallway.
  8. Target metric tables should store segment_code; readable names belong in vw_segment.