dating_platform/proposals.view.lookml 19 dims5 measures 3 warnings Repo files

LookML view · dating-platform

The propositions view: date proposals with response counts built in a derived table

At a glance

Does
Builds one row per proposition from propositions, joined to response counts per message type and to the template name. Exposes status, category, city, dates and response measures.Trust: Source-defined
Why
Measures how date proposals perform: how many responses each gets, of which type (intrigue, generic, private date, date response), and by template.Trust: Inferred
Grain
One row per proposition, grouped by id in the derived table. id is the primary key.Trust: Source-defined
Source
dating_platform/proposals.view.lookml 168 lines
Source: proposals.view.lookml L1-10
dating_platform/proposals.view.lookmlL1-10
- view: propositions  derived_table:    sql: |      WITH proposition_responses AS (        SELECT  proposition_id,                type,                COUNT(1) AS response_count        FROM    messages M                JOIN users U                ON  M.sender_id = U.id        WHERE   M.state = 'sent'                AND U.spammer = false        GROUP BY proposition_id, type

dating-platform, proposals.view.lookml, lines 1-10

Shape

Trust: Source-defined

Every field as declared, with the dashboard tiles that read it. Computed from the source; nothing here is edited.

Derived table: persists for 1 hour. Reads warehouse tables directly.

Dimensions 19

NameTypeSQLUsed byTags
idL72int${TABLE}.id-primary key
proposition_template_idL76int${TABLE}.proposition_template_id-hidden
categoryL80string${TABLE}.category-
cityL82string${TABLE}.city-
createdtime, date, week, monthL84time group${TABLE}.created_at-
proposeddate, week, monthL92time group${TABLE}.date-
is_deletedL99yesno${TABLE}.deleted_at IS NOT NULL-derived
delivery_statusL102yesno${TABLE}.delivery_status-
lifecycle_minute_of_posterL105int${TABLE}.lifecycle_minutes-
stateL108string${TABLE}.state-
statusL110string${TABLE}.status-
timeL112string${TABLE}.time-
is_unique_dateL114yesno${TABLE}.unique_date-
user_idL117int${TABLE}.user_id-hidden
message_response_typeL121stringmessages.type-hiddenderived
template_nameL127string${TABLE}.template_name-
date_response_numL130string${TABLE}.date_response_num (default)-hiddenimplicit sql
intrigue_response_numL132string${TABLE}.intrigue_response_num (default)-hiddenimplicit sql
response_rateL146number100.0 * ${response_count} /${count}-derived

Measures 5

NameTypeSQLUsed byTags
date_response_countL134avg${TABLE}.date_response_num-
response_countL138numberAVG(CAST(${TABLE}.response_num AS FLOAT))-derived
intrigue_response_countL142sum${intrigue_response_num}-derived
count_intrigue_responsesL150count_distinctmessages.idfilters: message_response_type = Messages::Intrigue-derivedfiltered
countL156count_distinct${TABLE}.id-

Relationships

Trust: Source-defined
Relationships of propositions
Relationships of propositions. Text version follows the diagram.This viewUsed by: explores, views, dashboardsbase viewas propositions, on propositions.proposition_templa... propositions explore in enterprise date_ideas explore in enterprise
  • This Block
  • No relationship declared
Text version
  • propositions is the base view of propositions: base view
  • propositions is joined into date_ideas: as propositions, on propositions.proposition_templa... (no relationship declared)

Filters and exclusions that change meaning

Responses only count sent messages from non-spammers

Trust: Source-defined

The CTE keeps messages with state = 'sent' whose sender has spammer = false. Responses from spammers or unsent drafts never reach any measure.

Source: proposals.view.lookml L4-14
dating_platform/proposals.view.lookmlL4-14
- view: propositions  derived_table:    sql: |      WITH proposition_responses AS (        SELECT  proposition_id,                type,                COUNT(1) AS response_count        FROM    messages M                JOIN users U                ON  M.sender_id = U.id        WHERE   M.state = 'sent'                AND U.spammer = false        GROUP BY proposition_id, type        )      SELECT  P.id,              P.user_id,              P.category,

dating-platform, proposals.view.lookml, lines 4-14

Published by default

Trust: Source-defined

In the enterprise model the propositions explore applies status = published unless the query filters on status.

Source: enterprise.model.lookml L39-41
dating_platform/enterprise.model.lookmlL39-41
- explore: propositions  view: propositions  conditionally_filter:    propositions.status: published    unless:    - propositions.status  joins:  - join: users    sql_foreign_key: propositions.user_id

dating-platform, enterprise.model.lookml, lines 39-41

Worth noticing

Measures named count are averages

Trust: Source-defined

response_count is AVG(response_num) typed as number, and date_response_count is type: avg. Both read as counts in the field picker.

Source: proposals.view.lookml L134-141
dating_platform/proposals.view.lookmlL134-141
    hidden: true  - dimension: intrigue_response_num    hidden: true  - measure: date_response_count    type: avg    decimals: 2    sql: ${TABLE}.date_response_num  - measure: response_count    type: number    decimals: 2    sql: AVG(CAST(${TABLE}.response_num AS FLOAT))  - measure: intrigue_response_count    type: sum    sql: ${intrigue_response_num}

dating-platform, proposals.view.lookml, lines 134-141

Template names are computed twice

Trust: Source-defined

The derived table builds template_name with COALESCE(PT.name, INITCAP(REPLACE(PT.slug, '-', ' '))), the same rule as proposition_templates.name. A change to one will not reach the other.

Source: proposals.view.lookml L46-51
dating_platform/proposals.view.lookmlL46-51
                WHEN PR.type = 'Messages::DateResponse' THEN PR.response_count                ELSE NULL              END ) AS date_response_num,              COALESCE(PT.name, INITCAP(REPLACE(PT.slug, '-', ' '))) AS template_name      FROM  propositions P            LEFT JOIN proposition_responses PR            ON  P.id = PR.proposition_id            LEFT JOIN proposition_templates PT            ON  P.proposition_template_id = PT.id      GROUP BY  P.id,                P.user_id,                P.category,

