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

Minghui dev #55

Closed
wants to merge 5 commits into from
Closed

Minghui dev #55

wants to merge 5 commits into from

Conversation

MingghuiA
Copy link
Collaborator

updated start_dev.py and modified email models to merge clinical trail, grants and publications into one email alert.

MingghuiA and others added 4 commits February 13, 2024 12:57
* 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>
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."
Copy link
Collaborator

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)
Copy link
Collaborator

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')
Copy link
Collaborator

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')
Copy link
Collaborator

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']}
Copy link
Collaborator

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

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']}
Copy link
Collaborator

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

Copy link
Collaborator Author

@MingghuiA MingghuiA May 24, 2024

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.

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':'--'}
Copy link
Collaborator

Choose a reason for hiding this comment

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

same as above

Copy link
Collaborator Author

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

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'}
Copy link
Collaborator

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

Copy link
Collaborator Author

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
Copy link
Collaborator

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
Copy link
Collaborator

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

Copy link
Collaborator Author

@MingghuiA MingghuiA May 24, 2024

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

Copy link
Collaborator

@devonleadman devonleadman left a 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

@MingghuiA MingghuiA closed this May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants