Commit
·
f7fa719
1
Parent(s):
7b589fe
Update Climate_site/python_scripts/paper_functions_own_details.py
Browse files
Climate_site/python_scripts/paper_functions_own_details.py
CHANGED
|
@@ -434,8 +434,9 @@ def main_authors( research_key_words , details , size):
|
|
| 434 |
dic_papers , dic_papers_ranked = ranking_own_research( research_key_words , details , False )
|
| 435 |
|
| 436 |
dic_papers_co_authors = {}
|
|
|
|
| 437 |
|
| 438 |
-
for paper in list(dic_papers_ranked.keys())
|
| 439 |
|
| 440 |
for k in range(len(dic_papers[paper]["authorships"])):
|
| 441 |
coauthor_id = dic_papers[paper]["authorships"][k]["author"]["id"]
|
|
@@ -467,9 +468,8 @@ def main_authors( research_key_words , details , size):
|
|
| 467 |
|
| 468 |
|
| 469 |
if dic_papers_co_authors != {}:
|
| 470 |
-
|
| 471 |
-
|
| 472 |
-
for author_name_norm in list(dic_papers_co_authors.keys())[:size]:
|
| 473 |
list_ids = dic_papers_co_authors[author_name_norm]["Author's id(s)"].split(", ")
|
| 474 |
work_count = 0
|
| 475 |
cited_by_count = 0
|
|
@@ -481,6 +481,11 @@ def main_authors( research_key_words , details , size):
|
|
| 481 |
data = get_data("https://api.openalex.org/people/" + elem)
|
| 482 |
work_count += data["works_count"]
|
| 483 |
cited_by_count += data["cited_by_count"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 484 |
if data["last_known_institution"] != None and data["last_known_institution"]["display_name"] != None:
|
| 485 |
if institutions == '':
|
| 486 |
institutions += data["last_known_institution"]["display_name"]
|
|
@@ -492,9 +497,13 @@ def main_authors( research_key_words , details , size):
|
|
| 492 |
dic_papers_co_authors[author_name_norm]["Last Known Institution"] = institutions
|
| 493 |
dic_papers_co_authors[author_name_norm]["Number of works"] = work_count
|
| 494 |
dic_papers_co_authors[author_name_norm]["Number of citations"] = cited_by_count
|
|
|
|
|
|
|
|
|
|
|
|
|
| 495 |
|
| 496 |
|
| 497 |
-
return pd.DataFrame(dic_papers_co_authors, index = [ "Author's name(s)" , "Author's id(s)" , "Number of occurence within the " + str(
|
| 498 |
|
| 499 |
else:
|
| 500 |
return ("Select another category")
|
|
|
|
| 434 |
dic_papers , dic_papers_ranked = ranking_own_research( research_key_words , details , False )
|
| 435 |
|
| 436 |
dic_papers_co_authors = {}
|
| 437 |
+
dic_papers_map = {}
|
| 438 |
|
| 439 |
+
for paper in list(dic_papers_ranked.keys()):
|
| 440 |
|
| 441 |
for k in range(len(dic_papers[paper]["authorships"])):
|
| 442 |
coauthor_id = dic_papers[paper]["authorships"][k]["author"]["id"]
|
|
|
|
| 468 |
|
| 469 |
|
| 470 |
if dic_papers_co_authors != {}:
|
| 471 |
+
|
| 472 |
+
for author_name_norm in list(dic_papers_co_authors.keys()):
|
|
|
|
| 473 |
list_ids = dic_papers_co_authors[author_name_norm]["Author's id(s)"].split(", ")
|
| 474 |
work_count = 0
|
| 475 |
cited_by_count = 0
|
|
|
|
| 481 |
data = get_data("https://api.openalex.org/people/" + elem)
|
| 482 |
work_count += data["works_count"]
|
| 483 |
cited_by_count += data["cited_by_count"]
|
| 484 |
+
|
| 485 |
+
institution_id = None
|
| 486 |
+
if data["last_known_institution"] != None and data["last_known_institution"]["id"] != None:
|
| 487 |
+
institution_id = data["last_known_institution"]["id"][21:]
|
| 488 |
+
|
| 489 |
if data["last_known_institution"] != None and data["last_known_institution"]["display_name"] != None:
|
| 490 |
if institutions == '':
|
| 491 |
institutions += data["last_known_institution"]["display_name"]
|
|
|
|
| 497 |
dic_papers_co_authors[author_name_norm]["Last Known Institution"] = institutions
|
| 498 |
dic_papers_co_authors[author_name_norm]["Number of works"] = work_count
|
| 499 |
dic_papers_co_authors[author_name_norm]["Number of citations"] = cited_by_count
|
| 500 |
+
dic_papers_co_authors[author_name_norm]["Institution_id"] = institution_id
|
| 501 |
+
|
| 502 |
+
|
| 503 |
+
dic_papers_co_authors = {k: v for k, v in sorted(dic_papers_co_authors.items(), key=lambda item: item[1]["Number of occurence within the " + str(200) + " most related papers"] , reverse = True)[:size]}
|
| 504 |
|
| 505 |
|
| 506 |
+
return pd.DataFrame(dic_papers_co_authors, index = [ "Author's name(s)" , "Author's id(s)" , "Number of occurence within the " + str(200) + " most related papers" , "Last Known Institution" , "Number of works" , "Number of citations" , "Number of related citations"]).T.style.hide(axis="index")
|
| 507 |
|
| 508 |
else:
|
| 509 |
return ("Select another category")
|