Experiment data quality · Original fictional data · Free files and full answers
Flag users violating any experimental guardrail
Under first-assignment eligibility, a user fails if any eligible outcome has error=1 OR they were assigned multiple variants. Return user_id,error_flag,contamination_flag for failed users only, sorted user_id.
Use this fixed business case to build a checked CSV and a replayable SQL handoff. No account required. Scenario datasets are shared across related exercises; each exercise has its own decision and output contract.
Your output contract
- Under first-assignment eligibility, a user fails if any eligible outcome has error=1 OR they were assigned multiple variants. Return user_id,error_flag,contamination_flag for failed users only, sorted user_id.
- Return exactly the declared columns and order. Money uses integer cents; time and date units follow the task and field dictionary. NULL is unknown and differs from numeric zero.
- These are original fictional records and exercise policies. Scenario data may be shared with related tasks, whose decisions and output contracts differ.
Return columns exactly as user_id, error_flag, contamination_flag. Sort order follows the task. Output has 3 rows; an empty CSV field means NULL.
Source data
assignments
12 source rows · Download assignments CSV
| id INTEGER | user_id INTEGER | variant TEXT | minute INTEGER | device TEXT | stratum TEXT |
|---|---|---|---|---|---|
| 1 | 1 | A | 0 | phone | new |
| 2 | 1 | A | 0 | phone | new |
| 3 | 2 | B | 0 | phone | new |
| 4 | 3 | A | 2 | web | old |
| 5 | 3 | B | 5 | web | old |
| 6 | 4 | B | 2 | web | old |
| 7 | 5 | A | 3 | phone | new |
| 8 | 6 | B | 4 | phone | old |
| 9 | 7 | A | 5 | web | new |
| 10 | 8 | B | 6 | web | new |
| 11 | 9 | A | 7 | phone | old |
| 12 | 10 | B | 8 | web | old |
outcomes
11 source rows · Download outcomes CSV
| id INTEGER | user_id INTEGER | minute INTEGER | value INTEGER | exposed INTEGER | error INTEGER |
|---|---|---|---|---|---|
| 1 | 1 | 4 | 10 | 1 | 0 |
| 2 | 1 | 6 | 20 | 1 | 0 |
| 3 | 2 | -1 | 50 | 1 | 0 |
| 4 | 2 | 5 | 0 | 1 | 1 |
| 5 | 3 | 8 | 100 | 1 | 0 |
| 6 | 4 | 10 | 30 | 1 | 0 |
| 7 | 5 | 8 | 0 | 0 | 0 |
| 8 | 6 | 12 | 500 | 1 | 1 |
| 9 | 7 | 12 | 0 | 1 | 0 |
| 10 | 8 | 15 | 40 | 1 | 0 |
| 11 | 9 | 20 | 10 | 1 | 0 |
Field dictionary and schema
assignments: id INTEGER — Stable source record identifier; not a row position. user_id INTEGER — Foreign business-record identifier; match to the named source key. variant TEXT — Literal business key or category label. Match exactly and retain NULL where present. minute INTEGER — Elapsed UTC minute from the fictional scenario origin. device TEXT — Literal business key or category label. Match exactly and retain NULL where present. stratum TEXT — Literal business key or category label. Match exactly and retain NULL where present. outcomes: id INTEGER — Stable source record identifier; not a row position. user_id INTEGER — Foreign business-record identifier; match to the named source key. minute INTEGER — Elapsed UTC minute from the fictional scenario origin. value INTEGER — Measured numeric value; NULL means unobserved. exposed INTEGER — Exact integer business measurement. Its specific business rule and eligibility are declared in the task. error INTEGER — Exact integer business measurement. Its specific business rule and eligibility are declared in the task.
A method you can reuse
- Under first-assignment eligibility, a user fails if any eligible outcome has error=1 OR they were assigned multiple variants. Return user_id,error_flag,contamination_flag for failed users only, sorted user_id.
- For the first output record, user_id = 2; error_flag = 1; contamination_flag = 0.
- Inspect the source grain, keys and ties. Compare each result column with the full worked SQL and expected CSV.
Watch for this wrong turn
Requiring every guardrail to fail misses users with one serious safety or data-quality failure.
Run and check in SQLite
Your SQL runs locally in the existing SQLite worker. The checker compares every column, row, type, value and row order with this fixed output. It accepts equivalent SELECT or WITH queries. Browser storage keeps your SQL on this device when available.
Complete worked SQL and expected output
WITH r AS (SELECT *,ROW_NUMBER() OVER(PARTITION BY user_id ORDER BY minute,id) n FROM assignments), f AS (SELECT a.user_id,EXISTS(SELECT 1 FROM outcomes o WHERE o.user_id=a.user_id AND o.minute>=a.minute AND o.error=1) error_flag,(SELECT COUNT(DISTINCT variant)>1 FROM assignments b WHERE b.user_id=a.user_id) contamination_flag FROM r a WHERE n=1) SELECT * FROM f WHERE error_flag=1 OR contamination_flag=1 ORDER BY user_id;
"user_id","error_flag","contamination_flag" "2","1","0" "3","0","1" "6","1","0"Reference SQL · Complete expected CSV · Empty answer CSV
Choose another SQL task · Original data exception cases · Larger workplace projects