Added a justfile, adjusted docker networks, restructured how data is downloaded

llm-extraction
youainti 3 years ago
parent a2c0e4dcc7
commit e240fff07c

3
.gitignore vendored

@ -180,8 +180,7 @@ Manifest.toml
###### Custom ##### ###### Custom #####
*_clinical_trials/ aact_downloads/
*_clinical_trials.zip
NCT*.html NCT*.html
/Orangebook/EOBZIP_*/ /Orangebook/EOBZIP_*/
/Orangebook/Orangebooks/ /Orangebook/Orangebooks/

@ -3,10 +3,15 @@ version: '3'
volumes: volumes:
aact_pg_database: #This is to hold the database. aact_pg_database: #This is to hold the database.
services: networks:
pharmaceutical_research:
external: true
services:
aact: aact:
build: ./ClinicalTrialHistory #build and use the clinical trial history db. build: ./ClinicalTrialHistory #build and use the clinical trial history db.
networks:
- pharmaceutical_research
container_name: aact_db container_name: aact_db
#restart: always #restart after crashes #restart: always #restart after crashes
environment: environment:
@ -17,5 +22,5 @@ services:
- "5432:5432" #host:container - "5432:5432" #host:container
volumes: #host:container is the format. volumes: #host:container is the format.
- aact_pg_database:/var/lib/postgresql/ # this is persistant storage for the database - 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

@ -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"
Loading…
Cancel
Save