From 64e17a4fec29af63b2559638ef20b6501e4d2ba0 Mon Sep 17 00:00:00 2001 From: Long Yang Date: Sun, 6 Dec 2020 05:36:41 -0500 Subject: [PATCH 1/5] ENH: add public and professional summary when f_prum --- regolith/helpers/u_finishprumhelper.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/regolith/helpers/u_finishprumhelper.py b/regolith/helpers/u_finishprumhelper.py index 677719c31..5026998a2 100644 --- a/regolith/helpers/u_finishprumhelper.py +++ b/regolith/helpers/u_finishprumhelper.py @@ -18,6 +18,10 @@ def subparser(subpi): subpi.add_argument("-d", "--database", help="The database that will be updated. Defaults to " "first database in the regolithrc.json file.") + subpi.add_argument("pub_sum", type = str, + help="The public summary that is mandatory for finishing a prum.") + subpi.add_argument("pro_sum", type = str, + help="The professional summary that is mandatory for finishing a prum.") return subpi @@ -60,6 +64,16 @@ def db_updater(self): print("Please rerun the helper specifying the complete ID.") return found_projectum.update({'status':'finished'}) + if rc.pub_sum: + found_projectum['deliverable'].update({'public_summary': rc.pub_sum}) + else: + print("Please enter the public summary by specifying pub_sum argument.") + return + if rc.pro_sum: + found_projectum['deliverable'].update({'professional_summary': rc.pro_sum}) + else: + print("Please enter the professional summary by specifying pro_sum argument.") + return if rc.end_date: found_projectum.update({'end_date': date_parser.parse(rc.end_date).date()}) else: From d77ee42af19ebbe2a4faa49877010d73a4ff57b7 Mon Sep 17 00:00:00 2001 From: Long Yang Date: Sun, 6 Dec 2020 06:24:07 -0500 Subject: [PATCH 2/5] ENH: check if there are pub_sum and pro_sum already in db --- regolith/helpers/u_finishprumhelper.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/regolith/helpers/u_finishprumhelper.py b/regolith/helpers/u_finishprumhelper.py index 5026998a2..429f15e53 100644 --- a/regolith/helpers/u_finishprumhelper.py +++ b/regolith/helpers/u_finishprumhelper.py @@ -18,9 +18,9 @@ def subparser(subpi): subpi.add_argument("-d", "--database", help="The database that will be updated. Defaults to " "first database in the regolithrc.json file.") - subpi.add_argument("pub_sum", type = str, + subpi.add_argument("--pub_sum", type = str, help="The public summary that is mandatory for finishing a prum.") - subpi.add_argument("pro_sum", type = str, + subpi.add_argument("--pro_sum", type = str, help="The professional summary that is mandatory for finishing a prum.") return subpi @@ -66,13 +66,13 @@ def db_updater(self): found_projectum.update({'status':'finished'}) if rc.pub_sum: found_projectum['deliverable'].update({'public_summary': rc.pub_sum}) - else: - print("Please enter the public summary by specifying pub_sum argument.") + elif found_projectum['deliverable'].get('public_summary') is not None: + print("Error: please enter the public summary by specifying pub_sum argument.") return if rc.pro_sum: found_projectum['deliverable'].update({'professional_summary': rc.pro_sum}) - else: - print("Please enter the professional summary by specifying pro_sum argument.") + elif found_projectum['deliverable'].get('professional_summary') is not None: + print("Error: please enter the professional summary by specifying pro_sum argument.") return if rc.end_date: found_projectum.update({'end_date': date_parser.parse(rc.end_date).date()}) From 7caf6d6b326d4127cc692d4a90755e72a58ff02e Mon Sep 17 00:00:00 2001 From: Long Yang Date: Tue, 8 Dec 2020 00:48:18 -0500 Subject: [PATCH 3/5] DOC: update helper function intro. --- regolith/helpers/u_finishprumhelper.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/regolith/helpers/u_finishprumhelper.py b/regolith/helpers/u_finishprumhelper.py index 429f15e53..769e5768b 100644 --- a/regolith/helpers/u_finishprumhelper.py +++ b/regolith/helpers/u_finishprumhelper.py @@ -19,9 +19,15 @@ def subparser(subpi): help="The database that will be updated. Defaults to " "first database in the regolithrc.json file.") subpi.add_argument("--pub_sum", type = str, - help="The public summary that is mandatory for finishing a prum.") + help="The public summary. This will be used in, for example, as web news items. " + "It should capture in a single paragraph the main context, result and importance " + "without jargon in words that a member of the general public can understand. " + "This is required to finish a prum.") subpi.add_argument("--pro_sum", type = str, - help="The professional summary that is mandatory for finishing a prum.") + help="he professional summary. This may be used in, for example, a progress report to" + " a funding agency, or in your cv, etc.. It should capture in a single paragraph the" + " main context, result and importance in more technical language with the target" + " audience of an expert in an adjacent field. This is required to finish a prum.") return subpi @@ -65,15 +71,15 @@ def db_updater(self): return found_projectum.update({'status':'finished'}) if rc.pub_sum: - found_projectum['deliverable'].update({'public_summary': rc.pub_sum}) - elif found_projectum['deliverable'].get('public_summary') is not None: - print("Error: please enter the public summary by specifying pub_sum argument.") - return + found_projectum['public_summary'] = rc.pub_sum + elif found_projectum.get('public_summary') is not None: + raise RuntimeError( + "ERROR: please rerun with a professional summary in field --pro_sum and public summary in --pub_sum") if rc.pro_sum: - found_projectum['deliverable'].update({'professional_summary': rc.pro_sum}) - elif found_projectum['deliverable'].get('professional_summary') is not None: - print("Error: please enter the professional summary by specifying pro_sum argument.") - return + found_projectum['professional_summary'] = rc.pro_sum + elif found_projectum['professional_summary'] is not None: + raise RuntimeError( + "ERROR: please rerun with a professional summary in field --pro_sum and public summary in --pub_sum") if rc.end_date: found_projectum.update({'end_date': date_parser.parse(rc.end_date).date()}) else: From 06ebc263b18e2d5b51651077c5c9450d34aca10d Mon Sep 17 00:00:00 2001 From: Long Yang Date: Fri, 18 Dec 2020 06:53:24 -0500 Subject: [PATCH 4/5] ENH: update public and professional summary logic --- regolith/helpers/u_finishprumhelper.py | 27 ++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/regolith/helpers/u_finishprumhelper.py b/regolith/helpers/u_finishprumhelper.py index 769e5768b..2b690d4e1 100644 --- a/regolith/helpers/u_finishprumhelper.py +++ b/regolith/helpers/u_finishprumhelper.py @@ -70,16 +70,27 @@ def db_updater(self): print("Please rerun the helper specifying the complete ID.") return found_projectum.update({'status':'finished'}) - if rc.pub_sum: - found_projectum['public_summary'] = rc.pub_sum - elif found_projectum.get('public_summary') is not None: + + if found_projectum['professional_summary']: + if rc.pro_sum: + raise RuntimeError( + "ERROR: please input the professional summary either in field --pro_sum or manually type in the yaml file.") + elif rc.pro_sum: + found_projectum['public_summary'] = rc.pro_sum + else: raise RuntimeError( - "ERROR: please rerun with a professional summary in field --pro_sum and public summary in --pub_sum") - if rc.pro_sum: - found_projectum['professional_summary'] = rc.pro_sum - elif found_projectum['professional_summary'] is not None: + "ERROR: please input the professional summary either in field --pro_sum or manually type in the yaml file.") + + if found_projectum['public_summary']: + if rc.pub_sum: + raise RuntimeError( + "ERROR: please input the public summary either in field --pub_sum or manually type in the yaml file.") + elif rc.pub_sum: + found_projectum['public_summary'] = rc.pub_sum + else: raise RuntimeError( - "ERROR: please rerun with a professional summary in field --pro_sum and public summary in --pub_sum") + "ERROR: please input the public summary either in field --pub_sum or manually type in the yaml file.") + if rc.end_date: found_projectum.update({'end_date': date_parser.parse(rc.end_date).date()}) else: From e15f55e40905fec931afe80a7522bac1f2776af8 Mon Sep 17 00:00:00 2001 From: Long Yang Date: Fri, 18 Dec 2020 07:46:54 -0500 Subject: [PATCH 5/5] MAINT: fix typo --- regolith/helpers/u_finishprumhelper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regolith/helpers/u_finishprumhelper.py b/regolith/helpers/u_finishprumhelper.py index 2b690d4e1..388e0c34e 100644 --- a/regolith/helpers/u_finishprumhelper.py +++ b/regolith/helpers/u_finishprumhelper.py @@ -76,7 +76,7 @@ def db_updater(self): raise RuntimeError( "ERROR: please input the professional summary either in field --pro_sum or manually type in the yaml file.") elif rc.pro_sum: - found_projectum['public_summary'] = rc.pro_sum + found_projectum['professional_summary'] = rc.pro_sum else: raise RuntimeError( "ERROR: please input the professional summary either in field --pro_sum or manually type in the yaml file.")