Skip to content

Commit

Permalink
stop autoupdate and checks
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasrodes committed Aug 21, 2024
1 parent 1284766 commit f7b3b24
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 77 deletions.
130 changes: 65 additions & 65 deletions scripts/scripts/autoupdate.sh
Original file line number Diff line number Diff line change
@@ -1,66 +1,66 @@
#!/bin/bash

set -e

BRANCH="master"
ROOT_DIR="/home/owid/covid-19-data" #"$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd ../.. && pwd )"
SCRIPTS_DIR=$ROOT_DIR/scripts


# ENV VARS
export OWID_COVID_PROJECT_DIR=${ROOT_DIR}
export OWID_COVID_CONFIG=${OWID_COVID_PROJECT_DIR}/scripts/config.yaml
export OWID_COVID_SECRETS=${OWID_COVID_PROJECT_DIR}/scripts/secrets.yaml
export PATH=$PATH:/usr/local/bin/ # so geckodriver is correctly found


# FUNCTIONS
has_changed() {
git diff --name-only --exit-code $1 >/dev/null 2>&1
[ $? -ne 0 ]
}

has_changed_gzip() {
# Ignore the header because it includes the creation time
cmp --silent -i 8 $1 <(git show HEAD:$1)
[ $? -ne 0 ]
}

git_push() {
if [ -n "$(git status --porcelain)" ]; then
msg="data("$1"): automated update"
git add .
git commit -m "$msg"
git push origin $BRANCH
fi
}
# set -e

# BRANCH="master"
# ROOT_DIR="/home/owid/covid-19-data" #"$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd ../.. && pwd )"
# SCRIPTS_DIR=$ROOT_DIR/scripts


# # ENV VARS
# export OWID_COVID_PROJECT_DIR=${ROOT_DIR}
# export OWID_COVID_CONFIG=${OWID_COVID_PROJECT_DIR}/scripts/config.yaml
# export OWID_COVID_SECRETS=${OWID_COVID_PROJECT_DIR}/scripts/secrets.yaml
# export PATH=$PATH:/usr/local/bin/ # so geckodriver is correctly found


# # FUNCTIONS
# has_changed() {
# git diff --name-only --exit-code $1 >/dev/null 2>&1
# [ $? -ne 0 ]
# }

# has_changed_gzip() {
# # Ignore the header because it includes the creation time
# cmp --silent -i 8 $1 <(git show HEAD:$1)
# [ $? -ne 0 ]
# }

# git_push() {
# if [ -n "$(git status --porcelain)" ]; then
# msg="data("$1"): automated update"
# git add .
# git commit -m "$msg"
# git push origin $BRANCH
# fi
# }

run_python() {
(cd $SCRIPTS_DIR/scripts; python -c "$1")
}
# run_python() {
# (cd $SCRIPTS_DIR/scripts; python -c "$1")
# }

# Move to the root directory
cd $ROOT_DIR
# # Move to the root directory
# cd $ROOT_DIR

# Activate Python virtualenv
source $SCRIPTS_DIR/venv/bin/activate
# # Activate Python virtualenv
# source $SCRIPTS_DIR/venv/bin/activate

# Make sure we have the latest commit.
git reset --hard origin/$BRANCH && git pull origin $BRANCH
# # Make sure we have the latest commit.
# git reset --hard origin/$BRANCH && git pull origin $BRANCH


# =====================================================================
# Cases & Deaths

# Attempt to download JHU CSVs

hour=$(date +%H)
echo "Hour: $hour" # Debugging output
if [ "$hour" == "00" ] || [ "$hour" == "06" ] || [ "$hour" == "12" ] || [ "$hour" == "18" ]; then
echo "Generating Case/Death files..."
cowid --server casedeath generate
git_push "case-death"
fi
# hour=$(date +%H)
# echo "Hour: $hour" # Debugging output
# if [ "$hour" == "00" ] || [ "$hour" == "06" ] || [ "$hour" == "12" ] || [ "$hour" == "18" ]; then
# echo "Generating Case/Death files..."
# cowid --server casedeath generate
# git_push "case-death"
# fi


# =====================================================================
Expand Down Expand Up @@ -123,26 +123,26 @@ fi
# =====================================================================
# Variants
# TODO: REMOVE
hour=$(date +%H)
if [ $hour == 19 ] ; then
echo "Generating CoVariants dataset..."
cowid --server variants generate
cowid --server variants grapher-io
git_push "variants"
fi
# hour=$(date +%H)
# if [ $hour == 19 ] ; then
# echo "Generating CoVariants dataset..."
# cowid --server variants generate
# cowid --server variants grapher-io
# git_push "variants"
# fi

# =====================================================================
# Excess Mortality
hour=$(date +%H)
if [ $hour == 21 ] ; then
echo "Generating XM dataset..."
cowid --server xm generate
git_push "xm"
fi
# hour=$(date +%H)
# if [ $hour == 21 ] ; then
# echo "Generating XM dataset..."
# cowid --server xm generate
# git_push "xm"
# fi



# =====================================================================
# Megafile
cowid --server megafile
git_push "megafile"
# cowid --server megafile
# git_push "megafile"
24 changes: 12 additions & 12 deletions scripts/scripts/update_alerts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ source $SCRIPTS_DIR/venv/bin/activate

hour=$(TZ=Europe/Paris date +%H)

if [ $hour == 07 ] ; then
cowid --server check casedeath
fi
# if [ $hour == 07 ] ; then
# cowid --server check casedeath
# fi

if [ $hour == 09 ] ; then
cowid --server check megafile
fi
# if [ $hour == 09 ] ; then
# cowid --server check megafile
# fi

if [ $hour == 12 ] ; then
cowid --server check vax
fi
# if [ $hour == 12 ] ; then
# cowid --server check vax
# fi

if [ $hour == 14 ] ; then
cowid --server check hosp
fi
# if [ $hour == 14 ] ; then
# cowid --server check hosp
# fi

0 comments on commit f7b3b24

Please sign in to comment.