https://github.com/p-gw/citrusbuilder.jl
Construct LimeSurveys in Julia
https://github.com/p-gw/citrusbuilder.jl
julia limesurvey
Last synced: 5 months ago
JSON representation
Construct LimeSurveys in Julia
- Host: GitHub
- URL: https://github.com/p-gw/citrusbuilder.jl
- Owner: p-gw
- License: mit
- Created: 2022-05-07T11:03:05.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-11-28T10:12:50.000Z (over 3 years ago)
- Last Synced: 2025-02-13T00:38:52.013Z (over 1 year ago)
- Topics: julia, limesurvey
- Language: Julia
- Homepage:
- Size: 245 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CitrusBuilder.jl
[](https://p-gw.github.io/CitrusBuilder.jl/stable)
[](https://p-gw.github.io/CitrusBuilder.jl/dev)
[](https://github.com/p-gw/CitrusBuilder.jl/actions/workflows/CI.yml?query=branch%3Amain)
[](https://codecov.io/gh/p-gw/CitrusBuilder.jl)
This Julia package provides utilities to construct surveys that can be uploaded to a running [LimeSurvey](https://www.limesurvey.org/) server.
## Getting started
A minimal survey must contain a survey id and a title.
```julia
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,
```julia
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`,
```julia
write("my_basic_survey.lss", basic_survey)
```
The resulting xml file can be imported on the server using the [LimeSurvey import function](https://manual.limesurvey.org/Surveys_-_introduction#Import_a_survey) or [CitrusAPI.jl](https://github.com/p-gw/CitrusAPI.jl).
For more details on how to use this package, please refer to the [documentation](https://p-gw.github.io/CitrusBuilder.jl/dev).