Write a query to calculate the rolling 7-day average of physical therapy sessions completed by users, partitioned by their clinical cohort at Hinge health.
Use completed sessions only. Include calendar dates with zero sessions, beginning with the earliest completed session date and ending with the latest.
clinical_cohort, activity_date, daily_sessions, and rolling_7_day_avg.clinical_cohort, then activity_date ascending.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique user identifier |
| clinical_cohort | VARCHAR(30) | Clinical cohort assigned to the user |
| Column | Type | Description |
|---|---|---|
| session_idPK | INT | Unique therapy session identifier |
| user_id | INT | User who attended or was scheduled for the session |
| session_date | DATE | Date associated with the therapy session |
| status | VARCHAR(20) | Session status, such as completed or scheduled |