Your question is Rolling Averages Across Batches. 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.
Recursion Pharmaceuticals needs to monitor metric stability across distinct laboratory batches in its high-throughput screening pipeline. Write a PostgreSQL query that calculates rolling 30-day averages for completed batches.
laboratory_batches to screening_metrics using batch_id.cell_viability measurements with non-null values.| Column | Type | Description |
|---|---|---|
| batch_idPK | VARCHAR(20) | Unique laboratory batch identifier |
| batch_label | VARCHAR(100) | Human-readable batch label |
| experiment_name | VARCHAR(120) | Screening experiment name |
| batch_status | VARCHAR(20) | Batch lifecycle status |
| Column | Type | Description |
|---|---|---|
| metric_idPK | INT | Unique metric observation identifier |
| batch_id | VARCHAR(20) | Laboratory batch associated with the observation |
| measurement_date | DATE | Date of metric measurement |
| metric_name | VARCHAR(60) | Screening metric name |
| metric_value | DECIMAL(10,2) | Observed metric value |