Skip to content

p-gw/CitrusBuilder.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CitrusBuilder.jl

Stable Dev Build Status Coverage

This Julia package provides utilities to construct surveys that can be uploaded to a running LimeSurvey server.

Getting started

A minimal survey must contain a survey id and a title.

my_survey = survey(100000, "my survey title")
Survey with 0 groups and 0 questions.
my survey title (id: 100000)

To add question groups and questions to a survey the do ... end syntax can be used. Note that LimeSurvey requires that questions must be nested within question groups.

If we want to create a basic survey asking for the name (using a short text question) and gender of the survey participants (using a dropdown select) we can use the following constructor,

gender_options = response_scale([
    response_option("f", "female"),
    response_option("m", "male")
])

basic_survey = survey(123456, "A basic survey") do
    question_group(1, "Basic participant information") do
        short_text_question("name", "Please state your full name.", mandatory=true),
        dropdown_list_question("gender", "Please select a gender.", gender_options, other=true, mandatory=true)
    end
end

which will yield

Survey with 1 group and 2 questions.
A basic survey (id: 123456)
└── Basic participant information (id: 1)
    ├── Please state your full name. (id: name)
    └── Please select a gender. (id: gender)

To export your survey simply call write,

write("my_basic_survey.lss", basic_survey)

The resulting xml file can be imported on the server using the LimeSurvey import function or CitrusAPI.jl.

For more details on how to use this package, please refer to the documentation.