Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
28b58b6
Update README.md
Rithish5513U Mar 8, 2025
36067e8
update readme.md
Rithish5513U Mar 8, 2025
03f5f21
Initial Commit
Mar 8, 2025
e1bc03e
Merge branch 'main' of https://github.com/Rithish5513U/Strike4-Backend
Mar 8, 2025
f2c932e
update
Rithish5513U Mar 8, 2025
5cc5ae4
env edit
Rithish5513U Mar 8, 2025
b056927
Merge pull request #1 from Rithish5513U/Rithish
RishabTR Mar 8, 2025
60f4956
update
Rithish5513U Mar 8, 2025
fc0914f
Merge pull request #2 from Rithish5513U/Rithish
RishabTR Mar 8, 2025
cba98aa
update login and signup
Mar 8, 2025
9cabdaa
delete
Mar 8, 2025
afa0092
Merge pull request #3 from Rithish5513U/Rishab
Rithish5513U Mar 8, 2025
01729a8
news update
Rithish5513U Mar 8, 2025
18c6032
Jwt Authentication Completed
Mar 8, 2025
c4a3dbe
Merge pull request #4 from Rithish5513U/Rithish
RishabTR Mar 8, 2025
0a560f6
Merge branch 'main' of https://github.com/Rithish5513U/Strike4-Backen…
Mar 8, 2025
97adf79
Merge pull request #5 from Rithish5513U/Rishab
Rithish5513U Mar 8, 2025
5310678
rename update
Rithish5513U Mar 8, 2025
60b97dc
Merge branch 'main' of https://github.com/Rithish5513U/Strike4-Backen…
Rithish5513U Mar 8, 2025
fc81203
Merge pull request #6 from Rithish5513U/Rithish
RishabTR Mar 8, 2025
280faae
faq update
Rithish5513U Mar 8, 2025
966f579
Merge pull request #7 from Rithish5513U/Rithish
RishabTR Mar 8, 2025
b19025e
node to flask api update
Mar 8, 2025
359bc56
Merge branch 'main' of https://github.com/Rithish5513U/Strike4-Backen…
Mar 8, 2025
67fb502
news update
Rithish5513U Mar 8, 2025
96aeed6
excel handler added
Rithish5513U Mar 8, 2025
55e6352
before backend and frontend integration
Mar 8, 2025
bb44c09
Merge pull request #8 from Rithish5513U/Rithish
RishabTR Mar 8, 2025
cd8afbd
Merge branch 'main' of https://github.com/Rithish5513U/Strike4-Backen…
Mar 8, 2025
9308525
Merge pull request #9 from Rithish5513U/Rishab
Rithish5513U Mar 8, 2025
37abe72
excel update
Rithish5513U Mar 8, 2025
aead352
minor update
Mar 8, 2025
9dbebf1
Merge pull request #10 from Rithish5513U/Rithish
RishabTR Mar 8, 2025
e60e8e9
Merge branch 'main' of https://github.com/Rithish5513U/Strike4-Backen…
Mar 8, 2025
6924ab3
update
Rithish5513U Mar 8, 2025
a1488d5
Merge branch 'main' of https://github.com/Rithish5513U/Strike4-Backen…
Rithish5513U Mar 8, 2025
97fac48
Merge pull request #11 from Rithish5513U/Rithish
RishabTR Mar 8, 2025
17d938e
Merge branch 'main' of https://github.com/Rithish5513U/Strike4-Backen…
Mar 8, 2025
124098b
update on transactionSchema
Mar 8, 2025
66c1c73
Merge pull request #12 from Rithish5513U/Rishab
Rithish5513U Mar 8, 2025
78cf920
Transaction stored in db
Mar 8, 2025
4598dcf
commit
Rithish5513U Mar 8, 2025
a4ba098
Merge branch 'main' of https://github.com/Rithish5513U/Strike4-Backen…
Rithish5513U Mar 8, 2025
4f13c48
faq Bot ready
Mar 9, 2025
98432e3
Merge pull request #13 from Rithish5513U/Rishab
Rithish5513U Mar 9, 2025
a28f36b
Merge pull request #14 from Rithish5513U/Rishab
Rithish5513U Mar 9, 2025
1b31490
Merge branch 'main' of https://github.com/Rithish5513U/Strike4-Backen…
Rithish5513U Mar 9, 2025
de6eceb
Platform integation
Mar 9, 2025
033e99d
final update
Rithish5513U Mar 9, 2025
23e1f8e
Merge pull request #15 from Rithish5513U/Rishab
Rithish5513U Mar 9, 2025
9d9e667
Merge pull request #16 from Rithish5513U/Rithish
Rithish5513U Mar 9, 2025
dcd92dc
Create README.md
Rithish5513U Mar 9, 2025
c93ea69
Update README.md
Rithish5513U Mar 9, 2025
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
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
flask/.env
node/.env
node/node_modules
.env
__pycache__
flask_backend/__pycache__
flask_backend/src/__pycache__
flask_backend/src/data
51 changes: 25 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,52 @@

