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
34 changes: 25 additions & 9 deletions regolith/builders/grantreportbuilder.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Builder for Proposal Reviews."""
from datetime import datetime, date
import datetime
import time
from nameparser import HumanName

Expand All @@ -15,6 +15,13 @@
)


def subparser(subpi):
subpi.add_argument("start_date", help="start date of the reporting period, formatted as YYYY-MM-DD",
default=None)
subpi.add_argument("end_date", help="end date of the reporting period, formatted as YYYY-MM-DD")
return subpi


class GrantReportBuilder(LatexBuilderBase):
"""Build a proposal review from database entries"""
btype = "grantreport"
Expand All @@ -36,12 +43,23 @@ def construct_global_ctx(self):

def latex(self):
"""Render latex template"""
rc = self.rc
# Get Dates
today = str(date.today()).split("-")
end_year, end_month, end_day = int(today[0]), int(today[1]), int(today[2])
begin_year, begin_month, begin_day = int(today[0]) - 1, int(today[1]), int(today[2])
end_date = date(end_year, end_month, end_day)
begin_date = date(begin_year, begin_month, begin_day)
start_date = rc.start_date.split("-")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is heading us back down a road to the old days (passing dates around as strings and ints) rather than the brave new world of working with dates. I very much doubt this is the direction we want to go in here....

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I realized this too! Will work with date objects instead of the strings and ints.

end_date = rc.end_date.split("-")
begin_year, begin_month, begin_day = int(start_date[0]), int(start_date[1]), int(start_date[2])
end_year, end_month, end_day = int(end_date[0]), int(end_date[1]), int(end_date[2])
end_date = datetime.datetime(end_year, end_month, end_day)
begin_date = datetime.datetime(begin_year, begin_month, begin_day)

# NSF Grant _id
grant_name = "dmref"
# Get people linked to grant and active during reporting period
people = [person for person in self.gtx['people']
if grant_name in person['grant']]
# Get prums linked to grant and active/finished during the reporting period

# Accomplishments

# Get All Active Members
current_members = [person for person in self.gtx['people'] if person['active']]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:) nice!

Expand All @@ -64,8 +82,6 @@ def latex(self):

# Plans for Next Reporting Period to Accomplish Goals



self.render(
"grantreport.txt",
"billinge_grant_report.txt",
Expand All @@ -76,5 +92,5 @@ def latex(self):
beginMonth=begin_month,
beginDay=begin_day,
presentations=valid_presentations,
individuals=individuals_data
individuals=individuals_data,
)
25 changes: 23 additions & 2 deletions regolith/templates/grantreport.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
NSF {{beginYear}}-{{endYear}} Annual Report by
{{authorFullName}}, ({{ institution }})
NSF {{beginYear}}-{{endYear}} Annual Report by {{authorFullName}}, ({{ institution }})

Accomplishments
------------------------------
* What are the major goals of the project?

In real-world applications, materials are rarely perfect crystals and their properties
depend sensitively on defects, nanoscale structures, interfaces, surfaces and multi-scale
heterogeneities. A major challenge is to gain a greater understanding of how such
"imperfect" materials operate, including on different length and time-scales. In situations
as complicated as this it is essential to validate theories against experiment, and vice versa.
A more tightly coupled partnership between experiment and theory is needed, having its roots
in information theory: the models need to capture all the physics of the problem become more
complicated, while at the same time the information content of experimental data is reduced,
due to lower resolution from finite size effects, defects, the presence of multiple components
with overlapping problems, which yield unreliable and non-unique solutions, a bottleneck to
predictive materials discovery. We will develop novel mathematical approaches to address this
problem. We will study as a test case the nanostructure inverse problem (NIP), a well defined
but generally ill-posed materials inverse problem; however, the methods that we develop will
have much broader applicability in the world of materials discovery.

Goal 1: Develop databases of nanostructure data from model systems
Goal 2: Develop data analytic and stochastic optimization methodologies for robust
nanostructure solutions
Goal 3: Develop software infrastructure for nanostructure modeling that use the databases
and the new methodologies for nanostructure solution
Goal 4: Apply this to real scientific problems

* What was accomplished under these goals (you must provide information for
at least one of the 4 categories below)?
Major Activities:
Expand Down
25 changes: 23 additions & 2 deletions tests/outputs/grantreport/billinge_grant_report.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
NSF 2019-2020 Annual Report by
Simon J. L. Billinge, (Columbia University)
NSF 2019-2020 Annual Report by Simon J. L. Billinge, (Columbia University)

Accomplishments
------------------------------
* What are the major goals of the project?

In real-world applications, materials are rarely perfect crystals and their properties
depend sensitively on defects, nanoscale structures, interfaces, surfaces and multi-scale
heterogeneities. A major challenge is to gain a greater understanding of how such
"imperfect" materials operate, including on different length and time-scales. In situations
as complicated as this it is essential to validate theories against experiment, and vice versa.
A more tightly coupled partnership between experiment and theory is needed, having its roots
in information theory: the models need to capture all the physics of the problem become more
complicated, while at the same time the information content of experimental data is reduced,
due to lower resolution from finite size effects, defects, the presence of multiple components
with overlapping problems, which yield unreliable and non-unique solutions, a bottleneck to
predictive materials discovery. We will develop novel mathematical approaches to address this
problem. We will study as a test case the nanostructure inverse problem (NIP), a well defined
but generally ill-posed materials inverse problem; however, the methods that we develop will
have much broader applicability in the world of materials discovery.

Goal 1: Develop databases of nanostructure data from model systems
Goal 2: Develop data analytic and stochastic optimization methodologies for robust
nanostructure solutions
Goal 3: Develop software infrastructure for nanostructure modeling that use the databases
and the new methodologies for nanostructure solution
Goal 4: Apply this to real scientific problems

* What was accomplished under these goals (you must provide information for
at least one of the 4 categories below)?
Major Activities:
Expand Down