dating-platform, proposals.view.lookml, lines 46-51

What can change the answer 3

Blocker: response_rate is a dimension built on measures

Trust: Source-defined

response_rate is declared as a dimension, but its SQL divides the measures response_count and count. Aggregates inside a grouped dimension are not valid SQL.

What goes wrong: Selecting response rate makes the query fail, so the only rate in this view cannot be used.

Source: proposals.view.lookml L146-149
dating_platform/proposals.view.lookmlL146-149
    type: sum    sql: ${intrigue_response_num}    detail: detail*  - dimension: response_rate    type: number    decimals: 2    sql: 100.0 * ${response_count} /${count}  - measure: count_intrigue_responses    type: count_distinct    sql: messages.id

dating-platform, proposals.view.lookml, lines 146-149

Caution: Summed responses fan out over the messages join

Trust: Inferred

intrigue_response_count sums a per-proposition column. When message_response_type or count_intrigue_responses pulls in the messages join, each proposition repeats once per message.

What goes wrong: Intrigue responses are multiplied by the number of messages on each proposition.

Read the guide: Join fanout

Source: proposals.view.lookml L142-155
dating_platform/proposals.view.lookmlL142-155
    type: number    decimals: 2    sql: AVG(CAST(${TABLE}.response_num AS FLOAT))  - measure: intrigue_response_count    type: sum    sql: ${intrigue_response_num}    detail: detail*  - dimension: response_rate    type: number    decimals: 2    sql: 100.0 * ${response_count} /${count}  - measure: count_intrigue_responses    type: count_distinct    sql: messages.id    filters:      message_response_type: Messages::Intrigue    detail: detail*  - measure: count    type: count_distinct    sql: ${TABLE}.id

dating-platform, proposals.view.lookml, lines 142-155

Note: delivery_status is typed yesno

Trust: Inferred

delivery_status is a yes/no field. If the column holds more than two delivery states, everything that is not true reads as No.

Source: proposals.view.lookml L102-104
dating_platform/proposals.view.lookmlL102-104
  - dimension: is_deleted    type: yesno    sql: ${TABLE}.deleted_at IS NOT NULL  - dimension: delivery_status    type: yesno    sql: ${TABLE}.delivery_status  - dimension: lifecycle_minute_of_poster    type: int    sql: ${TABLE}.lifecycle_minutes

dating-platform, proposals.view.lookml, lines 102-104

Parser checks 1

Trust: Source-defined

Mechanical findings from parsing the LookML. They are facts about the files. The cards above explain which ones matter.

Show all 1 check
  • dimension-uses-measure 1
    • proposals.view.lookml:146 Dimension propositions.response_rate references a measure.

Related

Guides built on this file

Related source files

Source model