-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreport.py
More file actions
52 lines (46 loc) · 1.67 KB
/
Copy pathreport.py
File metadata and controls
52 lines (46 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import calories
import exercise
import water
import mental_health
import log
# Function to collect all data
def collect_all_data():
calorie_data = calories.get_calorie_data()
exercise_data = exercise.get_exercise_data()
water_data = water.get_water_data()
mental_health_data = mental_health.get_mental_health_data()
log_data = log.get_log_data()
return {
"calorie": calorie_data,
"exercise": exercise_data,
"water": water_data,
"mental_health": mental_health_data,
"log": log_data
}
# Analysis function to calculate averages
def calculate_averages(data):
averages = {}
for key, value in data.items():
if value: # Ensure there is data to average
average = sum(value) / len(value)
averages[key] = average
return averages
# Main report function
def generate_report():
data = collect_all_data()
averages = calculate_averages(data)
report = "Health Management System Report\n"
report += "--------------------------------\n"
for category, avg in averages.items():
report += f"Average {category} data: {avg:.2f}\n"
# Add more detailed analyses as needed
report += "\nDetailed Analysis:\n"
report += f"Total water intake: {sum(data['water']):.2f} liters\n"
report += f"Total calories consumed: {sum(data['calorie']):.2f} calories\n"
report += f"Total exercise done: {sum(data['exercise']):.2f} minutes\n"
report += "Mental health status: Good" if any(data['mental_health']) else "Mental health status: Needs attention"
return report
# Example usage
if __name__ == "__main__":
full_report = generate_report()
print(full_report)