From 6b45a4c01451e2106ec3e958629ecc48e152e19e Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Mon, 13 Jan 2025 20:05:15 -0500 Subject: [PATCH] feat: nsf prior support now built as part of grantreport. initial commit (#1229) * nsf prior support now built as part of grantreport. initial commit * news * tests for grant-report * making pre-commit and tests happy at the same time --- news/prior-support.rst | 23 +++++++++++++++ src/regolith/builders/grantreportbuilder.py | 5 +++- src/regolith/exemplars.json | 6 ++++ src/regolith/schemas.json | 28 ++++++++++++++++++ src/regolith/templates/grantreport.txt | 29 +++++++++++++++++++ ...SymPy-1.1_report_2017-04-01_2018-03-31.txt | 18 ++++++++++++ 6 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 news/prior-support.rst diff --git a/news/prior-support.rst b/news/prior-support.rst new file mode 100644 index 000000000..a901e3f0f --- /dev/null +++ b/news/prior-support.rst @@ -0,0 +1,23 @@ +**Added:** + +* Ability to print a prior-support statement as part of the grant-report. + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* diff --git a/src/regolith/builders/grantreportbuilder.py b/src/regolith/builders/grantreportbuilder.py index 0d48c9342..c742fa5b5 100644 --- a/src/regolith/builders/grantreportbuilder.py +++ b/src/regolith/builders/grantreportbuilder.py @@ -161,11 +161,13 @@ def latex(self): # since=rp_start_date, # before=rp_end_date) publications = [publ for publ in self.gtx["citations"] if grant_id in publ.get("grant", "")] - + publ_ids = [] for publ in publications: + publ_ids.append(publ.get("_id")) formatted_authors = [f" {HumanName(name).full_name}" for name in publ.get("authors", [])] publ["authors"] = formatted_authors # Participants/Organizations + publication_id_string = ", ".join(publ_ids) participants = [] for person in self.gtx["people"]: months_on_grant, months_left = self.months_on(grant_id, person, rp_start_date, rp_end_date) @@ -217,6 +219,7 @@ def latex(self): grantPeople=grant_people, participants=participants, collaborators=collaborators, + publication_id_string=publication_id_string, hline="------------------------------------------------------------------------------", ) diff --git a/src/regolith/exemplars.json b/src/regolith/exemplars.json index 70b8d3c94..696c3d066 100644 --- a/src/regolith/exemplars.json +++ b/src/regolith/exemplars.json @@ -430,6 +430,12 @@ {"date": "2020-07-21", "funds_available": 2600.00} ], "narrative": "https://docs.google.com/document/d/1nZxqoL-Ucni_aXLWmXtRDd3IWqW0mZBO65CEvDrsXZM/edit?usp=sharing", + "prior_support": { + "introduction": "A general overview of the project", + "intellectual_merit": "Open source software got much better", + "broader_impact": "all of science became higher quality", + "products": "all of science became higher quality" + }, "program": "Small Development Grants", "team": [ { diff --git a/src/regolith/schemas.json b/src/regolith/schemas.json index 8654eac20..d6f01e721 100644 --- a/src/regolith/schemas.json +++ b/src/regolith/schemas.json @@ -777,6 +777,34 @@ "required": false, "anyof_type": ["integer", "float"] }, + "prior_support": { + "description": "everything we need to generate a prior support section in the proposal", + "required": false, + "type": "dict", + "schema": { + "introduction": { + "description": "text for the intellectual merit section", + "type": "string", + "required": false + }, + "intellectual_merit": { + "description": "text for the intellectual merit section", + "type": "string", + "required": false + }, + "broader_impact": { + "description": "text for the broader impacts section", + "type": "string", + "required": false + }, + "products": { + "description": "text describing non-publication products", + "type": "string", + "required": false + } + } + }, + "program": { "description": "the program the work was funded under", "required": false, diff --git a/src/regolith/templates/grantreport.txt b/src/regolith/templates/grantreport.txt index 93ff8f77e..f555d39c2 100644 --- a/src/regolith/templates/grantreport.txt +++ b/src/regolith/templates/grantreport.txt @@ -184,3 +184,32 @@ 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{{ newline }} + + +Prior Support: +{{ grant.get('awardnr','') }}, ${{- grant.get('amount','') -}}, {{ begin_date }} to {{ end_date -}}. +{{ grant.get('title', '') }} + +the work resulted in {{ len(products) }} publications: +\cite{ {{- publication_id_string -}} } + +{% if grant.get('prior_support',{}).get('introduction','') | length > 0 %} +Introduction: {{ grant.get('prior_support',{}).get('introduction','') }} +{% endif -%} +{% if grant.get('prior_support',{}).get('intellectual_merit','') | length > 0 %} +Intellectual Merit: {{ grant.get('prior_support',{}).get('intellectual_merit','') }} +{% endif -%} +{% if grant.get('prior_support',{}).get('broader_impact','') | length > 0 %} +Broader Impact: {{ grant.get('prior_support',{}).get('broader_impact','') }} +{% endif -%} +{% if grant.get('prior_support',{}).get('products','') | length > 0 %} +Products: {{ grant.get('prior_support',{}).get('products','') }} +{% endif %} +{%- for publ in products %} + - {{ publ.get('title') }} + {{ publ.get('_id') }} + {% for person in publ.get('author') %}{{ person }}, {% endfor %} + {{ publ.get('journal') }}, {{ publ.get('volume') }}, pp. {{ publ.get('pages') }} + {{ publ.get('month') }}/{{ publ.get('year') }} + {{ publ.get('doi') }} +{% endfor %} diff --git a/tests/outputs/grant-report/SymPy-1.1_report_2017-04-01_2018-03-31.txt b/tests/outputs/grant-report/SymPy-1.1_report_2017-04-01_2018-03-31.txt index 8a8d42914..fcbb18eac 100644 --- a/tests/outputs/grant-report/SymPy-1.1_report_2017-04-01_2018-03-31.txt +++ b/tests/outputs/grant-report/SymPy-1.1_report_2017-04-01_2018-03-31.txt @@ -83,3 +83,21 @@ 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 + + + +Prior Support: +NF-1234, $3000.0, 2017-04-01 to 2018-03-31. +SymPy 1.1 Release Support + +the work resulted in 0 publications: +\cite{} + + +Introduction: A general overview of the project + +Intellectual Merit: Open source software got much better + +Broader Impact: all of science became higher quality + +Products: all of science became higher quality