You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ClinicalTrialsDataProcessing/justfile

87 lines
3.1 KiB
Plaintext

#justfile, used for automating build/setup
# TODO
# - setup a .env file so things can be shared between just and docker
# - move network name to .env
# - move postgress login credentials (allow them to be printed from just while setting up)
data_link := "https://ctti-aact.nyc3.digitaloceanspaces.com/27grtsnhtccplxapj2o8ak9aotvv"
data_file := "2022-12-23_postgres_data.zip"
data_path := "./AACT_downloader/aact_downloads"
data_filepath := data_path / data_file
#must match the 'container name: aact_db' in the docker-compose.yaml
docker_container := `docker container ls -a | grep aact_db | cut -f 1 -d " " | tr "\n" " "`
#Various paths for docker stuff
dockerdef_path := "./AACT_downloader/ClinicalTrialHistory"
dockerdef_dockerfile := dockerdef_path / "Dockerfile"
dockerdef_schema_path := dockerdef_path / "docker-entrypoint-initdb.d"
dockerdef_schema_http := dockerdef_schema_path / "020_HttpSchema.sql"
dockerdef_schema_hist:= dockerdef_schema_path / "030_HistoricalSchema.sql"
dockerdef_schema_AViews := dockerdef_schema_path / "090_AnalysisViews.sql"
docker-compose_path := "./AACT_downloader/docker-compose.yaml"
#check for necessary dependencies
check-status:
docker --version
python --version
curl --version
echo "current docker containers:{{docker_container}}"
#Setup the AACT container
setup-containers:
@echo "Check for downloaded data"
[ -s {{data_path}}/postgres_data.dmp ]
@echo "Checking for key files"
#check appropriate files and directories are setup
[ -s {{dockerdef_schema_http}} ]
[ -s {{dockerdef_schema_hist}} ]
[ -s {{dockerdef_schema_AViews}} ]
#run docker compose
@echo "Setting up AACT container"
docker-compose -f {{docker-compose_path}} up -d
#Stop the appropriate docker container
stop-containers:
#stop all docker containers if they are currently running.
#The if statement is used because sometimes there are no running containers
if [ -n "{{docker_container}}" ]; then docker stop {{docker_container}}; fi
@echo "confirmed that docker containers {{docker_container}} are stopped"
#Remove the appropriate docker container as well as associated volumes
clean-docker: stop-containers
# remove docker containers
if [ -n "{{docker_container}}" ]; then docker rm {{docker_container}}; fi
# cleanup docker network
docker network prune
# cleanup docker volumes
docker volume prune
#sets up the docker network
setup-docker-network:
docker network create pharmaceutical_research
#Download the AACT data
download-aact-data:
curl {{data_link}} > ./AACT_downloader/aact_downloads/{{data_file}}
unzip {{data_filepath}} -d {{data_path}}
rm {{data_filepath}}
#Download and parse historical clinical trials data
download-parse-historical-ct:
echo "not implemented"
#Build everything from scratch
build-from-scratch: check-status download-aact-data setup-containers download-parse-historical-ct
echo "system will be built from scratch, including downloading data"
#build based on previously downloaded data
build-from-download: check-status setup-containers download-parse-historical-ct
echo "system will be built from downloading data"