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)
|
||||
end
|
||||
|
||||
open("results.md", "w") do f
|
||||
write(f, "# Antimicrobial usage survey open-ended questions\n\n")
|
||||
|
||||
# Compile comments from all requested questions
|
||||
for q in questions
|
||||
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")
|
||||
for (question, answers) in question_dict
|
||||
write(f, "## $(question): $(first(survey_data[!, question]))\n\n")
|
||||
|
||||
for (answer, themes) in answers
|
||||
write(f, "$answer\n\n Themes:\n")
|
||||
|
||||
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
|
||||
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_io)
|
||||
|
|
Loading…
Reference in a new issue