Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: #296 filter for PhD and post docs alongside advisors #23

Open
wants to merge 27 commits into
base: recent_collaborators
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e396c64
initial commit of recent-collabs builder
sbillinge Jan 3, 2020
a6b9851
now extracts people it finds in author list, but only if in people co…
sbillinge Jan 3, 2020
dd4d779
WIP working and returns set of folks in people coll
sbillinge Jan 3, 2020
54e3ee1
proper name parsing in recentcollabs builder
sbillinge Jan 5, 2020
49a105b
tweaking error handling in recent_collabs
sbillinge Jan 5, 2020
8799307
adding dateutil to requirements
sbillinge Jan 10, 2020
95eff79
ENH: add needed_dbs
dragonyanglong Feb 5, 2020
2e164af
MAINT: replace sbillinge with people argument
dragonyanglong Feb 5, 2020
68145d1
catch tbd months
sbillinge Feb 15, 2020
484abe5
more friendly fail when no person is specified
sbillinge Feb 16, 2020
5db5ea0
now extracts people it finds in author list, but only if in people co…
sbillinge Jan 3, 2020
a6bc4ba
people seems to be enforced as list in p3.8]
sbillinge Feb 17, 2020
71e55dc
test file
Feb 19, 2020
f2afba3
added coa_template.xlsx
Feb 19, 2020
b6fbe30
- added script coabuilder.py filling in excel template
Feb 20, 2020
900f02f
- removed the duplicate entries
Feb 21, 2020
4ca5487
added global variable NUM_MONTHS
Feb 21, 2020
abeadf0
requirements should have python-dateutil not just dateutil
sbillinge Mar 4, 2020
0b5677d
remove missing review-man test for test_builders. This should be in a…
sbillinge Mar 4, 2020
232b17a
changing tests so that recent collabs will run with scopatz as person
sbillinge Mar 4, 2020
c208195
added function filter for advisors and positions, status of last comm…
SaniHarouna-Mayer Mar 4, 2020
d29c162
add advisor to schema @ education and employment
SaniHarouna-Mayer Mar 4, 2020
73f3373
deleted duplicated function filter grants @tools.py
SaniHarouna-Mayer Mar 5, 2020
4f25ea5
in EXEMPLARS - add an advisor entry for one entry in employment and o…
SaniHarouna-Mayer Mar 5, 2020
1fe7cd2
add descripotion to advisor @employment & @education schema. descript…
SaniHarouna-Mayer Mar 5, 2020
c1b527b
update schema.py -> education and employment -> advisor -> descriptio…
SaniHarouna-Mayer Mar 16, 2020
100c5ea
update schema.py -> change key name advisor to mentor
SaniHarouna-Mayer Mar 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
proper name parsing in recentcollabs builder
sbillinge committed Mar 4, 2020

Verified

This commit was signed with the committer’s verified signature.
derekpierre Derek Pierre
commit 54e3ee131dbc05816b134e6a74955225896c464d
66 changes: 57 additions & 9 deletions regolith/builders/recentcollabsbuilder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Builder for publication lists."""
import os
import datetime as dt
from copy import copy
from dateutil.relativedelta import relativedelta

try:
@@ -32,6 +33,13 @@ def construct_global_ctx(self):
key=position_key,
reverse=True,
)
gtx["contacts"] = sorted(
all_docs_from_collection(rc.client, "contacts"),
key=position_key,
reverse=True,
)
gtx["institutions"] = all_docs_from_collection(rc.client,
"institutions")
gtx["citations"] = all_docs_from_collection(rc.client, "citations")
gtx["all_docs_from_collection"] = all_docs_from_collection

@@ -45,22 +53,62 @@ def latex(self):
reverse=True, bold=False)
my_collabs = []
for pub in pubs:
if is_since(pub.get("year"), since_date.year, pub.get("month", 1), since_date.month):
if is_since(pub.get("year"), since_date.year,
pub.get("month", 1), since_date.month):
if not pub.get("month"):
print("WARNING: {} is missing month".format(
pub["_id"]))
my_collabs.extend([collabs for collabs in
[names for names in
pub.get('author', [])]])
people = []
people, institutions = [], []
for collab in my_collabs:
people.append(fuzzy_retrieval(self.gtx["people"],
["name", "aka", "_id"], collab))
institutions = [places[0]["institution"] for places in
[person["education"] for person in people if person]]
ppl_names = [person["name"] for person in people if person]
# print(set([person["name"] for person in people if person]))
print(set([(person,institution) for person, institution in zip(ppl_names, institutions)]))
person = fuzzy_retrieval(all_docs_from_collection(
rc.client, "people"),
["name", "aka", "_id"],
collab)
if not person:
person = fuzzy_retrieval(all_docs_from_collection(
rc.client, "contacts"),
["name", "aka", "_id"], collab)
if not person:
print(
"WARNING: {} not found in contacts. Check aka".format(
collab))
else:
people.append(person)
inst = fuzzy_retrieval(all_docs_from_collection(
rc.client, "institutions"),
["name", "aka", "_id"],
person["institution"])
if inst:
institutions.append(inst["name"])
else:
institutions.append(
person.get("institution", "missing"))
print(
"WARNING: {} missing from institutions".format(
person["institution"]))
else:
people.append(person)
pinst = person.get("employment",
[{"organization": "missing"}])[
0]["organization"]
inst = fuzzy_retrieval(all_docs_from_collection(
rc.client, "institutions"), ["name", "aka", "_id"],
pinst)
if inst:
institutions.append(inst["name"])
else:
institutions.append(pinst)
print(
"WARNING: {} missing from institutions".format(
pinst))
ppl_names = [(person["name"], i) for
person, i in zip(people, institutions) if
person]
# print(set([person["name"] for person in people if person]))
print(set([person for person in ppl_names]))
emp = p.get("employment", [])
emp.sort(key=ene_date_key, reverse=True)
self.render(
2 changes: 1 addition & 1 deletion regolith/dates.py
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@
"dec.": 12,
"december": 12,
"": 1,
"tbd": 1,
"tbd": 1
}