refactor: Compile everything into a single report file

This commit is contained in:
Thomas A. Christensen II 2024-09-10 14:28:17 -05:00
parent 25d9e4aaad
commit 2ffd4f7c9e
Signed by: millironx
GPG key ID: B7044A3432851F64

34
main.jl
View file

@ -120,23 +120,31 @@ open("results.json", "w") do io
JSON3.write(io, question_dict) JSON3.write(io, question_dict)
end end
open("results.md", "w") do f
write(f, "# Antimicrobial usage survey open-ended questions\n\n")
# Compile comments from all requested questions for (question, answers) in question_dict
for q in questions write(f, "## $(question): $(first(survey_data[!, question]))\n\n")
open("$q.md", "w") do f
write(f, "# Antimicrobial usage survey open-ended question: $q\n\n") for (answer, themes) in answers
for (i, a) in enumerate(skipmissing(survey_data[!, q])) write(f, "$answer\n\n Themes:\n")
if i == 1
write(f, "**$a**\n\n") for (theme, is_answered) in themes
else if ismissing(is_answered)
write(f, "$a\n\n") write(f, " - $theme?\n")
elseif is_answered
write(f, " - $theme\n")
end #if end #if
end #for
end #do
run(`pandoc $q.md -o $q.docx`) end #for (theme)
write(f, "\n\n---\n\n")
end #for (answer)
write(f, "\n\n")
end #for (question)
write(f, "\n\n")
end #do
end #for run(`pandoc results.md -o results.docx`)
# Close log file # Close log file
close(log_io) close(log_io)