Last active
June 29, 2022 09:37
-
-
Save tomasonjo/40fcaf3c6dc882eae1a6f41361bc1bf6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df = gds.run_cypher(""" | |
MATCH (u:User) | |
CALL { | |
WITH u | |
MATCH (u)-[out:P2P]->() | |
RETURN sum(out.totalAmount) as totalOutgoingAmount, max(out.totalAmount) as maxOutgoingAmount, | |
avg(out.totalAmount) as avgOutgoingAmount, count(out) as outgoingTransactions | |
} | |
CALL { | |
WITH u | |
MATCH (u)<-[in:P2P]-() | |
RETURN sum(in.totalAmount) as totalIncomingAmount, max(in.totalAmount) as maxIncomingAmount, | |
avg(in.totalAmount) as avgIncomingAmount, count(in) as incomingTransactions | |
} | |
RETURN u.guid AS user_id, | |
u.fraudRisk AS fraudRisk, | |
size((u)-[:USED]->()) AS numberOfDevices, | |
size((u)-[:HAS_CC]->()) AS numberOfCCs, | |
size((u)-[:HAS_IP]->()) AS numberOfIps, | |
coalesce(totalOutgoingAmount, 0) AS totalOutgoingAmount, | |
coalesce(avgOutgoingAmount, 0) AS avgOutgoingAmount, | |
coalesce(maxOutgoingAmount, 0) AS maxOutgoingAmount, | |
outgoingTransactions, | |
coalesce(totalIncomingAmount, 0) AS totalIncomingAmount, | |
coalesce(avgIncomingAmount, 0) AS avgIncomingAmount, | |
coalesce(maxIncomingAmount, 0) AS maxIncomingAmount, | |
incomingTransactions | |
""") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment