Compare commits
2 commits
10357d86ca
...
b5200c5a8a
Author | SHA1 | Date | |
---|---|---|---|
b5200c5a8a | |||
c560041d82 |
2 changed files with 37 additions and 0 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -31,3 +31,5 @@ docs/site/
|
||||||
### Data gitignore ###
|
### Data gitignore ###
|
||||||
######################
|
######################
|
||||||
data.tsv
|
data.tsv
|
||||||
|
Q*.docx
|
||||||
|
Q*.md
|
||||||
|
|
35
main.jl
Executable file
35
main.jl
Executable file
|
@ -0,0 +1,35 @@
|
||||||
|
#!/usr/bin/env julia
|
||||||
|
using CSV
|
||||||
|
using DataFrames
|
||||||
|
|
||||||
|
# Import data
|
||||||
|
survey_data = DataFrame(CSV.File("data.tsv"; delim='\t', normalizenames=true))
|
||||||
|
deleteat!(survey_data, 2)
|
||||||
|
|
||||||
|
# Set descriptions of each column based on the actual question asked
|
||||||
|
for (i, col) in enumerate(eachcol(survey_data))
|
||||||
|
colmetadata!(survey_data, i, "description", first(col))
|
||||||
|
end #for
|
||||||
|
|
||||||
|
# Remove the messy JSON encoding
|
||||||
|
# TODO: For later graphs, move this step _before_ the import so that DataFrames can properly
|
||||||
|
# infer types
|
||||||
|
# deleteat!(survey_data, [1,2])
|
||||||
|
|
||||||
|
# Compile comments from all requested questions
|
||||||
|
questions = [:Q8, :Q16, :Q29, :Q30]
|
||||||
|
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")
|
||||||
|
end #if
|
||||||
|
end #for
|
||||||
|
end #do
|
||||||
|
|
||||||
|
run(`pandoc $q.md -o $q.docx`)
|
||||||
|
|
||||||
|
end #for
|
Loading…
Reference in a new issue