# Define 3.0
The official template repository for Define 3.0

![DefineHack 2025 Logo](https://github.com/user-attachments/assets/8173bc16-418e-4912-b500-c6427e4ba4b6)



# < Project Name >
# FlowFi
Cover Image If applicable

### Team Information
- **Team Name**: <Team Name>
- **Track**: < Track >
- Team Name: Strike4
- Track: Fintech

### Team Members
| Name | Role | GitHub | LinkedIn |
|------|------|--------|----------|
| [Full Name] | [Role] | [@username](https://github.com/username) | [Profile](https://linkedin.com/in/username) |
| [Full Name] | [Role] | [@username](https://github.com/username) | [Profile](https://linkedin.com/in/username) |
| [Full Name] | [Role] | [@username](https://github.com/username) | [Profile](https://linkedin.com/in/username) |
| [Full Name] | [Role] | [@username](https://github.com/username) | [Profile](https://linkedin.com/in/username) |
| [Gokul G] | [Frontend Developer] | [@GOKULGSECE](https://github.com/GOKULGSECE) | [Profile](https://linkedin.com/in/gokul-g-760a23259) |
| [Rithish S] | [Backend Developer] | [@rithish5513u](https://github.com/rithish5513u) | [Profile](https://linkedin.com/in/rithish-s) |
| [Rishab S] | [Backend Developer] | [@rishabtr](https://github.com/rishabtr) | [Profile](https://linkedin.com/in/rishab-s-0aa28b21a) |
| [Tamilkumaran N] | [Front End Developer] | [@tamilkumaran17](https://github.com/tamilkumaran17) | [Profile](https://linkedin.com/in/tamilkumarann) |

## Project Details

### Overview
_A concise summary of your project (2-3 sentences)_
We're building a fintech platform with an AI-powered chatbot to provide financial insights and customer support. Our platform pulls data from publicly available APIs to deliver personalized financial news. With a user-friendly dashboard, you can track your finances, analyze trends, and manage a virtual investment portfolio. Plus, you can upload your bank statements for automatic income and expense analysis. Our goal is to make financial management easier, helping users make smarter money decisions.

### Problem Statement
_Describe the problem your project aims to solve_
Develop a basic prototype of a fintech website with an AI-powered chatbot that provides users with financial insights and customer support. The website should have a clean, user-friendly interface with a simple dashboard displaying sample financial data and a chatbot capable of handling basic FAQs related to fintech services.

### Solution
_Explain your approach to solving the problem_
We're building a fintech platform with an AI-powered chatbot to provide financial insights and customer support. Our platform pulls data from publicly available APIs to deliver personalized financial news. With a user-friendly dashboard, you can track your finances, analyze trends, and manage a virtual investment portfolio. Plus, you can upload your bank statements for automatic income and expense analysis. Our goal is to make financial management easier, helping users make smarter money decisions.

### Demo
[![Project Demo](https://img.youtube.com/vi/VIDEO_ID/0.jpg)](https://www.youtube.com/watch?v=VIDEO_ID)
_Replace VIDEO_ID with your YouTube video ID or provide an alternative demo link_
Replace VIDEO_ID with your YouTube video ID or provide an alternative demo link

### Live Project
[Project Name](https://your-project-url.com)
[Project Name]FlowFii

## Technical Implementation

### Technologies Used
- **Frontend**: [Technologies]
- **Backend**: [Technologies]
- **Database**: [Technologies]
- **APIs**: [Technologies]
- **DevOps**: [Technologies]
- **Other Tools**: [Technologies]
- Frontend: ReactJS
- Backend: NodeJS/Flask
- Database: MongoDB
- APIs: [Technologies]
- DevOps: [Technologies]
- Other Tools: [Technologies]

### Key Features
- Feature 1
Expand All @@ -62,25 +61,25 @@ _Replace VIDEO_ID with your YouTube video ID or provide an alternative demo link
- Requirement 3

### Installation
```bash
bash


```

### Running the Project
```bash
bash


```

## Additional Resources

### Project Timeline
_Brief overview of your development process and milestones_
Brief overview of your development process and milestones

### Challenges Faced
_Discuss technical challenges and how you overcame them_
Discuss technical challenges and how you overcame them

### Future Enhancements
_Share your vision for future development_
Share your vision for future development

### References (if any)
- [Reference 1](link)
Expand Down
Empty file added flask_backend/__init__.py
Empty file.
40 changes: 40 additions & 0 deletions flask_backend/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from flask import Flask, request, jsonify
from flask_cors import CORS
from src.news import News
from src.faq_chatbot import FAQChatBot
from src.excelhandler import ExcelHandler

app = Flask(__name__)
CORS(app)

@app.route('/')
def home():
return "Welcome to FlowFi!"

@app.route('/financialInsights', methods = ['POST'])
def extract_news():
# used to extract the news based on user preferences
data = request.json
preferences = data['preferences']
news = News()
news_data = news.get_everything(preferences)
return jsonify(news_data)

@app.route('/faqHandler', methods = ['POST'])
def faq_handler():
# used to access the FAQ chatbot
data = request.json
user_query = data['user_query']
chatbot = FAQChatBot()
response = chatbot.get_financial_insight(user_query)
return jsonify({"response": response})

@app.route('/triggerExcel', methods = ['POST'])
def trigger_excel():
# used to convert the excel file to json
excel = ExcelHandler()
data = excel.get_json()
return jsonify(data)

if __name__ == '__main__':
app.run(debug = True, port = 8080)
9 changes: 9 additions & 0 deletions flask_backend/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
flask
flask-cors
openai
numpy
pandas
newsapi-python
google-generativeai
xlrd
yfinance
Empty file added flask_backend/src/__init__.py
Empty file.
90 changes: 90 additions & 0 deletions flask_backend/src/excelhandler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import pandas as pd
import os

class ExcelHandler:
def __init__(self):
self.folder_path = "flask_backend/src/data/"
self.required_columns = ['date', 'description', 'withdrawals', 'deposits', 'balance']

def getFiles(self):
"""
Function to get the files from the folder
Inputs:
None
Outputs:
List of files
"""
files = os.listdir(self.folder_path)
files = [
os.path.join(self.folder_path, f) for f in files
if (f.endswith(".xlsx") or f.endswith(".xls")) and os.path.isfile(os.path.join(self.folder_path, f))
]
return files

def validateExcel(self, file):
"""
Function to validate the excel file
Inputs:
file -> str
Outputs:
boolean value
"""
data = pd.read_excel(file)
columns = data.columns
columns = [column.lower() for column in columns]
for column in self.required_columns:
if column not in columns:
return False
return True

def getData(self, file):
"""
Function to get the data from the excel file
Inputs:
file -> str
Outputs:
data -> dict
"""
data = pd.read_excel(file)
data.columns = [column.lower() for column in data.columns]
data = data[self.required_columns]
return data

def delete_files(self, folder_path):
"""
Function to delete the files from the folder
Inputs:
folder_path -> str
Outputs:
None
"""
files = os.listdir(folder_path)
for file in files:
os.remove(os.path.join(folder_path, file))

def get_json(self):
"""
Function to convert the excel file to json
Inputs:
None
Outputs:
json data
"""
files = self.getFiles()
data = pd.DataFrame()
incorrect = 0
for file in files:
if self.validateExcel(file):
data = pd.concat([data, self.getData(file)])
else:
incorrect += 1
if incorrect > 0:
print(f"{incorrect} files are incorrect")

data.drop_duplicates(inplace = True) # checking for multiple same entries
data.fillna(0, inplace = True) # filling the null values with 0
data = data.to_dict(orient = 'records')
self.delete_files(self.folder_path) # deleting the files after reading

return data

27 changes: 27 additions & 0 deletions flask_backend/src/faq_chatbot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from dotenv import load_dotenv
import os
import google.generativeai as genai

load_dotenv()

genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))

class FAQChatBot:
def __init__(self):
self.model = genai.GenerativeModel("gemini-1.5-flash")
self.chat = self.model.start_chat(history=[])
self.system_prompt = (
"You are a financial assistant. You will only answer questions related to finance, "
"including investment strategies, market trends, personal finance, budgeting, and "
"other financial topics. If a user asks about a non-financial topic, politely decline "
"to answer and redirect them to financial inquiries."
"The answer should be brief and concise enough and should be to the point."
"The response should give sustainable fintech solutions"
)

def get_financial_insight(self, user_query):
response = self.chat.send_message(user_query)

if hasattr(response, 'text'):
return response.text.strip()
return "Sorry, I couldn't understand your query. Please try again."
77 changes: 77 additions & 0 deletions flask_backend/src/news.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
from newsapi import NewsApiClient
import os
from dotenv import load_dotenv
from typing import List

load_dotenv()
key = os.getenv("NEWS_API")

class News:
def __init__(self):
self.key = key
self.newsapi = NewsApiClient(api_key=key)

# for getting the top headlines based on user preferences
def get_top_headlines(self, preferences: List[str]) -> List[dict]:
"""
Inputs:
List of preferences -> str
Outputs:
List of dictionaries containing the news data
"""
threshold = 2
if len(preferences) <= 2:
threshold = 5

required_data = []
for preference in preferences:
top_headlines = self.newsapi.get_top_headlines(
q=preference, language="en"
)
result = top_headlines["articles"]
cnt = 0
for each in result:
if cnt == threshold:
break
cnt += 1
required_data.append(
{
"author": each["author"],
"title": each["title"],
"description": each["description"],
"url": each["url"],
"urlToImage": each["urlToImage"],
}
)
return required_data

# for getting all the news based on user preferences
def get_everything(self, preferences: List[str]) -> List[dict]:
"""
Inputs:
List of preferences -> str
Outputs:
List of dictionaries containing the news data
"""
result = []
threshold = 5
for preference in preferences:
everything = self.newsapi.get_everything(language="en", q=preference)
required = everything["articles"]
cnt = 0

for each in required:
if cnt == threshold:
break
cnt += 1
result.append(
{
"author": each["author"],
"publishedAt": each["publishedAt"],
"title": each["title"],
"description": each["description"],
"url": each["url"],
"urlToImage": each["urlToImage"],
}
)
return result
18 changes: 18 additions & 0 deletions node/controller/faqController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const faqService = require("../service/faqService");

exports.handleFAQRequest = async(req, res) =>{
try {
const { user_query } = req.body;
// {{console.log(req.body)}}
if (!user_query) {
return res.status(400).json({ error: "User query is required" });
}

const response = await faqService.faqService(user_query);
res.status(200).json({ response });
} catch (error) {
res.status(500).json({ error: error.message });
}
}


Loading