Measure Time From Credentialing to First Session by Cohort
Last updated: November 29, 2026
Quick Overview
Given provider credentialing events and session records, write SQL that groups newly credentialed therapists by the month they were first credentialed with any payer and reports the median days to their first completed session plus the share who saw a patient within 30 days.
Headway
November 29, 20260
0
0 solved
Given provider credentialing events and session records, write SQL that groups newly credentialed therapists by the month they were first credentialed with any payer and reports the median days to their first completed session plus the share who saw a patient within 30 days.
Getting newly credentialed therapists to their first patient quickly is a key supply-side health metric for Headway's marketplace. The interviewer looks for correct cohort definition, handling of providers who have not yet had a session, and right-censoring awareness.
What the Interviewer Expects
- Define the cohort by first credentialing date per provider
- Find each provider's first completed session after that date
- Compute medians with a percentile function and a 30 day activation rate
- Keep providers with no session yet in the denominator
- Call out right censoring for recent cohorts
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you turn this into a survival curve instead of a single median?
- Activation dropped for one cohort. What dimensions would you slice by first?
- Should the clock start at credentialing approval or at the first day the provider opened availability?
- How would you attribute an improvement to a new onboarding flow rather than seasonality?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
credentialing(provider_id, payer_id, approved_at) has one row per provider and payer approval. sessions(session_id, provider_id, status, starts_at) with status completed, cancelled or no_show. Onl...
Approach
Take MIN(approved_at) per provider as the start. Left join to the earliest completed session on or after that start. Days to first session is null for providers with none. The 30 day rate only count...