A modern, high-performance web application for calculating complex Warfarin dosage regimens. This project uniquely combines a Vue.js frontend for a reactive user experience with a powerful Rust-powered WebAssembly (WASM) core for all logical computations, ensuring maximum performance, safety, and reliability.
The application is designed to assist healthcare professionals by generating multiple, prioritized dosing options based on various parameters like target weekly dose, available pill strengths, and special dosing patterns.
- High-Performance Core: All complex calculations are handled by a Rust-powered WebAssembly module, offering near-native speed directly in the browser.
- Advanced Dosing Algorithms: Generates both uniform and non-uniform (e.g., special dose days, stop days) weekly regimens.
- Smart Option Prioritization: Results are intelligently sorted based on complexity (e.g., minimizing half-pills, using fewer pill strengths).
- Automatic Dose Adjustment: Quickly calculate new weekly doses based on percentage changes from the previous dose.
- Appointment-Based Pill Counting: Calculates the exact number of pills required until the next appointment date.
- Flexible Configuration: Users can select available pill strengths (1mg, 2mg, 3mg, 5mg) and toggle the use of half-pills.
- Interactive UI: A fully reactive interface built with Vue.js for a seamless user experience.
- Zero Backend Dependency: The entire application runs on the client-side, making it fast, private, and easy to deploy on static hosts.
This application is intended for educational and demonstration purposes only. It must NOT be used for actual medical decision-making. Warfarin dosage adjustments must always be performed by a qualified healthcare professional. The developers assume no liability for any misuse of this tool.
- Frontend: Vue.js 3 (with Composition API and Scoped CSS)
- Build Tool: Vite
- Logic Core: Rust compiled to WebAssembly
- Deployment: Vercel
The core principle of this project is to separate concerns: Vue.js manages the user interface and state, while Rust handles the heavy, mission-critical calculations, providing a robust and safe foundation.
Follow these instructions to get a local copy up and running for development purposes.
You need the following tools installed on your system:
- Node.js: Download & Install Node.js (LTS version recommended).
- Rust: Install Rust and Cargo via
rustup.# For Linux/macOS/WSL curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # For Windows, download from https://rustup.rs/
- wasm-pack: A tool for building Rust-generated WebAssembly.
cargo install wasm-pack
-
Clone the repository:
git clone https://github.com/pharmacist-sabot/warfarin-app.git cd warfarin-app -
Install frontend dependencies:
bun install
-
Build the WebAssembly module: This command compiles the Rust code in the
warfarin_logicdirectory into a WASM package insidewarfarin_logic/pkg.wasm-pack build ./warfarin_logic --target web
Note: You only need to re-run this command after making changes to the Rust (
.rs) files. -
Run the development server: This will start a Vite dev server, typically on
http://localhost:5173.bun run dev
Open your browser and navigate to the provided local URL to see the app in action!
.
├── warfarin_logic/ # Rust crate for all calculation logic
│ ├── src/
│ │ └── lib.rs # The heart of the application logic
│ └── Cargo.toml # Rust dependencies
│
├── src/ # Vue.js application source
│ ├── components/
│ └── App.vue # Main Vue component
│
├── public/ # Static assets
├── vite.config.js # Vite build configuration
├── package.json # Node.js project manifest
└── README.md # This file
This project is configured for seamless deployment on Vercel.
-
Push your code to a GitHub repository.
-
Import the repository into Vercel.
-
Configure the build settings:
- Framework Preset:
Vite - Build Command:
bun run build - Output Directory:
dist - Install Command:
bun install
Crucially, the install command must build the WASM module before Vite builds the frontend.
- Framework Preset:
-
Deploy! Vercel will handle the rest.
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is distributed under the MIT License.