diff --git a/.gitignore b/.gitignore index 75fd352..eecffb8 100644 --- a/.gitignore +++ b/.gitignore @@ -180,8 +180,7 @@ Manifest.toml ###### Custom ##### -*_clinical_trials/ -*_clinical_trials.zip +aact_downloads/ NCT*.html /Orangebook/EOBZIP_*/ /Orangebook/Orangebooks/ diff --git a/AACT_downloader/docker-compose.yaml b/AACT_downloader/docker-compose.yaml index 9628a85..fbdd998 100644 --- a/AACT_downloader/docker-compose.yaml +++ b/AACT_downloader/docker-compose.yaml @@ -3,10 +3,15 @@ version: '3' volumes: aact_pg_database: #This is to hold the database. -services: +networks: + pharmaceutical_research: + external: true +services: aact: build: ./ClinicalTrialHistory #build and use the clinical trial history db. + networks: + - pharmaceutical_research container_name: aact_db #restart: always #restart after crashes environment: @@ -17,5 +22,5 @@ services: - "5432:5432" #host:container volumes: #host:container is the format. - aact_pg_database:/var/lib/postgresql/ # this is persistant storage for the database - - ./20220201_clinical_trials/postgres_data.dmp:/mnt/host_data/postgres_data.dmp + - ./aact_downloads/postgres_data.dmp:/mnt/host_data/postgres_data.dmp diff --git a/justfile b/justfile new file mode 100644 index 0000000..36cce2d --- /dev/null +++ b/justfile @@ -0,0 +1,65 @@ +#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 := "postgres_data.dmp" + +#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" " "` + +#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" + [ -f ./AACT_downloader/aact_downloads/{{data_file}} ] + @echo "Setting up AACT container" + #check appropriate files and directories are setup + + #run docker compose + +#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 [ "{{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 [ "{{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}} + +#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" + +