From 85feb2be39422840bbec41712f5127174acb0f14 Mon Sep 17 00:00:00 2001 From: vivianlin2000 Date: Sun, 5 Jul 2020 14:00:48 -0400 Subject: [PATCH 01/12] Create proposalreportbuilder.py --- regolith/builders/proposalreportbuilder.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 regolith/builders/proposalreportbuilder.py diff --git a/regolith/builders/proposalreportbuilder.py b/regolith/builders/proposalreportbuilder.py new file mode 100644 index 000000000..e69de29bb From 78d735d752ab40cc68ac42348971fcda8efef337 Mon Sep 17 00:00:00 2001 From: vivianlin2000 Date: Sun, 5 Jul 2020 15:53:48 -0400 Subject: [PATCH 02/12] Create initial files --- regolith/builder.py | 2 ++ regolith/builders/proposalreportbuilder.py | 42 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/regolith/builder.py b/regolith/builder.py index a1a91f8ca..d63f46bdf 100644 --- a/regolith/builder.py +++ b/regolith/builder.py @@ -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 = { @@ -34,6 +35,7 @@ "resume": ResumeBuilder, "review-man": ManRevBuilder, "review-prop": PropRevBuilder, + "propreport": PropReportBuilder } diff --git a/regolith/builders/proposalreportbuilder.py b/regolith/builders/proposalreportbuilder.py index e69de29bb..f991f1da0 100644 --- a/regolith/builders/proposalreportbuilder.py +++ b/regolith/builders/proposalreportbuilder.py @@ -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""" From b9700ccbf5d2c3f02f0fcb5b35219e66d3a6129a Mon Sep 17 00:00:00 2001 From: vivianlin2000 Date: Mon, 6 Jul 2020 13:21:10 -0400 Subject: [PATCH 03/12] Changed Proposal Report Builder to Grant Report Builder --- regolith/builder.py | 4 ++-- .../{proposalreportbuilder.py => grantreportbuilder.py} | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) rename regolith/builders/{proposalreportbuilder.py => grantreportbuilder.py} (94%) diff --git a/regolith/builder.py b/regolith/builder.py index d63f46bdf..686220354 100644 --- a/regolith/builder.py +++ b/regolith/builder.py @@ -15,7 +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 +from regolith.builders.grantreportbuilder import GrantReportBuilder BUILDERS = { @@ -35,7 +35,7 @@ "resume": ResumeBuilder, "review-man": ManRevBuilder, "review-prop": PropRevBuilder, - "propreport": PropReportBuilder + "grantreport": GrantReportBuilder } diff --git a/regolith/builders/proposalreportbuilder.py b/regolith/builders/grantreportbuilder.py similarity index 94% rename from regolith/builders/proposalreportbuilder.py rename to regolith/builders/grantreportbuilder.py index f991f1da0..ec5faadb5 100644 --- a/regolith/builders/proposalreportbuilder.py +++ b/regolith/builders/grantreportbuilder.py @@ -14,9 +14,9 @@ ) -class PropReportBuilder(LatexBuilderBase): +class GrantReportBuilder(LatexBuilderBase): """Build a proposal review from database entries""" - btype = "propreport" + btype = "grantreport" needed_dbs = ['presentations', 'projecta', 'people'] def construct_global_ctx(self): From d549f9892d2a4a713d486eb10d3841e46f9d9ddf Mon Sep 17 00:00:00 2001 From: vivianlin2000 Date: Fri, 10 Jul 2020 13:35:58 -0400 Subject: [PATCH 04/12] Added template --- regolith/builders/grantreportbuilder.py | 4 + regolith/templates/grantreport.txt | 95 +++++++++++++++++++ .../grantreport/billinge_grant_report.txt | 95 +++++++++++++++++++ tests/test_builders.py | 3 +- 4 files changed, 196 insertions(+), 1 deletion(-) create mode 100644 regolith/templates/grantreport.txt create mode 100644 tests/outputs/grantreport/billinge_grant_report.txt diff --git a/regolith/builders/grantreportbuilder.py b/regolith/builders/grantreportbuilder.py index ec5faadb5..f2a8c09a1 100644 --- a/regolith/builders/grantreportbuilder.py +++ b/regolith/builders/grantreportbuilder.py @@ -40,3 +40,7 @@ def construct_global_ctx(self): def latex(self): """Render latex template""" + self.render( + "grantreport.txt" + "billinge_grant_report.txt" + ) diff --git a/regolith/templates/grantreport.txt b/regolith/templates/grantreport.txt new file mode 100644 index 000000000..b11d9481b --- /dev/null +++ b/regolith/templates/grantreport.txt @@ -0,0 +1,95 @@ +Accomplishments +------------------------------ +* What are the major goals of the project? + +* What was accomplished under these goals (you must provide information for +at least one of the 4 categories below)? + +Major Activities: +Specific Objectives: +Significant Results: +Key outcomes or Other achievements: + +* What opportunities for training and professional development has the project provided? + +* How have the results been disseminated to communities of interest? + +* 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 \ No newline at end of file diff --git a/tests/outputs/grantreport/billinge_grant_report.txt b/tests/outputs/grantreport/billinge_grant_report.txt new file mode 100644 index 000000000..b11d9481b --- /dev/null +++ b/tests/outputs/grantreport/billinge_grant_report.txt @@ -0,0 +1,95 @@ +Accomplishments +------------------------------ +* What are the major goals of the project? + +* What was accomplished under these goals (you must provide information for +at least one of the 4 categories below)? + +Major Activities: +Specific Objectives: +Significant Results: +Key outcomes or Other achievements: + +* What opportunities for training and professional development has the project provided? + +* How have the results been disseminated to communities of interest? + +* 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 \ No newline at end of file diff --git a/tests/test_builders.py b/tests/test_builders.py index 025097074..78c20585b 100644 --- a/tests/test_builders.py +++ b/tests/test_builders.py @@ -19,7 +19,8 @@ "reimb", "figure", "recent-collabs", - "beamplan" + "beamplan", + "grantreport" ] db_srcs = ["mongo", "fs"] From 65e7261343c0c7b7867a7359cbc78bd3ba5905f4 Mon Sep 17 00:00:00 2001 From: vivianlin2000 Date: Thu, 16 Jul 2020 13:47:37 -0400 Subject: [PATCH 05/12] progress --- regolith/builders/grantreportbuilder.py | 49 ++++++++++++++++--- regolith/templates/grantreport.txt | 4 +- .../grantreport/billinge_grant_report.txt | 4 +- 3 files changed, 49 insertions(+), 8 deletions(-) diff --git a/regolith/builders/grantreportbuilder.py b/regolith/builders/grantreportbuilder.py index f2a8c09a1..fb944ea10 100644 --- a/regolith/builders/grantreportbuilder.py +++ b/regolith/builders/grantreportbuilder.py @@ -1,5 +1,5 @@ -"""Builder for Proposal Reivews.""" -import datetime +"""Builder for Proposal Reviews.""" +from datetime import datetime, date import time from nameparser import HumanName @@ -10,14 +10,15 @@ from regolith.tools import ( all_docs_from_collection, filter_grants, - fuzzy_retrieval, + filter_presentations, + fuzzy_retrieval ) class GrantReportBuilder(LatexBuilderBase): """Build a proposal review from database entries""" btype = "grantreport" - needed_dbs = ['presentations', 'projecta', 'people'] + needed_dbs = ['presentations', 'projecta', 'people', 'grants', 'institutions'] def construct_global_ctx(self): """Constructs the global context""" @@ -33,6 +34,13 @@ def construct_global_ctx(self): gtx["presentations"] = sorted( all_docs_from_collection(rc.client, "presentations"), key=_id_key ) + gtx["grants"] = sorted( + all_docs_from_collection(rc.client, "grants"), key=_id_key + ) + gtx["institutions"] = sorted( + all_docs_from_collection(rc.client, "institutions"), key=_id_key + ) + gtx["all_docs_from_collection"] = all_docs_from_collection gtx["float"] = float gtx["str"] = str @@ -40,7 +48,36 @@ def construct_global_ctx(self): def latex(self): """Render latex template""" + # 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) + # Major Goals + + # Accomplishments + + # Opportunities for Training and Professional Development + valid_presentations = [] + for p in self.gtx["people"]: + if p["active"] and p["_id"] is not "sbillinge": + valid_presentations.append(filter_presentations( + self.gtx["people"], self.gtx["presentations"], self.gtx["institutions"], p["_id"], + ["tutorial", "contributed_oral"], begin_date, end_date)) + + # How have results been disseminated + + # Plans for Next Reporting Period to Accomplish Goals + self.render( - "grantreport.txt" - "billinge_grant_report.txt" + "grantreport.txt", + "billinge_grant_report.txt", + endYear=end_year, + endMonth=end_month, + endDay=end_date, + beginYear=begin_year, + beginMonth=begin_month, + beginDay=begin_day, + presentations=valid_presentations ) diff --git a/regolith/templates/grantreport.txt b/regolith/templates/grantreport.txt index b11d9481b..a937b9383 100644 --- a/regolith/templates/grantreport.txt +++ b/regolith/templates/grantreport.txt @@ -1,10 +1,12 @@ +NSF {{beginYear}}-{{endYear}} Annual Report by +{{authorFullName}}, ({{ institution }}) + Accomplishments ------------------------------ * What are the major goals of the project? * What was accomplished under these goals (you must provide information for at least one of the 4 categories below)? - Major Activities: Specific Objectives: Significant Results: diff --git a/tests/outputs/grantreport/billinge_grant_report.txt b/tests/outputs/grantreport/billinge_grant_report.txt index b11d9481b..5bb92353e 100644 --- a/tests/outputs/grantreport/billinge_grant_report.txt +++ b/tests/outputs/grantreport/billinge_grant_report.txt @@ -1,10 +1,12 @@ +NSF 2019-2020 Annual Report by +Simon J. L. Billinge, (Columbia University) + Accomplishments ------------------------------ * What are the major goals of the project? * What was accomplished under these goals (you must provide information for at least one of the 4 categories below)? - Major Activities: Specific Objectives: Significant Results: From 83e178c53ed509da7387840d2a57c1d384838dc6 Mon Sep 17 00:00:00 2001 From: vivianlin2000 Date: Fri, 17 Jul 2020 13:15:54 -0400 Subject: [PATCH 06/12] more edits --- regolith/builders/grantreportbuilder.py | 20 ++++++++++++++++--- regolith/templates/grantreport.txt | 5 ++++- .../grantreport/billinge_grant_report.txt | 2 +- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/regolith/builders/grantreportbuilder.py b/regolith/builders/grantreportbuilder.py index fb944ea10..6749f6870 100644 --- a/regolith/builders/grantreportbuilder.py +++ b/regolith/builders/grantreportbuilder.py @@ -54,14 +54,21 @@ def latex(self): 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) + + # Get All Active Members + people = [] + for p in self.gtx["people"]: + if p["active"]: + people.append(p) + # Major Goals # Accomplishments # Opportunities for Training and Professional Development valid_presentations = [] - for p in self.gtx["people"]: - if p["active"] and p["_id"] is not "sbillinge": + for p in people: + if p["_id"] is not "sbillinge": valid_presentations.append(filter_presentations( self.gtx["people"], self.gtx["presentations"], self.gtx["institutions"], p["_id"], ["tutorial", "contributed_oral"], begin_date, end_date)) @@ -70,6 +77,12 @@ def latex(self): # Plans for Next Reporting Period to Accomplish Goals + # Individuals that have worked on project + individuals_data = [] + for p in people: + individuals_data.append([p["_id"], p["position"]]) + + self.render( "grantreport.txt", "billinge_grant_report.txt", @@ -79,5 +92,6 @@ def latex(self): beginYear=begin_year, beginMonth=begin_month, beginDay=begin_day, - presentations=valid_presentations + presentations=valid_presentations, + individuals=individuals_data ) diff --git a/regolith/templates/grantreport.txt b/regolith/templates/grantreport.txt index a937b9383..d85e54714 100644 --- a/regolith/templates/grantreport.txt +++ b/regolith/templates/grantreport.txt @@ -10,9 +10,12 @@ at least one of the 4 categories below)? Major Activities: Specific Objectives: Significant Results: -Key outcomes or Other achievements: +Key outcomes or Other achievements: * What opportunities for training and professional development has the project provided? +{%- for opportunity in presentations %} + - {{opportunity -}} +{% endfor -%}} * How have the results been disseminated to communities of interest? diff --git a/tests/outputs/grantreport/billinge_grant_report.txt b/tests/outputs/grantreport/billinge_grant_report.txt index 5bb92353e..0c0d01a98 100644 --- a/tests/outputs/grantreport/billinge_grant_report.txt +++ b/tests/outputs/grantreport/billinge_grant_report.txt @@ -10,8 +10,8 @@ at least one of the 4 categories below)? Major Activities: Specific Objectives: Significant Results: -Key outcomes or Other achievements: +Key outcomes or Other achievements: * What opportunities for training and professional development has the project provided? * How have the results been disseminated to communities of interest? From 8e203147ef1fc4cf3c93994f57b13c4059536fca Mon Sep 17 00:00:00 2001 From: vivianlin2000 Date: Sun, 19 Jul 2020 18:24:19 -0400 Subject: [PATCH 07/12] Suggestions Implemented --- regolith/builders/grantreportbuilder.py | 45 ++++++++----------------- 1 file changed, 14 insertions(+), 31 deletions(-) diff --git a/regolith/builders/grantreportbuilder.py b/regolith/builders/grantreportbuilder.py index 6749f6870..8df69bbec 100644 --- a/regolith/builders/grantreportbuilder.py +++ b/regolith/builders/grantreportbuilder.py @@ -25,22 +25,10 @@ def construct_global_ctx(self): 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["grants"] = sorted( - all_docs_from_collection(rc.client, "grants"), key=_id_key - ) - gtx["institutions"] = sorted( - all_docs_from_collection(rc.client, "institutions"), key=_id_key - ) - + for dbs in rc.needed_dbs: + 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 @@ -51,36 +39,31 @@ def latex(self): # 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]) + 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) # Get All Active Members - people = [] - for p in self.gtx["people"]: - if p["active"]: - people.append(p) + current_members = [person for person in self.gtx['people'] if person['active']] # Major Goals # Accomplishments - # Opportunities for Training and Professional Development + # Opportunities for Training and Professional Development and + # Individuals that have worked on project valid_presentations = [] - for p in people: - if p["_id"] is not "sbillinge": - valid_presentations.append(filter_presentations( - self.gtx["people"], self.gtx["presentations"], self.gtx["institutions"], p["_id"], - ["tutorial", "contributed_oral"], begin_date, end_date)) + individuals_data = [] + for person in current_members: + valid_presentations.append(filter_presentations( + self.gtx["people"], self.gtx["presentations"], self.gtx["institutions"], person["_id"], + ["tutorial", "contributed_oral"], begin_date, end_date)) + individuals_data.append([person["_id"], person["position"]]) # How have results been disseminated # Plans for Next Reporting Period to Accomplish Goals - # Individuals that have worked on project - individuals_data = [] - for p in people: - individuals_data.append([p["_id"], p["position"]]) self.render( From db0168d0c4c8ed284e34b996b9a5c898500d622b Mon Sep 17 00:00:00 2001 From: vivianlin2000 Date: Wed, 29 Jul 2020 05:31:15 -0400 Subject: [PATCH 08/12] updates --- regolith/builders/grantreportbuilder.py | 34 ++++++++++++++----- regolith/templates/grantreport.txt | 25 ++++++++++++-- .../grantreport/billinge_grant_report.txt | 25 ++++++++++++-- 3 files changed, 71 insertions(+), 13 deletions(-) diff --git a/regolith/builders/grantreportbuilder.py b/regolith/builders/grantreportbuilder.py index 8df69bbec..2d13f3630 100644 --- a/regolith/builders/grantreportbuilder.py +++ b/regolith/builders/grantreportbuilder.py @@ -1,5 +1,5 @@ """Builder for Proposal Reviews.""" -from datetime import datetime, date +import datetime import time from nameparser import HumanName @@ -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" @@ -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("-") + 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']] @@ -64,8 +82,6 @@ def latex(self): # Plans for Next Reporting Period to Accomplish Goals - - self.render( "grantreport.txt", "billinge_grant_report.txt", @@ -76,5 +92,5 @@ def latex(self): beginMonth=begin_month, beginDay=begin_day, presentations=valid_presentations, - individuals=individuals_data + individuals=individuals_data, ) diff --git a/regolith/templates/grantreport.txt b/regolith/templates/grantreport.txt index d85e54714..4f3350486 100644 --- a/regolith/templates/grantreport.txt +++ b/regolith/templates/grantreport.txt @@ -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: diff --git a/tests/outputs/grantreport/billinge_grant_report.txt b/tests/outputs/grantreport/billinge_grant_report.txt index 0c0d01a98..e6932c7cb 100644 --- a/tests/outputs/grantreport/billinge_grant_report.txt +++ b/tests/outputs/grantreport/billinge_grant_report.txt @@ -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: From d2410bab846658da9e402a117ffadf3a41da262d Mon Sep 17 00:00:00 2001 From: vivianlin2000 Date: Wed, 29 Jul 2020 13:36:46 -0400 Subject: [PATCH 09/12] Retrieved prums and people associated with grant and active during reporting period --- regolith/builders/grantreportbuilder.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/regolith/builders/grantreportbuilder.py b/regolith/builders/grantreportbuilder.py index 2d13f3630..e8f61255f 100644 --- a/regolith/builders/grantreportbuilder.py +++ b/regolith/builders/grantreportbuilder.py @@ -1,5 +1,5 @@ """Builder for Proposal Reviews.""" -import datetime +from datetime import datetime import time from nameparser import HumanName @@ -45,19 +45,20 @@ def latex(self): """Render latex template""" rc = self.rc # Get Dates - start_date = rc.start_date.split("-") - 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) + start_date = datetime.strptime(rc.start_date, "%Y-%m-%d") + end_date = datetime.strptime(rc.end_date, "%Y-%m-%d") # 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 + # Get people and prum linked to grant and active during reporting period + prums = [prum for prum in self.gtx['projecta'] + if grant_name in prum['grants'] + and + ((start_date <= datetime.strptime(prum['end_date'], "%Y-%m-%d") <= end_date + and prum['status'] is 'finished') + or + start_date <= datetime.strptime(prum['begin_date'], "%Y-%m-%d") <= end_date)] + people = list(set([prum['lead'] for prum in prums])) # Accomplishments From bc7262760878385cd088cb22b8d2b6872b0382c1 Mon Sep 17 00:00:00 2001 From: vivianlin2000 Date: Thu, 30 Jul 2020 00:07:51 -0400 Subject: [PATCH 10/12] More Updates --- regolith/builders/grantreportbuilder.py | 89 +++++++++++-------- regolith/templates/grantreport.txt | 37 ++++++-- .../grantreport/billinge_grant_report.txt | 23 +++-- 3 files changed, 97 insertions(+), 52 deletions(-) diff --git a/regolith/builders/grantreportbuilder.py b/regolith/builders/grantreportbuilder.py index e8f61255f..4105900c9 100644 --- a/regolith/builders/grantreportbuilder.py +++ b/regolith/builders/grantreportbuilder.py @@ -2,9 +2,15 @@ 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 +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 ( @@ -25,7 +31,7 @@ def subparser(subpi): class GrantReportBuilder(LatexBuilderBase): """Build a proposal review from database entries""" btype = "grantreport" - needed_dbs = ['presentations', 'projecta', 'people', 'grants', 'institutions'] + needed_dbs = ['presentations', 'projecta', 'people', 'grants', 'institutions', 'expenses'] def construct_global_ctx(self): """Constructs the global context""" @@ -44,41 +50,49 @@ def construct_global_ctx(self): def latex(self): """Render latex template""" rc = self.rc - # Get Dates - start_date = datetime.strptime(rc.start_date, "%Y-%m-%d") - end_date = datetime.strptime(rc.end_date, "%Y-%m-%d") + + # 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 people and prum linked to grant and active during reporting period - prums = [prum for prum in self.gtx['projecta'] - if grant_name in prum['grants'] - and - ((start_date <= datetime.strptime(prum['end_date'], "%Y-%m-%d") <= end_date - and prum['status'] is 'finished') - or - start_date <= datetime.strptime(prum['begin_date'], "%Y-%m-%d") <= end_date)] - people = list(set([prum['lead'] for prum in prums])) - - # Accomplishments - # Get All Active Members - current_members = [person for person in self.gtx['people'] if person['active']] - - # Major Goals + # 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 - - # Opportunities for Training and Professional Development and - # Individuals that have worked on project - valid_presentations = [] - individuals_data = [] - for person in current_members: - valid_presentations.append(filter_presentations( - self.gtx["people"], self.gtx["presentations"], self.gtx["institutions"], person["_id"], - ["tutorial", "contributed_oral"], begin_date, end_date)) - individuals_data.append([person["_id"], person["position"]]) - + 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 @@ -86,12 +100,9 @@ def latex(self): self.render( "grantreport.txt", "billinge_grant_report.txt", - endYear=end_year, - endMonth=end_month, - endDay=end_date, - beginYear=begin_year, - beginMonth=begin_month, - beginDay=begin_day, - presentations=valid_presentations, - individuals=individuals_data, + beginYear=rp_start_date.year, + endYear=rp_end_date.year, + majorActivities=major_activities, + significantResults=significant_results, + trainingAndProfessionalDevelopment=training_and_professional_development, ) diff --git a/regolith/templates/grantreport.txt b/regolith/templates/grantreport.txt index 4f3350486..370c03973 100644 --- a/regolith/templates/grantreport.txt +++ b/regolith/templates/grantreport.txt @@ -1,9 +1,8 @@ -NSF {{beginYear}}-{{endYear}} Annual Report by {{authorFullName}}, ({{ institution }}) +NSF {{beginYear}}-{{endYear}} 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 @@ -28,17 +27,39 @@ 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: -Specific Objectives: -Significant Results: +------------------------------------------------------------------------------ +- Major Activities (currently worked on projecta): +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 presentations %} - - {{opportunity -}} +{%- 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 +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? diff --git a/tests/outputs/grantreport/billinge_grant_report.txt b/tests/outputs/grantreport/billinge_grant_report.txt index e6932c7cb..84c495249 100644 --- a/tests/outputs/grantreport/billinge_grant_report.txt +++ b/tests/outputs/grantreport/billinge_grant_report.txt @@ -1,9 +1,8 @@ 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 @@ -28,14 +27,28 @@ 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: -Specific Objectives: -Significant Results: +------------------------------------------------------------------------------ +- Major Activities (currently worked on projecta): +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. + +- 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): Key outcomes or Other achievements: * What opportunities for training and professional development has the project provided? * How have the results been disseminated to communities of interest? +1. Publications +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? From 0490554b173a3999b5bb344e04b10665adb491cf Mon Sep 17 00:00:00 2001 From: vivianlin2000 Date: Mon, 3 Aug 2020 17:37:14 -0400 Subject: [PATCH 11/12] updates --- regolith/builders/grantreportbuilder.py | 33 ++++++++++-- regolith/templates/grantreport.txt | 52 ++++++++----------- .../grantreport/billinge_grant_report.txt | 31 +++-------- 3 files changed, 58 insertions(+), 58 deletions(-) diff --git a/regolith/builders/grantreportbuilder.py b/regolith/builders/grantreportbuilder.py index 4105900c9..4a4b0bc5f 100644 --- a/regolith/builders/grantreportbuilder.py +++ b/regolith/builders/grantreportbuilder.py @@ -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) + months = 0 + if p['active']: + difference = datetime.today() - rp_start_date + 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 ) diff --git a/regolith/templates/grantreport.txt b/regolith/templates/grantreport.txt index 370c03973..c64db52f4 100644 --- a/regolith/templates/grantreport.txt +++ b/regolith/templates/grantreport.txt @@ -1,4 +1,4 @@ -NSF {{beginYear}}-{{endYear}} Annual Report by Simon J. L. Billinge, (Columbia University) +NSF {{beginYear}}-{{endYear}} Annual Report 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: diff --git a/tests/outputs/grantreport/billinge_grant_report.txt b/tests/outputs/grantreport/billinge_grant_report.txt index 84c495249..1118e3971 100644 --- a/tests/outputs/grantreport/billinge_grant_report.txt +++ b/tests/outputs/grantreport/billinge_grant_report.txt @@ -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? +############################################################# +## ## +## ## +## 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 ------------------------------ From 6546f6e14a3df93e964e1fac157a57f48ea398cc Mon Sep 17 00:00:00 2001 From: vivianlin2000 Date: Tue, 18 Aug 2020 02:06:47 -0400 Subject: [PATCH 12/12] Updates --- regolith/builders/grantreportbuilder.py | 75 +++++++++++++++---- regolith/templates/grantreport.txt | 24 ++---- .../grantreport/billinge_grant_report.txt | 16 +--- 3 files changed, 71 insertions(+), 44 deletions(-) diff --git a/regolith/builders/grantreportbuilder.py b/regolith/builders/grantreportbuilder.py index 4a4b0bc5f..533c0ffb0 100644 --- a/regolith/builders/grantreportbuilder.py +++ b/regolith/builders/grantreportbuilder.py @@ -23,6 +23,7 @@ def subparser(subpi): + subpi.add_argument("authorFullName", help="full name of the author of this grant report") 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") @@ -32,7 +33,7 @@ def subparser(subpi): class GrantReportBuilder(LatexBuilderBase): """Build a proposal review from database entries""" btype = "grantreport" - needed_dbs = ['presentations', 'projecta', 'people', 'grants', 'institutions', 'expenses', 'citations'] + needed_dbs = ['presentations', 'projecta', 'people', 'grants', 'institutions', 'expenses', 'citations', 'contacts'] def construct_global_ctx(self): """Constructs the global context""" @@ -100,26 +101,41 @@ def latex(self): defended_theses.append(id) # Products - # need rg-db-public's citation.yml... how to access that instead of the rg-db-group's citation.yml file + # need rg-db-public's citation.yml 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) - months = 0 - if p['active']: - difference = datetime.today() - rp_start_date - if difference.day > 15: - months = months + 1 - months = difference.year * 12 + difference.month - else: + for name in grant_people: + person = self.gtx["people"].get(name) + months_on_grant, months_left = self.months_on(grant_name, person, rp_start_date, rp_end_date) + participants[name] = [person.get('position'), months_on_grant] + + # Other Collaborators + collaborator_ids = [] + for prum in grant_prums: + collabs = prum.get("collaborators") + if collabs: + for id in collabs: + collaborator_ids.append(id) + collaborator_ids = set(collaborator_ids) + + collaborators = {} + for id in collaborator_ids: + contact = self.gtx["contacts"].get(id) + aka = contact.get("aka") + institution = contact.get("institution") + collaborators[id] = { + "aka": aka, + "institution": institution + } + + # Impacts - end_date = datetime.date(p['year']) - info = [p.get('position'), months] self.render( "grantreport.txt", "billinge_grant_report.txt", + authorFullName=rc.authorFullName, beginYear=rp_start_date.year, endYear=rp_end_date.year, majorActivities=major_activities, @@ -127,5 +143,36 @@ def latex(self): trainingAndProfessionalDevelopment=training_and_professional_development, defendedTheses=defended_theses, products=publications, - grantPeople=grant_people + grantPeople=grant_people, + participants=participants, + collaborators=collaborators ) + + def months_on(self, grant, person, since=datetime(1970, 1, 1), before=datetime.today()): + # print('Looking at months on grant {} in period since {} until {}'.format( + # grant, since, before), ) + total_months = 0 + appts = person.get('appointments') + if appts: + months = 0 + for k1, v1 in appts.items(): + if grant in v1.get('grant'): + dates = get_dates(v1) + startdate = dates.get('start_date') + enddate = dates.get('end_date') + loading = v1.get('loading') + if startdate >= since and enddate <= before: + months = months + ( + enddate - startdate).days * loading / 30.4 + elif startdate >= since and enddate > before: + months = months + ( + before - startdate).days * loading / 30.4 + elif startdate < since and enddate <= before: + months = months + ( + enddate - since).days * loading / 30.4 + elif startdate < since and enddate > before: + months = months + (before - since).days * loading / 30.4 + if months > 0: + total_months = total_months + months + months_left = (before - datetime.today()) + return total_months, months_left diff --git a/regolith/templates/grantreport.txt b/regolith/templates/grantreport.txt index c64db52f4..3a4e10835 100644 --- a/regolith/templates/grantreport.txt +++ b/regolith/templates/grantreport.txt @@ -1,4 +1,4 @@ -NSF {{beginYear}}-{{endYear}} Annual Report +NSF {{beginYear}}-{{endYear}} Annual Report by {{authorFullName}} Accomplishments ------------------------------------------------------------------------------ @@ -84,22 +84,14 @@ 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(''}} +{%- for person, info in participants.items() %} + - {{person}}: {{info[0]}}, {{info[1]}} +{% endfor -%}} + +What other organizations have been involved as partners?/What other collaborators or contacts have been involved? +{%- for contact, info in collaborators.items() %} + - {{contact}}: aka: {{info["aka"]}}, institution: {{info["institution"]}} {% endfor -%}} -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 ------------------------------ diff --git a/tests/outputs/grantreport/billinge_grant_report.txt b/tests/outputs/grantreport/billinge_grant_report.txt index 1118e3971..ac6ee5baf 100644 --- a/tests/outputs/grantreport/billinge_grant_report.txt +++ b/tests/outputs/grantreport/billinge_grant_report.txt @@ -1,4 +1,4 @@ -NSF 2019-2020 Annual Report +NSF 2019-2020 Annual Report by Simon J. L. Billinge Accomplishments ------------------------------------------------------------------------------ @@ -69,19 +69,7 @@ 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? +What other organizations have been involved as partners?/What other collaborators or contacts have been involved? Impacts ------------------------------