Select something in one LiveBook cell, update list in another cell

Hi All

Context
We are in business of hiring people to temporary or not so temporary jobs, so studying which kind of workers are suitable for which kind of companies, positions and times is something we do regularly and explore more ways for analysis.

Live book as simple-to-code browsing and analysis tool
I am trying to build a small research/analytics tool with the help of LiveBook. Idea is basically along these lines:

  1. Load data on open or not so open positions from our server (numbers are in dozens or hundreds, so caching doesn’t really matter, stupid code is fine)
  2. Choose this or that position (hopefully interactively in a filterable list - but that’s another topic)
  3. Look at the applicants to the position and choose one
  4. Look at what our formulas tell about the possible match, see which formulas seem to make sense, which aren’t, see what our first AI recommendations are about, etc
  5. Click buttons to save evaluation for further analysis

If things seems to work well, maybe we’ll even develop it further to a prototype of a production tool via LiveBook’s ability to make small apps and provide an API.

Cross cells interactivity
If I get it correctly, LiveBook is quite a lot targeted to this sort of workflows and indeed if you are fine enough with not exactly designer made UX it’s indeed fast to develop tool except this cross cell interactivity.

I am able to code everything wanted as a single giant elixir cell, but it kind’a removes half of LiveBook benefits. I am trying to develop it in bits cell-by-cell. So that e.g. one cell figures list of positions and you choose one (e.g. via selectbox), next cell based on the choice loads position details and presents a list of applicants.

It works perfectly once, but when I am trying to do a different choice in position selected cell, naturally the position details cell gets stale and doesn’t update.

I was playing with Kino Frames, subscribing to events etc, but it all seems to work inside one cell only. Once I select a different selectbox value, all the cells below are marked as stale and do not update.

How to solve?

  • Am I missing something?

  • Is it just hard LiveBook design constraint and there’s no way to update anything passed from cell 1 to cell 2?

  • Then should I pack all the code into module(s) and put all UI to some final cell?

  • How would you solve the situation?

Hey @artem! I think what you are looking for is for the dependent cells to be evaluated again automatically, which you can do by marking those cells to “Reevaluate automatically”:

1 Like

Do you mean something like that?

It’s possible to do that. But there is more than one approach. Here’s the source code od the demo above: Cross-Cell Interactivity in Livebook: Dynamic UI Updates · GitHub

3 Likes

Thank you, it worked! Somehow my trials with subscribe didn’t work, but this approach did!

1 Like