This is a text-only version of the following page on https://raymii.org:
---
Title       : 	NurseCalc Infuus - Bash script and Online app for infusion and drip (speed) Calculations 
Author      : 	Remy van Elst
Date        : 	01-02-2012
URL         : 	https://raymii.org/s/software/Nursecalc-Infuus.html
Format      : 	Markdown/HTML
---



This script will help you with nursing-related infusion and drip speed
calculations.  
**Also available as an online tool, scroll down for the link**.

<p class="ad"> <b>Recently I removed all Google Ads from this site due to their invasive tracking, as well as Google Analytics. Please, if you found this content useful, consider a small donation using any of the options below:</b><br><br> <a href="https://leafnode.nl">I'm developing an open source monitoring app called  Leaf Node Monitoring, for windows, linux & android. Go check it out!</a><br><br> <a href="https://github.com/sponsors/RaymiiOrg/">Consider sponsoring me on Github. It means the world to me if you show your appreciation and you'll help pay the server costs.</a><br><br> <a href="https://www.digitalocean.com/?refcode=7435ae6b8212">You can also sponsor me by getting a Digital Ocean VPS. With this referral link you'll get $100 credit for 60 days. </a><br><br> </p>


    
    
    NurseCalc infuus by Raymii.org. READ LICENSE
    Usage: ./infuus.sh $HOEVEELHEID $DRUPPELSNELHEID $TIJDSDUUR $DRUPPELSML
    Two variables are needed, the other will be calculated. Unknown variable should be entered as 0
    LAST VARIABLE (drips per ml) IS REQUIRED!
    $HOEVEELHEID = Total amount of drips
    $DRUPPELSNELHEID = drip speed in drips/min
    $TIJDSDUUR = Total time infusion needs to run in min
    $DRUPPELSML = drips in 1 ml of fluid. Most fluids have 20dr/ml
    Decimal hours to minutes: 4.87 hours = 0.87 hours * 0.60 = 4 hours and 52 minutes
    Calculate total amount of drips = dr/ml * total ml = 20 dr/ml * 2400 ml = 48000 drips total
    example: ./infuus.sh 2 85 2 0 will output 85 minutes.
    example: ./infuus.sh 40 90 720 0 will output 5 liters per minute
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    

### Online version

Thanks to the [Illumination Software Creator application builder][2] I've made
an online version. Same license, has bugs, not ready for production, regular
blabla.. Use on your own risk.  
[NurseCalc Infuus Online][3]

### Bash Script

