DOI: 10.5281/zenodo.15619881
title: Credit Card Transactions

description: Credit Card Transaction Dataset as Property graph with Time series as property of nodes and edges===============================================================================

This is a graph dataset transformed into a graph from a flat csv file downloadedfrom Kaggle's Credit Card Transactions Dataset(https://www.kaggle.com/datasets/priyamchoksi/credit-card-transactions-dataset).The downloaded dataset had the following fields.

ID - Serial number (starts from 0)trans_date_trans_time - Timestamp of the transactioncc_num - Credit card number (hashed or anonymized)merchant - Merchant or store where the transaction occurredcategory - Type of transaction (e.g., grocery, entertainment)amt - Amount of the transactionfirst - First name of the card holderlast - Last name of the card holdergender - Gender of the card holderstreet - Address details of the card holdercity - Address details of the card holderstate - Address details of the card holderzip - Address details of the card holderlat - Geographical coordinates of the transactionlong - Geographical coordinates of the transactioncity_pop - Population of the city where the transaction occurredjob - Occupation of the cardholderdob - Date of birth of the card holdertrans_num - Unique transaction numberunix_time - Unix timestamp of the transactionmerch_lat - Geographical coordinates of the merchantmerch_long - Geographical coordinates of the merchantmerch_zipcode - Address details of the merchantis_fraud - Indicator of whether the transaction is fraudulent

The original dataset has been converted into nodes and edges dataset.The nodes file contains 'credit cards' and 'merchants' as nodes and thetransactions between these are stored as edges between the two nodes in theedge file. Correspondingly, there are two edge files, one edge file storesmultiple transactions between the same credit card and merchant as multipleedges (cc_edges.csv), while the other edge file (cc_edges_ts.csv) consolidatesmultiple transactions between the same nodes as a single edge with time seriesproperties. The nodes also contains time series based on the transactionsthe nodes are involved in.

All the files contain comma separated fields with first two rows as header.The first row of each file contains the names of the fields, while the second rowspecifies the datatype of the field.

Note:    1. The user may choose which edge file to use based on program requirements.    2. The fields 'merch_lat', 'merch_long', 'merch_zipcode' and 'unix_time'        were dropped from the transformed dataset for sanity.

Datatypes of fields-------------------

    The fields in the nodes and the edge files may have one of the following    datatypes:        * str, float, int, bool - standard datatypes    * list - python list in square brackets ([]) if containing a single element,                and in double quoted square brackets ("[]") if containing                multiple elements. Each element of the list is a string.    * date - date string in 'yyyy-mm-dd' format    * datetime - datetime string in 'yyyy-mm-dd hh:mm:ss' format    * ts - time series as a list of python dictionary, with each dictionary            element containing exactly one key-value pair. Each key is a single            quoted datetime string, and values are either string or floats

cc_nodes.csv------------

    File contains list of nodes in the graph and their properties.

    * id - str - contains the id of the node in string format    * label - list - contains labels assigned to the nodes in the list format                (only two labels either ['credit_card'] or ['merchant'])    * cc_num - str - as given in the original dataset, in string format                (empty for nodes labeled 'merchant')    * first_name - str - as given in the original dataset, in string format                (empty for nodes labeled 'merchant')    * last_name - str - as given in the original dataset, in string format                (empty for nodes labeled 'merchant')    * gender - str - as given in the original dataset, in string format                (empty for nodes labeled 'merchant')    * street - str - as given in the original dataset, in string format                (empty for nodes labeled 'merchant')    * city - str - as given in the original dataset, in string format                (empty for nodes labeled 'merchant')    * state - str - as given in the original dataset, in string format                (empty for nodes labeled 'merchant')    * zip - str - as given in the original dataset, in string format                (empty for nodes labeled 'merchant')    * job - str - as given in the original dataset, in string format                (empty for nodes labeled 'merchant')    * dob - date - as given in the original dataset, in string format                (empty for nodes labeled 'merchant')    * transaction - ts - transactions on the credit card as time series                (empty for nodes labeled 'merchant')    * merch_name - str - merchant name in string format                (empty for nodes labeled 'credit_card')    * merch_transaction - ts - transactions at merchant as time series                (empty for nodes labeled 'credit_card')

