Files
ketapk/README.md
T
2026-08-01 22:22:19 +02:00

119 lines
4.2 KiB
Markdown

# KétaPK - Pharmacokinetic Simulation for Anesthesia & Intensive Care
**KétaPK** is a modern, cross-platform pharmacokinetic (PK) and pharmacodynamic (PD) modeling application for **Esketamine** and **Racemic Ketamine**. It allows anesthesiologists, intensive care physicians, and clinical researchers to simulate, visualize, and predict plasma drug concentrations ($C_p$) over a 300-minute timeline using multi-exponential models.
---
## 1. Overview & Purpose
* **Original Creator:** Dr. Georges Mion (Anesthesiologist-Intensivist)
* **Purpose:** To provide clinical specialists with an instantaneous, offline, and reliable decision-support and simulation tool for IV bolus doses and continuous infusions.
* **Core PK Models Integrated:**
* **Domino et al. (1982)** — Three-compartment model ($2.0\text{ mg/kg}$ reference)
* **Clements et al. (1981)** — Two-compartment model ($0.25\text{ mg/kg}$ reference)
* **Kamp et al. (2020)** — Meta-analytic multi-compartment model ($0.5\text{ mg/kg}$ reference)
---
## 2. Project Origin & AI Generation Transparency
### The Legacy Application
The initial version of **KétaPK** was hand-crafted as a Microsoft Excel workbook (`.xlsm`) using complex VBA (Visual Basic for Applications) macros, custom chart event listeners, and dynamic range colorizations.
### Modernization via AI Collaboration
To make the tool responsive, cross-platform, and independent of Microsoft Office, the application was re-engineered into a modern web and desktop software stack.
* **AI Collaboration Model:** Google Gemini
* **AI Model Version:** Gemini 3.6 Thinking
* **Generation Mode:** Context-aware multi-turn prompt engineering & source-code decompilation
* **Generation Parameters:** Standard System Instructions, Default Temperature (~0.7), Strict Module Separation (Decoupled Math Engine / Responsive UI / i18n Dictionary)
---
## 3. Legacy Excel Implementation
The original spreadsheet relied on embedded OLE streams, sheet-level event macros (`Worksheet_SelectionChange`), and manual range formulas to calculate 61 time points (0 to 300 minutes in 5-minute increments).
> **Learn more about the original implementation:**
> [View Original Excel/VBA Application Documentation & Walkthrough](https://georgesmion.com/ketapk-simuler-les-concentrations-plasmatiques-de-ketamine/)
---
## 4. Running with Docker
You can run **KétaPK** in an isolated container using Docker or Docker Compose.
### Option A: Using Docker CLI
```bash
# Build the Docker image using the non-root secure Dockerfile
docker build -t ketapk-web .
```
```bash
# Run the container mapping port 3000 on your host machine
docker run -d -p 3000:3000 --name ketapk-app ketapk-web
```
```bash
# Access the application in your browser at http://localhost:3000
```
### Option B: Using Docker Compose (Recommended)
```bash
# Build and start the containerized application in detached mode
docker compose up -d --build
```
```bash
# Stop and remove the running container environment
docker compose down
```
---
## 5. Compiling Desktop Apps with Tauri (Windows, macOS, Linux)
**KétaPK** uses **Tauri v2** to generate ultra-lightweight ($\sim 12\text{ MB}$), native desktop executables (`.exe`, `.dmg`, `.AppImage`) that operate 100% offline without requiring Node.js or Docker on the target medical machine.
### Prerequisites
* **Node.js** (v20 or higher)
* **Rust & Cargo** (installed via [rustup.rs](https://rustup.rs/))
* *Windows:* C++ Build Tools for Visual Studio
* *macOS:* Xcode Command Line Tools (`xcode-select --install`)
### Step-by-Step Build Process
```bash
# 1. Install project dependencies
npm install
```
```bash
# 2. Compile the static Tailwind CSS bundle
npm run build:css
```
```bash
# 3. Launch the application in desktop development mode (with Hot Reload)
npx tauri dev
```
```bash
# 4. Compile the production installer for your current Operating System
npx tauri build
```
---
## Output Installation Binaries
After running `npx tauri build`, your standalone installer will be available at:
* **Windows:** `src-tauri/target/release/bundle/nsis/KetaPK_1.0.0_x64-setup.exe`
* **macOS:** `src-tauri/target/release/bundle/dmg/KetaPK_1.0.0_x64.dmg`
* **Linux:** `src-tauri/target/release/bundle/appimage/KetaPK_1.0.0_amd64.AppImage`