Your question is SQL for Consecutive Treatment Gaps. Start with the requirements and the one table on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Verily’s clinical research workflows need to identify periods when a patient had no recorded treatment activity. Given a patient event log, write a PostgreSQL query that finds consecutive treatment events separated by more than 90 days.
event_type = 'treatment' and event_date is not NULL.| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique clinical event identifier |
| patient_id | INT | Identifier of the patient associated with the event |
| event_type | VARCHAR(30) | Clinical event classification, such as treatment, visit, or lab |
| event_date | DATE | Date on which the clinical event occurred |