Question: PLEASE WRITE IN PYTHON (python3) This has three parts that build on top of each other. 1. the first part is just getting a json

PLEASE WRITE IN PYTHON (python3)
This has three parts that build on top of each other.
1. the first part is just getting a json data set. This data set has one key, 'turbidity_data', whose value is a time series list of dictionaries. Each dictionary in this list has the same set of keys. A sample of this data set is below:
PLEASE WRITE IN PYTHON (python3)This has three parts that build on top
please note that the complete data set is already given to us but will be used in the following parts.
2. write a python3 script that reads the water quality data set and prints three things a. the current water turbidity(taken as the average of the most recent five data points), b. whether that turbidity is below the safe threshold and c. the min time required for turbidity to fall below the safe threshold ( if already below safe threshold print 0 hrs). Some requirements:
A. the script must have a main() that is only called when executing script directly
B. use the python 'requests' library to import the json data
C. the script must have a mim of two additional functions. 1. a function to calculate turbidity using equation below 2. a function to calculate min time to fall below safe threshold using equation below.
D. the safe threshold is a constant, 1.0 NTU
E. the decay factor per hour is a constant. 2% or 0.02
equations:
of each other. 1. the first part is just getting a json
^^ this is for the turbidity
data set. This data set has one key, 'turbidity_data', whose value is
^^ this is for finding the min time required to return below a safe threshold. it is expressed as an inequality and is a standard exponential decay function
the output should be similar to the below:
a time series list of dictionaries. Each dictionary in this list has
3. in a new python3 script, write unit tests to test the functions made in the previous script. the test script should work with 'pytest'. There must be at least one test associated with each function. They could simply perform math checks or something a bit more complicated including checking type returns
A template is below:
the same set of keys. A sample of this data set is

T=a0I90T=TurbidityinNTUUnits(040)a=CalibrationconstantI90=Ninetydegreedetectorcurrent Ts>T(1d)b Ts = Turbidity threshold for safe water To = Current turbidity d= decay factor per hour, expressed as a decimal b= hours elapsed Average turbidity based on most recent five measurements =1.1992 NTU Warning: Turbidity is above threshold for safe use Minimum time required to return below a safe threshold =8.99 hours Average turbidity based on most recent five measurements =0.9852 NTU Info: Turbidity is below threshold for safe use Minimum time required to return below a safe threshold =0 hours from my_module_name import func1, func2 import pytest def test_func1() : assert func1( info_to_pass_to_func1) == expected_value def test_func2() : assert func2( info_to_pass_to_func2 ) == expected_value

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!