A single-page application designed to calculate pill dosages efficiently. The app allows users to input dosage options, create dosage schedules, and calculate the required pills for each schedule and the total for all the schedules. It uses Unbounded Knapsack Problem algorithm to calculate the best match. The app prioritizes using the biggest pills whenever possible as they are usually cheaper.
- Dynamic Dosage Input: Add, edit, and remove dosage options with real-time updates.
- Dosage Schedule Management: Create and manage multiple dosage schedules.
- Advanced Calculations: Uses an optimized Unbounded Knapsack Algorithm to calculate the best combination of dosages.
- Validation: Ensures all inputs are valid and provides feedback for incorrect entries.
- Customizable Colors: Assign unique colors to dosages for better visualization.
- Responsive Design: Fully responsive and optimized for all devices.
To start the development server with hot-reload, run the following command. The server will be accessible at http://localhost:3000:
npm run dev(Repeat for npm, pnpm, and bun with respective commands.)
Add
NODE_OPTIONS='--no-warnings'to suppress the JSON import warnings that happen as part of the Vuetify import mapping. If you are on Node v21.3.0 or higher, you can change this toNODE_OPTIONS='--disable-warning=5401'. If you don't mind the warning, you can remove this from your package.json dev script.
npm run buildnpm run preview- Users can add up to 7 dosage options.
- Each dosage is validated to ensure it’s a valid number.
- Dosages are color-coded for better visualization across the app.
- Users can create multiple stages with specific dosages and durations.
- Supports complex dosage strings like
150+250for multiple daily doses.
- Uses the Unbounded knapsack algorithm to calculate the best combination of dosages.
- Prioritizes exact matches for the target dose capacity and the biggest available dosages.
- Handles large capacities efficiently with optimized memory usage and cached results.
- Ensures all inputs are valid before calculations.
- Provides feedback for invalid dosages or schedules.
- Each schedule item has a live preview that dynamically updates as the user modifies the dosage or schedule.
- Displays the calculated dosages in a visually appealing format, with color-coded pills for better clarity.
- Highlights inappropriate dosages that do not match the available options.
- The app provides a comprehensive summary of all schedules, including:
- The total number of days across all schedules.
- A detailed breakdown of the required dosages for each schedule.
- A list of inappropriate dosages that could not be matched with the available options.
Run the following commands to lint and format your code:
# Lint scripts
npm run lint:scripts # or npm run lint:scripts:fix to apply fixes
# Lint styles
npm run lint:styles # or npm run lint:styles:fix to apply fixes
# Lint all
npm run lint # or npm run lint:fix to apply fixes
# Format all files
npm run format:all # or npm run format:all:fix to apply fixesThis project is licensed under the MIT License.