**infuus.sh**

    
    
    #!/bin/bash
    # infuus.sh by raymii.org
    # script displays errors with float numbers, but calc is correct.
    #Copyright (c) 2012 Remy van Elst
    #Permission is hereby granted, free of charge, to any person obtaining a copy
    #of this software and associated documentation files (the "Software"), to deal
    #in the Software without restriction, including without limitation the rights
    #to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    #copies of the Software, and to permit persons to whom the Software is
    #furnished to do so, subject to the following conditions:
    #
    #The above copyright notice and this permission notice shall be included in
    #all copies or substantial portions of the Software.
    #
    #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    #IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    #FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    #AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    #LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    #OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    #THE SOFTWARE.
    
    HOEVEELHEID=$1
    DRUPPELSNELHEID=$2
    TIJDSDUUR=$3
    DRUPPELSML=$4
    
    
    function expl {
        echo 'NurseCalc infuus by Raymii.org. READ LICENSE';
        echo 'Usage: ./infuus.sh $HOEVEELHEID $DRUPPELSNELHEID $TIJDSDUUR $DRUPPELSML';
        echo 'Two variables are needed, the other will be calculated. Unknown variable should be entered as 0'
        echo 'LAST VARIABLE (drips per ml) IS REQUIRED!';
        echo '$HOEVEELHEID = Total amount of drips';
        echo '$DRUPPELSNELHEID = drip speed in drips/min';
        echo '$TIJDSDUUR = Total time infusion needs to run in min';
        echo '$DRUPPELSML = drips in 1 ml of fluid. Most fluids have 20dr/ml';
        echo 'Decimal hours to minutes: 4.87 hours = 0.87 hours * 0.60 = 4 hours and 52 minutes';
        echo 'Calculate total amount of drips = dr/ml * total ml = 20 dr/ml * 2400 ml = 48000 drips total';
        echo 'example: ./o2.sh 2 85 2 0 will output 85 minutes.';
        echo 'example: ./o2.sh 40 90 720 0 will output 5 liters per minute';
        echo 'THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.';
    }
    
    if [ -e $1 ] || [ -e $2 ] || [ -e $3 ] || [ -e $4 ]; then
        echo 'ERROR: One or more of the required input variables was/were empty.';
        expl;
        exit 1
    
    
    elif ! [[ "$HOEVEELHEID" =~ ^[0-9]+([.][0-9]+)?$ ]] || ! [[ "$DRUPPELSNELHEID" =~ ^[0-9]+([.][0-9]+)?$ ]] || ! [[ "$TIJDSDUUR" =~ ^[0-9]+([.][0-9]+)?$ ]] || ! [[ "$DRUPPELSML" =~ ^[0-9]+([.][0-9]+)?$ ]]; then
       exec >&&2; 
       echo 'ERROR: One or more of the variables are not numerical (integer or float)'; 
       expl;
       exit 1
    
    elif [ $HOEVEELHEID -eq 0 ] &&&& ! [ $DRUPPELSML -eq 0 ]; then 
        # hoeveelheid druppels  wanted
        exec >&&2;
        echo 'NurseCalc infuus by Raymii.org. READ LICENSE';
        echo -e "Druppelsnelheid $DRUPPELSNELHEID dr/min, nTijdsduur $TIJDSDUUR min ndr/ml = $DRUPPELSML";
        echo "########## ANSWER ##########"
        echo "Total drips";
        echo "scale=2; $DRUPPELSNELHEID * $TIJDSDUUR " | bc
        echo "Drips to ML:"; 
        echo "scale=2; ( $DRUPPELSNELHEID * $TIJDSDUUR ) / $DRUPPELSML" | bc
        exit 0
    
    elif [ $DRUPPELSNELHEID -eq 0 ] &&&& ! [ $DRUPPELSML -eq 0 ]; then 
        # druppelsnelheid wanted
        exec >&&2;
        echo 'NurseCalc infuus by Raymii.org. READ LICENSE';
        echo -e "Tijdsduur $TIJDSDUUR min, nTotaal aantal druppels $HOEVEELHEID ndr/ml = $DRUPPELSML";
        echo "########## ANSWER ##########"
        echo "Drip speed in min";
        echo "scale=2; ( $HOEVEELHEID / $TIJDSDUUR )" | bc
        exit 0
    
    elif [ $TIJDSDUUR -eq 0 ] &&&& ! [ $DRUPPELSML -eq 0 ]; then 
        # tijdsduur infuus wanted
        exec >&&2;
        echo 'NurseCalc infuus by Raymii.org. READ LICENSE';
        echo -e "Druppelsnelheid $DRUPPELSNELHEID dr/min, nTotaal aantal druppels $HOEVEELHEID ndr/ml = $DRUPPELSML";
        echo "########## ANSWER ##########"
        echo "Total infusion time in minutes";
        echo "scale=2; ( $HOEVEELHEID / $DRUPPELSNELHEID )" | bc
        echo "in hours";
        echo "scale=0; ( $HOEVEELHEID / $DRUPPELSNELHEID ) / 60 " | bc
        exit 0
    
    elif [ $DRUPPELSML -eq 0 ]; then 
        echo 'DRIPS PER ML IS REQUIRED.';
        echo '';
        expl;
        echo 'exiting now.';
        exit 1;
    fi
    

### Example output

    
    
    remy@solaris2 ~/projects/scripts/bash/vpcalc $ bash ./infuus.sh 34320 22 0 20
    NurseCalc infuus by Raymii.org. READ LICENSE
    Druppelsnelheid 22 dr/min, 
    Totaal aantal druppels 34320 
    dr/ml = 20
    ########## ANSWER ##########
    Total infusion time in minutes
    1560.00
    in hours
    26
    

   [1]: https://www.digitalocean.com/?refcode=7435ae6b8212
   [2]: http://radicalbreeze.com
   [3]: /s/inc/software/infuus/index.html

---

License:
All the text on this website is free as in freedom unless stated otherwise. 
This means you can use it in any way you want, you can copy it, change it 
the way you like and republish it, as long as you release the (modified) 
content under the same license to give others the same freedoms you've got 
and place my name and a link to this site with the article as source.

This site uses Google Analytics for statistics and Google Adwords for 
advertisements. You are tracked and Google knows everything about you. 
Use an adblocker like ublock-origin if you don't want it.

All the code on this website is licensed under the GNU GPL v3 license 
unless already licensed under a license which does not allows this form 
of licensing or if another license is stated on that page / in that software:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

Just to be clear, the information on this website is for meant for educational 
purposes and you use it at your own risk. I do not take responsibility if you 
screw something up. Use common sense, do not 'rm -rf /' as root for example. 
If you have any questions then do not hesitate to contact me.

See https://raymii.org/s/static/About.html for details.