added dummy data directory

This commit is contained in:
DJ Gillespie 2020-05-06 18:40:43 -06:00
parent 15f63b7847
commit 3689004a82
2 changed files with 822 additions and 0 deletions

View File

@ -0,0 +1,146 @@
from qrtr_account.models import Account, Institution, Bank
from connection.models import Connection
dummy_ac = Account.objects.all()[0]
dummy_isnt = Institution.objects.all()[0]
dummy_bank = Bank.objects.all()[0]
conn_dummy = Connection.objects.all()[0]
accounts= [
{
"account_id": "bE4Py7gXQlh1pQVGeeVnhXlAdeoDq5uVXrMdG",
"balances": {
"available": 100,
"current": 110,
"iso_currency_code": "USD",
"limit": None,
"unofficial_currency_code": None
},
"mask": "0000",
"name": "Plaid Checking",
"official_name": "Plaid Gold Standard 0% Interest Checking",
"subtype": "checking",
"type": "depository"
},
{
"account_id": "myp3AEbDZNsb86vEMMvdHkGnzml5docLD8VWL",
"balances": {
"available": 200,
"current": 210,
"iso_currency_code": "USD",
"limit": None,
"unofficial_currency_code": None
},
"mask": "1111",
"name": "Plaid Saving",
"official_name": "Plaid Silver Standard 0.1% Interest Saving",
"subtype": "savings",
"type": "depository"
},
{
"account_id": "yqxJrB5KzghpdBw9yywPSGVAv3JQy7hyzp7l4",
"balances": {
"available": None,
"current": 1000,
"iso_currency_code": "USD",
"limit": None,
"unofficial_currency_code": None
},
"mask": "2222",
"name": "Plaid CD",
"official_name": "Plaid Bronze Standard 0.2% Interest CD",
"subtype": "cd",
"type": "depository"
},
{
"account_id": "9rpy6BK7NeiqLAPNyyPVsxpgRVawWntRpMX5q",
"balances": {
"available": None,
"current": 410,
"iso_currency_code": "USD",
"limit": 2000,
"unofficial_currency_code": None
},
"mask": "3333",
"name": "Plaid Credit Card",
"official_name": "Plaid Diamond 12.5% APR Interest Credit Card",
"subtype": "credit card",
"type": "credit"
},
{
"account_id": "vXzelKAD9Lu79KvEppvNSEwrjzPD67IWMV9En",
"balances": {
"available": 43200,
"current": 43200,
"iso_currency_code": "USD",
"limit": None,
"unofficial_currency_code": None
},
"mask": "4444",
"name": "Plaid Money Market",
"official_name": "Plaid Platinum Standard 1.85% Interest Money Market",
"subtype": "money market",
"type": "depository"
},
{
"account_id": "R3LjGboMXPTrxdoQzzo3Ud413EPWXRFRg5mBG",
"balances": {
"available": None,
"current": 320.76,
"iso_currency_code": "USD",
"limit": None,
"unofficial_currency_code": None
},
"mask": "5555",
"name": "Plaid IRA",
"official_name": None,
"subtype": "ira",
"type": "investment"
},
{
"account_id": "6lMyvKd6NPf8xAaBkkaLsnwJXDKApgFgBnVyG",
"balances": {
"available": None,
"current": 23631.9805,
"iso_currency_code": "USD",
"limit": None,
"unofficial_currency_code": None
},
"mask": "6666",
"name": "Plaid 401k",
"official_name": None,
"subtype": "401k",
"type": "investment"
},
{
"account_id": "XPlKrkBGEMimr7Gb44GNIQvlMP1NnZIdm8w39",
"balances": {
"available": None,
"current": 65262,
"iso_currency_code": "USD",
"limit": None,
"unofficial_currency_code": None
},
"mask": "7777",
"name": "Plaid Student Loan",
"official_name": None,
"subtype": "student",
"type": "loan"
}
]
for account in accounts:
fields = {
"connection":conn_dummy,
"institution_id":dummy_isnt.id,
"nickname":account.get("name"),
"official_name":account.get("official_name"),
"mask":account.get("mask"),
"ac_type":account.get("type"),
"ac_subtype":account.get("subtype"),
"balance":account.get("balances",{}).get("current"),
"balance_limit":account.get("balances",{}).get("limit")
}
Bank.objects.update_or_create(qrtr_account=dummy_ac, acc_id=account.get("account_id"),
defaults=fields)

View File

