Skip to content

its2easy/pills-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

106 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pills calculator💊

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.

App screenshot

Features

  • 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.

Tech stack

Usage

Starting the development server

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 to NODE_OPTIONS='--disable-warning=5401'. If you don't mind the warning, you can remove this from your package.json dev script.

Building for production

npm run build

Preview

npm run preview

Description of features

1. Dynamic dosage input

  • 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.

2. Dosage schedule management

  • Users can create multiple stages with specific dosages and durations.
  • Supports complex dosage strings like 150+250 for multiple daily doses.

3. Advanced calculations

  • 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.

4. Validation

  • Ensures all inputs are valid before calculations.
  • Provides feedback for invalid dosages or schedules.

5. Live preview for each schedule item

  • 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.

6. Summary

  • 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.

Linting and formatting

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 fixes

📝 License

This project is licensed under the MIT License.

About

simple one page app (vue 3 + ts + vuetify)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published