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
34
main.jl
34
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 (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 #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 #do
|
||||||
|
|
||||||
run(`pandoc $q.md -o $q.docx`)
|
run(`pandoc results.md -o results.docx`)
|
||||||
|
|
||||||
end #for
|
|
||||||
|
|
||||||
# Close log file
|
# Close log file
|
||||||
close(log_io)
|
close(log_io)
|
||||||
|
|
Loading…
Reference in a new issue