Welcome, Guest
Username: Password: Remember me

TOPIC: automated export of survey results for import in R

automated export of survey results for import in R 1 year 2 months ago #96586

  • svollmar
  • svollmar's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 10
  • Thank you received: 1
  • Karma: 0
Hello,

we have integrated LimeSurvey 2.00 into our workflow for managing our proband data (we have written a lot of MySQL, PHP and Python code). At our institute, LimeSurvey is used as a web front end for surveys, management of invitations and reminders is handled by our system, as is the generation of tokens; we have patched "application/helpers/SurveryRuntimeHelper.php" to trigger (via ZMQ) an immediate response from our internal system when a survey has been completed. So far, we are very satisfied with the whole setup.

However, we would like to take integration one step further: if certain surveys are completed, they should be evaluated and the results be transferred to some internal databases. As mentioned above, we can already trigger arbitrary code of ours when the survey has been completed. We can also manually export data for import in R (this seems to be the cleanest method) and would like to automate that step: is there a way to have LimeSurvey write the R files for a particular $sid to some file? We can run code locally on the machine serving LimeSurvey, or use a remote PHP call with a URL.

Many thanks in advance.
Stefan
The administrator has disabled public write access.

automated export of survey results for import in R 1 year 2 months ago #96595

  • mdekker
  • mdekker's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 341
  • Thank you received: 68
  • Karma: 38
Have you tried remote control? You might not need the remote control but you can see how export results is handled there. I believe there is some documentation on the subject, but if you get stuck you can always ask for help here.
---
Menno Dekker
The administrator has disabled public write access.

automated export of survey results for import in R 1 year 1 month ago #96647

  • svollmar
  • svollmar's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 10
  • Thank you received: 1
  • Karma: 0
Dear mdekker,

thank you for mentioning "remote control". We have just tried the API via JSON-RPC with

...
$responses = $myJSONRPCClient->export_responses ($sessionKey, $survey_id,
"csv",
"de",
"full",
"long"
); //Export response data to pdf,csv,xls,doc
file_put_contents("/tmp/a.csv", base64_decode($responses));
...

and got the expected result - great!
However, so far we can only export the CSV version of a given survey. Is there a way to also export the "R syntax" file?
Many thanks in advance,
Stefan
The administrator has disabled public write access.
The following user(s) said Thank You: stevelegare

automated export of survey results for import in R 1 year 1 month ago #96674

  • mdekker
  • mdekker's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 341
  • Thank you received: 68
  • Karma: 38
At the moment this is not possible as R and SPSS exports have a different code base then the other exports. It is on the roadmap for a future version to make all exports behave the same but unfortunately I can give no ETA for that feature.

Maybe your best shot for now would be to look at the file /application/controllers/admin/export.php and look at the exportr() method.
---
Menno Dekker
The administrator has disabled public write access.

automated export of survey results for import in R 1 year 1 month ago #96678

  • svollmar
  • svollmar's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 10
  • Thank you received: 1
  • Karma: 0
Been there, done that - but I did not see a good (or any) way to call the code there in an automated fashion. I would need to supply the survey id and then, somehow, call exportr().

Anyway, exporting the CSV file in a (clean) and automated fashion was the important part, the R file (as I understand it) only needs to be generated once for each survey (unless the structure changes).

Thanks,
Stefan
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.107 seconds
Donation Image