Commit 5ed82015 authored by Manas Gabani's avatar Manas Gabani

Added Distribution routes for teachers page

parent d1945233
......@@ -37,7 +37,15 @@ dict_summary={"top3":[],"bottom3":[]}
form_value_to_sub_dimension_mapping = {
'govt':'Government',
'private':'Private',
'others':'Madrasas & Unrecognised'
'others':'Madrasas & Unrecognised',
'below_secondary':'Below Secondary',
'secondary':'Secondary',
'higher_secondary':'Higher Secondary',
'graduate':'Graduate',
'post_graduate':'Post Graduate',
'mphil_phd':'M.Phil / Ph.D',
'post_doctorate':'Post Doctorate',
'no_response':'No Response'
}
# fig_size_w=16
# fig_size_h=13
......@@ -177,9 +185,21 @@ def students():
elementary_enrolment_summary = statewise_distribution(os.path.join(app.config['UPLOAD_FOLDER'], distribution_elementary_enrolment), final_df, latest_year, main_dimension = "Elementary Enrolment by School Category", sub_dimension=rural_enrolment_category)
return render_template('students.html', distribution_rural_enrolment=distribution_rural_enrolment, distribution_elementary_enrolment=distribution_elementary_enrolment, rural_enrolment_summary=rural_enrolment_summary, elementary_enrolment_summary=elementary_enrolment_summary, rural_enrolment_category=rural_enrolment_category, elementary_enrolment_category=elementary_enrolment_category)
distribution_teachers_by_category = ''
distribution_teachers_by_educational_qualification = ''
teachers_by_category_summary = {}
teachers_by_educational_qualification_summary = {}
teachers_category = ''
teachers_qualification = ''
@app.route('/teachers.html')
def teachers():
return render_template('teachers.html')
global distribution_teachers_by_educational_qualification, distribution_teachers_by_category, teachers_by_category_summary, teachers_by_educational_qualification_summary, teachers_category, teachers_qualification
teachers_category, teachers_qualification = 'Government', 'Below Secondary'
distribution_teachers_by_category = "img/distribution_teachers_by_category_govt_{}.jpeg".format(latest_year)
teachers_by_category_summary = statewise_distribution(os.path.join(app.config['UPLOAD_FOLDER'], distribution_teachers_by_category), final_df, latest_year, main_dimension = "Teachers by School Category", sub_dimension=teachers_category)
distribution_teachers_by_educational_qualification = "img/distribution_teachers_by_educational_qualification_below_secondary_{}.jpeg".format(latest_year)
teachers_by_educational_qualification_summary = statewise_distribution(os.path.join(app.config['UPLOAD_FOLDER'], distribution_teachers_by_educational_qualification), final_df, latest_year, main_dimension = "Teachers by Educational Qualification", sub_dimension=teachers_qualification)
return render_template('teachers.html', distribution_teachers_by_category=distribution_teachers_by_category, distribution_teachers_by_educational_qualification=distribution_teachers_by_educational_qualification, teachers_by_category_summary=teachers_by_category_summary, teachers_by_educational_qualification_summary=teachers_by_educational_qualification_summary, teachers_category=teachers_category, teachers_qualification=teachers_qualification)
@app.route('/schools.html')
def schools():
......@@ -230,17 +250,23 @@ def get_distribution_for_rural_enrolment():
rural_enrolment_summary = statewise_distribution(os.path.join(app.config['UPLOAD_FOLDER'], distribution_rural_enrolment), final_df, requested_year, main_dimension = "Elementary Enrolment by School Category", sub_dimension=rural_enrolment_category)
return render_template('students.html', distribution_rural_enrolment=distribution_rural_enrolment, distribution_elementary_enrolment=distribution_elementary_enrolment, rural_enrolment_summary=rural_enrolment_summary, elementary_enrolment_summary=elementary_enrolment_summary, rural_enrolment_category=rural_enrolment_category, elementary_enrolment_category=elementary_enrolment_category)
@app.route('/get_trend_from_teachers', methods=['POST'])
def get_trend_from_teachers():
trend_from_teachers = 'img/sample_trend_teachers_new.jpeg'
prepare_graph(trend_from_teachers)
return render_template('teachers.html', trend_from_teachers=trend_from_teachers)
@app.route('/get_distribution_from_teachers', methods=['POST'])
def get_distribution_from_teachers():
distribution_from_teachers = 'img/sample_distribution_teachers_new.jpeg'
prepare_graph(distribution_from_teachers)
return render_template('teachers.html', distribution_from_teachers=distribution_from_teachers)
@app.route('/get_distribution_for_teachers_by_category', methods=['POST'])
def get_distribution_for_teachers_by_category():
global distribution_teachers_by_educational_qualification, distribution_teachers_by_category, teachers_by_category_summary, teachers_by_educational_qualification_summary, teachers_category, teachers_qualification
teachers_category = form_value_to_sub_dimension_mapping[request.form['category']]
requested_year = int(request.form['year'])
distribution_teachers_by_category = "img/distribution_teachers_by_category_govt_{}.jpeg".format(requested_year)
teachers_by_category_summary = statewise_distribution(os.path.join(app.config['UPLOAD_FOLDER'], distribution_teachers_by_category), final_df, requested_year, main_dimension = "Teachers by School Category", sub_dimension=teachers_category)
return render_template('teachers.html', distribution_teachers_by_category=distribution_teachers_by_category, distribution_teachers_by_educational_qualification=distribution_teachers_by_educational_qualification, teachers_by_category_summary=teachers_by_category_summary, teachers_by_educational_qualification_summary=teachers_by_educational_qualification_summary, teachers_category=teachers_category, teachers_qualification=teachers_qualification)
@app.route('/get_distribution_for_teachers_by_educational_qualification', methods=['POST'])
def get_distribution_for_teachers_by_educational_qualification():
global distribution_teachers_by_educational_qualification, distribution_teachers_by_category, teachers_by_category_summary, teachers_by_educational_qualification_summary, teachers_category, teachers_qualification
teachers_qualification = form_value_to_sub_dimension_mapping[request.form['qualification']]
requested_year = int(request.form['year'])
distribution_teachers_by_educational_qualification = "img/distribution_teachers_by_educational_qualification_below_secondary_{}.jpeg".format(requested_year)
teachers_by_educational_qualification_summary = statewise_distribution(os.path.join(app.config['UPLOAD_FOLDER'], distribution_teachers_by_educational_qualification), final_df, requested_year, main_dimension = "Teachers by Educational Qualification", sub_dimension=teachers_qualification)
return render_template('teachers.html', distribution_teachers_by_category=distribution_teachers_by_category, distribution_teachers_by_educational_qualification=distribution_teachers_by_educational_qualification, teachers_by_category_summary=teachers_by_category_summary, teachers_by_educational_qualification_summary=teachers_by_educational_qualification_summary, teachers_category=teachers_category, teachers_qualification=teachers_qualification)
@app.route('/get_trend_from_schools', methods=['POST'])
def get_trend_from_schools():
......
No preview for this file type
......@@ -107,7 +107,7 @@
<div class="content-2">
<div class="new-students">
<div class="title">
Distribution across states for Elementary Enrolment in {% print(elementary_enrolment_category) %} Schools
Distribution across states of Elementary Enrolment in {% print(elementary_enrolment_category) %} Schools
</div>
<form method="POST" action="/get_distribution_for_elementary_enrolment">
Select Year:
......@@ -189,7 +189,7 @@
<div class="content-2">
<div class="new-students">
<div class="title">
Distribution across states for Rural Enrolment in {% print(rural_enrolment_category) %} Schools
Distribution across states of Rural Enrolment in {% print(rural_enrolment_category) %} Schools
</div>
<form method="POST" action="/get_distribution_for_rural_enrolment">
Select Year:
......@@ -266,7 +266,6 @@
</table>
</div>
</div>
</div>
</div>
</body>
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment