Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data Not Saving in Local participant.db File on PsiTurk 3.3.1 with Heroku #566 #19

Open
RhtK07 opened this issue Jul 23, 2024 · 5 comments

Comments

@RhtK07
Copy link

RhtK07 commented Jul 23, 2024

Context
PsiTurk Version: 3.3.1
Hosting Platform: Heroku
Experiment Repository: fredcallaway/heroku-experiment
Problem Description

The experiment runs perfectly fine, and participants can complete and submit the experiment. However, the data is not being saved in the local participant.db file. Consequently, when attempting to approve workers, I receive the following error:

Response(Operation: approve_assignment_by_assignment_id | Status: error | Exception: AssignmentIdNotFoundInLocalDBError: )

Steps to Reproduce

  1. Deploy the experiment to Heroku following the steps provided in the repository fredcallaway/heroku-experiment. changes the config file with the ad url
  2. Run the experiment to completion.
  3. Submit the experiment.
  4. Check the local participant.db file for saved data.
  5. Attempt to approve a worker using the worker approve command.

Observed Behavior

  1. Experiment runs and completes without issues.
  2. Data submission appears to be successful on the frontend.
  3. No data is saved in the participant.db file.
  4. Attempting to approve workers results in AssignmentIdNotFoundInLocalDBError.

Expected Behavior

  1. Data should be saved in the participant.db file upon experiment completion and submission.
  2. Worker approval should proceed without errors.

Any help or suggestions on resolving this issue would be greatly appreciated. Thank you!

@fredcallaway
Copy link
Owner

participants.db is only used for local testing. Data will be saved there if you run the experiment locally (I think make dev?)

The data generated online should be saved in the heroku psql server. You can get the db location with heroku config:get DATABASE_URL. You can also view it with heorku psql.

But if you just want to download the data, you should be able to just run bin/fetch_data.py

As for using the psiturk command line to approve people (if that's what you're doing), that won't work directly because the database location is not set in config.txt (for security reasons). @cgc might have advice here.

I've been running on Prolific exclusively, so I don't really remember how I was approving/bonusing MTurk participants. I think I used this script at one point—maybe it will be of help. https://github.com/fredcallaway/webofcash/blob/retention/bin/compensation.py

If you are using Prolific, then you can try bin/prolific.py pay (there are other useful commands, see the CLI methods)

@RhtK07
Copy link
Author

RhtK07 commented Jul 23, 2024

Hi there,

Thank you for getting back to me. I have a couple of follow-up questions:

  1. Broken Link: The link you provided (https://github.com/fredcallaway/webofcash/blob/retention/bin/compensation.py) does not seem to be working. Could you please check the link or provide the correct one?
  2. Specifying Database Path in Config File: To ensure the data is saved correctly to the Heroku PostgreSQL database, I would like to confirm if specifying the database URL in the config.txt file as follows is the correct approach:
    [Database Parameters]
    database_url = postgres://username:password@hostname:port/dbname

Or can you give an example.

Thankyou again for all your help.

@fredcallaway
Copy link
Owner

fredcallaway commented Jul 23, 2024 via email

@RhtK07
Copy link
Author

RhtK07 commented Jul 23, 2024

Hi Fred. Thankyou for your message. But using the above code is giving a lots of problem. Especially because how fetch data.py code is written and how it creates the file in data folder.

@fredcallaway
Copy link
Owner

I'm not sure how to help without knowing exactly what issues you're encountering with fetch_data.py. That script is the only way I ever download data. You should be able to pull out the key code to access the database if you don't like the way it preprocess and saves the data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants