Update data.py
Browse files
data.py
CHANGED
|
@@ -1,15 +1,8 @@
|
|
| 1 |
import json
|
| 2 |
import pandas as pd
|
| 3 |
-
from
|
| 4 |
|
| 5 |
-
_driver
|
| 6 |
-
|
| 7 |
-
def get_driver():
|
| 8 |
-
global _driver
|
| 9 |
-
if _driver is None:
|
| 10 |
-
_driver = GraphDatabase.driver(NEO4J_URI, auth=(NEO4J_USER, NEO4J_PASS))
|
| 11 |
-
return _driver
|
| 12 |
-
|
| 13 |
#for adding bank name to the cards in the graph
|
| 14 |
eligibility_df = pd.read_csv("cards_eligibility_updated.csv")
|
| 15 |
card_to_bank = dict(zip(eligibility_df['Name'], eligibility_df['Bank']))
|
|
@@ -46,10 +39,10 @@ for _, row in eligibility_df.iterrows():
|
|
| 46 |
"""
|
| 47 |
eligibility_lookup[card_name] = eligibility_info.strip()
|
| 48 |
|
|
|
|
| 49 |
def get_all_features():
|
| 50 |
with get_driver().session() as session:
|
| 51 |
result = session.run("MATCH (f:Feature) RETURN f.name AS feature")
|
| 52 |
return [record["feature"] for record in result]
|
| 53 |
|
| 54 |
features = get_all_features()
|
| 55 |
-
|
|
|
|
| 1 |
import json
|
| 2 |
import pandas as pd
|
| 3 |
+
from recommender.graph_retrieval_vectordb import NEO4J_PASS,NEO4J_URI,NEO4J_USER,get_driver
|
| 4 |
|
| 5 |
+
_driver=None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
#for adding bank name to the cards in the graph
|
| 7 |
eligibility_df = pd.read_csv("cards_eligibility_updated.csv")
|
| 8 |
card_to_bank = dict(zip(eligibility_df['Name'], eligibility_df['Bank']))
|
|
|
|
| 39 |
"""
|
| 40 |
eligibility_lookup[card_name] = eligibility_info.strip()
|
| 41 |
|
| 42 |
+
|
| 43 |
def get_all_features():
|
| 44 |
with get_driver().session() as session:
|
| 45 |
result = session.run("MATCH (f:Feature) RETURN f.name AS feature")
|
| 46 |
return [record["feature"] for record in result]
|
| 47 |
|
| 48 |
features = get_all_features()
|
|
|