citation-map 3.2__tar.gz → 3.4__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.
@@ -1,15 +1,15 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: citation-map
3
- Version: 3.2
3
+ Version: 3.4
4
4
  Summary: A simple tool to generate your Google Scholar citation world map.
5
5
  Home-page: https://github.com/ChenLiu-1996/CitationMap
6
6
  Author: Chen Liu
7
7
  Author-email: chen.liu.cl2482@yale.edu
8
- License: MIT
8
+ License: Apache 2.0
9
9
  Keywords: citation map,citation world map,google scholar
10
10
  Classifier: Development Status :: 3 - Alpha
11
11
  Classifier: Intended Audience :: Developers
12
- Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
13
  Classifier: Programming Language :: Python :: 3
14
14
  Description-Content-Type: text/markdown
15
15
  License-File: LICENSE.md
@@ -17,7 +17,6 @@ License-File: LICENSE.md
17
17
  # Google Scholar Citation World Map
18
18
 
19
19
  [![Latest PyPI version](https://img.shields.io/pypi/v/citation-map.svg)](https://pypi.org/project/citation-map/)
20
- [![PyPI license](https://img.shields.io/pypi/l/citation-map.svg)](https://pypi.python.org/pypi/citation-map/)
21
20
  [![PyPI download month](https://img.shields.io/pypi/dm/citation-map.svg)](https://pypi.python.org/pypi/citation-map/)
22
21
  [![PyPI download day](https://img.shields.io/pypi/dd/citation-map.svg)](https://pypi.python.org/pypi/citation-map/)
23
22
  [![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/)
@@ -32,6 +31,8 @@ This is a simple Python tool to generate an HTML citation world map from your Go
32
31
 
33
32
  It is easy to install (`pip install citation-map`, available on [PyPI](https://pypi.org/project/citation-map/)) and easy to use (see the [Usage](https://github.com/ChenLiu-1996/CitationMap?tab=readme-ov-file#usage) section).
34
33
 
34
+ **You don't need to fork this repo unless you want to make custom changes.**
35
+
35
36
  ## Expected Outcome
36
37
  You will be given an HTML file as the output of the script.
37
38
 
@@ -45,6 +46,10 @@ If you open it on a browser, you will see your own version of the following cita
45
46
  ```
46
47
  pip install citation-map
47
48
  ```
49
+ Remember to upgrade to the latest version if you installed an earlier version.
50
+ ```
51
+ pip install citation-map --upgrade
52
+ ```
48
53
 
49
54
  2. Find your Google Scholar ID.
50
55
 
@@ -86,6 +91,13 @@ If you open it on a browser, you will see your own version of the following cita
86
91
  If true, print the list of citing institutions (affiliations of citing authors).
87
92
  ```
88
93
 
94
+ ## Debug
95
+ 1. `scholarly._proxy_generator.MaxTriesExceededException`
96
+
97
+ - From my experience, this is a good indicator that your IP address is blocked by Google Scholar due to excessive or frequent crawling (using the `scholarly` package).
98
+ - One hot fix I found was to hop on a University VPN and run again. I typically experience this error after running the tool twice, and I need to disconnect and reconnect my VPN to "unblock" myself.
99
+ - In case changing your IP address does not help, you can try to reduce the number of processes (e.g., setting `num_processes=1`).
100
+
89
101
  ## Changelog
90
102
 
91
103
  ### Version 3.0
@@ -1,23 +1,6 @@
1
- Metadata-Version: 2.1
2
- Name: citation-map
3
- Version: 3.2
4
- Summary: A simple tool to generate your 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
1
  # Google Scholar Citation World Map
18
2
 
19
3
  [![Latest PyPI version](https://img.shields.io/pypi/v/citation-map.svg)](https://pypi.org/project/citation-map/)
20
- [![PyPI license](https://img.shields.io/pypi/l/citation-map.svg)](https://pypi.python.org/pypi/citation-map/)
21
4
  [![PyPI download month](https://img.shields.io/pypi/dm/citation-map.svg)](https://pypi.python.org/pypi/citation-map/)
22
5
  [![PyPI download day](https://img.shields.io/pypi/dd/citation-map.svg)](https://pypi.python.org/pypi/citation-map/)
23
6
  [![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/)
@@ -32,6 +15,8 @@ This is a simple Python tool to generate an HTML citation world map from your Go
32
15
 
33
16
  It is easy to install (`pip install citation-map`, available on [PyPI](https://pypi.org/project/citation-map/)) and easy to use (see the [Usage](https://github.com/ChenLiu-1996/CitationMap?tab=readme-ov-file#usage) section).
34
17
 
18
+ **You don't need to fork this repo unless you want to make custom changes.**
19
+
35
20
  ## Expected Outcome
36
21
  You will be given an HTML file as the output of the script.
37
22
 
@@ -45,6 +30,10 @@ If you open it on a browser, you will see your own version of the following cita
45
30
  ```
46
31
  pip install citation-map
47
32
  ```
33
+ Remember to upgrade to the latest version if you installed an earlier version.
34
+ ```
35
+ pip install citation-map --upgrade
36
+ ```
48
37
 
49
38
  2. Find your Google Scholar ID.
50
39
 
@@ -86,6 +75,13 @@ If you open it on a browser, you will see your own version of the following cita
86
75
  If true, print the list of citing institutions (affiliations of citing authors).
87
76
  ```
88
77
 
78
+ ## Debug
79
+ 1. `scholarly._proxy_generator.MaxTriesExceededException`
80
+
81
+ - From my experience, this is a good indicator that your IP address is blocked by Google Scholar due to excessive or frequent crawling (using the `scholarly` package).
82
+ - One hot fix I found was to hop on a University VPN and run again. I typically experience this error after running the tool twice, and I need to disconnect and reconnect my VPN to "unblock" myself.
83
+ - In case changing your IP address does not help, you can try to reduce the number of processes (e.g., setting `num_processes=1`).
84
+
89
85
  ## Changelog
90
86
 
91
87
  ### Version 3.0
@@ -23,31 +23,50 @@ def find_all_citing_institutions(publications, num_processes: int = 16) -> List[
23
23
  '''
24
24
  Step 2. Final all citing institutions (i.e., insitutions of citing authors).
25
25
  '''
26
- # Fetch metadata for all publications, in parallel.
27
- with Pool(processes=num_processes) as pool:
28
- all_publications = list(tqdm(pool.imap(__fill_publication_metadata, publications),
29
- desc='Filling metadata for all publications...',
30
- total=len(publications)))
31
-
32
- # Find all citing papers from all publications, in parallel.
33
- with Pool(processes=num_processes) as pool:
34
- all_citing_papers_nested = list(tqdm(pool.imap(__citing_papers_from_publication, all_publications),
35
- desc='Finding all citations...',
36
- total=len(all_publications)))
37
- all_citing_papers = list(itertools.chain(*all_citing_papers_nested))
38
-
39
- # Find all citing authors from all citing papers, in parallel.
40
- with Pool(processes=num_processes) as pool:
41
- all_citing_authors_nested = list(tqdm(pool.imap(__authors_from_papers, all_citing_papers),
42
- desc='Finding all citing authors...',
43
- total=len(all_citing_papers)))
44
- all_citing_authors = list(itertools.chain(*all_citing_authors_nested))
45
-
46
- # Find all citing insitutions from all citing authors, in parallel.
47
- with Pool(processes=num_processes) as pool:
48
- author_institution_tuple_list = list(tqdm(pool.imap(__institutions_from_authors, all_citing_authors),
49
- desc='Finding all citing institutions...',
50
- total=len(all_citing_authors)))
26
+ if num_processes > 1 and isinstance(num_processes, int):
27
+ # Fetch metadata for all publications, in parallel.
28
+ with Pool(processes=num_processes) as pool:
29
+ all_publications = list(tqdm(pool.imap(__fill_publication_metadata, publications),
30
+ desc='Filling metadata for all publications...',
31
+ total=len(publications)))
32
+
33
+ # Find all citing papers from all publications, in parallel.
34
+ with Pool(processes=num_processes) as pool:
35
+ all_citing_papers_nested = list(tqdm(pool.imap(__citing_papers_from_publication, all_publications),
36
+ desc='Finding all citations...',
37
+ total=len(all_publications)))
38
+ all_citing_papers = list(itertools.chain(*all_citing_papers_nested))
39
+
40
+ # Find all citing authors from all citing papers, in parallel.
41
+ with Pool(processes=num_processes) as pool:
42
+ all_citing_authors_nested = list(tqdm(pool.imap(__authors_from_papers, all_citing_papers),
43
+ desc='Finding all citing authors...',
44
+ total=len(all_citing_papers)))
45
+ all_citing_authors = list(itertools.chain(*all_citing_authors_nested))
46
+
47
+ # Find all citing insitutions from all citing authors, in parallel.
48
+ with Pool(processes=num_processes) as pool:
49
+ author_institution_tuple_list = list(tqdm(pool.imap(__institutions_from_authors, all_citing_authors),
50
+ desc='Finding all citing institutions...',
51
+ total=len(all_citing_authors)))
52
+ else:
53
+ all_publications = []
54
+ for pub in tqdm(publications, desc='Filling metadata for all publications...', total=len(publications)):
55
+ all_publications.append(__fill_publication_metadata(pub))
56
+
57
+ all_citing_papers_nested = []
58
+ for pub in tqdm(all_publications, desc='Finding all citations...', total=len(all_publications)):
59
+ all_citing_papers_nested.append(__citing_papers_from_publication(pub))
60
+ all_citing_papers = list(itertools.chain(*all_citing_papers_nested))
61
+
62
+ all_citing_authors_nested = []
63
+ for paper in tqdm(all_citing_papers, desc='Finding all citing authors...', total=len(all_citing_papers)):
64
+ all_citing_authors_nested.append(__authors_from_papers(paper))
65
+ all_citing_authors = list(itertools.chain(*all_citing_authors_nested))
66
+
67
+ author_institution_tuple_list = []
68
+ for author in tqdm(all_citing_authors, desc='Finding all citing institutions...', total=len(all_citing_authors)):
69
+ author_institution_tuple_list.append(__institutions_from_authors(author))
51
70
 
52
71
  return author_institution_tuple_list
53
72
 
@@ -76,10 +95,18 @@ def institution_text_to_geocode(author_institution_tuple_list: List[Tuple[str]],
76
95
  '''
77
96
  Step 4: Convert institutions in plain text to Geocode.
78
97
  '''
79
- with Pool(processes=num_processes) as pool:
80
- coordinates = list(tqdm(pool.imap(__text_to_geocode, author_institution_tuple_list),
81
- desc='Finding all geographic coordinates...',
82
- total=len(author_institution_tuple_list)))
98
+ if num_processes > 1 and isinstance(num_processes, int):
99
+ with Pool(processes=num_processes) as pool:
100
+ coordinates = list(tqdm(pool.imap(__text_to_geocode, author_institution_tuple_list),
101
+ desc='Finding all geographic coordinates...',
102
+ total=len(author_institution_tuple_list)))
103
+ else:
104
+ coordinates = []
105
+ for author_institution_tuple in tqdm(author_institution_tuple_list,
106
+ desc='Finding all geographic coordinates...',
107
+ total=len(author_institution_tuple_list)):
108
+ coordinates.append(__text_to_geocode(author_institution_tuple))
109
+
83
110
  coordinates = [item for item in coordinates if item is not None] # Filter out empty coordinates.
84
111
  return coordinates
85
112
 
@@ -107,8 +134,9 @@ def __fill_publication_metadata(pub):
107
134
 
108
135
  def __citing_papers_from_publication(pub):
109
136
  if 'citedby_url' in pub:
110
- time.sleep(random.uniform(1, 5)) # Random delay to reduce risk of being blocked.
137
+ # time.sleep(random.uniform(1, 5)) # Random delay to reduce risk of being blocked.
111
138
  citing_paper_obj = scholarly.citedby(pub)
139
+ # time.sleep(random.uniform(1, 5)) # Random delay to reduce risk of being blocked.
112
140
  return [item for item in citing_paper_obj]
113
141
  return []
114
142
 
@@ -193,7 +221,7 @@ def generate_citation_map(scholar_id: str,
193
221
  for item in sorted(cleaned_author_institution_tuple_list):
194
222
  print(item)
195
223
 
196
- coordinates = institution_text_to_geocode(author_institution_tuple_list + cleaned_author_institution_tuple_list)
224
+ coordinates = institution_text_to_geocode(author_institution_tuple_list + cleaned_author_institution_tuple_list, num_processes=num_processes)
197
225
  print('\nConverted the institutions to Geocodes.')
198
226
 
199
227
  citation_map = create_map(coordinates, pin_colorful=pin_colorful)
@@ -1,7 +1,22 @@
1
+ Metadata-Version: 2.1
2
+ Name: citation-map
3
+ Version: 3.4
4
+ Summary: A simple tool to generate your 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: Apache 2.0
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 :: Apache Software License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE.md
16
+
1
17
  # Google Scholar Citation World Map
2
18
 
3
19
  [![Latest PyPI version](https://img.shields.io/pypi/v/citation-map.svg)](https://pypi.org/project/citation-map/)
4
- [![PyPI license](https://img.shields.io/pypi/l/citation-map.svg)](https://pypi.python.org/pypi/citation-map/)
5
20
  [![PyPI download month](https://img.shields.io/pypi/dm/citation-map.svg)](https://pypi.python.org/pypi/citation-map/)
6
21
  [![PyPI download day](https://img.shields.io/pypi/dd/citation-map.svg)](https://pypi.python.org/pypi/citation-map/)
7
22
  [![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/)
@@ -16,6 +31,8 @@ This is a simple Python tool to generate an HTML citation world map from your Go
16
31
 
17
32
  It is easy to install (`pip install citation-map`, available on [PyPI](https://pypi.org/project/citation-map/)) and easy to use (see the [Usage](https://github.com/ChenLiu-1996/CitationMap?tab=readme-ov-file#usage) section).
18
33
 
34
+ **You don't need to fork this repo unless you want to make custom changes.**
35
+
19
36
  ## Expected Outcome
20
37
  You will be given an HTML file as the output of the script.
21
38
 
@@ -29,6 +46,10 @@ If you open it on a browser, you will see your own version of the following cita
29
46
  ```
30
47
  pip install citation-map
31
48
  ```
49
+ Remember to upgrade to the latest version if you installed an earlier version.
50
+ ```
51
+ pip install citation-map --upgrade
52
+ ```
32
53
 
33
54
  2. Find your Google Scholar ID.
34
55
 
@@ -70,6 +91,13 @@ If you open it on a browser, you will see your own version of the following cita
70
91
  If true, print the list of citing institutions (affiliations of citing authors).
71
92
  ```
72
93
 
94
+ ## Debug
95
+ 1. `scholarly._proxy_generator.MaxTriesExceededException`
96
+
97
+ - From my experience, this is a good indicator that your IP address is blocked by Google Scholar due to excessive or frequent crawling (using the `scholarly` package).
98
+ - One hot fix I found was to hop on a University VPN and run again. I typically experience this error after running the tool twice, and I need to disconnect and reconnect my VPN to "unblock" myself.
99
+ - In case changing your IP address does not help, you can try to reduce the number of processes (e.g., setting `num_processes=1`).
100
+
73
101
  ## Changelog
74
102
 
75
103
  ### Version 3.0
@@ -5,8 +5,8 @@ with open('README.md') as f:
5
5
 
6
6
  setup(
7
7
  name='citation-map',
8
- version='3.2',
9
- license='MIT',
8
+ version='3.4',
9
+ license='Apache 2.0',
10
10
  author='Chen Liu',
11
11
  author_email='chen.liu.cl2482@yale.edu',
12
12
  packages={'citation_map'},
@@ -20,7 +20,7 @@ setup(
20
20
  classifiers=[
21
21
  'Development Status :: 3 - Alpha', # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
22
22
  'Intended Audience :: Developers', # Define that your audience are developers
23
- 'License :: OSI Approved :: MIT License', # Again, pick a license
23
+ 'License :: OSI Approved :: Apache Software License', # Again, pick a license
24
24
  'Programming Language :: Python :: 3', #Specify which pyhton versions that you want to support
25
25
  ],
26
26
  )
File without changes
File without changes