From 1882816f3bebf18b99d86049b0aa4820cb8cea67 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Mon, 13 Jan 2025 19:22:00 -0500 Subject: [PATCH 1/4] nsf prior support now built as part of grantreport. initial commit --- src/regolith/builders/grantreportbuilder.py | 5 +++- src/regolith/exemplars.json | 6 ++++ src/regolith/schemas.json | 28 +++++++++++++++++++ src/regolith/templates/grantreport.txt | 31 +++++++++++++++++++++ 4 files changed, 69 insertions(+), 1 deletion(-) 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 3d68b1d11..df12229bf 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..d7f452809 100644 --- a/src/regolith/templates/grantreport.txt +++ b/src/regolith/templates/grantreport.txt @@ -184,3 +184,34 @@ 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 -}} - {{- 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 %} From 123047bc45625d89db92021794ad7528fd7ce0a7 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Mon, 13 Jan 2025 19:25:00 -0500 Subject: [PATCH 2/4] news --- news/prior-support.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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..a260e06ac --- /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:** + +* From 059d776e96682b3b60255662b6fbff1008f80a87 Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Mon, 13 Jan 2025 19:45:13 -0500 Subject: [PATCH 3/4] tests for grant-report --- news/prior-support.rst | 2 +- src/regolith/templates/grantreport.txt | 8 +++----- .../SymPy-1.1_report_2017-04-01_2018-03-31.txt | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/news/prior-support.rst b/news/prior-support.rst index a260e06ac..a901e3f0f 100644 --- a/news/prior-support.rst +++ b/news/prior-support.rst @@ -1,6 +1,6 @@ **Added:** -* ability to print a prior-support statement as part of the grant-report +* Ability to print a prior-support statement as part of the grant-report. **Changed:** diff --git a/src/regolith/templates/grantreport.txt b/src/regolith/templates/grantreport.txt index d7f452809..b863f48b5 100644 --- a/src/regolith/templates/grantreport.txt +++ b/src/regolith/templates/grantreport.txt @@ -187,7 +187,7 @@ Significant changes in use or care of biohazards{{ newline }} Prior Support: -{{ grant.get('awardnr','') }}, ${{- grant.get('amount','') -}}, {{- begin_date -}} - {{- end_date -}}. +{{ grant.get('awardnr','') }}, ${{- grant.get('amount','') -}}, {{ begin_date }} to {{ end_date -}}. {{ grant.get('title', '') }} the work resulted in {{ len(products) }} publications: @@ -204,10 +204,8 @@ 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 %} +{% endif %} +{% for publ in products %} - {{ publ.get('title') }} {{ publ.get('_id') }} {% for person in publ.get('author') %}{{ person }}, {% 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 From 1fd7f70565fde3242fcdb97a3bcd9dd520928fae Mon Sep 17 00:00:00 2001 From: Simon Billinge Date: Mon, 13 Jan 2025 19:49:15 -0500 Subject: [PATCH 4/4] making pre-commit and tests happy at the same time --- src/regolith/templates/grantreport.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/regolith/templates/grantreport.txt b/src/regolith/templates/grantreport.txt index b863f48b5..f555d39c2 100644 --- a/src/regolith/templates/grantreport.txt +++ b/src/regolith/templates/grantreport.txt @@ -205,7 +205,7 @@ Broader Impact: {{ grant.get('prior_support',{}).get('broader_impact','') }} {% if grant.get('prior_support',{}).get('products','') | length > 0 %} Products: {{ grant.get('prior_support',{}).get('products','') }} {% endif %} -{% for publ in products %} +{%- for publ in products %} - {{ publ.get('title') }} {{ publ.get('_id') }} {% for person in publ.get('author') %}{{ person }}, {% endfor %}