citation-map 0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- citation-map-0.1/LICENSE.md +9 -0
- citation-map-0.1/PKG-INFO +59 -0
- citation-map-0.1/README.md +43 -0
- citation-map-0.1/citation_map/__init__.py +4 -0
- citation-map-0.1/citation_map/citation_map.py +109 -0
- citation-map-0.1/citation_map.egg-info/PKG-INFO +59 -0
- citation-map-0.1/citation_map.egg-info/SOURCES.txt +10 -0
- citation-map-0.1/citation_map.egg-info/dependency_links.txt +1 -0
- citation-map-0.1/citation_map.egg-info/requires.txt +4 -0
- citation-map-0.1/citation_map.egg-info/top_level.txt +1 -0
- citation-map-0.1/setup.cfg +4 -0
- citation-map-0.1/setup.py +26 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Chen Liu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: citation-map
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: Google Scholar Citation World Map.
|
|
5
|
+
Home-page: https://github.com/ChenLiu-1996/CitationMap
|
|
6
|
+
Author: Chen Liu
|
|
7
|
+
Author-email: chen.liu.cl2482@yale.edu
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: citation map,citation world map,google scholar
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE.md
|
|
16
|
+
|
|
17
|
+
# Google Scholar Citation World Map
|
|
18
|
+
|
|
19
|
+
Chen Liu, CS PhD Candidate at Yale University
|
|
20
|
+
|
|
21
|
+
## Purpose
|
|
22
|
+
This is a simple Python tool to generate a HTML citation world map from your Google Scholar ID.
|
|
23
|
+
|
|
24
|
+
## Warning
|
|
25
|
+
1. This script is a bit slow. On my personal computer, it takes half a minute to process each citation. If you have thousands of citations, it may or may not be a good idea to use this script.
|
|
26
|
+
2. I tried to use multiprocessing, but unfortunately the excessive visits get me blocked by Google Scholar.
|
|
27
|
+
|
|
28
|
+
## Demo
|
|
29
|
+
<img src = "assets/citation_world_map.png" width=800>
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
1. Install the package.
|
|
33
|
+
```
|
|
34
|
+
pip install citation-map
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
2. Find your Google Scholar ID.
|
|
38
|
+
|
|
39
|
+
On your Google Scholar profile, the string `GOOGLE_SCHOLAR_ID` in the URL `https://scholar.google.com/citations?user=GOOGLE_SCHOLAR_ID` be will be your Google Scholar ID. Ignore the configuration strings such as `&hl=en` or `&view_op=list_works&sortby=pubdate`.
|
|
40
|
+
|
|
41
|
+
3. In an empty Python script, run the following.
|
|
42
|
+
```
|
|
43
|
+
from citation_map import citation_map_from_google_scholar_id
|
|
44
|
+
|
|
45
|
+
# This is my Google Scholar ID. Replace this with your ID.
|
|
46
|
+
scholar_id = "3rDjnykAAAAJ"
|
|
47
|
+
citation_map_from_google_scholar_id(scholar_id)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Dependencies
|
|
51
|
+
```
|
|
52
|
+
scholarly
|
|
53
|
+
geopy
|
|
54
|
+
folium
|
|
55
|
+
tqdm
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Acknowledgements
|
|
59
|
+
This script was written under the help of ChatGPT-4o, but of course after intense debugging.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Google Scholar Citation World Map
|
|
2
|
+
|
|
3
|
+
Chen Liu, CS PhD Candidate at Yale University
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
This is a simple Python tool to generate a HTML citation world map from your Google Scholar ID.
|
|
7
|
+
|
|
8
|
+
## Warning
|
|
9
|
+
1. This script is a bit slow. On my personal computer, it takes half a minute to process each citation. If you have thousands of citations, it may or may not be a good idea to use this script.
|
|
10
|
+
2. I tried to use multiprocessing, but unfortunately the excessive visits get me blocked by Google Scholar.
|
|
11
|
+
|
|
12
|
+
## Demo
|
|
13
|
+
<img src = "assets/citation_world_map.png" width=800>
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
1. Install the package.
|
|
17
|
+
```
|
|
18
|
+
pip install citation-map
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
2. Find your Google Scholar ID.
|
|
22
|
+
|
|
23
|
+
On your Google Scholar profile, the string `GOOGLE_SCHOLAR_ID` in the URL `https://scholar.google.com/citations?user=GOOGLE_SCHOLAR_ID` be will be your Google Scholar ID. Ignore the configuration strings such as `&hl=en` or `&view_op=list_works&sortby=pubdate`.
|
|
24
|
+
|
|
25
|
+
3. In an empty Python script, run the following.
|
|
26
|
+
```
|
|
27
|
+
from citation_map import citation_map_from_google_scholar_id
|
|
28
|
+
|
|
29
|
+
# This is my Google Scholar ID. Replace this with your ID.
|
|
30
|
+
scholar_id = "3rDjnykAAAAJ"
|
|
31
|
+
citation_map_from_google_scholar_id(scholar_id)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Dependencies
|
|
35
|
+
```
|
|
36
|
+
scholarly
|
|
37
|
+
geopy
|
|
38
|
+
folium
|
|
39
|
+
tqdm
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Acknowledgements
|
|
43
|
+
This script was written under the help of ChatGPT-4o, but of course after intense debugging.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
from scholarly import scholarly, ProxyGenerator
|
|
2
|
+
from geopy.geocoders import Nominatim
|
|
3
|
+
import folium
|
|
4
|
+
from tqdm import tqdm
|
|
5
|
+
import random
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def __fetch_google_scholar_profile(scholar_id):
|
|
9
|
+
'''
|
|
10
|
+
Step 1: Fetch Google Scholar Profile using Scholar ID
|
|
11
|
+
'''
|
|
12
|
+
author = scholarly.search_author_id(scholar_id)
|
|
13
|
+
author = scholarly.fill(author, sections=["publications"])
|
|
14
|
+
return author
|
|
15
|
+
|
|
16
|
+
def __parse_profile(author):
|
|
17
|
+
'''
|
|
18
|
+
Step 2: Parse the Profile and find citing author affiliations.
|
|
19
|
+
Without parallel processing.
|
|
20
|
+
'''
|
|
21
|
+
citation_locations = []
|
|
22
|
+
for pub in tqdm(author['publications']):
|
|
23
|
+
pub = scholarly.fill(pub)
|
|
24
|
+
if 'citedby_url' in pub:
|
|
25
|
+
citing_paper_obj = scholarly.citedby(pub)
|
|
26
|
+
citing_paper_list = [item for item in citing_paper_obj]
|
|
27
|
+
for citing_paper in tqdm(citing_paper_list):
|
|
28
|
+
if 'author_id' in citing_paper:
|
|
29
|
+
author_id_list = citing_paper['author_id']
|
|
30
|
+
author_id_list = [item for item in author_id_list if item] # Filter out empty author ids.
|
|
31
|
+
|
|
32
|
+
for author_id in author_id_list:
|
|
33
|
+
citing_author = scholarly.search_author_id(author_id)
|
|
34
|
+
citing_author = scholarly.fill(citing_author)
|
|
35
|
+
if 'affiliation' in citing_author:
|
|
36
|
+
citation_locations.append(citing_author['affiliation'])
|
|
37
|
+
return citation_locations
|
|
38
|
+
|
|
39
|
+
def __geocode_locations(locations):
|
|
40
|
+
'''
|
|
41
|
+
Step 3: Convert locations in plain text to Geocode.
|
|
42
|
+
'''
|
|
43
|
+
geolocator = Nominatim(user_agent="citation_mapper")
|
|
44
|
+
coordinates = []
|
|
45
|
+
for location in locations:
|
|
46
|
+
try:
|
|
47
|
+
geo_location = geolocator.geocode(location)
|
|
48
|
+
if geo_location:
|
|
49
|
+
coordinates.append((geo_location.latitude, geo_location.longitude, location))
|
|
50
|
+
except Exception as e:
|
|
51
|
+
print(f"Error geocoding location {location}: {e}")
|
|
52
|
+
return coordinates
|
|
53
|
+
|
|
54
|
+
def __create_map(coordinates):
|
|
55
|
+
'''
|
|
56
|
+
Step 4: Create the Map.
|
|
57
|
+
'''
|
|
58
|
+
# citation_map = folium.Map(location=[20, 0], zoom_start=2)
|
|
59
|
+
# for lat, lon, location in coordinates:
|
|
60
|
+
# folium.Marker([lat, lon], popup=location).add_to(citation_map)
|
|
61
|
+
# return citation_map
|
|
62
|
+
citation_map = folium.Map(location=[20, 0], zoom_start=2)
|
|
63
|
+
colors = ['red', 'blue', 'green', 'purple', 'orange', 'darkred',
|
|
64
|
+
'lightred', 'beige', 'darkblue', 'darkgreen', 'cadetblue',
|
|
65
|
+
'darkpurple', 'white', 'pink', 'lightblue', 'lightgreen',
|
|
66
|
+
'gray', 'black', 'lightgray']
|
|
67
|
+
for lat, lon, location in coordinates:
|
|
68
|
+
color = random.choice(colors)
|
|
69
|
+
folium.Marker([lat, lon], popup=location, icon=folium.Icon(color=color)).add_to(citation_map)
|
|
70
|
+
return citation_map
|
|
71
|
+
|
|
72
|
+
def citation_map_from_google_scholar_id(scholar_id: str,
|
|
73
|
+
use_proxy: bool = False):
|
|
74
|
+
'''
|
|
75
|
+
Google Scholar Citation World Map.
|
|
76
|
+
|
|
77
|
+
----
|
|
78
|
+
scholar_id: str
|
|
79
|
+
Your Google Scholar ID.
|
|
80
|
+
use_proxy: bool
|
|
81
|
+
If true, we will use a scholarly proxy.
|
|
82
|
+
It is necessary for some environments to avoid blocks, but it usually makes things slower.
|
|
83
|
+
|
|
84
|
+
'''
|
|
85
|
+
|
|
86
|
+
if use_proxy:
|
|
87
|
+
pg = ProxyGenerator()
|
|
88
|
+
pg.FreeProxies()
|
|
89
|
+
scholarly.use_proxy(pg)
|
|
90
|
+
print('Proxy used.')
|
|
91
|
+
|
|
92
|
+
author = __fetch_google_scholar_profile(scholar_id)
|
|
93
|
+
print('Author profile found, with %d publications.' % len(author['publications']))
|
|
94
|
+
|
|
95
|
+
locations = __parse_profile(author)
|
|
96
|
+
print('A total of %d citation locations recorded.' % len(locations))
|
|
97
|
+
|
|
98
|
+
coordinates = __geocode_locations(locations)
|
|
99
|
+
print('Converted the locations to Geocodes.')
|
|
100
|
+
|
|
101
|
+
citation_map = __create_map(coordinates)
|
|
102
|
+
citation_map.save('citation_map.html')
|
|
103
|
+
print("Map created and saved as citation_map.html")
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
if __name__ == "__main__":
|
|
107
|
+
# Replace this with your Google Scholar ID.
|
|
108
|
+
scholar_id = "3rDjnykAAAAJ"
|
|
109
|
+
citation_map_from_google_scholar_id(scholar_id, use_proxy=False)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: citation-map
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: Google Scholar Citation World Map.
|
|
5
|
+
Home-page: https://github.com/ChenLiu-1996/CitationMap
|
|
6
|
+
Author: Chen Liu
|
|
7
|
+
Author-email: chen.liu.cl2482@yale.edu
|
|
8
|
+
License: MIT
|
|
9
|
+
Keywords: citation map,citation world map,google scholar
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE.md
|
|
16
|
+
|
|
17
|
+
# Google Scholar Citation World Map
|
|
18
|
+
|
|
19
|
+
Chen Liu, CS PhD Candidate at Yale University
|
|
20
|
+
|
|
21
|
+
## Purpose
|
|
22
|
+
This is a simple Python tool to generate a HTML citation world map from your Google Scholar ID.
|
|
23
|
+
|
|
24
|
+
## Warning
|
|
25
|
+
1. This script is a bit slow. On my personal computer, it takes half a minute to process each citation. If you have thousands of citations, it may or may not be a good idea to use this script.
|
|
26
|
+
2. I tried to use multiprocessing, but unfortunately the excessive visits get me blocked by Google Scholar.
|
|
27
|
+
|
|
28
|
+
## Demo
|
|
29
|
+
<img src = "assets/citation_world_map.png" width=800>
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
1. Install the package.
|
|
33
|
+
```
|
|
34
|
+
pip install citation-map
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
2. Find your Google Scholar ID.
|
|
38
|
+
|
|
39
|
+
On your Google Scholar profile, the string `GOOGLE_SCHOLAR_ID` in the URL `https://scholar.google.com/citations?user=GOOGLE_SCHOLAR_ID` be will be your Google Scholar ID. Ignore the configuration strings such as `&hl=en` or `&view_op=list_works&sortby=pubdate`.
|
|
40
|
+
|
|
41
|
+
3. In an empty Python script, run the following.
|
|
42
|
+
```
|
|
43
|
+
from citation_map import citation_map_from_google_scholar_id
|
|
44
|
+
|
|
45
|
+
# This is my Google Scholar ID. Replace this with your ID.
|
|
46
|
+
scholar_id = "3rDjnykAAAAJ"
|
|
47
|
+
citation_map_from_google_scholar_id(scholar_id)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Dependencies
|
|
51
|
+
```
|
|
52
|
+
scholarly
|
|
53
|
+
geopy
|
|
54
|
+
folium
|
|
55
|
+
tqdm
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Acknowledgements
|
|
59
|
+
This script was written under the help of ChatGPT-4o, but of course after intense debugging.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
LICENSE.md
|
|
2
|
+
README.md
|
|
3
|
+
setup.py
|
|
4
|
+
citation_map/__init__.py
|
|
5
|
+
citation_map/citation_map.py
|
|
6
|
+
citation_map.egg-info/PKG-INFO
|
|
7
|
+
citation_map.egg-info/SOURCES.txt
|
|
8
|
+
citation_map.egg-info/dependency_links.txt
|
|
9
|
+
citation_map.egg-info/requires.txt
|
|
10
|
+
citation_map.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
citation_map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from setuptools import setup
|
|
2
|
+
|
|
3
|
+
with open('README.md') as f:
|
|
4
|
+
long_description = f.read()
|
|
5
|
+
|
|
6
|
+
setup(
|
|
7
|
+
name='citation-map',
|
|
8
|
+
version='0.1',
|
|
9
|
+
license='MIT',
|
|
10
|
+
author='Chen Liu',
|
|
11
|
+
author_email='chen.liu.cl2482@yale.edu',
|
|
12
|
+
packages={'citation_map'},
|
|
13
|
+
# package_dir={'': ''},
|
|
14
|
+
description='Google Scholar Citation World Map.',
|
|
15
|
+
long_description=long_description,
|
|
16
|
+
long_description_content_type='text/markdown',
|
|
17
|
+
url='https://github.com/ChenLiu-1996/CitationMap',
|
|
18
|
+
keywords='citation map, citation world map, google scholar',
|
|
19
|
+
install_requires=['scholarly', 'geopy', 'folium', 'tqdm'],
|
|
20
|
+
classifiers=[
|
|
21
|
+
'Development Status :: 3 - Alpha', # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
|
|
22
|
+
'Intended Audience :: Developers', # Define that your audience are developers
|
|
23
|
+
'License :: OSI Approved :: MIT License', # Again, pick a license
|
|
24
|
+
'Programming Language :: Python :: 3', #Specify which pyhton versions that you want to support
|
|
25
|
+
],
|
|
26
|
+
)
|