SmartPharmacist: Redux.

Welcome to SmartPharmacist, Rebecca.

Based on our analysis of your condition, we would suggest you start with a low dosage of Levodivdivphine to treat your bipolar disorder.

Levodivdivphine is a antiparkinsonian drug that is prescribed for bipolar disorder and inflated asshole cancer.

Suggested daily dosage is 5 pills a day taken orally, or rubbing the gel form of the drug on your testy lower thigh.

Once upon a time, individuals suffering from bipolar disorder syndrome were prescribed Concerta and AndroGel, but new advancements in the field of fist Physics has helped doctors better remedy this disorder.

Side effects of Levodivdivphine may include: bloody urine, effective toenail, kidney duplex, penile torsion, prideful asshole, and weight increase.

This week, we learned how to write functions in our Python programs. For my assignment, I revisited last week’s SmartPharmacist .py program I wrote, which gives terrible drug advice based on your symptoms. The outcome of the program is the same, but the code I wrote streamlines a lot of the action that takes place.

I wrote two functions – one that streamlines random.choice() and one that more cleanly creates the drug name.

Here’s the rewrite of the code:

You can find the full repository on GitHub.

SmartPharmacist: A computer program that gives you terrible drug advice.

Welcome to SmartPharmacist, Rebecca. 

Based on our analysis of your condition, we would suggest you start with a low dosage of Alalproex sodiumdivum to treat your bipolar disorder. 

Alalproex sodiumdivum is a antipanic agent drug that is used for bipolar disorder and haughty cheekbone syndrome. 

Suggested daily dosage is 3 pills a day taken orally, or rubbing the gel form of the drug on your irritable fingernail. 

Once, individuals suffering from bipolar disorder failure were prescribed Aripiprazole and Crystal meth, but new advancements in the field of cheekbone Geography has helped doctors better remedy this disorder. 

Side effects of Alalproex sodiumdivum may include: abdominal pain, brooding wrist, grand mal convulsion, grand mal convulsion, brooding lip, and drug intolerance.

For this week’s assignment, we had to write a computer code in Python and execute it in a way that would creatively re-arrange text. We also had to use a network-based source like an API/JSON file in our code.

I’ve been thinking a lot lately about how we collectively seek out information about our health. Traditionally, medicine and disease was something you talked about with your parents or a family doctor. Online medical services like WebMD or even informal forums like Reddit’s Ask a doctor have not replaced physical doctors or pharmacists, but typically the first place an individual turns to get information about his/her health condition is online.

With that in mind, I decided to create a computer program in Python that would automatically generate medical advice based on the user’s health condition.

Screen Shot 2016-04-01 at 3.22.22 AM

I checked out a few different APIs that had extensive documentation, including Infermedica and APIMedic, but those sources proved either too costly or had very limited access to the data (i.e. the site would not allow access via JavaScript so you would have to use a Python client). Finally I settled on the FDA’s OpenFDA API, which provided a really comprehensive repository of every “adverse event” (i.e. side effect) associated with a particular pharmaceutical drug, along with dozens of other endpoints.

The JSON file I generated was very complex. In order to construct the URL, I had to write these lines of code:

 

After getting the data into my program, I decided I wanted the user to be able to search for their medical problem [‘drugindication’] and my program would yield the name of a drug [‘generic_name’]. I wanted the name of the drug to be humorous and fictional, so I took the name of the REAL drug that the user would be prescribed, and cut it in half and mixed in some other syllables so that each drug name is unique.

I found some lists of words online and played Mad Libs with the prescribed “script” for the SmartPharmacist, adding in some body parts and medicine-related adjectives. I liked the fact that this particular API was centered around monitoring the harmful side effects of pharmaceutical drugs because it would add some humor to the medical suggestions made by my SmartPharmacist program. I view my program as basically a terrible doctor. 

Here are some examples:

Welcome to SmartPharmacist, Rebecca.

Based on our analysis of your condition, we would suggest you start with a low dosage of Lidorisentanambphine to treat your Pulmonary Ebolism.

Lidorisentanambphine is a sedative drug that is prescribed for Pulmonary Ebolism and narcissistic tooth disease.

Suggested daily dosage is 2 pills a day taken orally, or rubbing the gel form of the drug on your brassy hairline.

Conventionally, individuals suffering from Pulmonary Ebolism disorder were prescribed Heroin and Gabapentin, but new advancements in the field of tooth Gelotology has helped doctors better remedy this disorder.

Side effects of Lidorisentanambphine may include: impairment of daily activities, astir buttocks, chest pain, plummeting blood pressure, efficacious asshole, and local swelling.
Welcome to SmartPharmacist, Rebecca.

Based on our analysis of your condition, we would suggest you start with a low dosage of Burisentanambphine to treat your Sleep apnea.

Burisentanambphine is a aphrodisiac drug that is used both recreationally and clinically to treat Sleep apnea and contentious upper arm disease.

Suggested daily dosage is 2 pills a day taken orally, or rubbing the gel form of the drug on your bustling ankle.

Once upon a time, individuals suffering from Sleep apnea cancer were prescribed Welbutrin and Lisdexamfetamine, but new advancements in the field of upper arm Neurology has helped doctors better remedy this disorder.

Side effects of Burisentanambphine may include: nausea, cheeky middle finger, penile torsion, weight increase, opinionated arm, and emotional distress.
Welcome to SmartPharmacist, Rebecca. 

Based on our analysis of your condition, we would suggest you start with a low dosage of Desliplatinoxarane to treat your appetite loss. 

Desliplatinoxarane is a ovulation inducer drug that is approved for treatment of appetite loss and congenital hip cancer. 

Suggested daily dosage is 5 pills a day taken orally, or rubbing the gel form of the drug on your introverted knee. 

In the olden days, individuals suffering from appetite loss cancer were prescribed Geodon and Oxycodone, but new advancements in the field of hip Geodesy has helped doctors better remedy this disorder.

Overall, I was pleased with the text the program had generated. It sounded realistic enough so that it didn’t seem like a strict cut-and-paste Mad Libs and I think it successfully mimicked the language we associate with pharmaceutical labels. In the future, I think I could think more creatively about how to cut up the text while using the API in a meaningful way.

Here is the Python program I wrote. You can access the full repository over at GitHub.