bluesky-collector/scripts/04-human-review.sql

21 lines
1.2 KiB
MySQL
Raw Normal View History

Add human review feature and enhance data collection Enhanced the web interface with comprehensive human review capabilities for validating AI-flagged toxicity classifications. Added date filtering and improved data collection to include engagement metrics for mentions. Features added: - Human review system with ✓/✗/? status buttons and filtering - Date range filtering (from/to) for flagged content - Review status tracking with database migrations - Engagement metrics collection for mentions (likes, replies, reposts, quotes) - Interactive review buttons that allow changing classifications - Review filter to show unreviewed, correct, incorrect, or unsure items UI improvements: - Fixed Chart.js CDN URLs (switched to jsdelivr) - Smart axis scaling for toxicity category charts with dynamic decimal places - Clickable max toxicity badges linking to filtered content - Improved mention author display using raw_json fallback - Sortable table columns with visual indicators - Review status preserved across pagination and filtering Bug fixes: - Commented out problematic account (stephanvanbaarle.bsky.social) - Fixed filter parameter names (content_type, account_did) - Fixed threshold boundary issues with 0.001 offset - Added extra_js block to base template for JavaScript functionality Database changes: - Migration 03: Added engagement columns to mentions table - Migration 04: Added human_reviewed, review_status, reviewed_at columns 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-30 14:13:14 +02:00
-- Add human review functionality to toxicity scores
-- Migration to add human_reviewed, review_status, and reviewed_at columns
-- Add columns to toxicity_scores (for posts)
ALTER TABLE toxicity_scores
ADD COLUMN IF NOT EXISTS human_reviewed BOOLEAN DEFAULT FALSE,
ADD COLUMN IF NOT EXISTS review_status VARCHAR(20) DEFAULT NULL, -- 'correct', 'incorrect', 'unsure'
ADD COLUMN IF NOT EXISTS reviewed_at TIMESTAMP DEFAULT NULL;
-- Add columns to mention_toxicity_scores (for mentions)
ALTER TABLE mention_toxicity_scores
ADD COLUMN IF NOT EXISTS human_reviewed BOOLEAN DEFAULT FALSE,
ADD COLUMN IF NOT EXISTS review_status VARCHAR(20) DEFAULT NULL, -- 'correct', 'incorrect', 'unsure'
ADD COLUMN IF NOT EXISTS reviewed_at TIMESTAMP DEFAULT NULL;
-- Create indexes for filtering
CREATE INDEX IF NOT EXISTS idx_toxicity_scores_human_reviewed ON toxicity_scores (human_reviewed);
CREATE INDEX IF NOT EXISTS idx_toxicity_scores_review_status ON toxicity_scores (review_status);
CREATE INDEX IF NOT EXISTS idx_mention_toxicity_scores_human_reviewed ON mention_toxicity_scores (human_reviewed);
CREATE INDEX IF NOT EXISTS idx_mention_toxicity_scores_review_status ON mention_toxicity_scores (review_status);