Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file added Market_Research/SRS_document.pdf
Binary file not shown.
Binary file added Market_Research/potential competitors.pdf
Binary file not shown.
Binary file added Market_Research/user_stories_file.xlsx
Binary file not shown.
32 changes: 32 additions & 0 deletions neo_dolfin/ai/generated_data/loan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import pandas as pd
import numpy as np
import random
from datetime import datetime, timedelta

# Define variables
start_date = datetime(2020, 1, 1)
end_date = datetime(2021, 12, 31)
account_number = 'ACC123456789' # Sample account number

# Generate mock data for the Transaction table for a single user
transaction_data = pd.DataFrame({
'Transaction ID': ['TRX' + ''.join(random.choices('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ', k=8)) for _ in range(1000)],
'Account number': [account_number for _ in range(1000)],
'Transaction date': [start_date + timedelta(days=random.randint(1, 730)) for _ in range(1000)],
'Transaction time': [datetime.strptime(f"{random.randint(0,23):02d}:{random.randint(0,59):02d}", "%H:%M").time() for _ in range(1000)],
'Transaction amount': [random.uniform(-1000, 1000) for _ in range(1000)],
'Credit or debit indicator': [random.choice(['Credit', 'Debit']) for _ in range(1000)],
'Statement description': ['Transaction ' + str(i) for i in range(1000)],
'High level transaction purpose': [random.choice(['Shopping', 'Dining', 'Utilities', 'Transportation']) for _ in range(1000)],
'Mid level transaction purpose': [random.choice(['Online Shopping', 'Restaurant', 'Electricity', 'Gas']) for _ in range(1000)],
'Low level transaction purpose': [random.choice(['Amazon', 'McDonalds', 'Electricity bill', 'Gas bill']) for _ in range(1000)],
'Transaction code': [random.randint(1000, 9999) for _ in range(1000)],
'Merchant ID': [random.randint(100000, 999999) for _ in range(1000)],
'Previous repayment date': [start_date - timedelta(days=random.randint(1, 30)) for _ in range(1000)]
})

# Update the product type to include random products
transaction_data['Product type'] = [random.choice(['appliances', 'clothing', 'electronics', 'groceries', 'furniture']) for _ in range(1000)]

# Save data to Excel sheet
transaction_data.to_excel('loan.xlsx', index=False)
Binary file added neo_dolfin/ai/generated_data/loan.xlsx
Binary file not shown.
1,001 changes: 1,001 additions & 0 deletions neo_dolfin/ai/generated_data/mockaroo_loan_data.csv

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions neo_dolfin/ai/generated_data/personal_loan_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import pandas as pd
import numpy as np
import random
from datetime import datetime, timedelta

# Define variables
monthly_due_date = 5 # Assume the due date is the 5th of each month
monthly_repayment_amount = 100 # Monthly repayment amount in currency
transaction_limit = 1000 # Transaction/account limit in currency
interest_value = 10 # Interest value for late payment in currency
late_payment_value = 50 # Penalty for late payment in currency
loan_amount = 5000 # Loan amount in currency

# Generate personal loan dataset
def generate_personal_loan_data(start_date, end_date):
dates = pd.date_range(start=start_date, end=end_date, freq='MS')
data = {'Date of Transaction': [], 'Description': [], 'Amount': [], 'Balance of Account': [], 'User ID': []}
balance = loan_amount
for date in dates:
# Check if it's the due date
if date.day == monthly_due_date:
# Assume a random chance of late payment
if random.random() < 0.5: # 50% chance of late payment
description = 'Late Payment'
amount = -(monthly_repayment_amount + late_payment_value)
balance -= monthly_repayment_amount + late_payment_value
else:
description = 'Repayment'
amount = -monthly_repayment_amount
balance -= monthly_repayment_amount
else:
# Assume random transactions throughout the month
description = 'Charge' if random.random() < 0.5 else 'Transaction'
amount = random.uniform(-transaction_limit, transaction_limit)
balance += amount

data['Date of Transaction'].append(date)
data['Description'].append(description)
data['Amount'].append(amount)
data['Balance of Account'].append(balance)
data['User ID'].append(random.randint(10000, 99999)) # Generate random user ID

return pd.DataFrame(data)

# Generate data for two years (24 months)
start_date = datetime(2022, 1, 1)
end_date = datetime(2023, 12, 31)
personal_loan_data = generate_personal_loan_data(start_date, end_date)

# Flag user for debt collection if amount is negative
personal_loan_data['Debt Collection Flag'] = np.where(personal_loan_data['Amount'] < 0, 'Yes', 'No')

# Save data to Excel
personal_loan_data.to_excel('personal_loan_data.xlsx', index=False)
Binary file not shown.
66 changes: 66 additions & 0 deletions neo_dolfin/ai/visusalisations/transaction_category.ipynb

Large diffs are not rendered by default.

Binary file not shown.