diff --git a/Government of NCT of Delhi/app.py b/Government of NCT of Delhi/app.py index c5743e9..f079b16 100644 --- a/Government of NCT of Delhi/app.py +++ b/Government of NCT of Delhi/app.py @@ -482,11 +482,35 @@ def doctor_app(): @app.route('/superadmin/', methods=['GET', 'POST']) def superadmin(): - no_of_hospital = hospital_data_collection.count_documents() - total_doctor = doctors_collection.count_documents() - active_patient = patients_collection.count_documents() - - return render_template('super_admin_dash.html') + # Count the total number of hospitals, doctors, and active patients + no_of_hospital = hospital_data_collection.count_documents({}) + total_doctor = doctors_collection.count_documents({}) + active_patient = patients_collection.count_documents({}) + + # Aggregate the total number of beds, ICU beds, and ventilators + total_beds = hospital_data_collection.aggregate([ + {"$group": {"_id": None, "total_beds": {"$sum": "$number_of_beds"}}} + ]).next()['total_beds'] + + total_icu_beds = hospital_data_collection.aggregate([ + {"$group": {"_id": None, "total_icu_beds": {"$sum": "$number_of_icu_beds"}}} + ]).next()['total_icu_beds'] + + total_ventilators = hospital_data_collection.aggregate([ + {"$group": {"_id": None, "total_ventilators": {"$sum": "$number_of_ventilators"}}} + ]).next()['total_ventilators'] + + # Debugging prints (can be removed in production) + print(total_ventilators, total_beds, total_icu_beds) + + # Render the template with the computed values + return render_template('super_admin_dash.html', + no_hospital=no_of_hospital, + doctor=total_doctor, + patient=active_patient, + total_beds=total_beds, + total_icu_beds=total_icu_beds, + total_ventilators=total_ventilators) @app.route("/superadmin_login", methods=['GET', 'POST']) diff --git a/Government of NCT of Delhi/templates/super admin dash.html b/Government of NCT of Delhi/templates/super admin dash.html deleted file mode 100644 index 9b0bd1d..0000000 --- a/Government of NCT of Delhi/templates/super admin dash.html +++ /dev/null @@ -1,235 +0,0 @@ - - - -
- - -Loading...
+{{no_hospital}}
Loading...
+{{doctor}}
Loading...
+{{patient}}
Loading...
Loading...
+{{total_ventilators}}
Loading...
+{{total_icu_beds}}
Loading...
+{{total_beds}}