Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The idea for this code is to be able to display a link within the tool that will lead people to a survey that they can fill out. The results from the survey can later be fetched again through the API. If you'd like to test it out, I can give you the login data for the Kobotoolbox account containing the base survey that I used to test this. You will also need the
KOBO_API_TOKEN
.Process concept
Setup
0. Create a base survey
The base survey corresponds to the survey that should be duplicated when the user requests it. By using duplicates every survey will have the set of answers unique to the user/project, and not contain the answers for all users. The survey ID can be found in its URL on Kobotoolbox.
Survey deployment
(These steps are currently performed in the
__init__
of theKoboToolbox
class.1. Clone the survey
Clone the survey given by the corresponding ID, which is then saved as a draft on the
KoboToolbox
account. The function will return thenew_form_id
, which is needed to deploy the form.2. Assign permissions
By default, only assigned people (which then obviously also need a Kobotoolbox account) can fill out the survey. Anonymous users can fill out the survey by adding the permissions
view_asset
andadd_submissions
toAnonymousUser
.3. Deploy the survey
By deploying the form, it will be moved from the drafts to the deployed forms, allowing people to fill it out. The function will return the link to the online survey.
... after this happens, I figured there should be a button to press when the user knows that the survey has been filled out by all necessary people, and then:
Data processing
(These steps are not yet in the code)
4. Retrieve survey data
The answers from the survey can be retrieved back once it has been filled out. I did not implement this yet in my version, but Johann did some of it for WEFESiteAnalyst already https://github.com/rl-institut/WEFESiteAnalyst/tree/data_analysis_ui.
5. Do post-processing