-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
some improvements to heredicare communication
- Loading branch information
Showing
10 changed files
with
245 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
set -e | ||
set -o pipefail | ||
#set -o verbose | ||
|
||
helpFunction() | ||
{ | ||
echo "" | ||
echo "Usage: $0 -w env -h path" | ||
echo "This script starts a full import from HerediCaRe" | ||
echo -e "\t-w Provide 'dev' for development server and 'prod' for production gunicorn server." | ||
exit 1 # Exit script after printing help | ||
} | ||
|
||
while getopts "w:" opt | ||
do | ||
case "$opt" in | ||
w ) we="$OPTARG" ;; | ||
? ) helpFunction ;; # Print helpFunction in case parameter is non-existent | ||
esac | ||
done | ||
|
||
# Print helpFunction in case parameters are empty | ||
if [ -z "$we" ] | ||
then | ||
echo "Some or all of the parameters are empty"; | ||
helpFunction | ||
fi | ||
|
||
export WEBAPP_ENV=$we | ||
|
||
echo "Importing HerediCaRe and updating upload stati...." | ||
|
||
SCRIPT=$(readlink -f "$0") | ||
ROOT=$(dirname $(dirname $(dirname "$SCRIPT"))) | ||
cd $ROOT | ||
pwd | ||
|
||
source .venv/bin/activate | ||
|
||
python3 $ROOT/src/frontend_celery/webapp/utils/import_heredicare.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import sys | ||
from os import path | ||
sys.path.append(path.dirname(path.dirname(path.dirname(path.dirname(path.abspath(__file__)))))) | ||
from common.db_IO import Connection | ||
import common.functions as functions | ||
import common.paths as paths | ||
import json | ||
import argparse | ||
sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) | ||
import upload.upload_functions as upload_functions | ||
import frontend_celery.webapp.tasks as tasks | ||
|
||
|
||
roles = ["db_admin"] | ||
|
||
conn = Connection(roles) | ||
|
||
# update state of unfinished heredicare uploads | ||
variant_ids = conn.get_variant_ids_by_publish_heredicare_status(stati = ['pending', 'progress', 'submitted']) | ||
upload_functions.check_update_all_most_recent_heredicare(variant_ids, conn) | ||
|
||
# update state of unfinished clinar uploads | ||
variant_ids = conn.get_variant_ids_by_publish_clinvar_status(stati = ['pending', 'progress', 'submitted']) | ||
upload_functions.check_update_all_most_recent_clinvar(variant_ids, conn) | ||
|
||
|
||
# import HerediCaRe VIDs | ||
botname = "heredivar_bot" | ||
conn.insert_user(username = botname, first_name = "HerediVar", last_name = "Bot", affiliation = "Bot", api_roles = "") | ||
bot_id = conn.get_user_id(botname) | ||
vids = "update" # start task importing all updated heredicare vids | ||
import_queue_id = tasks.start_variant_import(vids, bot_id, roles, conn) | ||
|
||
conn.close() |