I’m trying to build a simple webapp to register medication and to show taken medication and active dosages. I’m trying to build an MVP with the following:
- One number field to enter a dosage with one decimal.
- A submit button to submit your dosage.
- A number field that shows your current active dose. I want to calculate the dose based on half life. For that I need to register the amount of minutes since the last dose. For example, if a dose halves every 4 hours the formula would be:
- A small table with all taken dosages the last 24 hours.
I’ve got the input field to register a taken dosage, but I’m currently stuck trying to find:
- How to register the time of input or the amount of minutes since the last input
- How to calculate the current dose variable based on the input variable and formula to calculate current dose.
This all assumes one single medicine taken, after that I’d like to add categories with different half lifes etc, but first things first
Can anyone point me in the right direction here?