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: Regolith Grant Report Builder #523

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
2 changes: 2 additions & 0 deletions regolith/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from regolith.builders.coabuilder import RecentCollaboratorsBuilder
from regolith.builders.beamplanbuilder import BeamPlanBuilder
from regolith.builders.activitylogbuilder import ActivitylogBuilder
from regolith.builders.proposalreportbuilder import PropReportBuilder


BUILDERS = {
Expand All @@ -34,6 +35,7 @@
"resume": ResumeBuilder,
"review-man": ManRevBuilder,
"review-prop": PropRevBuilder,
"propreport": PropReportBuilder
}


Expand Down
42 changes: 42 additions & 0 deletions regolith/builders/proposalreportbuilder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""Builder for Proposal Reivews."""
import datetime
import time
from nameparser import HumanName

from regolith.builders.basebuilder import LatexBuilderBase
from regolith.dates import month_to_int
from regolith.fsclient import _id_key
from regolith.sorters import position_key
from regolith.tools import (
all_docs_from_collection,
filter_grants,
fuzzy_retrieval,
)


class PropReportBuilder(LatexBuilderBase):
"""Build a proposal review from database entries"""
btype = "propreport"
needed_dbs = ['presentations', 'projecta', 'people']

def construct_global_ctx(self):
"""Constructs the global context"""
super().construct_global_ctx()
gtx = self.gtx
rc = self.rc
gtx["projecta"] = sorted(
all_docs_from_collection(rc.client, "projecta"), key=_id_key
)
gtx["people"] = sorted(
all_docs_from_collection(rc.client, "people"), key=_id_key
)
gtx["presentations"] = sorted(
all_docs_from_collection(rc.client, "presentations"), key=_id_key
)
gtx["all_docs_from_collection"] = all_docs_from_collection
gtx["float"] = float
gtx["str"] = str
gtx["zip"] = zip

def latex(self):
"""Render latex template"""