Skip to content

Commit

Permalink
Add NEMO -> XLSForm qtype conversion table
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex committed Sep 25, 2023
1 parent dd18170 commit 182a45d
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion app/models/forms/export.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,34 @@ class Export
"geq" => ">="
}.freeze

QTYPE_TO_XLS = {
# conversions
"location" => "geopoint",
"long_text" => "text",
"datetime" => "dateTime",
"annotated_image" => "image",
"counter" => "integer",

# no change
"text" => "text",
"select_one" => "select_one",
"select_multiple" => "select_multiple",
"decimal" => "decimal",
"time" => "time",
"date" => "date",
"image" => "image",
"barcode" => "barcode",
"audio" => "audio",
"video" => "video",
"integer" => "integer",

# Not supported in XLSForm
"sketch" => "sketch (WARNING: not supported)",
"signature" => "signature (WARNING: not supported)",

# XLSForm qtypes not supported in NEMO: range, geotrace, geoshape, note, file, select_one_from_file, select_multiple_from_file, background-audio, calculate, acknowledge, hidden, xml-external
}.freeze

def initialize(form)
@form = form
end
Expand Down Expand Up @@ -100,7 +128,10 @@ def to_xls
os_name = ""
end

type_to_push = "#{q.qtype_name}#{os_name}"
# convert question types
qtype_converted = QTYPE_TO_XLS[q.qtype_name]

type_to_push = "#{qtype_converted}#{os_name}"
code_to_push = "#{q.full_dotted_rank}_#{q.code}"

# Write the question row
Expand Down

0 comments on commit 182a45d

Please sign in to comment.