This worked:
// Creating recipient nodes for all recipients with old and new balances
LOAD CSV WITH HEADERS FROM 'file:///fraud_detection.csv' AS row
MERGE (r:Recipient {
R_ID: row.nameDest,
oldBalance: toFloat(row.oldbalanceDest),
newBalance: toFloat(row.newbalanceDest)
})
// Creating customer nodes with new and old balances
LOAD CSV WITH HEADERS FROM 'file:///fraud_detection.csv' AS row
MERGE (c:Customer {
C_ID: row.nameOrig,
oldBalance: toFloat(row.oldbalanceOrg),
newBalance: CASE WHEN trim(row.newbalanceOrg) <> '' THEN toFloat(row.newbalanceOrg) ELSE 0.0 END
})
I;m having an error in this:
// Creating transaction nodes with type and relationships
LOAD CSV WITH HEADERS FROM 'file:///fraud_detection.csv' AS row
// Iterate over rows and conditionally create nodes and relationships
FOREACH(ignoreMe IN CASE WHEN row.steps IS NOT NULL AND trim(row.steps) <> '' THEN [1] ELSE END |
MERGE (t:Transaction {
steps: toInteger(row.steps),
T_type: row.T_type, // Keep 'type' as it is
amount: toFloat(row.amount),
isFraud: toInteger(row.isFraud)
})
// Conditional CREATE for customer node
MERGE (customer:Customer { C_ID: row.nameOrig })
// Conditional CREATE for recipient node
MERGE (recipient:Recipient { R_ID: row.nameDest })
// Create relationships
WITH t, customer, recipient
MERGE (customer)-[:MADE]->(t)
WITH t, recipient
MERGE (t)-[:RECEIVED]->(recipient);
);
"WITH" (line 14, column 37 (offset: 568))
" MERGE (t)-[:RECEIVED]->(recipient)"
if anyone can provide a solution or better query much appreciated