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