Live Coding: Authenticating an Imagery Request

Reading Time: 4 minutes

In The Case of the Failing Upload, I introduced you to an app designed to help researchers run earth science projects on the Zooniverse. We discovered an upload issue with the app and confirmed the cause.

In short, Theia does not allow anyone to upload subjects to any project because the Zooniverse API, called Panoptes, does not allow that (and rightfully so). Theia must cooperate with Panoptes authentication in order for this step to work.

I wanted to live stream my process of fixing the issue for you. Here’s the rub: two days before I needed to fix this, I managed to lay myself up with a nasty case of…something. That something elected to roll over me like an avalanche of mild misery on Friday afternoon, when I suddenly found myself doubled over with such vigorous coughing fits that I my abs got sore.

Sick Pikachu

It also took away my voice. So I made the videos lying flat on my back, with no narration. My plan, at the time, was to go back later, closely watch these videos, and provide you with timestamps of things you might want to see someone do, even if it weren’t narrated.

Then, last week, my Grandmother passed away. So I’m currently sitting shiva (Jewish mourning ritual) in New York City. I don’t have the time or energy right now to get that done for you (though, if you want to read about my Grandma, have at it).

So, I’m trying an experiment. It involves, of all people, you. 

The plan:

  1. I provide you with three videos and a general explanation of what I did.
  2. You are welcome to watch them, or bounce around in them, and Slack me (or email me, chelsea at chelseatroy dot com) what you saw, or what you liked, or what you didn’t like. Please provide a time stamp if you can. If you don’t want to watch all the videos and you only want to look at one or two parts of one video, that still helps :).
  3. I will curate your curations and update this blog post on your findings, with credit to you, quoting your comments.

This might work. This might totally not work. We shall see.

Explanation I provided in the pull request with this change:

Admin users (from the authentication schema implemented in Django, where information about the authenticated user is available everywhere) are used to create Pipeline Stages and Pipelines. They are not the same as Zooniverse-authenticated users (from the authentication schema implemented in Panoptes that theia accesses through Oauth2 authentication with a Python library called social-auth. This provides us with a bearer token, a refresh token, and an expiration). We use these to upload to Panoptes, but they’re not automatically universally available in the app.

No problem, right? We’ll just take the authentication information and pass it through to the upload task. Unfortunately, it’s not that simple. Each task, called a pipeline stage, is independently instantiated based on its position in a Pipeline assigned to each ImageryRequest.

So, here’s what we’re doing: we authenticate through social-auth, we store them with Django’s sessions API designed precisely for saving things like this, and we pass them to any ImageryRequest made by this client, so they’re available at upload time.

The Videos of the Development Process




Maybe this will work. Maybe it won’t. This is an experiment. We’ll see how it goes :).

If you liked this piece, you might also like:

This post on my entree into live coding (plus, how to get a transcript of a YouTube video)

This series about Structure and Interpretation of Computer Programs—in which I share what I learned in a week-long course on the classic book

The listening series—Unrelated to live coding, but hopefully useful 🙂

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.