UPDATE rm_forecast_cache
SET confidence_score = (model_signals->'modelSignals'->'grok'->>'confidence')::double precision
WHERE composite_confidence IS NOT NULL
  AND model_signals IS NOT NULL
  AND (model_signals->'modelSignals'->'grok'->>'confidence') IS NOT NULL
  AND ABS(
    COALESCE(confidence_score, composite_confidence)
    - ((model_signals->'modelSignals'->'grok'->>'confidence')::double precision)
  ) > 0.0005;
