Skip to content

Commit

Permalink
added fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamDee committed Dec 15, 2023
1 parent 2a6d5a3 commit a9d842f
Show file tree
Hide file tree
Showing 5 changed files with 167 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,56 @@ metric:
name: bookings
join_to_timespine: true
---
metric:
name: visit_buy_conversion_rate_7days
description: conversion rate on visits-buys on a 7 day window
type: conversion
type_params:
conversion_type_params:
base_measure: visits
conversion_measure: buys
window: 7 days
entity: user
calculation: conversion_rate
---
metric:
name: visit_buy_conversion_rate
description: conversion rate on visits-buys
type: conversion
type_params:
conversion_type_params:
base_measure: visits
conversion_measure: buys
entity: user
calculation: conversion_rate
---
metric:
name: visit_buy_conversions
description: conversion count on visits-buys on a 7 day window
type: conversion
type_params:
conversion_type_params:
base_measure: visits
conversion_measure: buys
window: 7 days
entity: user
calculation: conversions
---
metric:
name: visit_buy_conversion_rate_by_session
description: conversion rate on visits-buys on a 7 day window held by a constant session_id
type: conversion
type_params:
conversion_type_params:
base_measure: visits
conversion_measure: buys
window: 7 days
entity: user
calculation: conversion_rate
constant_properties:
- base_property: session
conversion_property: session_id
---
metric:
name: bookings_fill_nulls_with_0_without_time_spine
description: Simple metric filling 0 without time spine. Not a commonly expected scenario.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
semantic_model:
name: buys_source
description: buys_source

node_relation:
schema_name: $source_schema
alias: fct_buys

defaults:
agg_time_dimension: ds

measures:
- name: buys
expr: 1
agg: count
- name: buyers
expr: user_id
agg: count_distinct

dimensions:
- name: ds
type: time
type_params:
time_granularity: day

primary_entity: buy

entities:
- name: user
type: foreign
expr: user_id
- name: session_id
type: foreign
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
semantic_model:
name: visits_source
description: visits_source

node_relation:
schema_name: $source_schema
alias: fct_visits

defaults:
agg_time_dimension: ds

measures:
- name: visits
expr: 1
agg: count
- name: visitors
expr: user_id
agg: count_distinct

dimensions:
- name: ds
type: time
type_params:
time_granularity: day
- name: referrer_id
type: categorical

primary_entity: visit

entities:
- name: user
type: foreign
expr: user_id
- name: session
type: foreign
expr: session_id
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
table_snapshot:
table_name: fct_buys
column_definitions:
- name: ds
type: TIME
- name: user_id
type: STRING
- name: session_id
type: STRING
rows:
- ["2020-01-02", "u0004114", "s1"]
- ["2020-01-03", "u0042324", "s9"]
- ["2020-01-04", "u0005432", "s6"]
- ["2020-01-04", "u0003452", "s7"]
- ["2020-01-07", "u1612112", "s123"]
- ["2020-01-07", "u0004114", "s14"]
- ["2020-01-07", "u0003141", "s3"]
- ["2020-01-10", "u0004117", "s15"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
table_snapshot:
table_name: fct_visits
column_definitions:
- name: user_id
type: STRING
- name: ds
type: TIME
- name: referrer_id
type: STRING
- name: session_id
type: STRING
rows:
- ["u0004114", "2020-01-01", "fb_ad_1", "s1"]
- ["u0004214", "2020-01-01", "fb_ad_2", "s2"]
- ["u0003141", "2020-01-01", "homepage_1", "s3"]
- ["u0003154", "2020-01-01", "homepage_2", "s4"]
- ["u1612112", "2020-01-02", "homepage_1", "s5"]
- ["u0005432", "2020-01-02", "fb_ad_3", "s6"]
- ["u0003452", "2020-01-02", "fb_ad_1", "s7"]
- ["u0003452", "2020-01-02", "user_2", "s8"]
- ["u0042324", "2020-01-03", "fb_ad_1", "s9"]
- ["u0005432", "2020-01-03", "google_ad_1", "s10"]
- ["u0005472", "2020-01-03", "google_ad_2", "s11"]
- ["u0005414", "2020-01-04", "google_ad_1", "s12"]
- ["u0004114", "2020-01-06", "homepage_1", "s13"]
- ["u0004114", "2020-01-07", "fb_ad_2", "s14"]
- ["u0004117", "2020-01-10", "google_ad_1", "s15"]
- ["u0003141", "2020-01-12", "user_1", "s16"]

0 comments on commit a9d842f

Please sign in to comment.