Compare commits

...

3 commits

4 changed files with 46 additions and 1 deletions

2
.gitignore vendored
View file

@ -31,3 +31,5 @@ docs/site/
### Data gitignore ###
######################
data.tsv
Q*.docx
Q*.md

View file

@ -2,7 +2,7 @@
julia_version = "1.10.5"
manifest_format = "2.0"
project_hash = "7e38425d15a28e7abd87534dcfc793c08d63a4f4"
project_hash = "2fa745387593e623f1f0981fb03a0365b52a606c"
[[deps.Artifacts]]
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
@ -138,6 +138,12 @@ version = "1.2.0"
[[deps.Mmap]]
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
[[deps.Mustache]]
deps = ["Printf", "Tables"]
git-tree-sha1 = "3b2db451a872b20519ebb0cec759d3d81a1c6bcb"
uuid = "ffc61752-8dc7-55ee-8c37-f3e9cdd09e70"
version = "1.0.20"
[[deps.OpenBLAS_jll]]
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"]
uuid = "4536629a-c528-5b80-bd46-f80d51c5b363"

View file

@ -1,3 +1,4 @@
[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Mustache = "ffc61752-8dc7-55ee-8c37-f3e9cdd09e70"

36
main.jl Executable file
View file

@ -0,0 +1,36 @@
#!/usr/bin/env julia
using CSV
using DataFrames
using Mustache
# 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