A Streamlit app used to aid in cancer treatment

Here is a Streamlit app that helps us in our cancer treatment centre:
https://share.streamlit.io/pymedphys/streamlit/main/mudensity.py (in the demo try using a Patient ID of 989898 or 979797)

At cancer care centres all around the world some patients will get radiation therapy to treat their cancer. To do this a machine called a linear accelerator is used. They use these at CERN to help accelerate particles. We use smaller ones to treat patients with cancer.

When this treatment is undergone it has a range of complicated parameters that need a defence in depth approach to verify that everything is always as it should be.

Using Streamlit I have developed and deployed an application that acts as an extra layer of cheese. The backend software collects log files from the machine while it is delivering, connects to the original planning software that the Doctor signs off on, pulls data from the medical information system database, as well as providing other options for manual upload of DICOM files. The Streamlit application then takes all of this data and presents it to users within the clinic so that they can quickly and effectively determine if this quality assurance step has or has not found any issues.

A key requirement with applications such as these is that the barrier to entry for other Medical Physicists into the code base needs to be relatively low. Building an application on traditional web stacks is just too much left of field for the average Medical Physicist that I would be introducing a bus factor of 1 within our team. By being able to use Streamlit I can make quality, beautiful and powerful applications, that others on my team can understand the inner workings of when the need arises.

The application itself is built into the PyMedPhys library and within CI integration tests are done with Cypress.

Many years ago, to address the need for as simple as possible web application framework I wanted what Streamlit is now in my hands then and couldn’t find anything like it anywhere. So I built ScriptedForms. Today however, Streamlit has above and beyond met all the dreams of what I needed and hoped for when building ScriptedForms.

Thank you Streamlit team for making such an awesome tool. It is a pleasure to use, and it helps us day to day in our treating of cancer. Thank you.

6 Likes

Great app! I imagine in time this could replace dozens of excel spreadsheets and random pieces of software. I guess the main barrier to adoption would be the deployment and scaling of these apps, which presumably would require kubernetes experience etc. Any plans for a hosted solution for users that lack these devops resources? Also how has the reception been from your colleagues who would be the target audience? I recall the medical physics community being quite cautious with regard to new software and ways of working.
Cheers

1 Like

Thanks Rob :). We had lots of fun back in the day iterating on ScriptedForms it’s great to see you so active here. Are you still in the satellite business? Do you find Streamlit useful at work or mostly for the home automation projects?

My direct colleagues in the same centre with me love it. It meets our needs more reliably and quickly than current commercial offerings. The biggest hole currently though is that it doesn’t calculate dose.

For use across our sites I am sharing the hosted streamlit application at one site with the other centres via SSH port forwarding and nginx. For our needs just at our centre we certainly haven’t needed the extra complications of a kubernetes set up.

Regarding a SaaS solution, I am certainly trying to think of ways to make pymedphys itself a sustainable open source project, and offering a hosted solution seems to be a great way to make open source sustainable. Some key barriers though are the sensitivity of the patient data, so some form of reversible public key encryption based anonymisation would need to occur client side before the data is sent to the server. Certainly a custom Streamlit component could handle that in the GUI case. But the other major hurdle is the need to still have some software running on the user’s network in order to automatically collect the required information from the various sources. A solution to this may be to create a sort of “PyMedPhys RasberryPi” that can be purchased and plugged into the user’s network to collect, encrypt, and transmit the required data to the server for processing and then displaying within the GUI. The user could have their own private key which is only ever stored client side and never sent to the server so that patient data can be decrypted client side for display within a custom component. Maybe the private key can be entirely stored locally within Dexiejs and the streamlit app can then on the fly decrypt this patient information when needed.

But anyway, all just thoughts, and until there is also a dose calculation algorithm there are still a decent class of issues that are not picked up. I wouldn’t be the biggest fan of providing a hosted solution until the software could also pick up those issues as well. So, first things first, an open source collapsed cone algorithm written in jax so that all the speed ups made for TensorFlow on the GPU can be utilised for a collapsed cone algorithm.

Any ideas on your end? It certainly would be really amazing to be able to bootstrap a sustainable open source PyMedPhys library.

1 Like

@SimonBiggs no longer in satellite business, now data engineering for ecommerce. Streamlit usage in hobby work so far but there are use cases at work also, although there are mostly legacy solutions using flask which we just patch now and again.
I am glad to hear of your interest in using the RPi as a node in a remote solution, as that is something I am also investigating.
RE dose calculation that is probably a topic for another forum, but definitely interested to hear what you can find online?
It appears there is a gap in the market for a managed, but non cloud & private, streamlit solution… :slight_smile:

@robmarkcole regarding dose calculation, how bout we move discussion over to https://github.com/pymedphys/pymedphys/issues/1101?

1 Like