SELECT DISTINCT     -- we use distinct to handle multiple chip runs. Distribution will find right chipRun
    'raw' AS stage,
    rawExp.exp_id AS stage_id,
    rawExp.exp_name AS run_tag,
    rawExp.obs_mode,
    distTarget.target_id,
    distTarget.clean
FROM rawExp
JOIN chipRun USING(exp_id)
JOIN distTarget ON distTarget.obs_mode = rawExp.obs_mode AND distTarget.stage = 'raw'
JOIN rcInterest USING(target_id)
LEFT JOIN distRun ON distRun.stage = 'raw' AND distRun.stage_id = exp_id
    AND distRun.clean = distTarget.clean
    -- JOIN hook for magicked stuff %s
WHERE distTarget.state = 'enabled'
    AND rcInterest.state = 'enabled'
    AND distRun.dist_id IS NULL      -- no existing distRun

