You are given the task of identifying potentially fraudulent Lyft driver accounts based on signals in the first 7 days after signup. Write a PostgreSQL query that returns drivers who look suspicious because they share a payout bank account with another driver, have multiple failed background checks, or generate unusually high ride cancellation activity shortly after onboarding. Return one row per driver with the driver ID, signup date, count of distinct drivers sharing the same bank account, failed background check count, cancellation rate in the first 7 days, and a final fraud flag.
Use only drivers who signed up in January 2024. A driver should be flagged when they meet at least two of these conditions: shared bank account with at least 2 drivers total, at least 2 failed background checks, or cancellation rate above 40% in the first 7 days.