Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def getReportsPDF(fundername):
current_working_directory = os.getcwd()
try:
return send_file(
f'{current_working_directory}/reports/{fundername}/report.pdf',
f'{current_working_directory}/data/reports/{fundername}/report.pdf',
attachment_filename=f'{fundername}.pdf',
as_attachment=True
)
Expand Down
Binary file modified data_static.zip
Binary file not shown.
4 changes: 3 additions & 1 deletion deploy/data.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

FROM python:3.8-slim-buster

RUN apt-get update
RUN apt-get update -y
RUN apt-get install latexmk -y
RUN apt-get install -y texlive-latex-extra

WORKDIR /app

Expand Down
12 changes: 7 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,29 @@ services:

flask:
container_name: gwas_flask
volumes:
- ./:/var/www
- ./data:/app/data
build:
context: ./
dockerfile: deploy/flask.Dockerfile
command: gunicorn --config gunicorn_config.py wsgi:app
volumes:
- ./:/var/www
- ./data:/app/data
networks:
my-network:
aliases:
- flask-app
depends_on:
- data
restart: unless-stopped

data:
container_name: gwas_data
volumes:
- ./data:/app/data
build:
context: ./
dockerfile: deploy/data.Dockerfile
command: ["python3", "generate_data.py"]
volumes:
- ./data:/app/data
networks:
- my-network
restart: on-failure
Expand Down
5 changes: 2 additions & 3 deletions generate_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,6 @@ def check_paths(data_path):
os.mkdir(os.path.join(data_path, subdir))
if os.path.exists(os.path.join(data_path, 'catalog', 'raw')) is False:
os.mkdir(os.path.join(data_path, 'catalog', 'raw'))
os.mkdir(os.path.join(data_path, 'catalog', 'raw'))
if os.path.exists(os.path.join(data_path, 'catalog', 'synthetic')) is False:
os.mkdir(os.path.join(data_path, 'catalog', 'synthetic'))

Expand Down Expand Up @@ -1430,13 +1429,12 @@ def clean_funder_data(data_path):
ebi_download = 'https://www.ebi.ac.uk/gwas/api/search/downloads/'
final_year = determine_year(datetime.date.today())
diversity_logger.info('final year is being set to: ' + str(final_year))
reports_path = os.path.join(os.getcwd(), 'reports')
reports_path = os.path.join(data_path, 'reports')
try:
if download_cat(data_path, ebi_download) is True:
clean_gwas_cat(data_path)
generate_funder_data(data_path)
clean_funder_data(data_path)
generate_reports(data_path, reports_path, diversity_logger)
make_bubbleplot_df(data_path)
make_doughnut_df(data_path)
tsinput = pd.read_csv(os.path.join(data_path, 'catalog', 'synthetic',
Expand All @@ -1451,6 +1449,7 @@ def clean_funder_data(data_path):
zip_for_download(os.path.join(data_path, 'toplot'),
os.path.join(data_path, 'todownload'))
json_converter(data_path)
generate_reports(data_path, reports_path, diversity_logger)
diversity_logger.info('generate_data.py completed with new data!')
else:
diversity_logger.info('generate_data.py completed quickly: no new data!')
Expand Down
7 changes: 3 additions & 4 deletions generate_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ def get_agency_list(data_path):


def watermark(path, data_path):
watermark_path = os.path.join('app',
'static',
'images',
watermark_path = os.path.join(os.getcwd(),
'data',
'lcds_watermark.pdf')
Doc = open(path+'.pdf', 'rb')
pdfReader = PyPDF2.PdfReader(Doc)
Expand Down Expand Up @@ -150,4 +149,4 @@ def generate_reports(data_path, reports_path, diversity_logger):
diversity_logger.info('Build of the reports: Complete')
except Exception as e:
print(traceback.format_exc())
diversity_logger.debug('Build of the reports: Failed with exception: ', e)
diversity_logger.debug('Build of the reports: Failed with exception: ', e)