Skip to content

pythonhealthdatascience/llm_simpy_models

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Licence: MIT Python 3.10+ DOI

Complementary repository: Final discrete-event simulation models and streamlit applications from Large Language Models

This repository is complementary to:

Thomas Monks, Alison Harper, and Amy Heather. Research Compendium: Replicating Simulations in Python using Generative AI. https://github.com/pythonhealthdatascience/llm_simpy.

It contains the final formatted code from each of the SimPy discrete-event simulation models that were generated by Perplexity as part of that project.

The web applications are deployed as a single app on GitHub pages using stlite. This allows the app to run directly in a user's web browser without requiring any manual installations. It achieves this by using WebAssembly technology to run a serverless version of streamlit (i.e. stlite). The entire app, along with all its dependencies, are downloaded and installed within the browser at runtime using pyodide and micropip. There will be a short wait while the app is setup. Once the setup is complete, the app runs locally in the browser, meaning that no user data leaves the local machine. Please note that stlite does not currently work in Mozilla Firefox.

Link to the deployed app: https://pythonhealthdatascience.github.io/llm_simpy_models/

Code: The final formatted code from each stage are stored in 📁pages\:

  • CCU_Stage_1.py
  • CCU_Stage_2.py
  • Stroke_Stage_1.py
  • Stroke_Stage_2.py

The stroke .py files combine the seperate model and app .py files from the llm_simpy repository.

For a full record of the generation of these models, please refer to: https://github.com/pythonhealthdatascience/llm_simpy.


👥 Authors

  • Thomas Monks    ORCID: Monks

  • Alison Harper    ORCID: Harper

  • Amy Heather    ORCID: Heather


🌐 Creating the environment

The project uses conda to manage dependencies. Navigate your terminal to the directory containing the code and run:

conda env create -f binder/environment.yml

This will create a conda environment called gen_simpy_apps. To activate:

conda activate gen_simpy_apps

This environment is a simplified version of that from the llm_simpy repository, containing only the dependencies required for running the apps.


🖥️ Viewing the apps locally

For deployment, we have brought the LLM-generated apps together into a single app, which can be deployed by running:

streamlit run Home.py

However, you can also run the individual original apps generated by the LLMs by calling on a specific file - for example:

streamlit run pages/CCU_Stage_1.py

To test the stlite app locally, run the following command, and then open http://0.0.0.0:8000/ on your web browser:

python3 -m http.server

📝 Citation

Please cite the archived repository:

Thomas Monks, Alison Harper, and Amy Heather. Complementary repository: Final discrete-event simulation models and streamlit applications from Large Language Models. https://doi.org/10.5281/zenodo.15082494.

You can also cite this GitHub repository as:

Thomas Monks, Alison Harper, and Amy Heather. Complementary repository: Final discrete-event simulation models and streamlit applications from Large Language Models. https://github.com/pythonhealthdatascience/llm_simpy_models.

A CITATION.cff file is also provided.


💰 Funding

This project was developed as part of the project STARS: Sharing Tools and Artefacts for Reproducible Simulations. It is supported by the Medical Research Council [grant number MR/Z503915/1].