Analyze timing of circular gift flows - same-year symmetric and adjacent-year round-trips
Analyze the timing of circular gift flows for: $ARGUMENTS
This is the most forensically significant analysis tool. It distinguishes legitimate collaboration from potential disbursement quota gaming.
Generate the risk report (includes temporal analysis):
npm run risk -- --name "$ARGUMENTS"
Read the "Same-Year Symmetric Flows" section from data/reports/risk-<BN>.md:
Read the "Adjacent-Year Round-Trips" section:
For the most concerning partner pairs, run year-by-year analysis:
WITH out_by_yr AS (
SELECT EXTRACT(YEAR FROM fpe)::int AS yr, SUM(total_gifts) AS amt
FROM cra_qualified_donees WHERE bn='<BN_A>' AND donee_bn='<BN_B>' AND total_gifts>0
GROUP BY EXTRACT(YEAR FROM fpe)
), in_by_yr AS (
SELECT EXTRACT(YEAR FROM fpe)::int AS yr, SUM(total_gifts) AS amt
FROM cra_qualified_donees WHERE bn='<BN_B>' AND donee_bn='<BN_A>' AND total_gifts>0
GROUP BY EXTRACT(YEAR FROM fpe)
)
SELECT COALESCE(o.yr,i.yr) AS year, COALESCE(o.amt,0) AS sent,
COALESCE(i.amt,0) AS received,
CASE WHEN o.amt>0 AND i.amt>0
THEN ROUND(LEAST(o.amt,i.amt)/GREATEST(o.amt,i.amt)*100)
ELSE NULL END AS symmetry_pct
FROM out_by_yr o FULL JOIN in_by_yr i ON o.yr=i.yr ORDER BY year;
Classify each partner pair:
Key insight: Aggregate symmetry that dissolves at the yearly level is LESS concerning than symmetry within a single year.