Advanced developers looking to design complex event detection, sliding window triggers, and threshold alarms.
Detect rapid successive banking transactions to flag potential fraud.
Save the following raw rows locally as \`dataset.csv\` to test your pipeline:
timestamp,card_id,amount,location
1719830400,card1,50.00,NY
1719830402,card1,200.00,NY
1719830410,card2,10.00,CA
1719830415,card1,800.00,London
1719830440,card2,500.00,CACreate a local file named \`starter.py\` and copy the following skeleton. Complete the missing transformations:
# starter.py - Fraud Detection
import apache_beam as beam
from apache_beam.options.pipeline_options import PipelineOptions
def run_pipeline():
options = PipelineOptions()
with beam.Pipeline(options=options) as p:
# TODO: Apply sliding windows (10s duration, 5s slide)
# TODO: Count transactions per card ID
# TODO: Filter counts > 2
pass
if __name__ == "__main__":
run_pipeline()