-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.py
32 lines (25 loc) · 882 Bytes
/
utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import functools
import pandas
@functools.lru_cache()
def get_crossref_type_df():
"""
Return dataframe from Sci-Hub Coverage Study of Crossref Types
https://github.com/greenelab/scihub/issues/7
"""
url = "https://github.com/greenelab/scihub/raw/9280e4479fbe32a48d7c0f836b9292b0e4a5319c/data/crossref-types.tsv"
crossref_type_df = pandas.read_csv(url, sep='\t')
return crossref_type_df
def get_crossref_types():
"""
Return a set of Crossref Types to include in analysis.
"""
crossref_type_df = get_crossref_type_df()
return set(crossref_type_df.query("include == 1").type_id)
# Access status categories inferred from Unpaywall data
# Colors taken from https://doi.org/10.7717/peerj.4375/fig-2
access_categories_colors = {
'gold': '#D5BC2D',
'hybrid/bronze': '#A66B00',
'green': '#4AAB4E',
'closed': '#BBBBBB',
}