Skip to content

Commit

Permalink
add_detail_modification
Browse files Browse the repository at this point in the history
  • Loading branch information
ManaS066 committed Sep 1, 2024
1 parent 396f706 commit a09b22f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 247 deletions.
34 changes: 29 additions & 5 deletions Government of NCT of Delhi/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down
235 changes: 0 additions & 235 deletions Government of NCT of Delhi/templates/super admin dash.html

This file was deleted.

14 changes: 7 additions & 7 deletions Government of NCT of Delhi/templates/super_admin_dash.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ <h2>Super Admin Dashboard</h2>
<div class="grid-container">
<div class="card">
<h3>Total Hospitals</h3>
<p id="total-hospitals">Loading...</p>
<p id="total-hospitals">{{no_hospital}}</p>
</div>
<div class="card">
<h3>Total Doctors</h3>
<p id="total-doctors">Loading...</p>
<p id="total-doctors">{{doctor}}</p>
</div>
<div class="card">
<h3>Total Active Patients</h3>
<p id="total-active-patients">Loading...</p>
<p id="total-active-patients">{{patient}}</p>
</div>
<div class="card">
<h3>Total Inventory Distributors</h3>
Expand All @@ -145,16 +145,16 @@ <h3>Total Admin Staff</h3>
<p id="total-admin-staff">Loading...</p>
</div>
<div class="card">
<h3>Total OPD Beds</h3>
<p id="total-opd-beds">Loading...</p>
<h3>Total Ventilator Beds</h3>
<p id="total-opd-beds">{{total_ventilators}}</p>
</div>
<div class="card">
<h3>Total ICU Beds</h3>
<p id="total-icu-beds">Loading...</p>
<p id="total-icu-beds">{{total_icu_beds}}</p>
</div>
<div class="card">
<h3>Total General Wards</h3>
<p id="total-general-wards">Loading...</p>
<p id="total-general-wards">{{total_beds}}</p>
</div>
<div class="card">
<h3>Blood Status</h3>
Expand Down

0 comments on commit a09b22f

Please sign in to comment.