Let us worry about your assignment instead!

We Helped With This Python Programming Homework: Have A Similar One?

SOLVED
CategoryProgramming
SubjectPython
DifficultyUndergraduate
StatusSolved
More InfoPython Coding Help
43081

Short Assignment Requirements

The following application file needs to be done. There is another python starter file that I have as well. I was not able to attach more than 3 files.

Assignment Description

HIMT 345 

Homework 12: Application 1 

Overview:  

Use the skills and strategies learned in Modules 1-10 to create Python mini-programs to analyze healthcare data. 

 

Prior Task Completion: 

You should have already downloaded the complete Severance source files for Chapters 3-10.  There is a screen cast video to guide that download and installation.  It is found in D2L | Content | Textbook Materials and Links and looks like this:

 

Specifics:  

Download and unzip the PyCharm Python project entitled Hwk12_STARTER.zip. After loading it into PyCharm, Refactor | Rename it to the usual <Hwk12_YourLastname>.  

Three Python files are there and need renaming:  from Hwk12a_STARTER to Hwk12a_YourLastname.py, etc.  Several data files are also present: Patients.txt, Diagnoses.txt, Labs.txt, and Admissions.txt.

Please note that each data file has a columns descriptor line as the first line of the file.  When processing, we must IGNORE that line as it is obviously not valid data.  The following code preceding the actual loop that reads the file does just that.  Each time you read a file containing that header line you must include this code.

fhand = open('Diagnoses.txt')    # open the file, establish the file handle fhand.readline()                 # read the first line and ignore it 

# declare and set any initialization variables here, such as counters, lists, dictionaries

 

for line in fhand:                # loop through the file line by line  

 

1.   Hwk12a:  What patient (by ID) has the most admissions?  

 

Open Hwk12a_STARTER.py, rename it, and run it.  It should display the ID field from all the lines in the file Admissions.txt.  Comments included therein guide your code development.

 

Run and study the code in Ch 9 code sample 13.  It provides most of what you need for this task.

 

 

2.   Hwk12b:  What are the 10 patients (by ID) having the most labs?  

 

To tackle this task, repeat the code you wrote in 12a to create a dictionary containing IDs and the count of those IDs, this time on the Labs.txt file.

 

Then employ the strategies used in Ch 10 code sample 10 (ten most common words) to create a list of tuples, sort the list, and then print the first ten.

 

 

 

3.   Hwk12c:  Of the top 10 patients with the most labs, how many are male?  Print their IDs, and print the number of males in the top 10.

 

Repeat the code you wrote in 12b to create a dictionary containing IDs and the count of those IDs, create the list, and sort the list in reverse.

 

Now you have to find out which of the top 10 in the list of most Labs are male.  To do that, you have to loop through the Patients.txt file, checking to see if the ID is present in the same line as the word ‘Male’.

 

Follow the comments in the code to add the statements necessary to achieve the tasks.  Don’t be afraid to add print statements to help you write the code; remove them when you’re finished.  The output is shown below.

 

 

 

What to hand in: 

Create a Word doc (Hwk12_YourLastName.doc)containing both the Python code and the console output for each of 12a, 12b, and 12c.

1.   Screen snips of the code editor for 12a.  Then, a screen snip of the console window showing the result 12a.

 

2.   Similarly for each of 12b and 12c. 

 

<CONTINUED>

 

3. Upload the Word doc and the Python program files for 12a, 12b, and 12c to the appropriate D2L dropbox.   Four files total.

 

 

 

 

 

 

 

 

 

 

 

 

Assignment Code


# Hwk12a - What Patient (by ID) has the most admissions?

# Add the usual file documentation

fhand = open('Admissions.txt')    # open the file, establish the file handle
fhand.readline()                # read the first line and ignore it

for line in fhand:
    # print line

    # slice the line (string) to get the ID
    ID = line[:8]
    print ID                    # remove this after you get the counting down

    # use the counting strategies with a dictionary shown in Chap 9 Sample 13 Find the word count fo a file

fhand.close()

# print out the result


Assignment Code


# Hwk12b - What are the top 10 patients (by ID) with the most labs?

# Add the usual file documentation

# Repeat the code you wrote in 12a to create a dictionary containing IDs and the count of those IDs.

# Use the strategies used in Ch 10 code sample 10 (ten most common words) to create a list of tuples,
#   sort the list in reverse, and then print the first ten.


Assignment Code


# Hwk12c - Of the 10 patients (by ID) with the most labs, how many are male?

# Add the usual file documentation

# *** Repeat the code you wrote in 12b to create a dictionary containing IDs and the count of those IDs.

# *** Again, use the strategies used in Ch 10 code sample 10 (ten most common words) to create a list of tuples,
#   sort the list in reverse, and then print the first ten.

# Given the listOfTuples, process the first ten
count = 0
for val, key in listOfTuples[:10] :
    print key, val                      # remove this once you get going

    # now must check if the key (ID) and 'Male' are in the same line of the Patients.txt file

    # *** open the file 'Patients.txt' and read the first line

    for line in fhand:
        # *** add an  if-statement to check if the ID (which is in the key position)
        #     is in the line, AND 'Male' is in the line
            # print line                  # just to show that we've selected it; delete this later
            # count this line - it contains both the ID and 'Male'
            count = count + 1

print "Of the 10 patients with the most labs, there were " + str(count) + " males."

Frequently Asked Questions

Is it free to get my assignment evaluated?

Yes. No hidden fees. You pay for the solution only, and all the explanations about how to run it are included in the price. It takes up to 24 hours to get a quote from an expert. In some cases, we can help you faster if an expert is available, but you should always order in advance to avoid the risks. You can place a new order here.

How much does it cost?

The cost depends on many factors: how far away the deadline is, how hard/big the task is, if it is code only or a report, etc. We try to give rough estimates here, but it is just for orientation (in USD):

Regular homework$20 - $150
Advanced homework$100 - $300
Group project or a report$200 - $500
Mid-term or final project$200 - $800
Live exam help$100 - $300
Full thesis$1000 - $3000

How do I pay?

Credit card or PayPal. You don't need to create/have a Payal account in order to pay by a credit card. Paypal offers you "buyer's protection" in case of any issues.

Why do I need to pay in advance?

We have no way to request money after we send you the solution. PayPal works as a middleman, which protects you in case of any disputes, so you should feel safe paying using PayPal.

Do you do essays?

No, unless it is a data analysis essay or report. This is because essays are very personal and it is easy to see when they are written by another person. This is not the case with math and programming.

Why there are no discounts?

It is because we don't want to lie - in such services no discount can be set in advance because we set the price knowing that there is a discount. For example, if we wanted to ask for $100, we could tell that the price is $200 and because you are special, we can do a 50% discount. It is the way all scam websites operate. We set honest prices instead, so there is no need for fake discounts.

Do you do live tutoring?

No, it is simply not how we operate. How often do you meet a great programmer who is also a great speaker? Rarely. It is why we encourage our experts to write down explanations instead of having a live call. It is often enough to get you started - analyzing and running the solutions is a big part of learning.

What happens if I am not satisfied with the solution?

Another expert will review the task, and if your claim is reasonable - we refund the payment and often block the freelancer from our platform. Because we are so harsh with our experts - the ones working with us are very trustworthy to deliver high-quality assignment solutions on time.

Customer Feedback

"Thanks for explanations after the assignment was already completed... Emily is such a nice tutor! "

Order #13073

Find Us On

soc fb soc insta


Paypal supported