Detect Ransomware-Like Collapses in Volume Data Reduction

Last updated: November 29, 2026

Quick Overview

Given 5-minute telemetry per volume (bytes written and inline data reduction ratio), use pandas to flag incidents where the recent reduction ratio drops below half of its trailing baseline while write volume jumps at least threefold, and return one row per contiguous incident.

Pure Storage
Data Manipulation (SQL/Python)
Data Scientist
Pure Storage
November 29, 2026
Data Scientist
Take-home Project
Data Manipulation (SQL/Python)
Medium

0

0

0 solved


Given 5-minute telemetry per volume (bytes written and inline data reduction ratio), use pandas to flag incidents where the recent reduction ratio drops below half of its trailing baseline while write volume jumps at least threefold, and return one row per contiguous incident.

Encrypted data does not compress or dedupe, so a sudden collapse in reduction ratio during a write surge is a useful ransomware signal for Pure1 alongside SafeMode snapshots. The exercise checks grouped rolling windows, leakage-free baselines and turning point flags into incidents an on-call person can act on.

What the Interviewer Expects
  • Computes rolling statistics per volume, not across the whole frame
  • Shifts the baseline so it does not include the window being tested
  • Requires both conditions (ratio drop and write surge) to cut false positives
  • Uses medians where robustness to single bad buckets matters
  • Groups consecutive flagged buckets into incidents with start, end and severity
  • Handles cold-start volumes with too little history
Key Topics to Cover
pandas groupby rolling
Anomaly detection
Baselines
Event grouping
Ransomware signals
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 tune the thresholds without labelled ransomware events?
  • Which legitimate workloads (for example a database restoring compressed backups) would trigger this, and how would you suppress them?
  • How would you run this in streaming form across a large fleet?
  • What would you do automatically when an incident fires?
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

Columns: volume_id, ts (5-minute buckets, possibly with gaps), bytes_written, reduction_ratio. I assume one row per volume per bucket. Recent window is 12 buckets (1 hour), baseline is the pre...

Approach

Sort by volume and time, then per volume compute: rolling median of the ratio over the recent window, a baseline median over the prior day using shift(window) so the recent hour cannot contaminate i...


Submit Your Answer
Markdown supported

Related Questions