Your question is Top Treatment Response Patients. Start with the requirements and the two tables 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.
Dana-Farber Cancer Institute researchers need a ranked view of patients with the strongest treatment responses in a clinical trial. Write a PostgreSQL query that calculates each enrolled patient's average finalized response score and returns the top 10 patients.
patients with treatment_responses using patient_id.enrollment_status is Enrolled, finalized assessments, and non-null response scores.patient_id.| Column | Type | Description |
|---|---|---|
| patient_idPK | INT | Unique patient identifier |
| patient_name | VARCHAR(100) | Patient display name |
| trial_arm | VARCHAR(20) | Assigned treatment arm |
| enrollment_status | VARCHAR(20) | Current trial enrollment status |
| Column | Type | Description |
|---|---|---|
| response_idPK | INT | Unique response assessment identifier |
| patient_id | INT | References patients.patient_id |
| assessment_date | DATE | Date of the response assessment |
| response_score | NUMERIC(5,2) | Treatment response score |
| assessment_status | VARCHAR(20) | Assessment workflow status |