Compare commits
3 commits
b5200c5a8a
...
10357d86ca
Author | SHA1 | Date | |
---|---|---|---|
10357d86ca | |||
ad73e2ef8f | |||
792fb98c76 |
4 changed files with 46 additions and 1 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
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
julia_version = "1.10.5"
|
julia_version = "1.10.5"
|
||||||
manifest_format = "2.0"
|
manifest_format = "2.0"
|
||||||
project_hash = "7e38425d15a28e7abd87534dcfc793c08d63a4f4"
|
project_hash = "2fa745387593e623f1f0981fb03a0365b52a606c"
|
||||||
|
|
||||||
[[deps.Artifacts]]
|
[[deps.Artifacts]]
|
||||||
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
|
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
|
||||||
|
@ -138,6 +138,12 @@ version = "1.2.0"
|
||||||
[[deps.Mmap]]
|
[[deps.Mmap]]
|
||||||
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
|
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.OpenBLAS_jll]]
|
||||||
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"]
|
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"]
|
||||||
uuid = "4536629a-c528-5b80-bd46-f80d51c5b363"
|
uuid = "4536629a-c528-5b80-bd46-f80d51c5b363"
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
[deps]
|
[deps]
|
||||||
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
|
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
|
||||||
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
|
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
|
||||||
|
Mustache = "ffc61752-8dc7-55ee-8c37-f3e9cdd09e70"
|
||||||
|
|
36
main.jl
Executable file
36
main.jl
Executable 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
|
Loading…
Reference in a new issue