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.grantreportbuilder import GrantReportBuilder


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


Expand Down
108 changes: 108 additions & 0 deletions regolith/builders/grantreportbuilder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
"""Builder for Proposal Reviews."""
from datetime import datetime
import time
from nameparser import HumanName
import dateutil.parser as date_parser

from regolith.builders.basebuilder import LatexBuilderBase
from regolith.dates import (month_to_int,
get_dates,
get_due_date,
is_current,
is_after,
is_before)
from regolith.fsclient import _id_key
from regolith.sorters import position_key
from regolith.tools import (
all_docs_from_collection,
filter_grants,
filter_presentations,
fuzzy_retrieval
)


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"
needed_dbs = ['presentations', 'projecta', 'people', 'grants', 'institutions', 'expenses']

def construct_global_ctx(self):
"""Constructs the global context"""
super().construct_global_ctx()
gtx = self.gtx
rc = self.rc
for dbs in rc.needed_dbs:
Copy link
Contributor

Choose a reason for hiding this comment

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

so pretty! 👍

gtx[dbs] = sorted(
all_docs_from_collection(rc.client, dbs), 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"""
rc = self.rc

# Convert Date Strings to Datetime Objects
rp_start_date = date_parser.parse(rc.start_date)
rp_end_date = date_parser.parse(rc.end_date)

# NSF Grant _id
grant_name = "dmref"

# Get prum associated to grant and active during reporting period
grant_prums = []
for prum in self.gtx['projecta']:
if grant_name in prum['grants']:
begin_date = get_dates(prum).get('begin_date')
due_date = get_due_date(prum['deliverable'])
# if projectum was finished during reporting period or is still current
# some projectum don't have an "end date", but all projecta have a deliverable
# due_date
if (rp_start_date <= due_date <= rp_end_date and prum['status'] is "finished") or is_current(prum):
grant_prums.append(prum)
# Get people associated with grant
grant_people = list(set([prum['lead'] for prum in grant_prums]))

# Accomplishments
major_activities = []
significant_results = []
for prum in grant_prums:
if prum['status'] is "finished":
significant_results.append(prum)
else:
major_activities.append(prum)

# Opportunities for Training and Professional Development
training_and_professional_development = []
# presentations
for id in grant_people:
training_and_professional_development.extend(
filter_presentations(self.gtx["people"], self.gtx["presentations"], self.gtx["institutions"], id,
types=["all"], since=rp_start_date, before=rp_end_date, statuses=["accepted"]))
# thesis defendings
# how do i access people.yml in rg-db-public vs the people.yml file in rg-db-group?
for id in grant_people:
person = self.gtx['people'][id]
if person['']
# How have results been disseminated

# Plans for Next Reporting Period to Accomplish Goals

self.render(
"grantreport.txt",
"billinge_grant_report.txt",
beginYear=rp_start_date.year,
endYear=rp_end_date.year,
majorActivities=major_activities,
significantResults=significant_results,
trainingAndProfessionalDevelopment=training_and_professional_development,
)
142 changes: 142 additions & 0 deletions regolith/templates/grantreport.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
NSF {{beginYear}}-{{endYear}} Annual Report by Simon J. L. Billinge, (Columbia University)
Copy link
Contributor

Choose a reason for hiding this comment

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

I shouldn't be hard-coded in here.


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 (currently worked on projecta):
Copy link
Contributor

Choose a reason for hiding this comment

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

again, can't have me hard-coded in here.

If there is something that is "me" specific that doesn't change often it should probably be in people. However, since this is a grant-specific thing it might better be in grants? If it is mostly me-specific but will be described in the grant report of multiple grants, this should probably be in people but have a field that is grant. This is how we discover how the world is organized!

PDF in the cloud (PDFitc): Development of a web-based service for determining
structures from measured PDFs given known structures in structural databases
xpdTools, xpdAcq, xpdAn, xpdView: Software tools for streaming data analysis
and visualization of diffraction data from the XPD diffractometer at NSLS-II
synchrotron. The tools can also be used to analyze data from other diffraction
beamlines.
{%- for prum in majorActivities %}
{{ prum['name'] }}: {{ prum['description'] }}
{% endfor -%}

- Specific Objectives:
PDF in the cloud (PDFitc): Development of a web-based service for determining
structures from measured PDFs given known structures in structural databases

- Significant Results (finished projecta):
{%- for prum in significantResults %}
{{ prum['name'] }}: {{ prum['description'] }}
{% endfor -%}

Key outcomes or Other achievements:
* What opportunities for training and professional development has the project provided?
{%- for opportunity in trainingAndProfessionalDevelopment %}
- Authors: {{ opportunity['authors'] }}
- Title: {{ opportunity['title'] }}
- Location: {{ opportunity['meeting_name'] }}
{% endfor -%}}

* How have the results been disseminated to communities of interest?
1. Publications
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 an interesting one. It should probably be in people too so any user of Regolith can decide for themselves.

2. Software releases and deployment of software packages on conda-forge and pypi for ease of installation
3. Presentations at conferences and seminars

* What do you plan to do during the next reporting period to accomplish the goals?

Products
------------------------------
Books

Book Chapters

Inventions

Journals or Juried Conference Papers

Licenses

Other Conference Presentations / Papers

Other Products

Other Publications

Patents

Technologies or Techniques

Thesis/Dissertations

Websites

Participants/Organizations
------------------------------
What individuals have worked on the project?

Name, Most Senior Project Role, Nearest Person Month Worked

Full details of individuals who have worked on the project:

Name:
Email:
Most Senior Project Role:
Nearest Person Month Worked:
Contribution to the Project:
Funding Support:
International Collaboration:
International Travel:

What other organizations have been involved as partners?
What other collaborators or contacts have been involved?

Impacts
------------------------------
What is the impact on the development of the principal discipline(s) of the project?

What is the impact on other disciplines?

What is the impact on the development of human resources?

What is the impact on physical resources that form infrastructure?

What is the impact on institutional resources that form infrastructure?

What is the impact on information resources that form infrastructure?

What is the impact on technology transfer?

What is the impact on society beyond science and technology?

Changes/Problems
------------------------------
Changes in approach and reason for change

Actual or Anticipated problems or delays and actions or plans to resolve them

Changes that have a significant impact on expenditures

Significant changes in use or care of human subjects

Significant changes in use or care of vertebrate animals

Significant changes in use or care of biohazards
Loading