Skip to content
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

ENH: add public and professional summary when f_prum #657

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions regolith/helpers/u_finishprumhelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
dragonyanglong marked this conversation as resolved.
Show resolved Hide resolved
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


Expand Down Expand Up @@ -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:
Copy link
Contributor

@sbillinge sbillinge Dec 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this logic is not quite right, please see my code from the previous convo. The outer loop should check if the summaries exist in the db or not and it should not overwrite them if they do. Then it should check if rc.pub_sum exists and use that, finally it should raise a runtime error if it neither already exists in the db nor has been given to the cli.

We should also catch the case where it finds something in the db and is given a value on the cli with a f"WARNING: public summary {found_projectum.get('public_summary')} exists in the db and will not be overwritten with {rc.pub_sum} given on the command line. If you want to force this change please rerun adding --force" or sthg like that.

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:
Expand Down