In Demo Day 8, I talked about connecting multiple apps on Compute Studio with PSL Stitch. The source code for PSL stitch can be found in this repository.
Stitch is composed of three components:
- A python package that can be run like a normal Python package.
- A RESTful API built with FastAPI that is called remotely to create simulations on Compute Studio.
- A GUI built with ReactJS that makes calls to the REST API to create and monitor simulations.
One of the cool things about this app is that it uses ParamTools to read the JSON files under the hood. This means that it can read links to data in other Compute Studio runs, files on GitHub, or just plain JSON. Here are some example parameters:
- policy parameters:
cs://PSLmodels:Tax-Brain@49779/inputs/adjustment/policy
- tax-cruncher parameters:
{"sage": [{"value": 25}]}
- business tax parameters:
{"CIT_rate": [{"value": 0.25, "year": 2021}]}
After clicking run, three simulations will be created on Compute Studio and the app will update as soon as the simulations have finished:
Once they are done, the simulations are best viewed and interacted with on Compute Studio, but you can still inspect the JSON response from the Compute Studio API:
I created this app to show that it’s possible to build apps on top of the Compute Studio API. I think PSL Stitch is a neat example of how to do this, but I am even more excited to see what others build next.
Also, this is an open source project and has lots of room for improvement. If you are interested in learning web technologies related to REST APIs and frontend development with JavaScript, then this project could be a good place to start!
Resources: