refactor: Compile everything into a single report file
This commit is contained in:
parent
25d9e4aaad
commit
2ffd4f7c9e
1 changed files with 22 additions and 14 deletions
36
main.jl
36
main.jl
|
@ -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 (i, a) in enumerate(skipmissing(survey_data[!, q]))
|
|
||||||
if i == 1
|
|
||||||
write(f, "**$a**\n\n")
|
|
||||||
else
|
|
||||||
write(f, "$a\n\n")
|
|
||||||
end #if
|
|
||||||
end #for
|
|
||||||
end #do
|
|
||||||
|
|
||||||
run(`pandoc $q.md -o $q.docx`)
|
for (answer, themes) in answers
|
||||||
|
write(f, "$answer\n\n Themes:\n")
|
||||||
|
|
||||||
end #for
|
for (theme, is_answered) in themes
|
||||||
|
if ismissing(is_answered)
|
||||||
|
write(f, " - $theme?\n")
|
||||||
|
elseif is_answered
|
||||||
|
write(f, " - $theme\n")
|
||||||
|
end #if
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
run(`pandoc results.md -o results.docx`)
|
||||||
|
|
||||||
# Close log file
|
# Close log file
|
||||||
close(log_io)
|
close(log_io)
|
||||||
|
|
Loading…
Reference in a new issue