Median Time From User Report to Moderation Action by Policy

Last updated: November 29, 2026

Quick Overview

Given a reports table (one row per user report on a video, with policy category) and a moderation_actions table, compute for each policy category the median minutes from a video's first report to its first moderation action, plus the share of reported videos that were actioned.

TikTok
Data Manipulation (SQL/Python)
Data Scientist
TikTok
November 29, 2026
Data Scientist
Technical Screen
Data Manipulation (SQL/Python)
Medium

0

0

0 solved


Given a reports table (one row per user report on a video, with policy category) and a moderation_actions table, compute for each policy category the median minutes from a video's first report to its first moderation action, plus the share of reported videos that were actioned.

TikTok's Trust and Safety org tracks how quickly reported content is reviewed, with tighter targets for categories like minor safety than for spam. The interviewer checks that you pick the right grain (video, not report), compute a median without relying on a vendor function, and keep unactioned videos visible.

What the Interviewer Expects
  • Collapse many reports per video to the first report
  • Use the first action at or after the first report
  • Compute a median with ROW_NUMBER and counts, or PERCENTILE_CONT where available
  • Report actioned share separately so the median does not hide backlog
  • Explain why median beats mean for latency
Key Topics to Cover
median in SQL
grain selection
Trust and Safety metrics
latency
censoring
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
  • How would you add the 90th percentile and why might it matter more for minor safety?
  • Some videos are actioned proactively before any report. How do you treat them?
  • How would you show latency trends while the most recent reports are still pending?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice SQL Problems
Sample Answer
Clarify the Data
  • reports(report_id, video_id, policy_category, reported_at): a viral video may get thousands of reports.
  • moderation_actions(video_id, action, actioned_at): removals, age restrictions, and later...
Approach
  1. First report per video and category.
  2. First action per video.
  3. Join on video, keep actions at or after the first report, compute minutes.
  4. Median per category: rank rows, keep the middle one ...

Submit Your Answer
Markdown supported