fix drugs with mL dosage
This commit is contained in:
parent
18639e914d
commit
13c78e1be0
2 changed files with 54 additions and 20 deletions
|
|
@ -354,9 +354,10 @@ class EstimationService:
|
|||
if medication.applicant != applicant_id:
|
||||
continue
|
||||
try:
|
||||
drug_name = medication.name
|
||||
drug_name = medication.name.lower()
|
||||
drug_url = search_drug(drug_name)
|
||||
drug_dosage = float(medication.dosage)
|
||||
print(f"{drug_name} | {drug_url} | {drug_dosage}")
|
||||
drug_price = await fetch_drug_with_dosage(drug_url, drug_dosage)
|
||||
|
||||
if medication.frequency in ["Once daily", "At bedtime"]:
|
||||
|
|
@ -378,6 +379,7 @@ class EstimationService:
|
|||
|
||||
rx_spend += drug_price.unit_price * month_times
|
||||
except Exception as e:
|
||||
raise e
|
||||
print(f"Error calculating rx spend for {medication.name}: {e}")
|
||||
pass
|
||||
return rx_spend
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue