Question: use python 04: Write the following function: Function name get_patient_statistics Parameter(s) argument(s) 1. List of Patient class instances. i.e. type list[Patient] The definition of the

use python

use python 04: Write the following function: Function name get_patient_statistics Parameter(s) argument(s)

1. List of Patient class instances. i.e. type list[Patient] The definition of

04: Write the following function: Function name get_patient_statistics Parameter(s) argument(s) 1. List of Patient class instances. i.e. type list[Patient] The definition of the Patient class is shown in your submission template Return value A patient's medical conditions are recorded as str type objects in a list that is stored in the instance attribute self._medical_conditions Return a dictionary with str for keys and integer for values i.e. type dict(str, int] There should be 4 key-value pairs: 1. Key: "high_risk_count" Value: Number of patients with 2 or more medical conditions 2. Key: "low_risk_count" Value: Number of patients with less than 2 medical conditions 3. Key: "no_risk_count" Value: Number of patients with no medical condition 4. Key: "invalid_count", Value: Number of patients with no medical conditions The function must handle No RecordsError. The definition of the Error is provided in the template. The function must not raise any exceptions. Error handling Notes: Detailed description The function should not write to stdout i.e. do not use print(). The Patient class definition is given below and in the submission template. You HAVE to use Patient's instance method get_med_cond() to access the patient instance attribute self._medical_conditions. The value for the key-value pair is O if none of the Patient instances meets the stated condition Example usage patients - Patient("Tom"), # Invalid Patient("Dick", ["hbp", "Type 1 diabetic", "high cholesterol"]), # High risk Patient("Harry", ["hbp", "diabetic"]), # High risk Patient("Jane", []), # No risk Patient("John", ("lbp"]), # Low risk ] print(get_patient_statistics(patients)) Example usage's console output {"high_risk_count": 2, "low_risk_count": 1, "no_risk_count": 1, "invalid_count": 1}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!