File size: 1,942 Bytes
308b000
 
d1b1dae
d69f4fb
 
 
 
 
 
308b000
c1b42f1
d69f4fb
 
 
 
 
 
 
308b000
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c1b42f1
308b000
d7f7f8d
308b000
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import json
import pandas as pd
import os
from neo4j import GraphDatabase

#neo4j credentials
NEO4J_URI = os.environ.get("NEO4J_URI")
NEO4J_USER = os.environ.get("NEO4J_USER")
NEO4J_PASS = os.environ.get("NEO4J_PASS")

_driver=None

def get_driver():
    global _driver
    if _driver is None:
        _driver = GraphDatabase.driver(NEO4J_URI, auth=(NEO4J_USER, NEO4J_PASS))
    return _driver

#for adding bank name to the cards in the graph
eligibility_df = pd.read_csv("cards_eligibility_updated.csv")
card_to_bank = dict(zip(eligibility_df['Name'], eligibility_df['Bank']))

# Loading credit card data
df = pd.read_csv("credit_card_data_updated.csv")
card_descriptions = dict(zip(df["name"], df["description"]))

# Loading all 55 cards for comparison feature
df_all_cards = pd.read_csv("credit_card_data_updated.csv") 
all_card_names = df_all_cards["name"].tolist()
all_card_lookup = dict(zip(df_all_cards["name"], df_all_cards["description"]))
    
with open('for_graph_construction_(expanded labels).json') as f:
    card_feature_data = json.load(f)

card_features_lookup = {
    card['card_name']: set(card['features'])
    for card in card_feature_data
}


#function for the chatbot functionality
eligibility_lookup = {}
for _, row in eligibility_df.iterrows():
    card_name = row["Name"].strip()
    eligibility_info = f"""
        - Bank: {row['Bank']}
        - Age: {row['Minimum Age']} to {row['Maximum Age']}
        - Minimum Income: {row['Minimum Income (LPA)']} LPA
        - Minimum Credit Score: {row['Minimum Credit Score']}
        - Joining Fee: ₹{row['Joining fee']}
        - Annual Fee: ₹{row['Annual fee']}
    """
    eligibility_lookup[card_name] = eligibility_info.strip()

   
def get_all_features():
    with get_driver().session() as session:
        result = session.run("MATCH (f:Feature) RETURN f.name AS feature")
        return [record["feature"] for record in result]

features = get_all_features()