Just to close this off, I figured out / hacked together a solution using @Ben_Lee’s amazing work here.
Thanks again for your help!