Python flask application for calculating drug dosages and halflifes
$30-250 USD
In Progress
Posted almost 6 years ago
$30-250 USD
Paid on delivery
I need a python application written in flask. Most of the logic and function sudo code is already written so this should be an easy one.
See attached python file for more information.
I'd like the flask application to allow adding of additional drugs and dosages in a database, along with graphing in something like plotly or similar.
Function examples:
def calc_peak_plasma_time(drug, last_dose_time):
# Returns time that drug will reach peak plasma
# If false, add peak plasma to future time
return
def calc_plasma_level(drug, last_dose_time, current_level):
# returns plasma concentration.
# Checks if at peak plasma
# If not, checks amount at current_time level should be all
# If no current_level, use last_dose via calc_halflife_level
# If past, uses half life to determine level at X time
return
def calc_halflife_level(drug, dose, last_dose_time, target_time):
# Read drug halflife
# If bdo or if ghb statements (don’t need these, just read the halflife from the dict)
# Divide in minutes the current halflife expected and calculate metabolism at target_time
# Return expected level left unmetabolized
# Add this amount to current_level
return
def calc_total_level(drug, dose, target_time, current_level):
# runs calc_plasma_level and current_level against
# adds the resultants together at the time indicated.
return
def calc_adjusted_bioavailability(dose, percentage):
# reduce initial pre peak plasma by X amount
return
'''
Main logic
Set drugs dict with bdo and ghb peak plasma and half lifes and bioavailability (usually route dependant)
Create doses dict with drug, dose, timestamp
Create a dict with drug, dose, time (X minute increments), plasma_level for drug (future feature, allow 2 stage conversions. For example, would involve using bdo + conversion time to figure out ghb conversion levels)
For each dose, first, use first dose after peak plasma time adjusted with bioavailability to set current_level at next time, then for next dose, first calc total level after accounting for half life of
'''