-
Notifications
You must be signed in to change notification settings - Fork 7
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
Minghui dev #55
Minghui dev #55
Conversation
* test pull (#48) * remove test file * modify the email module to use the rdas system to send email, move the initiation firebase admin to the star_dev, replaced ses_firebase.py codes by test_ses_firebase.py * remove test emails and remove '/' from file_paths in the sysvars.py --------- Co-authored-by: devonleadman <shanmardev@hotmail.com>
…ses alerts into one email.
sysvars.py
Outdated
@@ -16,11 +16,12 @@ | |||
firebase_key_path = '{base_path}crt/ncats-summer-interns-firebase-adminsdk-9g7zz-a4e783d24c.json'.format(base_path=base_path) # May have to set this in new enviroment | |||
|
|||
# if you are not using minghui's test dataset, make db_prefix="" | |||
db_prefix="minghui." | |||
db_prefix="minghui.rdas." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change this back to "" before commiting
sysvars.py
Outdated
@@ -5,7 +5,7 @@ | |||
# Basic user information | |||
current_user = 'aom2' | |||
base_directory_name = 'RDAS' | |||
base_path = '/home/{current_user}/{base_directory_name}/'.format(current_user=current_user, base_directory_name=base_directory_name) | |||
base_path = '/home/{current_user}/RDAS_master/{base_directory_name}/'.format(current_user=current_user, base_directory_name=base_directory_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change this back to '/home/{current_user}/{base_directory_name}/'
start_dev.py
Outdated
|
||
print(f'Update of {full_db_name} Database Complete...') | ||
if True in has_updates.values(): | ||
ses_firebase.trigger_email(firestore_db,has_updates, date_start='03/23/22',date_end='03/30/24') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hard coded dates, i think these should be some sort of variable
start_dev.py
Outdated
for k,v in current_updates.items(): | ||
print("updates:::",k,v) | ||
if v == True: | ||
full_db_name = sysvars.db_abbrevs[k] | ||
print(f'{full_db_name} Update Initiated') | ||
has_updates[full_db_name]=True | ||
# p = Popen(['python3', 'driver_manual.py', '-db', f'{k}', '-m', 'update'], encoding='utf8') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure to un-comment the lines of codes 91 - 119
start_dev.py
Outdated
@@ -38,7 +41,8 @@ def check_update(db_type): | |||
# Get the current date and time | |||
today = datetime.now() | |||
|
|||
config_selection = {'ct':['clinical_update', 'ct_interval'], 'pm':['pubmed_update', 'pm_interval'], 'gnt':['grant_update', 'gnt_interval']} | |||
# config_selection = {'ct':['clinical_update', 'ct_interval'], 'pm':['pubmed_update', 'pm_interval'], 'gnt':['grant_update', 'gnt_interval']} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this line needs to be uncommented and the below line commented out, that or use the variable in sysvars.py to make this generalizable
emails/ses_firebase.py
Outdated
cred = credentials.Certificate(sysvars.firebase_key_path) | ||
firebase_admin.initialize_app(cred) | ||
firestore_db = firestore.client() | ||
convert = {prefix+'ctkg':['ClinicalTrial','GARD','GardId'], prefix+'pakg':['Article','GARD','GardId'], prefix+'gfkg':['Project','GARD','GardId']} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
manually doing "prefix+'ctkg'" seems unnecessary as in sysvars.py we already build out the DB name we are using. Example: the variable ct_db in sysvars.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can just set the prefix ="". by keeping the prefix it will be easier for the development because it unifies the settings according to our needs. so next time if we need to make any improvement, we don't need to change all the parameters over and over again.
emails/ses_firebase.py
Outdated
firebase_admin.initialize_app(cred) | ||
firestore_db = firestore.client() | ||
convert = {prefix+'ctkg':['ClinicalTrial','GARD','GardId'], prefix+'pakg':['Article','GARD','GardId'], prefix+'gfkg':['Project','GARD','GardId']} | ||
connect_to_gard = {prefix+'ctkg':'--(:Condition)--(:Annotation)--',prefix+'pakg':'--',prefix+'gfkg':'--'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as my above comment
emails/ses_firebase.py
Outdated
def trigger_email(firestore_db,has_updates,date_start=datetime.today().strftime('%m/%d/%y'), date_end=datetime.today().strftime('%m/%d/%y')): | ||
print("start_date",date_start, " end date:: ",date_end) | ||
#obtain users contact information | ||
txt_tabs_1 = {'trials':prefix +'ctkg', 'grants':prefix +'gfkg', 'articles':prefix +'pakg'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above for lines 71-72
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as my above comment
date_list = pd.date_range(date_start_obj, date_end_obj, freq='D').strftime('%m/%d/%y').to_list() | ||
|
||
print(f'Searching for nodes created between {date_start_string} and {date_end_string}') | ||
prefix = sysvars.db_prefix # you can set the db_prefix in sysvars.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can probably remove this with the fixes below this
config.ini
Outdated
minghui.grant_update = 11/30/22 | ||
minghui.pubmed_update = 10/30/22 | ||
minghui.gard_update = 11/30/23 | ||
; minghui.clinical_update = 01/08/24 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
confused on what these lines are with the ; symbol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the ; symbol means these lines are commented out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left you some comments to review
updated start_dev.py and modified email models to merge clinical trail, grants and publications into one email alert.