Howdy, Stranger!

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

Supported by

JATOS read from database

Hello,

I am trying to implement some functionality for a worker to restart a study. Let's assume they are using a Personal Multiple type link. The worker has a full list of tasks to complete, but what if they need to stop, their internet vanishes, etc. Is there any way for them to restart the study where they left off?

My though it to have jatos read from the mySQL database to identify what this worker has completed?

I see that jatos.js uses GET and PUT, is there a way to write custom mySQL commands using this functionality to read from the mySQL dB?

Thank you,

Comments

  • Hi!

    I guess you are talking about restarting a study run after a participant closed the browser or the tab in the browser. If the browser tab is still open with the study running it should be no problem to continue where the participant stopped before. The Internet (and JATOS in that case) is build to cover unstable network.

    But in the case of a participant closed the browser it is not that easy to restart at the point where the participant left off. I heard this question before and it's not easy to address since for JATOS a study is just a black box that uses jatos.js to communicated with the JATOS server.

    My though it to have jatos read from the mySQL database to identify what this worker has completed?

    The problem here is that your study operates on the client side and JATOS' MySQL is on the server side. They cannot talk directly to each other - only via mediation through JATOS and jatos.js. But you could use JATOS' batch session to do this (more further down).

    I see that jatos.js uses GET and PUT, is there a way to write custom mySQL commands using this functionality to read from the mySQL dB?

    It would pose a security risk to allow a client to write custom MySQL commands from the browser.

    My idea is to use JATOS' sessions to do what you are asking for. E.g. in the study session one can write arbitrary data that are then accessible throughout the whole study run (in the following components but also if the same component gets reloaded, which would be your case). You can use jatos.setStudySessionData to write to the study session. Now what is left to you to safe your participants progress continuously in the study session. You would have to find the right points in your code to do this. Then, if a study restart happens because the browser tab got closed, the first thing in your code should be to check the study session if there is already something written and if so, use this and start your study from where you left. But all this coding is left to you because like I said for JATOS your study code is just a black box.

    A second idea to achieve this (but pretty similar) is to use JATOS' batch session. The batch session has some advantages over the study session that e.g it is more economical with the network by sending only the difference of the session data each time one changes something in it. But it is confined to JSON format. And since every participant in the same batch can access the batch session it is advisable to have only one participant per batch to keep others from reading the session data. Apart from that it's the same general procedure as with the study session.

    I hope this gives you some idea how to do this.

    Best,

    Kristian

  • Hello Kristian,

    Thank you for the feedback.

    I see that jatos.js uses GET and PUT, is there a way to write custom mySQL commands using this functionality to read from the mySQL dB?

    It would pose a security risk to allow a client to write custom MySQL commands from the browser.

    Thank you for this guidance, the GET and PUT and security is beyond me!


    I have tried with the session data and I do not think that will work. My experiment is essentially the participants filling out a lot of questionnaires. What if they need a break? They decide to stop and go do something else. Then when they sit down again (the next day after turning off their computer), they reopen the original Personal Multiple type link I have emailed them. In my hands, the session data has been removed in this case from when they first clicked the link and when they reopen the link the second time.

    Based on your suggestion I tried using Batch data and that seems like it will work. When the worker first clicks a link they are undefined in the Batch data and I create a new variable, which is their worker_id and the value of zero:

            if ( typeof jatos.batchSession.get(jatos.workerId) == 'undefined' )
            {
                console.log("EMPTY")
                jatos.batchSession.set(jatos.workerId, 0);
            }
    

    Then I can update this value at the end of each task they complete.

                // find the count 
                var c = jatos.batchSession.get(jatos.workerId)
                // update it
                jatos.batchSession.set(jatos.workerId, c + 1);
    

    The next time they open the link, the batch data is checked for their workerId and their value. This value will be used to direct them to the appropriate task in their list of "to be completed tasks." I understand that this requires me to use the jatos.batchSession.set/get commands in various places through my jsPsych code.

    I also understand that each worker in the Batch will have access to this batch data, which to me is not a problem.

    What are your thoughts?

    Jason

  • krikri
    edited October 10

    Hi Jason!

    When I wrote the last message I had a different scenario in mind: participant closes browsers -> reopens browser and continues with the last webpage they were one (and without clicking on the study link again). In this scenario the study session would work since it's still the same study run.

    But your scenario as I understand now is a slightly different one: participant runs study, but stops somewhere in the middle -> at another time participant clicks again on the study link and wants to continue where they left off. Each clicking on the study links causes a new study run.

    You could tackle that as you are suggesting with the batch session. For the study link type the Personal Multiple is probably the best. But there is a catch: the data in the batch session is shared with every other participant running the study. This is of course not suited for any sensitive or private data.

    Then, what you proposed in handling the batch session looks fine. Instead of typeof jatos.batchSession.get(jatos.workerId) == 'undefined' you could use jatos.batchSession.defined("/" + jatos.workerId). Slightly more readable but does the same.

    Best,

    Kristian

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