parameterize the number of years to get profile info from, defaults to 3
@@ -1688,7 +1688,7 @@ def get_profile_info(profile):
'publications': publications
}
-def get_neurips_profile_info(profile):
+def get_neurips_profile_info(profile, n_years=3):
domains = set()
emails=set()
@@ -1696,17 +1696,19 @@ def get_neurips_profile_info(profile):
publications = set()
common_domains = ['gmail.com', 'qq.com', '126.com', '163.com',
'outlook.com', 'hotmail.com', 'yahoo.com', 'foxmail.com', 'aol.com', 'msn.com', 'ymail.com', 'googlemail.com', 'live.com']
+ curr_year = datetime.datetime.now().year
+ cut_off_year = curr_year - n_years - 1
- ## Institution section, get history within the last three years
+ ## Institution section, get history within the last n years
for h in profile.content.get('history', []):
- if h.get('end') is None or int(h.get('end')) > 2017:
+ if h.get('end') is None or int(h.get('end')) > cut_off_year:
domain = h.get('institution', {}).get('domain', '')
domains.update(openreview.tools.subdomains(domain))
- ## Relations section, get coauthor/coworker relations within the last three years + all the other relations
+ ## Relations section, get coauthor/coworker relations within the last n years + all the other relations
for r in profile.content.get('relations', []):
if r.get('relation', '') in ['Coauthor','Coworker']:
- if r.get('end') is None or int(r.get('end')) > 2017:
+ if r.get('end') is None or int(r.get('end')) > cut_off_year:
relations.add(r['email'])
else:
relations.add(r['email'])
@@ -1719,13 +1721,13 @@ def get_neurips_profile_info(profile):
for email in profile.content['emails']:
domains.update(openreview.tools.subdomains(email))
- ## Publications section: get publications within last three years
+ ## Publications section: get publications within last n years
for pub in profile.content.get('publications', []):
if pub.cdate:
year = int(datetime.datetime.fromtimestamp(pub.cdate/1000).year)
else:
year = int(datetime.datetime.fromtimestamp(pub.tcdate/1000).year)
- if year > 2017:
+ if year > cut_off_year:
publications.add(pub.id)
## Filter common domains
