Changes between Version 2 and Version 3 of RSVPConversion


Ignore:
Timestamp:
05/13/26 21:49:53 (13 days ago)
Author:
193284
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • RSVPConversion

    v2 v3  
    33== 3. Scenario Overview ==
    44
    5 This scenario analyzes RSVP response efficiency and attendance conversion for wedding events.
    6 
    7 The analysis measures:
    8 * invitation response rates
    9 * RSVP confirmation rates
    10 * attendance conversion percentages
    11 * guest engagement metrics
    12 * response timing statistics
    13 
    14 The generated analytical reports provide insights into invitation effectiveness and guest participation behavior.
     5This scenario analyzes RSVP conversion efficiency and guest engagement across wedding events.
     6
     7The analysis combines:
     8* guest invitations
     9* RSVP responses
     10* attendance records
     11* response rates
     12* attendance conversion metrics
     13
     14The report enables:
     15* invitation effectiveness analysis
     16* guest engagement tracking
     17* attendance prediction
     18* RSVP monitoring
     19* response behavior analysis
    1520
    1621== 3.1 Objective ==
     
    1823Quantify the conversion efficiency from guest invitations to confirmed attendance across wedding events.
    1924
    20 The analysis calculates:
    21 * RSVP response rates
    22 * confirmation percentages
    23 * attendance conversion metrics
    24 * average response timing before events
    25 
    26 The scenario demonstrates how analytical SQL queries can be used to evaluate guest engagement patterns.
     25This report calculates RSVP response rates, conversion metrics from response to actual attendance, and temporal analysis of guest response patterns.
     26
     27The analysis identifies invitation effectiveness and guest engagement trends.
    2728
    2829== 3.2 SQL Query Implementation ==
     
    4243
    4344    e.event_id,
    44 
    4545    e.event_type,
    4646
     
    5151        AS rsvp_responses,
    5252
    53     COUNT(
    54         DISTINCT CASE
    55             WHEN r.status = 'CONFIRMED'
    56             THEN r.response_id
    57         END
    58     ) AS confirmed_rsvps,
    59 
    60     COUNT(
    61         DISTINCT CASE
    62             WHEN r.status = 'DECLINED'
    63             THEN r.response_id
    64         END
    65     ) AS declined_rsvps,
     53    COUNT(DISTINCT CASE
     54        WHEN r.status = 'CONFIRMED'
     55        THEN r.response_id
     56    END) AS confirmed_rsvps,
     57
     58    COUNT(DISTINCT CASE
     59        WHEN r.status = 'DECLINED'
     60        THEN r.response_id
     61    END) AS declined_rsvps,
    6662
    6763    COUNT(DISTINCT a.attendance_id)
    6864        AS attendance_records,
    6965
    70     COUNT(
    71         DISTINCT CASE
    72             WHEN a.status = 'ATTENDED'
    73             THEN a.attendance_id
    74         END
    75     ) AS actual_attendees,
     66    COUNT(DISTINCT CASE
     67        WHEN a.status = 'ATTENDED'
     68        THEN a.attendance_id
     69    END) AS actual_attendees,
    7670
    7771    ROUND(
     
    8781        (
    8882            CAST(
    89                 COUNT(
    90                     DISTINCT CASE
    91                         WHEN r.status = 'CONFIRMED'
    92                         THEN r.response_id
    93                     END
    94                 ) AS NUMERIC
     83                COUNT(DISTINCT CASE
     84                    WHEN r.status = 'CONFIRMED'
     85                    THEN r.response_id
     86                END) AS NUMERIC
    9587            )
    9688            /
     
    10395        (
    10496            CAST(
    105                 COUNT(
    106                     DISTINCT CASE
    107                         WHEN a.status = 'ATTENDED'
    108                         THEN a.attendance_id
    109                     END
    110                 ) AS NUMERIC
     97                COUNT(DISTINCT CASE
     98                    WHEN a.status = 'ATTENDED'
     99                    THEN a.attendance_id
     100                END) AS NUMERIC
    111101            )
    112102            /
    113103            NULLIF(
    114                 COUNT(
    115                     DISTINCT CASE
    116                         WHEN r.status = 'CONFIRMED'
    117                         THEN r.response_id
    118                     END
    119                 ),
     104                COUNT(DISTINCT CASE
     105                    WHEN r.status = 'CONFIRMED'
     106                    THEN r.response_id
     107                END),
    120108                0
    121109            )
     
    158146== 3.3 Query Complexity Analysis ==
    159147
    160 * Join Count:
    161   * 6 tables
    162 
     148* Join Count: 6 tables
    163149* Join Types:
    164150  * INNER JOIN
     
    170156  * NULLIF()
    171157
    172 * Conditional Aggregation:
    173   * CASE WHEN logic inside COUNT()
    174 
    175158* Conversion Metrics:
    176159  * RSVP response rate
    177160  * confirmation rate
    178   * attendance conversion percentage
     161  * attendance conversion rate
     162
     163* Conditional Aggregation:
     164  * CASE WHEN logic inside COUNT()
    179165
    180166== 3.4 Relational Algebra Expression ==
     
    186172    w.date,
    187173    e.event_id,
    188     e.event_type,
    189 
    190     COUNT(g.guest_id),
    191 
    192     COUNT(r.response_id),
    193 
    194     COUNT(CONFIRMED),
    195 
    196     COUNT(DECLINED),
    197 
    198     COUNT(a.attendance_id),
    199 
    200     COUNT(ATTENDED)
     174    e.event_type
    201175)
    202176
     
    223197* γ = Grouping and aggregation
    224198* ⟕ = Left outer join
    225 * COUNT(DISTINCT ...) = Distinct aggregation
    226 * CASE = Conditional aggregation
     199* COUNT(DISTINCT ...) = distinct counting
    227200
    228201=== Interpretation ===
    229202
    230 The expression combines weddings, guests, RSVP responses, and attendance records in order to calculate RSVP conversion metrics.
    231 
    232 Grouping operations aggregate invitation, RSVP, and attendance statistics for each event.
     203The expression combines wedding, event, guest, RSVP, and attendance relations to calculate guest engagement and RSVP conversion metrics.
    233204
    234205== 3.5 PostgreSQL Stored Procedure ==
     
    238209{{{
    239210#!sql
    240 CREATE OR REPLACE PROCEDURE
    241 rsvp_conversion_report(
     211CREATE OR REPLACE PROCEDURE rsvp_conversion_report(
    242212
    243213    IN p_wedding_id INT DEFAULT NULL,
    244 
    245214    IN p_event_type VARCHAR DEFAULT NULL,
    246 
    247215    IN p_min_response_rate NUMERIC DEFAULT 0,
    248 
    249216    IN p_max_response_rate NUMERIC DEFAULT 100
     217
    250218)
    251 
    252219LANGUAGE plpgsql
    253 
    254220AS $$
    255221
     
    257223
    258224    v_wedding_record RECORD;
    259 
    260225    v_event_record RECORD;
    261226
    262227    v_total_invitations INTEGER;
    263 
    264228    v_rsvp_responses INTEGER;
    265229
    266230    v_confirmed_rsvps INTEGER;
    267 
    268231    v_declined_rsvps INTEGER;
    269232
    270233    v_attendance_records INTEGER;
    271 
    272234    v_actual_attendees INTEGER;
    273235
    274236    v_rsvp_rate NUMERIC;
    275 
    276237    v_confirmation_rate NUMERIC;
    277 
    278238    v_attendance_rate NUMERIC;
    279239
     
    283243
    284244        wedding_id INTEGER,
    285 
    286245        organizer_name VARCHAR,
    287 
    288246        wedding_date DATE,
    289247
    290248        event_id INTEGER,
    291 
    292249        event_type VARCHAR,
    293250
    294251        total_invitations INTEGER,
    295 
    296252        rsvp_responses INTEGER,
    297253
    298254        confirmed_rsvps INTEGER,
    299 
    300255        declined_rsvps INTEGER,
    301256
    302257        attendance_records INTEGER,
    303 
    304258        actual_attendees INTEGER,
    305259
    306260        rsvp_response_rate_percent NUMERIC,
    307 
    308261        confirmation_rate_percent NUMERIC,
    309 
    310262        attendance_conversion_percent NUMERIC
     263
    311264    );
    312265
     
    325278
    326279        WHERE
    327             (
    328                 p_wedding_id IS NULL
    329                 OR w.wedding_id = p_wedding_id
    330             )
     280            (p_wedding_id IS NULL
     281            OR w.wedding_id = p_wedding_id)
    331282
    332283    LOOP
     
    341292
    342293            WHERE
    343                 e.wedding_id =
    344                 v_wedding_record.wedding_id
    345 
     294                e.wedding_id = v_wedding_record.wedding_id
    346295                AND (
    347296                    p_event_type IS NULL
     
    352301
    353302            SELECT COUNT(DISTINCT g.guest_id)
    354 
    355303            INTO v_total_invitations
    356 
    357304            FROM guest g
    358 
    359             WHERE
    360                 g.wedding_id =
    361                 v_wedding_record.wedding_id;
     305            WHERE g.wedding_id = v_wedding_record.wedding_id;
    362306
    363307            SELECT COUNT(DISTINCT r.response_id)
    364 
    365308            INTO v_rsvp_responses
    366 
    367309            FROM event_rsvp r
    368 
    369             WHERE
    370                 r.event_id =
    371                 v_event_record.event_id;
     310            WHERE r.event_id = v_event_record.event_id;
    372311
    373312            SELECT COUNT(DISTINCT r.response_id)
    374 
    375313            INTO v_confirmed_rsvps
    376 
    377314            FROM event_rsvp r
    378 
    379             WHERE
    380                 r.event_id =
    381                 v_event_record.event_id
    382 
    383                 AND r.status = 'CONFIRMED';
     315            WHERE r.event_id = v_event_record.event_id
     316            AND r.status = 'CONFIRMED';
    384317
    385318            SELECT COUNT(DISTINCT r.response_id)
    386 
    387319            INTO v_declined_rsvps
    388 
    389320            FROM event_rsvp r
    390 
    391             WHERE
    392                 r.event_id =
    393                 v_event_record.event_id
    394 
    395                 AND r.status = 'DECLINED';
     321            WHERE r.event_id = v_event_record.event_id
     322            AND r.status = 'DECLINED';
    396323
    397324            SELECT COUNT(DISTINCT a.attendance_id)
    398 
    399325            INTO v_attendance_records
    400 
    401326            FROM attendance a
    402 
    403             WHERE
    404                 a.event_id =
    405                 v_event_record.event_id;
     327            WHERE a.event_id = v_event_record.event_id;
    406328
    407329            SELECT COUNT(DISTINCT a.attendance_id)
    408 
    409330            INTO v_actual_attendees
    410 
    411331            FROM attendance a
    412 
    413             WHERE
    414                 a.event_id =
    415                 v_event_record.event_id
    416 
    417                 AND a.status = 'ATTENDED';
     332            WHERE a.event_id = v_event_record.event_id
     333            AND a.status = 'ATTENDED';
    418334
    419335            v_total_invitations :=
     
    429345                COALESCE(v_declined_rsvps, 0);
    430346
    431             v_attendance_records :=
    432                 COALESCE(v_attendance_records, 0);
    433 
    434             v_actual_attendees :=
    435                 COALESCE(v_actual_attendees, 0);
    436 
    437347            IF v_total_invitations > 0 THEN
    438348
    439                 v_rsvp_rate :=
    440                     ROUND(
    441                         (
    442                             CAST(v_rsvp_responses AS NUMERIC)
    443                             / v_total_invitations
    444                         ) * 100,
    445                         2
    446                     );
     349                v_rsvp_rate := ROUND(
     350                    (
     351                        CAST(v_rsvp_responses AS NUMERIC)
     352                        / v_total_invitations
     353                    ) * 100,
     354                    2
     355                );
    447356
    448357            ELSE
     
    454363            IF v_rsvp_responses > 0 THEN
    455364
    456                 v_confirmation_rate :=
    457                     ROUND(
    458                         (
    459                             CAST(v_confirmed_rsvps AS NUMERIC)
    460                             / v_rsvp_responses
    461                         ) * 100,
    462                         2
    463                     );
     365                v_confirmation_rate := ROUND(
     366                    (
     367                        CAST(v_confirmed_rsvps AS NUMERIC)
     368                        / v_rsvp_responses
     369                    ) * 100,
     370                    2
     371                );
    464372
    465373            ELSE
     
    471379            IF v_confirmed_rsvps > 0 THEN
    472380
    473                 v_attendance_rate :=
    474                     ROUND(
    475                         (
    476                             CAST(v_actual_attendees AS NUMERIC)
    477                             / v_confirmed_rsvps
    478                         ) * 100,
    479                         2
    480                     );
     381                v_attendance_rate := ROUND(
     382                    (
     383                        CAST(v_actual_attendees AS NUMERIC)
     384                        / v_confirmed_rsvps
     385                    ) * 100,
     386                    2
     387                );
    481388
    482389            ELSE
     
    488395            IF v_rsvp_rate BETWEEN
    489396                p_min_response_rate
    490                 AND
    491                 p_max_response_rate
    492 
     397                AND p_max_response_rate
    493398            THEN
    494399
    495400                INSERT INTO rsvp_conversion_results
    496 
    497401                VALUES (
    498 
    499402                    v_wedding_record.wedding_id,
    500 
    501                     v_wedding_record.first_name || ' '
    502                     || v_wedding_record.last_name,
    503 
     403                    v_wedding_record.first_name || ' ' || v_wedding_record.last_name,
    504404                    v_wedding_record.date,
    505 
    506405                    v_event_record.event_id,
    507 
    508406                    v_event_record.event_type,
    509 
    510407                    v_total_invitations,
    511 
    512408                    v_rsvp_responses,
    513 
    514409                    v_confirmed_rsvps,
    515 
    516410                    v_declined_rsvps,
    517 
    518411                    v_attendance_records,
    519 
    520412                    v_actual_attendees,
    521 
    522413                    v_rsvp_rate,
    523 
    524414                    v_confirmation_rate,
    525 
    526415                    v_attendance_rate
    527416                );
     
    535424    RAISE NOTICE
    536425        'RSVP Conversion Report Generated - % events processed',
    537 
    538426        (
    539427            SELECT COUNT(*)
     
    548436
    549437* Nested Loop Logic:
    550   * iteration through weddings and events
    551 
    552 * Conversion Metrics:
    553   * RSVP response rate
     438  * weddings and events iteration
     439
     440* RSVP Metrics:
     441  * response rate
    554442  * confirmation rate
    555443  * attendance conversion rate
     
    560448
    561449* Filtering:
    562   * response rate interval filtering
    563 
    564 * Dynamic Parameters:
    565   * optional wedding filtering
    566   * optional event type filtering
     450  * event type filtering
     451  * response rate filtering
     452
     453* Reporting:
     454  * session-scoped temporary table
    567455
    568456== 3.7 Proof of Execution with Sample Data ==
     
    579467)
    580468VALUES (
    581     'Александар',
    582     'Николовски',
    583     'aleksandar.n@email.com',
    584     '071-222-333'
     469    'Марко',
     470    'Николов',
     471    'marko@email.com',
     472    '071-333-444'
    585473);
    586474
     
    595483    3
    596484);
     485
     486INSERT INTO event (
     487    event_type,
     488    date,
     489    start_time,
     490    end_time,
     491    status,
     492    wedding_id
     493)
     494VALUES (
     495    'Ceremony',
     496    '2024-08-10',
     497    '14:00:00',
     498    '15:00:00',
     499    'SCHEDULED',
     500    3
     501);
    597502}}}
    598503
     
    600505
    601506{{{
    602  wedding_id | organizer_name        | total_invitations
    603 ------------+-----------------------+-------------------
    604  3          | Aleksandar Nikolovski | 15
     507 wedding_id | organizer_name | event_type | invitations
     508------------+----------------+------------+-------------
     509 3          | Марко Николов  | Ceremony  | 15
    605510}}}
    606511
     
    611516
    612517* RSVP Responses:
    613   * total RSVP replies
     518  * guests who submitted RSVP responses
    614519
    615520* Confirmed RSVPs:
    616   * guests who accepted invitations
    617 
    618 * Declined RSVPs:
    619   * guests who rejected invitations
     521  * responses with CONFIRMED status
    620522
    621523* Attendance Conversion:
    622   * ratio between confirmed RSVPs and actual attendance
     524  * actual attendees compared to confirmed RSVPs
     525
     526* Response Rate:
     527  * RSVP responses relative to invitations
    623528
    624529== Summary ==
    625530
    626 This scenario demonstrates advanced RSVP analytics using:
    627 * analytical SQL queries
    628 * conditional aggregation
    629 * conversion metrics
    630 * PostgreSQL stored procedures
    631 * attendance analysis
    632 * guest engagement reporting
     531This scenario demonstrates:
     532* RSVP analytics
     533* guest engagement tracking
     534* attendance conversion analysis
     535* aggregate SQL reporting
     536* stored procedures
     537* advanced event analytics