@ -0,0 +1,676 @@
from qrtr_account.models import Transaction
from datetime import datetime
null = None
false = False
true = True
transactions = [
{
"account_id": "9rpy6BK7NeiqLAPNyyPVsxpgRVawWntRpMX5q",
"account_owner": null,
"amount": 500,
"authorized_date": null,
"category": [
"Travel",
"Airlines and Aviation Services"
],
"category_id": "22001000",
"date": "2020-03-31",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "United Airlines",
"payment_channel": "in store",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "MqedPko4Gxhpmrw9MMwqS1yZZWjVmmc9JGd8x",
"transaction_type": "special",
"unofficial_currency_code": null
},
{
"account_id": "bE4Py7gXQlh1pQVGeeVnhXlAdeoDq5uVXrMdG",
"account_owner": null,
"amount": 6.33,
"authorized_date": null,
"category": [
"Travel",
"Taxi"
],
"category_id": "22016000",
"date": "2020-03-29",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "Uber",
"payment_channel": "in store",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "apaN7j9XyAf58dVK33V1HBdGG9aPvvc7BVAx5",
"transaction_type": "special",
"unofficial_currency_code": null
},
{
"account_id": "9rpy6BK7NeiqLAPNyyPVsxpgRVawWntRpMX5q",
"account_owner": null,
"amount": 500,
"authorized_date": null,
"category": [
"Food and Drink",
"Restaurants"
],
"category_id": "13005000",
"date": "2020-03-26",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "Tectra Inc",
"payment_channel": "in store",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "1Zj7WnmV3xFQ9oz7JJzpsQA77oEvaas58EAGR",
"transaction_type": "place",
"unofficial_currency_code": null
},
{
"account_id": "9rpy6BK7NeiqLAPNyyPVsxpgRVawWntRpMX5q",
"account_owner": null,
"amount": 2078.5,
"authorized_date": null,
"category": [
"Payment"
],
"category_id": "16000000",
"date": "2020-03-25",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "AUTOMATIC PAYMENT - THANK",
"payment_channel": "other",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "oEgdyA9DNjhbek8G668lH8jnnQVq99cRdGWnB",
"transaction_type": "special",
"unofficial_currency_code": null
},
{
"account_id": "9rpy6BK7NeiqLAPNyyPVsxpgRVawWntRpMX5q",
"account_owner": null,
"amount": 500,
"authorized_date": null,
"category": [
"Food and Drink",
"Restaurants",
"Fast Food"
],
"category_id": "13005032",
"date": "2020-03-25",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "KFC",
"payment_channel": "in store",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "pw8kAG9Dp7fRjk8EWW8qClyNNwB8XXtLZ8ANq",
"transaction_type": "place",
"unofficial_currency_code": null
},
{
"account_id": "9rpy6BK7NeiqLAPNyyPVsxpgRVawWntRpMX5q",
"account_owner": null,
"amount": 500,
"authorized_date": null,
"category": [
"Shops",
"Sporting Goods"
],
"category_id": "19046000",
"date": "2020-03-25",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "Madison Bicycle Shop",
"payment_channel": "in store",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "Ll7xP8oay3fLeKGbmmGlSGazzoRZEESPXdVy5",
"transaction_type": "place",
"unofficial_currency_code": null
},
{
"account_id": "myp3AEbDZNsb86vEMMvdHkGnzml5docLD8VWL",
"account_owner": null,
"amount": 25,
"authorized_date": null,
"category": [
"Payment",
"Credit Card"
],
"category_id": "16001000",
"date": "2020-03-16",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "CREDIT CARD 3333 PAYMENT *//",
"payment_channel": "other",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "eEjewZ1XQrho4PVGvvVzS4rnnw6kWWiL4eolg",
"transaction_type": "special",
"unofficial_currency_code": null
},
{
"account_id": "bE4Py7gXQlh1pQVGeeVnhXlAdeoDq5uVXrMdG",
"account_owner": null,
"amount": 5.4,
"authorized_date": null,
"category": [
"Travel",
"Taxi"
],
"category_id": "22016000",
"date": "2020-03-16",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "Uber",
"payment_channel": "in store",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "4LQyZlGbj4i8aoX5nnX4sgErrPyK88IdQ4jwy",
"transaction_type": "special",
"unofficial_currency_code": null
},
{
"account_id": "vXzelKAD9Lu79KvEppvNSEwrjzPD67IWMV9En",
"account_owner": null,
"amount": 5850,
"authorized_date": null,
"category": [
"Transfer",
"Debit"
],
"category_id": "21006000",
"date": "2020-03-15",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "ACH Electronic CreditGUSTO PAY 123456",
"payment_channel": "other",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": "ACH",
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "8KLyZzqmV7FlqrNw88N4i9bDDoNgXXfwbekVx",
"transaction_type": "special",
"unofficial_currency_code": null
},
{
"account_id": "yqxJrB5KzghpdBw9yywPSGVAv3JQy7hyzp7l4",
"account_owner": null,
"amount": 1000,
"authorized_date": null,
"category": [
"Transfer",
"Deposit"
],
"category_id": "21007000",
"date": "2020-03-15",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "CD DEPOSIT .INITIAL.",
"payment_channel": "other",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "Z7KzB3eMDLfneQVk99VmSBdkkj1PWWcg69dDR",
"transaction_type": "special",
"unofficial_currency_code": null
},
{
"account_id": "9rpy6BK7NeiqLAPNyyPVsxpgRVawWntRpMX5q",
"account_owner": null,
"amount": 78.5,
"authorized_date": null,
"category": [
"Recreation",
"Gyms and Fitness Centers"
],
"category_id": "17018000",
"date": "2020-03-14",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "Touchstone Climbing",
"payment_channel": "in store",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "g9el71kXZBiwZNVEPPVvTvGkkXQMeeFgxdvQj",
"transaction_type": "place",
"unofficial_currency_code": null
},
{
"account_id": "bE4Py7gXQlh1pQVGeeVnhXlAdeoDq5uVXrMdG",
"account_owner": null,
"amount": -500,
"authorized_date": null,
"category": [
"Travel",
"Airlines and Aviation Services"
],
"category_id": "22001000",
"date": "2020-03-14",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "United Airlines",
"payment_channel": "other",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "NKQaPWgNbdForzbwllbXSqkNNlgnLLHW4kPq4",
"transaction_type": "special",
"unofficial_currency_code": null
},
{
"account_id": "bE4Py7gXQlh1pQVGeeVnhXlAdeoDq5uVXrMdG",
"account_owner": null,
"amount": 12,
"authorized_date": null,
"category": [
"Food and Drink",
"Restaurants",
"Fast Food"
],
"category_id": "13005032",
"date": "2020-03-13",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": "3322"
},
"name": "McDonald's",
"payment_channel": "in store",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "PzMN7GoWX4cnG3yb99yzS9vmm3rKWWf7PVpr4",
"transaction_type": "place",
"unofficial_currency_code": null
},
{
"account_id": "bE4Py7gXQlh1pQVGeeVnhXlAdeoDq5uVXrMdG",
"account_owner": null,
"amount": 4.33,
"authorized_date": null,
"category": [
"Food and Drink",
"Restaurants",
"Coffee Shop"
],
"category_id": "13005043",
"date": "2020-03-13",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "Starbucks",
"payment_channel": "in store",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "jEMr7oP5Xdhb87v9ppvLHVGggK8Nzzu1Vlr8X",
"transaction_type": "place",
"unofficial_currency_code": null
},
{
"account_id": "bE4Py7gXQlh1pQVGeeVnhXlAdeoDq5uVXrMdG",
"account_owner": null,
"amount": 89.4,
"authorized_date": null,
"category": [
"Food and Drink",
"Restaurants"
],
"category_id": "13005000",
"date": "2020-03-12",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "SparkFun",
"payment_channel": "in store",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "7q1yXrlb3jh8wA4v994VsJabbQk4eefgor7KW",
"transaction_type": "place",
"unofficial_currency_code": null
},
{
"account_id": "myp3AEbDZNsb86vEMMvdHkGnzml5docLD8VWL",
"account_owner": null,
"amount": -4.22,
"authorized_date": null,
"category": [
"Transfer",
"Credit"
],
"category_id": "21005000",
"date": "2020-03-11",
"iso_currency_code": "USD",
"location": {
"address": null,
"city": null,
"country": null,
"lat": null,
"lon": null,
"postal_code": null,
"region": null,
"store_number": null
},
"name": "INTRST PYMNT",
"payment_channel": "other",
"payment_meta": {
"by_order_of": null,
"payee": null,
"payer": null,
"payment_method": null,
"payment_processor": null,
"ppd_id": null,
"reason": null,
"reference_number": null
},
"pending": false,
"pending_transaction_id": null,
"transaction_code": null,
"transaction_id": "QB1PZnmMgNfn3xXe99XoS53AAe4rJJtp5RqWg",
"transaction_type": "special",
"unofficial_currency_code": null
}
]
for transaction in transactions:
bank = Bank.objects.filter(acc_id=transaction.get("account_id",[None]))[0]
if bank:
fields = {
"datetime":datetime.strptime(transaction.get("date"),"%Y-%m-%d"),
"details":transaction
}
Transaction.objects.update_or_create(Bank=bank,defaults=fields)