Update app.py
Browse files
app.py
CHANGED
@@ -60,33 +60,15 @@ narrator_bios['Generation'] = narrator_bios['Generation'].replace([None], [-1])
|
|
60 |
narrator_bios['Generation'] = narrator_bios['Generation'].astype(int)
|
61 |
|
62 |
|
63 |
-
|
64 |
node_info = narrator_bios[narrator_bios['Rawi ID'] == int(node)]
|
65 |
-
|
66 |
-
if
|
67 |
-
|
68 |
-
else
|
69 |
-
|
70 |
-
student_gen = node_info['Generation'].to_list()
|
71 |
-
if len(student_gen):
|
72 |
-
student_gen = student_gen[0]
|
73 |
-
else:
|
74 |
-
student_gen = -1
|
75 |
-
student_rank = node_info["Narrator Rank"].to_list()
|
76 |
-
if len(student_rank):
|
77 |
-
student_rank = student_rank[0]
|
78 |
-
else:
|
79 |
-
student_rank = 'ููุงู'
|
80 |
-
node_name = node_info['Famous Name'].to_list()
|
81 |
-
if len(node_name):
|
82 |
-
node_name = node_name[0]
|
83 |
-
else:
|
84 |
-
node_name = 'ููุงู'
|
85 |
return node_info,student_narrations,student_gen, student_rank, node_name
|
86 |
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
def network_narrator(narrator_id):
|
91 |
edge_narrator = edge_info[(edge_info['Teacher_ID'] == str(narrator_id)) | (edge_info['Student_ID'] == str(narrator_id))]
|
92 |
edge_full = edge_narrator[['Taraf Count', 'Hadith Count', 'Isnad Count', 'Source', 'Book Count', 'Destination']]
|
|
|
60 |
narrator_bios['Generation'] = narrator_bios['Generation'].astype(int)
|
61 |
|
62 |
|
63 |
+
def get_node_info(node):
|
64 |
node_info = narrator_bios[narrator_bios['Rawi ID'] == int(node)]
|
65 |
+
# Extract values with defaults, using `.iloc` if available, otherwise default
|
66 |
+
student_narrations = node_info['Number of Narrations'].iloc[0] if not node_info.empty else 1
|
67 |
+
student_gen = node_info['Generation'].iloc[0] if not node_info.empty else -1
|
68 |
+
student_rank = node_info['Narrator Rank'].iloc[0] if not node_info.empty else 'ููุงู'
|
69 |
+
node_name = node_info['Famous Name'].iloc[0] if not node_info.empty else 'ููุงู'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
return node_info,student_narrations,student_gen, student_rank, node_name
|
71 |
|
|
|
|
|
|
|
72 |
def network_narrator(narrator_id):
|
73 |
edge_narrator = edge_info[(edge_info['Teacher_ID'] == str(narrator_id)) | (edge_info['Student_ID'] == str(narrator_id))]
|
74 |
edge_full = edge_narrator[['Taraf Count', 'Hadith Count', 'Isnad Count', 'Source', 'Book Count', 'Destination']]
|