Have developed / operationalized a clinical interview and use Python / RC2 to extract the results and post-process them into a plain text format that I then copy / paste into an electronic health record. Works reasonably well. Useful.
Is there a way to automatically execute my Python post-processing script when the patient completes the survey? The patient's token number would have to be passed to the script.
Note that you can dynamically access {SAVEDID} & {TOKEN} values in the completed message/page , so you can use several other redirect methods like AJAX calls or meta refresh redirection:
Am a fair novice still with website design / management (knowledge has exploded much faster over the decades than I can learn it as a clinical professional), but got the "End URL" Python script to work via CGI.
Had to read up on how to configure the Python scripts to run via CGI (URLs below.) I now know there are options other than CGI, and I don't know all the security ramifications, but this will all be run only within the walls of a LAN. No WAN use. Am just trying to make it work.
I set the following:
Survey properties -> Edit survey text elements and settings -> Presentation & navigation -> Automatically load URL when survey complete = "On"
public function afterSurveyComplete() {
$surveyId =$this->getEvent()->get('surveyId');
$token = isset($_SESSION['survey_'.$surveyId]['token'] ? $_SESSION['survey_'.$surveyId]['token'] : null;
if($token) {
// There are surely another way to call a py script ???
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://localhost:8080/cgi-bin/Psychiatric%20Diagnostic%20Interview%20Print.py?surveyid=".$surveyId."&urltoken=".$token);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
curl_close($ch);
}
}
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. -
Professional support
-
Plugins, theme and development
. I don't answer to private message.