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":[]} ...@@ -37,7 +37,15 @@ dict_summary={"top3":[],"bottom3":[]}
form_value_to_sub_dimension_mapping = { form_value_to_sub_dimension_mapping = {
'govt':'Government', 'govt':'Government',
'private':'Private', '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_w=16
# fig_size_h=13 # fig_size_h=13
...@@ -177,9 +185,21 @@ def students(): ...@@ -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) 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) 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') @app.route('/teachers.html')
def teachers(): 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') @app.route('/schools.html')
def schools(): def schools():
...@@ -230,17 +250,23 @@ def get_distribution_for_rural_enrolment(): ...@@ -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) 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) 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']) @app.route('/get_distribution_for_teachers_by_category', methods=['POST'])
def get_trend_from_teachers(): def get_distribution_for_teachers_by_category():
trend_from_teachers = 'img/sample_trend_teachers_new.jpeg' global distribution_teachers_by_educational_qualification, distribution_teachers_by_category, teachers_by_category_summary, teachers_by_educational_qualification_summary, teachers_category, teachers_qualification
prepare_graph(trend_from_teachers) teachers_category = form_value_to_sub_dimension_mapping[request.form['category']]
return render_template('teachers.html', trend_from_teachers=trend_from_teachers) requested_year = int(request.form['year'])
distribution_teachers_by_category = "img/distribution_teachers_by_category_govt_{}.jpeg".format(requested_year)
@app.route('/get_distribution_from_teachers', methods=['POST']) 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)
def get_distribution_from_teachers(): 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)
distribution_from_teachers = 'img/sample_distribution_teachers_new.jpeg'
prepare_graph(distribution_from_teachers) @app.route('/get_distribution_for_teachers_by_educational_qualification', methods=['POST'])
return render_template('teachers.html', distribution_from_teachers=distribution_from_teachers) 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']) @app.route('/get_trend_from_schools', methods=['POST'])
def get_trend_from_schools(): def get_trend_from_schools():
......
No preview for this file type
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
<div class="content-2"> <div class="content-2">
<div class="new-students"> <div class="new-students">
<div class="title"> <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> </div>
<form method="POST" action="/get_distribution_for_elementary_enrolment"> <form method="POST" action="/get_distribution_for_elementary_enrolment">
Select Year: Select Year:
...@@ -189,7 +189,7 @@ ...@@ -189,7 +189,7 @@
<div class="content-2"> <div class="content-2">
<div class="new-students"> <div class="new-students">
<div class="title"> <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> </div>
<form method="POST" action="/get_distribution_for_rural_enrolment"> <form method="POST" action="/get_distribution_for_rural_enrolment">
Select Year: Select Year:
...@@ -266,7 +266,6 @@ ...@@ -266,7 +266,6 @@
</table> </table>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</body> </body>
......
...@@ -107,66 +107,123 @@ ...@@ -107,66 +107,123 @@
<div class="content-2"> <div class="content-2">
<div class="new-students"> <div class="new-students">
<div class="title"> <div class="title">
Distribution across states Distribution across states of Teachers in {% print(teachers_category) %} Schools
</div> </div>
<form method="POST" action="/get_distribution_from_teachers"> <form method="POST" action="/get_distribution_for_teachers_by_category">
Select state: Select Year:
<select name="state" class="state"> <select name="year" class="year">
<option value="Maharashtra">Maharashtra</option> <option value="2016">2016</option>
<option value="Gujarat">Gujarat</option> <option value="2015">2015</option>
<option value="Karnataka">Karnataka</option> <option value="2014">2014</option>
<option value="Kerela">Kerela</option> <option value="2013">2013</option>
<option value="2012">2012</option>
<option value="2011">2011</option>
<option value="2010">2010</option>
<option value="2009">2009</option>
<option value="2008">2008</option>
<option value="2007">2007</option>
<option value="2006">2006</option>
</select> </select>
Select type: Select Category:
<select name="type" class="type"> <select name="category" class="category">
<option value="government">Government</option> <option value="govt">Government</option>
<option value="private">Private</option> <option value="private">Private</option>
<option value="others">Madrasas and Others</option> <option value="others">Madrasas and Others</option>
</select> </select>
<input name="get_distribution_from_teachers" type="submit" value="Submit"> <input name="get_distribution_for_teachers_by_category" type="submit" value="Submit">
</form> </form>
{% if distribution_from_teachers %}
<div>
<img src="{{ url_for('static', filename=distribution_from_teachers) }}">
</div>
{% else %}
<div> <div>
<img src="{{ url_for('static', filename='img/sample_distribution_teachers.jpeg') }}"> <img src="{{ url_for('static', filename=distribution_teachers_by_category) }}">
</div> </div>
{% endif %}
</div> </div>
</div> </div>
{% if distribution_from_teachers %} <div class="content-2">
<div class="cards"> <div class="new-students">
<div class="card"> <div class="title">
<div class="box"> Top Performing States
<h1>2194</h1>
<h3>Government</h3>
</div>
<div class="icon-case">
<img src="{{ url_for('static', filename='img/students.png') }}" alt="">
</div> </div>
<table>
<tr>
<th>Rank</th>
<th>Name</th>
</tr>
<tr>
<td>1</td>
<td>{% print(teachers_by_category_summary['top3'][0]) %}</td>
</tr>
<tr>
<td>2</td>
<td>{% print(teachers_by_category_summary['top3'][1]) %}</td>
</tr>
<tr>
<td>3</td>
<td>{% print(teachers_by_category_summary['top3'][2]) %}</td>
</tr>
</table>
</div> </div>
<div class="card"> <div class="new-students">
<div class="box"> <div class="title">
<h1>53</h1> Worst Performing States
<h3>Private</h3>
</div>
<div class="icon-case">
<img src="{{ url_for('static', filename='img/teachers.png') }}" alt="">
</div> </div>
<table>
<tr>
<th>Rank</th>
<th>Name</th>
</tr>
<tr>
<td>1</td>
<td>{% print(teachers_by_category_summary['bottom3'][0]) %}</td>
</tr>
<tr>
<td>2</td>
<td>{% print(teachers_by_category_summary['bottom3'][1]) %}</td>
</tr>
<tr>
<td>3</td>
<td>{% print(teachers_by_category_summary['bottom3'][2]) %}</td>
</tr>
</table>
</div> </div>
<div class="card"> </div>
<div class="box">
<h1>5</h1> <div class="content-2">
<h3>Others</h3> <div class="new-students">
<div class="title">
Distribution across states of Teachers by Educational Qualification: {% print(teachers_qualification) %}
</div> </div>
<div class="icon-case"> <form method="POST" action="/get_distribution_for_teachers_by_educational_qualification">
<img src="{{ url_for('static', filename='img/schools.png') }}" alt=""> Select Year:
<select name="year" class="year">
<option value="2016">2016</option>
<option value="2015">2015</option>
<option value="2014">2014</option>
<option value="2013">2013</option>
<option value="2012">2012</option>
<option value="2011">2011</option>
<option value="2010">2010</option>
<option value="2009">2009</option>
<option value="2008">2008</option>
<option value="2007">2007</option>
<option value="2006">2006</option>
</select>
Select Educational Qualification:
<select name="qualification" class="qualification">
<option value="below_secondary">Below Secondary</option>
<option value="secondary">Secondary</option>
<option value="higher_secondary">Higher Secondary</option>
<option value="graduate">Graduate</option>
<option value="post_graduate">Post Graduate</option>
<option value="mphil_phd">M.Phil / Ph.D</option>
<option value="post_doctorate">Post Doctorate</option>
<option value="no_response">No Response</option>
</select>
<input name="get_distribution_for_teachers_by_educational_qualification" type="submit" value="Submit">
</form>
<div>
<img src="{{ url_for('static', filename=distribution_teachers_by_educational_qualification) }}">
</div> </div>
</div> </div>
</div> </div>
{% else %}
<div class="content-2"> <div class="content-2">
<div class="new-students"> <div class="new-students">
<div class="title"> <div class="title">
...@@ -179,15 +236,15 @@ ...@@ -179,15 +236,15 @@
</tr> </tr>
<tr> <tr>
<td>1</td> <td>1</td>
<td>Maharashtra</td> <td>{% print(teachers_by_educational_qualification_summary['top3'][0]) %}</td>
</tr> </tr>
<tr> <tr>
<td>2</td> <td>2</td>
<td>Gujarat</td> <td>{% print(teachers_by_educational_qualification_summary['top3'][1]) %}</td>
</tr> </tr>
<tr> <tr>
<td>3</td> <td>3</td>
<td>Karnataka</td> <td>{% print(teachers_by_educational_qualification_summary['top3'][2]) %}</td>
</tr> </tr>
</table> </table>
</div> </div>
...@@ -202,20 +259,19 @@ ...@@ -202,20 +259,19 @@
</tr> </tr>
<tr> <tr>
<td>1</td> <td>1</td>
<td>West Bengal</td> <td>{% print(teachers_by_educational_qualification_summary['bottom3'][0]) %}</td>
</tr> </tr>
<tr> <tr>
<td>2</td> <td>2</td>
<td>Orissa</td> <td>{% print(teachers_by_educational_qualification_summary['bottom3'][1]) %}</td>
</tr> </tr>
<tr> <tr>
<td>3</td> <td>3</td>
<td>Bihar</td> <td>{% print(teachers_by_educational_qualification_summary['bottom3'][2]) %}</td>
</tr> </tr>
</table> </table>
</div> </div>
</div> </div>
{% endif %}
</div> </div>
</div> </div>
</body> </body>
......
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