-
Notifications
You must be signed in to change notification settings - Fork 72
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
85feb2b
78d735d
b9700cc
d549f98
65e7261
83e178c
8e20314
db0168d
d2410ba
bc72627
0490554
6546f6e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,8 @@ | |
all_docs_from_collection, | ||
filter_grants, | ||
filter_presentations, | ||
fuzzy_retrieval | ||
fuzzy_retrieval, | ||
filter_publications | ||
) | ||
|
||
|
||
|
@@ -31,7 +32,7 @@ def subparser(subpi): | |
class GrantReportBuilder(LatexBuilderBase): | ||
"""Build a proposal review from database entries""" | ||
btype = "grantreport" | ||
needed_dbs = ['presentations', 'projecta', 'people', 'grants', 'institutions', 'expenses'] | ||
needed_dbs = ['presentations', 'projecta', 'people', 'grants', 'institutions', 'expenses', 'citations'] | ||
|
||
def construct_global_ctx(self): | ||
"""Constructs the global context""" | ||
|
@@ -90,13 +91,32 @@ def latex(self): | |
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? | ||
defended_theses = [] | ||
for id in grant_people: | ||
person = self.gtx['people'][id] | ||
if person[''] | ||
# How have results been disseminated | ||
for education in person['education']: | ||
if 'phd' in education['degree'].lower() and 'columbia' in education['institution'].lower() and \ | ||
rp_start_date.year <= education['end_year'] <= rp_end_date.year: | ||
defended_theses.append(id) | ||
|
||
# Plans for Next Reporting Period to Accomplish Goals | ||
# Products | ||
# need rg-db-public's citation.yml... how to access that instead of the rg-db-group's citation.yml file | ||
publications = filter_publications(self.gtx["citations"], grant_people, since=rp_start_date, before=rp_end_date) | ||
|
||
# Participants/Organizations | ||
participants = {} | ||
for person in grant_people: | ||
p = self.gtx["people"].get(person) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please don't be lazy with variable names, it makes the code hard to read. What is p? Here I think the logic is that p contains the person document for the person of name person, so I would pick variable names like this:
I think this logic assumes that the names in grant_people are valid id's is that right? This might be a bit brittle. |
||
months = 0 | ||
if p['active']: | ||
difference = datetime.today() - rp_start_date | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is it correct to do this calculation from today? |
||
if difference.day > 15: | ||
months = months + 1 | ||
months = difference.year * 12 + difference.month | ||
else: | ||
|
||
end_date = datetime.date(p['year']) | ||
info = [p.get('position'), months] | ||
self.render( | ||
"grantreport.txt", | ||
"billinge_grant_report.txt", | ||
|
@@ -105,4 +125,7 @@ def latex(self): | |
majorActivities=major_activities, | ||
significantResults=significant_results, | ||
trainingAndProfessionalDevelopment=training_and_professional_development, | ||
defendedTheses=defended_theses, | ||
products=publications, | ||
grantPeople=grant_people | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
NSF {{beginYear}}-{{endYear}} Annual Report by Simon J. L. Billinge, (Columbia University) | ||
NSF {{beginYear}}-{{endYear}} Annual Report | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't you want a name here (just not my name hard-coded) |
||
|
||
Accomplishments | ||
------------------------------------------------------------------------------ | ||
|
@@ -36,7 +36,7 @@ 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'] }} | ||
{{ prum.get('name') }}: {{ prum.get('description') }} | ||
{% endfor -%} | ||
|
||
- Specific Objectives: | ||
|
@@ -45,15 +45,18 @@ structures from measured PDFs given known structures in structural databases | |
|
||
- Significant Results (finished projecta): | ||
{%- for prum in significantResults %} | ||
{{ prum['name'] }}: {{ prum['description'] }} | ||
{{ prum.get('name') }}: {{ prum.get('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'] }} | ||
- Authors: {{ opportunity.get('authors') }} | ||
- Title: {{ opportunity.get('title') }} | ||
- Location: {{ opportunity.get('meeting_name') }} | ||
{% endfor -%}} | ||
{%- for thesis in defendedTheses %} | ||
{{thesis}} wrote and successfully defended their thesis. | ||
{% endfor -%}} | ||
|
||
* How have the results been disseminated to communities of interest? | ||
|
@@ -62,39 +65,28 @@ Key outcomes or Other achievements: | |
3. Presentations at conferences and seminars | ||
|
||
* What do you plan to do during the next reporting period to accomplish the goals? | ||
############################################################# | ||
## ## | ||
## ## | ||
## FILL THIS PART IN !!! FILL THIS PART IN !!! ## | ||
## ## | ||
## ## | ||
############################################################# | ||
|
||
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 | ||
{%- for doi in products %} | ||
- {{doi.get('doi')}} | ||
{% endfor -%}} | ||
|
||
Participants/Organizations | ||
------------------------------ | ||
What individuals have worked on the project? | ||
|
||
Name, Most Senior Project Role, Nearest Person Month Worked | ||
|
||
{%- for person in grantPeople %} | ||
- {{person.get('_id')}}, {{person.get(''}} | ||
{% endfor -%}} | ||
Full details of individuals who have worked on the project: | ||
|
||
Name: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
NSF 2019-2020 Annual Report by Simon J. L. Billinge, (Columbia University) | ||
NSF 2019-2020 Annual Report | ||
|
||
Accomplishments | ||
------------------------------------------------------------------------------ | ||
|
@@ -51,32 +51,17 @@ Key outcomes or Other achievements: | |
3. Presentations at conferences and seminars | ||
|
||
* What do you plan to do during the next reporting period to accomplish the goals? | ||
############################################################# | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this looks like copy-pasted text....maybe assign this string to a variable and use that? |
||
## ## | ||
## ## | ||
## FILL THIS PART IN !!! FILL THIS PART IN !!! ## | ||
## ## | ||
## ## | ||
############################################################# | ||
|
||
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 | ||
------------------------------ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since you will be doing something like this a lot I guess, you may want to use a function. Can you use is_current which has already been written? I would probably try and use get_dates to get dates and then is_current.
It may not work, but using functions that are well tested and can handle edge cases well will save time later.