Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[open] Qualtrics Survey Integration

edited November 2014 in OpenSesame

Hello All,

I have another question about integrating survey. I built a survey using Qualtrics and I want to integrate this survey in my experiment. I don't want to build the survey with opensesame. Is there a way that I can do that?

Comments

  • edited 2:26AM

    Hi,

    You can't directly integrate it, but you can open it in a browser from OpenSesame. Put the following code in the Run phase of an inline_script:

    import webbrowser
    
    # change the URL to your survey's URL
    webbrowser.open("http://www.qualtrics.com/", autoraise=True)
    

    The most convenient place for this, I think, would be the end of your actual experiment (to prevent potential screw-ups when the browser is closed and the experiment needs to be raised to the foreground again). But this is up to you, and very much open for testing.

    Good luck!

    Edwin

  • edited 2:26AM

    Thank you. It is working. I put inline-script at the end of the experiment. but I was hoping to detect the period of time the subject spends on the survey to match it to his/her physiological data I'm recording. I don't have python programming language experience. When I did what you suggested, it ended the experiment and the pop up message appeared to save data file right before displaying the survey.
    Is there anyway to make the survey part of the whole experience. I mean once the subject finishes answering the survey, he gets back to the experiment in Opensesame!

    Also, Is there a way to make opensesame open a program in my laptop once the experiment start. I'm considering using emwave desktop relief system for measuring heart rate variability. The only concern I have is to synchronize the timing, I want to detect subject'sHRV during stimuli exposure. So, I was wondering if opensesame can open emwave program at the beginning of the experiment and add triggers to HRV measurements!

  • edited 2:26AM

    To return to the experiment afterwards, could you try appending a sketchpad item with a Duration of keypress to the experiment? (Place it directly after the inline_script)

    There isn't likely a good way of matching physiological data and the questionnaire, unless the website that collects the questionnaire provides you with timestamps of when participants answered each question. You can adopt the inline_script to save the exact starting time of the questionnaire, by inserting the following:

    import time
    import webbrowser
    
    # get the current time
    ct = time.localtime()
    date = time.strftime(u"%4.f-%2.f-%2.f" % (ct.tm_year, ct.tm_mon, ct.tm_mday))
    time = time.strftime(u"%2.f:%2.f:%2.f" % (ct.tm_hour, ct.tm_min, ct.tm_sec))
    
    # log the current time
    exp.log("survey start,%s,%s" % (date,time))
    
    # change the URL to your survey's URL
    webbrowser.open("http://www.qualtrics.com/", autoraise=True)
    

    BUT! Normally, when recording physiological data, you can send triggers to whatever recording equipment you use. This is usually done via the serial or parallel port (or a USB connection emulating a serial port). You can do so by using either the parallel or the serial trigger plug-in, which you can insert in the experiment directly before the inline_script.

    On your second question: Is your laptop a different computer than the computer you use to run the experiment? If it isn't, you can use the os module to make system calls, which can start up an executable:

    import os
    
    os.system('start "go" "C:\path_to_program\program.exe"')
    

    If you laptop is a different computer than the one you use to run the experiment, things get more complicated, as you will have to implement a way to make them communicate to eachother. If, as you say, you are a programming novice, this is probably not something you would want to attempt if you can find an easier way to get around it. It will require quite a bit of learning and messing around with scripting, and is therefore quite time consuming. If you do want to learn, we're happy to give you some pointers, of course!

  • edited 2:26AM

    I know it's an old thread, but here is how I've dealt with integrating Qualtrics as a step in an Opensesame experiment, using NirSoft's super-versatile Nircmd:

    PREPARE:

    NirPath = exp.get_file("nircmdc.exe")
    

    RUN:

    import subprocess
    from time import sleep
    subprocess.Popen('"C:\\Program Files\\Internet Explorer\\iexplore.exe" -k http://www.qualtrics.com')
    sleep(3)
    subprocess.Popen(NirPath + ' win activate title "Expyriment Backend"')
    subprocess.Popen(NirPath + ' win activate title "qualtrics"')
    

    I'm using a folder as filepool, and I've place nircmdC.exe from NirSoft in it.

    My experiment will run on several Windows machines, and I've opted to use IE's Kiosk mode to run the QT survey, with an instruction at the end to press Alt-F4. Not very elegant, but it works.

    Nirsoft's tool is used to restore the focus after the Ss close IE. It's an indirect route (activate OS, activate IE, let/(hope) windows 'revert' to OS when IE closes), but it seems to be working in internal testing so far. The study is not yet 'in production' so if anyone has constructive comments they will be greatly appreciated.

    The study can be seen at github (still a work in progress):

  • edited 2:26AM

    Hi Michael,

    Thanks for sharing!

    Eduard

    Buy Me A Coffee

  • edited 2:26AM

    Back again with a related issue..
    I had to change a few things because the method I published wasn't working (can't remember how exactly it didn't work; so many test-runs so many ways to malfunction...).
    This is what I've got so far:

    PREPARE:

    import subprocess
    from time import sleep
    from multiprocessing import Process
    
    def processExists(processname):
            # taken from Ewerybody at http://stackoverflow.com/questions/7787120/python-check-if-a-process-is-running-or-not
        tlcall = 'TASKLIST', '/FI', 'imagename eq %s' % processname
        # shell=True hides the shell window, stdout to PIPE enables
        # communicate() to get the tasklist command result
        tlproc = subprocess.Popen(tlcall, shell=True, stdout=subprocess.PIPE)
        # trimming it to the actual lines with information
        tlout = tlproc.communicate()[0].strip().split('\r\n')
        # if TASKLIST returns single line without processname: it's not running
        if len(tlout) > 1 and processname in tlout[-1]:
            print('process "%s" is running!' % processname)
            return True
        else:
            print(tlout[0])
            print('process "%s" is NOT running!' % processname)
            return False
    
    def qualIE():
        subprocess.Popen('"C:\\Program Files\\Internet Explorer\\iexplore.exe" -k https://www.qualtrics.com/')
        print('qualIE ran')
        # just for debug, count repeats of processExists
        existReps = 0
        while(processExists('iexplore.exe')):
            print('existReps:')
            print(existReps)
            existReps = existReps + 1
            sleep(1)
    
    p = Process(target=qualIE)
    

    RUN:

    p.run()
    

    The end goal here is launch the Qualtrics survey (or any other external EXE for that matter), then set the focus to that EXE using Nircmd* (probably redundant, but just to make sure nothing slips by). Then, run a While loop to figure out when the EXE is no longer running, and set the focus to the backend, to continue the experiment.

    This seems to run as expected when running in windowed mode (Ctrl+W), but hangs on 'Preparing Experiment' when running in full-screen (Ctrl+R). I've tried with both the Legacy and the Xpyriment backends, with OpenGL turned on and off, as I thought that is the main difference between windowed and fullscreen modes (clearly there are other differences, but I thought this might be the crux of the matter in this case), but to no avail.

    What am I doing wrong here?
    I've posted the relevant code at
    https://github.com/pinusm/Opensesame_qualtrics_hang

    • I've left out the Nircmd related code in the above passage, because it does not seem to be involved with unexpected behavior I'm experiencing. For completeness, this is the function definition:
    NirPath = exp.get_file("nircmdc.exe")
    def front(windowsname):
        subprocess.Popen(NirPath + ' win activate title "%s"' % windowsname)
        print('Window "%s" is in front!' % windowsname)
    

    and these are the calls:

    # PREPARE: in def qualIE(), after 'subprocess.Popen('"C:\\Program Files\\Internet....'
    front('qualtrics')
    
    # RUN, after 'p.run()'
    front('Backend')
    
  • edited 2:26AM

    A bit more info, as it might be needed:
    I've been able to reproduce this behavior on Windows 10 and Windows 7, using Opensesame 2.9.6, 2.9.7pre5, and 3.0.0a8-py2.7.
    As mentioned, this only happens when running in fullscreen, not windowed. I've test both 'plain' run in a window mode (Ctrl-W, as mentioned), and quickrun mode (Ctrl-Shift-W).
    IE version was 11, in both testing environments.
    Michael

  • edited 2:26AM

    Hi Michael,

    What you're trying to do is pretty unusual, and I doubt someone will be able to help you with this. It's a matter of tinkering until it works, I suppose.

    But you mention that it does work in window mode, right? So what you could try to do is just use a window that covers the full screen. You can do this by:

    • setting the back-end to legacy
    • making sure that the resolution of your experiment matches the display resolution
    • under back-end settings, set window position to 0,0 and
    • draw window frame to 'no'

    Cheers!
    Sebastiaan

  • edited 2:26AM

    Hi Sebastiaan,
    Thank you very much for your suggestion! It appears to be working on my development machine, and I'll be sure to test it on the actual machine that will be running experiment and report back shortly!!

    I'd also like to apologize for filing an uninformative bug report. I thought the info provided here would be enough, and I must admit, I'm not very experienced with filing bug reports. Was there a guidelines document somewhere and I've missed it?

    The reason I'm inclined to think this is an Opensesame issue is that the behavior in fullscreen and windowed mode are different, and that fullscreen mode hangs while Opensesame is preparing the experiment, and that this happens also in a striped-down version of the experiment (https://github.com/pinusm/Opensesame_qualtrics_hang). While I don't have the proper training to know if this means something isn't working in Opensesame or the backend or someother background process, I think this means the problem is not with my part of the code (Again, I'm not very experienced; Please correct me if I'm wrong).

    I do not believe this is an unusual experimental design, as it applies to all external processes in general; it was IE and Qualtrics in my case, but IMHO a solid and robust way to integrate and run external process, and detect and regain focus once they've finished running, could be beneficial in many scenarios. That being said, I realize this might be a platform specific issue, and might not be what you'd like to invest your resources into.. I thank you for efforts anyhow, and highly appreciate your work and product (!!), and I'll try to contribute whenever I can...
    Michael

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games