Esempio n. 1
0
 def latex(self):
     """Render latex template"""
     rc = self.rc
     for p in self.gtx['people']:
         names = frozenset(p.get('aka', []) + [p['name']])
         pubs = filter_publications(
             all_docs_from_collection(rc.client, 'citations'),
             names, reverse=True)
         bibfile = make_bibtex_file(pubs, pid=p['_id'],
                                    person_dir=self.bldir)
         emp = p.get('employment', [])
         emp.sort(key=ene_date_key, reverse=True)
         edu = p.get('education', [])
         edu.sort(key=ene_date_key, reverse=True)
         projs = filter_projects(
             all_docs_from_collection(rc.client, 'projects'), names)
         grants = list(all_docs_from_collection(rc.client, 'grants'))
         pi_grants, pi_amount, _ = filter_grants(grants, names, pi=True)
         coi_grants, coi_amount, coi_sub_amount = filter_grants(grants,
                                                                names,
                                                                pi=False)
         aghs = awards_grants_honors(p)
         self.render('cv.tex', p['_id'] + '.tex', p=p,
                     title=p.get('name', ''), aghs=aghs,
                     pubs=pubs, names=names, bibfile=bibfile,
                     education=edu, employment=emp, projects=projs,
                     pi_grants=pi_grants, pi_amount=pi_amount,
                     coi_grants=coi_grants, coi_amount=coi_amount,
                     coi_sub_amount=coi_sub_amount,
                     )
Esempio n. 2
0
    def latex(self):
        """Render latex template"""
        rc = self.rc
        if rc.people:
            people = [
                fuzzy_retrieval(self.gtx["people"], ["aka", "_id", "name"],
                                rc.people[0])
            ]
        else:
            people = self.gtx["people"]

        for p in people:
            names = frozenset(p.get("aka", []) + [p["name"]])
            pubs = filter_publications(
                all_docs_from_collection(rc.client, "citations"),
                names,
                reverse=True,
            )
            bibfile = make_bibtex_file(pubs,
                                       pid=p["_id"],
                                       person_dir=self.bldir)
            emp = p.get("employment", [])
            emp = [em for em in emp if not em.get("not_in_cv", False)]
            for e in emp:
                e['position'] = e.get('position_full',
                                      e.get('position').title())
            emp.sort(key=ene_date_key, reverse=True)
            edu = p.get("education", [])
            edu.sort(key=ene_date_key, reverse=True)
            projs = filter_projects(
                all_docs_from_collection(rc.client, "projects"), names)
            grants = list(all_docs_from_collection(rc.client, "grants"))
            proposals = list(all_docs_from_collection(rc.client, "proposals"))
            grants = merge_collections_superior(proposals, grants,
                                                "proposal_id")
            pi_grants, pi_amount, _ = filter_grants(grants, names, pi=True)
            coi_grants, coi_amount, coi_sub_amount = filter_grants(grants,
                                                                   names,
                                                                   pi=False)
            aghs = awards_grants_honors(p, "honors")
            self.render(
                "resume.tex",
                p["_id"] + ".tex",
                p=p,
                title=p.get("name", ""),
                aghs=aghs,
                pubs=pubs,
                names=names,
                bibfile=bibfile,
                education=edu,
                employment=emp,
                projects=projs,
                pi_grants=pi_grants,
                pi_amount=pi_amount,
                coi_grants=coi_grants,
                coi_amount=coi_amount,
                coi_sub_amount=coi_sub_amount,
            )
            self.pdf(p["_id"])
Esempio n. 3
0
    def latex(self):
        """Render latex template"""
        rc = self.rc
        for p in self.gtx["people"]:
            # so we don't modify the dbs when de-referencing
            names = frozenset(p.get("aka", []) + [p["name"]])
            pubs = filter_publications(
                all_docs_from_collection(rc.client, "citations"),
                names,
                reverse=True,
            )
            bibfile = make_bibtex_file(
                pubs, pid=p["_id"], person_dir=self.bldir
            )
            emp = p.get("employment", [])

            for e in emp:
                e['position'] = e.get('position_full', e.get('position').title())
            emp.sort(key=ene_date_key, reverse=True)
            edu = p.get("education", [])
            edu.sort(key=ene_date_key, reverse=True)
            teach = p.get("teaching", [])
            for t in teach:
                t['position'] = t.get('position').title()

            projs = filter_projects(
                all_docs_from_collection(rc.client, "projects"), names
            )
            grants = list(all_docs_from_collection(rc.client, "grants"))
            pi_grants, pi_amount, _ = filter_grants(grants, names, pi=True)
            coi_grants, coi_amount, coi_sub_amount = filter_grants(
                grants, names, pi=False
            )
            aghs = awards_grants_honors(p)
            # TODO: pull this out so we can use it everywhere
            for ee in [emp, edu]:
                for e in ee:
                    dereference_institution(e, self.gtx["institutions"])
            self.render(
                "cv.tex",
                p["_id"] + ".tex",
                p=p,
                title=p.get("name", ""),
                aghs=aghs,
                pubs=pubs,
                names=names,
                bibfile=bibfile,
                education=edu,
                employment=emp,
                projects=projs,
                pi_grants=pi_grants,
                pi_amount=pi_amount,
                coi_grants=coi_grants,
                coi_amount=coi_amount,
                coi_sub_amount=coi_sub_amount,
            )
            self.pdf(p["_id"])
