Task

You work for a Med Tech company and have been asked to create NEWS score calculator for use in Hospitals. It will need to take in data that a doctor inputs, convert the data into a points, and present the doctor with the overall NEWS score. They would like your code to be as sophisticated as possible and allow for use in other situations.

Background

The NEWS score is a systematic scoring system used to assess the likelihood of a patient having a poor outcome. The following table shows you the criteria and parameters that are used to calculate a patient’s score:

news
news

Over to you

Please do not start by trying to complete the hardest task. You will need to complete the easy task to be able to move on to the harder tasks.

Easy

Create a NEWS score calculator for SBP, RR and whether the patient is on oxygen.

You will need to:

  • Take user input for each criterion and save it
    • Google how to take user input in python
  • Create an ‘If statement’ for each criterion converting the user input into a NEWS score
    • Try and write the logic up before you start writing the code
    • E.g. if the SBP I am given is less than this, I will need to add 3 points to the score….
  • Add up all the individual scores to give an overall NEWS score
    • The output should be something like
    • The patient’s NEWS score is ‘x’

Hard

Create a NEWS score calculator for SBP, RR and whether the patient is on oxygen using some FUNCTIONS.

You will need to:

  • Take user input for each criterion and validate the user input
    • i.e. for SBP, you only want your program to accept a positive integer
  • Create a function for SBP and RR converting the user input into a NEWS score
    • You should only need to write one functions which will work for both criteria
    • Your function should be generic and allow you to run it using different values each time
    • Remember, you can have multiple inputs into a function
    • You will need to create variables to do this too
  • Create a function for whether the patient is on oxygen
  • Call all your functions
    • Hint: sometimes you will have to specify an input, sometimes you won’t
  • Add up all the individual scores to give an overall NEWS score

Harder

Create a NEWS score calculator for ALL of the NEWS parameters using FUNCTIONS.

You will need to:

  • Create functions that take different TYPES of user input and validates the user input
    • i.e. for temperature, you only want your program to accept a positive floating point number
    • Make your functions generic so you can use one function for getting inputs for many parameters
  • Create functions for each criterion converting the user input into a NEWS score
    • You may need to write numerous functions depending on how many parameters each criterion has
    • i.e. RR has 4 parameters, oxygen saturation has 3
  • Call all your functions
  • Add up all the individual scores to give an overall NEWS score

Hardest

Create a NEWS score calculator for ALL of the NEWS parameters using functions where all the functions are saved in one file and are called in another file.

You will need to:

  • Create a file called functions.py
  • In this file, write functions that take different TYPES of user input and validates the user input
    • i.e. for temperature, you only want your program to accept a positive floating point number
    • Make your functions generic so you can use one function for getting inputs for many parameters
  • In the same file write functions for each criterion converting the user input into a NEWS score
    • You may need to write numerous functions depending on how many parameters each criterion has
    • i.e. RR has 4 parameters, oxygen saturation has 3
  • In the same file, write functions that include the previous functions so that you only have to call one function for your program to take user input and calculate a NEWS score
  • In a separate file, import your functions.py script
  • In this file, call the functions you created previously
  • Add up all the individual scores to give an overall NEWS score

 

Extension

Interpret the NEWS scores that you get: 

I.e. the patient’s NEWS score is high, you will need to ….