diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..5c7c04e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,49 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test-backend: + name: Backend & Analysis Tests + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version-file: .python-version + cache: pip + cache-dependency-path: requirements.txt + + - name: Install dependencies + run: pip install -r requirements.txt + + - name: Run tests + run: python -m pytest tests/backend/ tests/analysis/ -v -p no:django + + test-frontend: + name: Frontend (Django) Tests + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version-file: .python-version + cache: pip + cache-dependency-path: environment/frontend_server/requirements.txt + + - name: Install dependencies + run: pip install -r environment/frontend_server/requirements.txt + + - name: Run tests + run: python -m pytest tests/frontend/ -v + env: + DJANGO_SETTINGS_MODULE: frontend_server.settings.base + PYTHONPATH: reverie/backend_server:environment/frontend_server:analysis diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..dbfbb8a --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,56 @@ +name: Docker + +on: + push: + branches: [main] + +jobs: + build-backend: + name: Build & Push Backend Image + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v4 + + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.backend + push: true + tags: | + ghcr.io/${{ github.repository_owner }}/edsim-backend:latest + ghcr.io/${{ github.repository_owner }}/edsim-backend:${{ github.sha }} + + build-frontend: + name: Build & Push Frontend Image + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v4 + + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile.frontend + push: true + tags: | + ghcr.io/${{ github.repository_owner }}/edsim-frontend:latest + ghcr.io/${{ github.repository_owner }}/edsim-frontend:${{ github.sha }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a8fb0a5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,20 @@ +name: Release + +on: + push: + tags: + - "v*" + +jobs: + release: + name: Create GitHub Release + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - uses: actions/checkout@v4 + + - uses: softprops/action-gh-release@v2 + with: + generate_release_notes: true diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..78c9a28 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.9.12 diff --git a/CLAUDE.md b/CLAUDE.md index a59697b..2fb2484 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,10 +1,12 @@ # CLAUDE.md +![CI](https://github.com/denoslab/EDSim/actions/workflows/ci.yml/badge.svg) + This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Project Overview -EDsim is an LLM-powered multi-agent simulation of emergency department (ED) workflows. It builds on the [Generative Agents](https://arxiv.org/abs/2304.03442) framework (Park et al., 2023). Four agent types — Doctor, Bedside Nurse, Triage Nurse, and Patient — perceive their environment, plan actions, converse with each other, and execute behaviors driven by LLM calls. +EDSim is an LLM-powered multi-agent simulation of emergency department (ED) workflows. It builds on the [Generative Agents](https://arxiv.org/abs/2304.03442) framework (Park et al., 2023). Four agent types — Doctor, Bedside Nurse, Triage Nurse, and Patient — perceive their environment, plan actions, converse with each other, and execute behaviors driven by LLM calls. ## Environment Setup @@ -46,6 +48,21 @@ To run tests inside the container: docker compose run --rm backend python -m pytest /app/tests/backend/ /app/tests/analysis/ -v -p no:django ``` +## CI/CD + +GitHub Actions runs automatically on every PR and push to `main`: + +| Workflow | Trigger | What it does | +|---|---|---| +| **CI** (`ci.yml`) | PR / push to `main` | Runs all unit tests — backend, analysis, and frontend | +| **Docker** (`docker.yml`) | Push to `main` | Builds and pushes images to GHCR | +| **Release** (`release.yml`) | Push a `v*` tag | Creates a GitHub Release with auto-generated notes | + +To cut a release: +```bash +git tag v1.0.0 && git push origin v1.0.0 +``` + ## Running the Simulation ### Interactive mode (frontend + backend) diff --git a/README.md b/README.md index 432e07d..dad10c0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ -# EDsim: An LLM-Powered Emergency Department Simulation Using Generative Agents +# EDSim: An LLM-Powered Emergency Department Simulation Using Generative Agents -EDsim is a multi-agent simulation of emergency department (ED) workflows driven by large language model (LLM)-powered autonomous agents. Each agent (doctors, nurses, patients) perceives its environment, makes decisions through cognitive modules, and interacts with other agents in real time, producing realistic ED dynamics suitable for operational analysis and research. +[![CI](https://github.com/denoslab/EDSim/actions/workflows/ci.yml/badge.svg)](https://github.com/denoslab/EDSim/actions/workflows/ci.yml) + +EDSim is a multi-agent simulation of emergency department (ED) workflows driven by large language model (LLM)-powered autonomous agents. Each agent (doctors, nurses, patients) perceives its environment, makes decisions through cognitive modules, and interacts with other agents in real time, producing realistic ED dynamics suitable for operational analysis and research. ## Table of Contents @@ -16,7 +18,7 @@ EDsim is a multi-agent simulation of emergency department (ED) workflows driven ## Architecture Overview -EDsim consists of three main components: +EDSim consists of three main components: ### Backend Simulation Engine (`reverie/`) @@ -52,8 +54,8 @@ Post-simulation scripts that compute operational metrics from the simulation out 2. Clone this repository: ```bash - git clone EDsim - cd EDsim + git clone EDSim + cd EDSim ``` 3. Create and activate the Conda environment: @@ -105,7 +107,7 @@ Post-simulation scripts that compute operational metrics from the simulation out ## Running the Simulation -There are two ways to run EDsim: **interactive mode** (with the frontend visualization) and **batch mode** (headless, using `run_simulation.py`). +There are two ways to run EDSim: **interactive mode** (with the frontend visualization) and **batch mode** (headless, using `run_simulation.py`). --- @@ -278,14 +280,14 @@ Patient times in both area and state are also exported as separate CSV files alo ## Acknowledgments -EDsim builds on the **Generative Agents** framework by Park et al. (Stanford/Google): +EDSim builds on the **Generative Agents** framework by Park et al. (Stanford/Google): > Joon Sung Park, Joseph C. O'Brien, Carrie J. Cai, Meredith Ringel Morris, Percy Liang, and Michael S. Bernstein. 2023. *Generative Agents: Interactive Simulacra of Human Behavior.* In Proceedings of the 36th Annual ACM Symposium on User Interface Software and Technology (UIST '23). ACM. > ## Citation -If you use EDsim in your research, please cite: +If you use EDSim in your research, please cite: ```bibtex @misc{wu2026edsim, diff --git a/environment/frontend_server/requirements.txt b/environment/frontend_server/requirements.txt index c7679c5..fc9375d 100644 --- a/environment/frontend_server/requirements.txt +++ b/environment/frontend_server/requirements.txt @@ -34,7 +34,10 @@ packaging==23.0 pandas==1.1.5 patsy==0.5.3 Pillow==8.4.0 +psutil==7.0.0 psycopg2-binary==2.9.5 +pytest==8.1.1 +pytest-django==4.8.0 pycparser==2.21 pyparsing==3.0.6 PySocks==1.7.1