Skip to content

Commit

Permalink
Merge pull request #53 from bcbi/sem_rel
Browse files Browse the repository at this point in the history
fix(medline): check directory structure thoroughly
  • Loading branch information
mcmcgrath13 authored Jan 17, 2019
2 parents 1be220d + bf9598e commit c83afc6
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/Processes/medline_load.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function load_medline!(db_con::MySQL.Connection, output_dir::String; start_file:
end

@info "Parsing files into CSV"
pmap(x -> parse_ml_file(get_file_name(x, year, test), output_dir), start_file:end_file) # CHANGED FROM PMAP TO MAP TO GET MORE USEFUL STACKTRACE
pmap(x -> parse_ml_file(get_file_name(x, year, test), output_dir), start_file:end_file)

@info "Loading CSVs into MySQL"
for n = start_file:end_file
Expand Down Expand Up @@ -67,17 +67,24 @@ function init_medline(output_dir::String, test::Bool=false)
## SET UP ENVIRONMENT
@info "======Setting up folders and creating FTP Connection======"

try
mkdir(joinpath(output_dir,"medline"))
catch
ml_dir = joinpath(output_dir,"medline")

if isdir(ml_dir)
println("medline directory already exists")
else
mkdir(ml_dir)
end

try
mkdir(joinpath(output_dir,"medline","raw_files"))
mkdir(joinpath(output_dir,"medline","parsed_files"))
catch
println("files directories already exists")
if isdir(joinpath(ml_dir, "raw_files"))
println("raw files directory already exists")
else
mkdir(joinpath(ml_dir, "raw_files"))
end

if isdir(joinpath(ml_dir, "parsed_files"))
println("parsed files directory already exists")
else
mkdir(joinpath(ml_dir, "parsed_files"))
end

# Initialize FTP
Expand Down

0 comments on commit c83afc6

Please sign in to comment.