cc_edges.csv------------

    The edge file contains the following fields (multiple entries for the same    source and target nodes possible).

    * src_id - str - id of the source node (matches a node id in the node file)    * dst_id - str - id of the target node (matches a node id in the node file)    * label - list - label of the edge (single label ['transacts_with'])    * txn_id - str - id of the transaction as given in the original dataset    * amt - float - amount of the transaction as given in the original dataset    * txn_time - datetime - timestamp of the transaction as given in the original                dataset under column trans_date_trans_time    * category - str - type of transaction as given in the original dataset    * lat - float - as given in the original dataset    * long - float - as given in the original dataset    * city_pop - int - as given in the original dataset    * is_fraud - bool - as given in the original dataset (0/ 1)

cc_edges_ts.csv---------------

    The edge file contains the following fields (exactly one entry for a pair of    nodes).

    * src_id - str - id of the source node (matches a node id in the node file)    * dst_id - str - id of the target node (matches a node id in the node file)    * label - list - label of the edge (single label ['transacts_with'])    * txn_id - ts - corresponding values of properties of edges between same                pair of nodes, from cc_edges.csv, consolidated to create time                series using txn_time as key    * amt - ts - corresponding values of properties of edges between same pair                of nodes, from cc_edges.csv, consolidated to create time series                using txn_time as key    * category - ts - corresponding values of properties of edges between same                pair of nodes, from cc_edges.csv, consolidated to create time                series using txn_time as key    * city_pop - ts - corresponding values of properties of edges between same                pair of nodes, from cc_edges.csv, consolidated to create time                series using txn_time as key    * is_fraud - ts - corresponding values of properties of edges between same                pair of nodes, from cc_edges.csv, consolidated to create time                series using txn_time as key    * lat - float - as given in the original dataset    * long - float - as given in the original dataset (0/ 1)

ccard-db.dump-------------

    This is a Neo4j dump to directly load the dataset into Neo4j database using    the following command.    neo4j-admin database load --database=neo4j --from=<path to dir>/ccard-db.dump --force    The version of Neo4j used is - 5.25.1    The database was hosted in a docker container and can be created using the    docker-compose.yml file.

    The database was created using cc_nodes.csv and cc_edges.csv files. The    time series of nodes was stored as two lists, a list of timestamps and a    corresponding list of values. The names of these two properties can be    obtained by adding a suffix to the original field name, i.e., for the field    'transaction' for nodes labeled 'credit_card', the list of timestamps is    stored as property 'transaction_ts' and corresponding list of values is    stored as 'transaction_tsval'. Similarly for 'merchant_transaction' for    nodes labeled 'merchant'.

    The database additionally contains meta nodes (labeled 'graph_meta_info')    which stores the meta property of the time series, i.e., standard deviation    of mean of time series, of standard deviation of time series and of lag-1    autocorrelation values of each time series fields (can be used to compute if    two time series are similar to each other, i.e., if their mean, std dev and    lag1 autocorrelation values fall in one std deviation of each other). The    time series meta data for nodes is stored in node with id 'node_meta_info'    while for edges the id is 'edge_meta_info'. As the edges don't have time    series property associated the 'edge_meta_info' node has no property    assigned. The 'node_meta_info' has the following properties:

    * id    * merch_transaction_autolag1_stddev    * merch_transaction_mean_stddev    * merch_transaction_stddev_stddev    * transaction_autolag1_stddev    * transaction_mean_stddev    * transaction_stddev_stddev

ccard-db-ts.dump-------------

    This is a Neo4j dump to directly load the dataset into Neo4j database using    the following command.    neo4j-admin database load --database=neo4j --from=<path to dir>/ccard-db-ts.dump --force    The version of Neo4j used is - 5.25.1    The database was hosted in a docker container and can be created using the    docker-compose.yml file.

    The database was created using cc_nodes.csv and cc_edges.csv files. The time    series of nodes was stored as an indexed list of time series objects in    nodes_transaction.idx and nodes_merch_transaction.idx. The names of time series    properties can be obtained by adding a suffix of the object to the field name,    i.e., nodes labeled 'credit_card' will have the time series field 'transaction',    the corresponding file to store the value of the property for different nodes    will have the name 'nodes_transaction.idx'; similarly, nodes labeled 'merchant'    will have the time series field 'merch_transaction', the corresponding file to    store the value of the property for different nodes will have the name    'nodes_merch_transaction.idx'. This graph doesn't have any time series property    on edges, such a property would be stored as 'edges_<property name>.idx'.    Additionally, the value of the time series properties for individual objects will    reflect the name of the file and the id of the object that need to be searched for    in the index file, e.g., node labeled 'credit_card' with 'id' 1, will have the    value 'transaction_1' for the time series property 'transaction'.