Esempio n. 4
0
 def latex(self):
     """Render latex template"""
     rc = self.rc
     for p in self.gtx["people"]:
         names = frozenset(p.get("aka", []) + [p["name"]])
         pubs = filter_publications(
             all_docs_from_collection(rc.client, "citations"),
             names,
             reverse=True,
         )
         bibfile = make_bibtex_file(pubs,
                                    pid=p["_id"],
                                    person_dir=self.bldir)
         emp = p.get("employment", [])
         for e in emp:
             e['position'] = e.get('position_full',
                                   e.get('position').title())
         emp.sort(key=ene_date_key, reverse=True)
         edu = p.get("education", [])
         edu.sort(key=ene_date_key, reverse=True)
         projs = filter_projects(
             all_docs_from_collection(rc.client, "projects"), names)
         grants = list(all_docs_from_collection(rc.client, "grants"))
         pi_grants, pi_amount, _ = filter_grants(grants, names, pi=True)
         coi_grants, coi_amount, coi_sub_amount = filter_grants(grants,
                                                                names,
                                                                pi=False)
         aghs = awards_grants_honors(p)
         self.render(
             "resume.tex",
             p["_id"] + ".tex",
             p=p,
             title=p.get("name", ""),
             aghs=aghs,
             pubs=pubs,
             names=names,
             bibfile=bibfile,
             education=edu,
             employment=emp,
             projects=projs,
             pi_grants=pi_grants,
             pi_amount=pi_amount,
             coi_grants=coi_grants,
             coi_amount=coi_amount,
             coi_sub_amount=coi_sub_amount,
         )
         self.pdf(p["_id"])
Esempio n. 5
0
    def latex(self):
        """Render latex template"""
        rc = self.rc
        for p in self.gtx["people"]:
            # so we don't modify the dbs when de-referencing
            names = frozenset(p.get("aka", []) + [p["name"]] + [p["_id"]])
            begin_period = date(1650, 1, 1)

            pubs = filter_publications(
                all_docs_from_collection(rc.client, "citations"),
                names,
                reverse=True,
            )
            bibfile = make_bibtex_file(pubs,
                                       pid=p["_id"],
                                       person_dir=self.bldir)
            emp = p.get("employment", [])

            for e in emp:
                e['position'] = e.get('position_full',
                                      e.get('position').title())
            emp.sort(key=ene_date_key, reverse=True)
            edu = p.get("education", [])
            edu.sort(key=ene_date_key, reverse=True)
            teach = p.get("teaching", [])
            for t in teach:
                t['position'] = t.get('position').title()

            projs = filter_projects(
                all_docs_from_collection(rc.client, "projects"), names)
            just_grants = list(all_docs_from_collection(rc.client, "grants"))
            just_proposals = list(
                all_docs_from_collection(rc.client, "proposals"))
            grants = merge_collections_superior(just_proposals, just_grants,
                                                "proposal_id")
            presentations = filter_presentations(self.gtx["people"],
                                                 self.gtx["presentations"],
                                                 self.gtx["institutions"],
                                                 p.get("_id"),
                                                 statuses=["accepted"])

            for grant in grants:
                for member in grant.get("team"):
                    dereference_institution(member, self.gtx["institutions"])
            pi_grants, pi_amount, _ = filter_grants(grants, names, pi=True)
            coi_grants, coi_amount, coi_sub_amount = filter_grants(grants,
                                                                   names,
                                                                   pi=False)
            aghs = awards_grants_honors(p, "honors")
            service = awards_grants_honors(p, "service", funding=False)
            # TODO: pull this out so we can use it everywhere
            for ee in [emp, edu]:
                for e in ee:
                    dereference_institution(e, self.gtx["institutions"])

            undergrads = filter_employment_for_advisees(
                self.gtx["people"], begin_period, "undergrad")
            masters = filter_employment_for_advisees(self.gtx["people"],
                                                     begin_period, "ms")
            currents = filter_employment_for_advisees(self.gtx["people"],
                                                      begin_period, "phd")
            graduateds = filter_employment_for_advisees(
                self.gtx["people"], begin_period, "phd")
            postdocs = filter_employment_for_advisees(self.gtx["people"],
                                                      begin_period, "postdoc")
            visitors = filter_employment_for_advisees(self.gtx["people"],
                                                      begin_period,
                                                      "visitor-unsupported")
            iter = deepcopy(graduateds)
            for g in iter:
                if g.get("active"):
                    graduateds.remove(g)
            iter = deepcopy(currents)
            for g in iter:
                if not g.get("active"):
                    currents.remove(g)

            self.render(
                "cv.tex",
                p["_id"] + ".tex",
                p=p,
                title=p.get("name", ""),
                aghs=aghs,
                service=service,
                undergrads=undergrads,
                masters=masters,
                currentphds=currents,
                graduatedphds=graduateds,
                postdocs=postdocs,
                visitors=visitors,
                pubs=pubs,
                names=names,
                bibfile=bibfile,
                education=edu,
                employment=emp,
                presentations=presentations,
                sentencecase=sentencecase,
                monthstyle=month_fullnames,
                projects=projs,
                pi_grants=pi_grants,
                pi_amount=pi_amount,
                coi_grants=coi_grants,
                coi_amount=coi_amount,
                coi_sub_amount=coi_sub_amount,
            )
            self.pdf(p["_id"])
Esempio n. 6
0
def test_get_id_from_name(input, expected):
    assert (awards_grants_honors(input) == expected)