def processing_agent( measurement: entity.Measurement, statistics: entity.Statistics) -> entity.MeasurementResult: """ The processing agent goes through the whole measurement. For the types (oxygen, pulse, and both bloodpressures) - they will be analyised for validity and status - their status will be added to their measurement statistics - they will be added to the measurement results those results will be returned to the main :param: measurement The measurement that will be processed. :param: statistics The statistics object that needs to be updated. :return: The result of the processing in the form of a results object. """ oxygen_status = oxygen_analysis(measurement.oxygen, statistics.oxygen) pulse_status = pulse_analysis(measurement.pulse, statistics.pulse) systolic_status = blood_pressure_systolic_analysis( measurement.blood_pressure_systolic, statistics.blood_pressure_systolic) diastolic_status = blood_pressure_diastolic_analysis( measurement.blood_pressure_diastolic, statistics.blood_pressure_diastolic) # Add new statuses to the result measurement_results = entity.MeasurementResult(measurement, oxygen_status, pulse_status, systolic_status, diastolic_status) return measurement_results
def test_MeasurementResult(capsys): """Testing entity MeasurementResult""" m = entity.Measurement() mr = entity.MeasurementResult(m) assert mr.oxygen_status is entity.StatusEnum.MISSING assert mr.pulse_status is entity.StatusEnum.MISSING assert mr.blood_pressure_systolic_status is entity.StatusEnum.MISSING assert mr.blood_pressure_diastolic_status is entity.StatusEnum.MISSING assert mr.m is m
def test_MeasurementResultValues(capsys): """Testing entity MeasurementResultValues""" m = entity.Measurement(10, 20, 30, 40) mr = entity.MeasurementResult( m, entity.StatusEnum.MISSING, entity.StatusEnum.OK, entity.StatusEnum.MINOR, entity.StatusEnum.MAJOR, ) assert mr.oxygen_status == entity.StatusEnum.MISSING assert mr.pulse_status == entity.StatusEnum.OK assert mr.blood_pressure_systolic_status == entity.StatusEnum.MINOR assert mr.blood_pressure_diastolic_status == entity.StatusEnum.MAJOR
def test_output_parse4(capsys): m = entity.Measurement(90, 100, 110, 120) mr = entity.MeasurementResult( m, entity.StatusEnum.OK, entity.StatusEnum.OK, entity.StatusEnum.MISSING, entity.StatusEnum.OK, ) res = output_parser.format_status(mr) assert "100" in res assert "90" in res assert "120" in res assert "OK" in res assert "MISSING" in res
def test_output_parse(capsys): m = entity.Measurement(90, 100, 110, 120) mr = entity.MeasurementResult( m, entity.StatusEnum.MINOR, entity.StatusEnum.OK, entity.StatusEnum.LIFE_THREATENING, entity.StatusEnum.MAJOR, ) output = output_parser.format_status(mr) assert "90" in output assert "100" in output assert "110" in output assert "120" in output
def test_output_parse2(capsys): m = entity.Measurement(90, 100, 110, 120) mr = entity.MeasurementResult( m, entity.StatusEnum.MISSING, entity.StatusEnum.OK, entity.StatusEnum.LIFE_THREATENING, entity.StatusEnum.MAJOR, ) res = output_parser.format_status(mr) assert "0" in res assert "100" in res assert "110" in res assert "120" in res assert "MISSING" in res assert "OK" in res assert "LIFE_THREATENING" in res assert "MAJOR" in res