Misc updates
This commit is contained in:
@ -5,7 +5,7 @@ WITH config AS (
|
||||
-- that churn during this period differently since they likely haven't actually
|
||||
-- tried the software very much. We'll also use this to isolate feature usage
|
||||
-- from this period, as it's likely that user goals are different at this stage.
|
||||
14 AS short_term,
|
||||
16 AS short_term,
|
||||
-- This is our ~day74 cutoff. For users, we want to see patterns of usage here
|
||||
-- that might differ from those who either churn later or hang around for a while.
|
||||
-- For feature aggregates, this should represent the "serious" efforts to use ZenMaid.
|
||||
@ -18,6 +18,8 @@ WITH config AS (
|
||||
-- For features, we'll look at this as features used in the company's day-to-day, and not
|
||||
-- evaluation attempts.
|
||||
360 AS long_term,
|
||||
-- This is an arbitrary timespan we use to filter records created during account generation.
|
||||
interval '10 minutes' AS time_to_spin_up_account,
|
||||
-- We'll only look back a few years since we want to make fairish comparisons between users
|
||||
-- exposed to "modern" ZenMaid tools.
|
||||
CAST('2023-01-01' AS timestamp) AS date_cutoff,
|
||||
@ -28,8 +30,9 @@ WITH config AS (
|
||||
-- Then establish a standard core set of user data
|
||||
users_with_churn_stats AS (
|
||||
SELECT id, active, billing_state,
|
||||
created_at, free_trial_ends_at, updated_at,
|
||||
created_at, free_trial_ends_at, updated_at, booked_demo_call_at,
|
||||
churned_at, owner.max_owner_updated,
|
||||
users.created_at + config.time_to_spin_up_account AS autogen_cutoff,
|
||||
users.created_at::date + config.long_term AS content_cutoff,
|
||||
GREATEST(owner.max_owner_updated, users.churned_at) AS last_update,
|
||||
GREATEST(owner.max_owner_updated, users.churned_at)::date - created_at::date AS lifespan
|
||||
@ -182,7 +185,7 @@ employee_counts AS (
|
||||
SELECT employees.user_id, employees.created_at::date - users_to_examine.created_at::date AS created_age
|
||||
FROM config, employees
|
||||
JOIN users_to_examine ON employees.user_id = users_to_examine.id
|
||||
WHERE employees.created_at >= users_to_examine.created_at
|
||||
WHERE employees.created_at >= users_to_examine.autogen_cutoff
|
||||
AND employees.created_at <= users_to_examine.content_cutoff
|
||||
),
|
||||
-- Group by week for line charts
|
||||
@ -219,7 +222,7 @@ contact_counts AS (
|
||||
SELECT customers.user_id, customers.created_at::date - users_to_examine.created_at::date AS created_age
|
||||
FROM config, customers
|
||||
JOIN users_to_examine ON customers.user_id = users_to_examine.id
|
||||
WHERE customers.created_at >= users_to_examine.created_at
|
||||
WHERE customers.created_at >= users_to_examine.autogen_cutoff
|
||||
AND customers.created_at <= users_to_examine.content_cutoff
|
||||
),
|
||||
-- Group by week for line charts
|
||||
@ -328,7 +331,7 @@ appointment_counts AS (
|
||||
SELECT appointments.user_id, appointments.created_at::date - users_to_examine.created_at::date AS created_age
|
||||
FROM config, appointments
|
||||
JOIN users_to_examine ON appointments.user_id = users_to_examine.id
|
||||
WHERE appointments.created_at >= users_to_examine.created_at
|
||||
WHERE appointments.created_at >= users_to_examine.autogen_cutoff
|
||||
AND appointments.created_at <= users_to_examine.content_cutoff
|
||||
),
|
||||
-- Group by week for line charts
|
||||
@ -436,14 +439,7 @@ checklist_filled_counts AS (
|
||||
FROM bucket_counts JOIN weekly_counts ON weekly_counts.user_id = bucket_counts.user_id
|
||||
)
|
||||
-- Finally, we'll flatten it all out into a repurposable flat table
|
||||
SELECT users_to_examine.id,
|
||||
users_to_examine.active,
|
||||
users_to_examine.billing_state,
|
||||
users_to_examine.free_trial_ends_at,
|
||||
users_to_examine.category,
|
||||
users_to_examine.created_at,
|
||||
users_to_examine.updated_at,
|
||||
users_to_examine.lifespan,
|
||||
SELECT users_to_examine.*,
|
||||
COALESCE(booking_form_counts.short_term, 0) AS booking_forms_short_term,
|
||||
COALESCE(booking_form_counts.medium_term, 0) AS booking_forms_medium_term,
|
||||
COALESCE(booking_form_counts.long_term, 0) AS booking_forms_long_term,
|
||||
|
||||
8191
churn-analysis.ipynb
8191
churn-analysis.ipynb
File diff suppressed because one or more lines are too long
BIN
churn-analysis.pdf
Normal file
BIN
churn-analysis.pdf
Normal file
Binary file not shown.
8028
complexity.html
Normal file
8028
complexity.html
Normal file
File diff suppressed because one or more lines are too long
2349
complexity.ipynb
Normal file
2349
complexity.ipynb
Normal file
File diff suppressed because one or more lines are too long
BIN
complexity.pdf
Normal file
BIN
complexity.pdf
Normal file
Binary file not shown.
Reference in New Issue
Block a user