Commit cd3579df authored by Odair M.'s avatar Odair M. Committed by Bruno Meyer

Closes adega#151 : analises de taxas da turma ingresso

parent b8f3e12f
......@@ -5,7 +5,7 @@
{% block content %}
<div class="row">
<div class="col-md-12">
<h1>Informações Gerais</h1>
<h1>Informações Gerais - Turma Ingresso</h1>
<table class="table">
<tr>
<td>Ano/Semestre</td>
......@@ -13,23 +13,23 @@
</tr>
<tr>
<td>Quantidade de alunos</td>
<td> NO </td>
<td> {{admission_info.quantidade_alunos}} </td>
</tr>
<tr>
<td>Ira Médio</td>
<td>IRA Médio</td>
<td> {{admission_info.ira|floatformat:2}} &plusmn {{admission_info.std|floatformat:2}} </td>
</tr>
<tr>
<td>Tempo médio de formatura em anos</td>
<td> NO </td>
<td>Tempo médio de formatura em anos <b>atual</b></td>
<td> {{admission_info.formatura_media}} </td>
</tr>
<tr>
<td>Indice de Reprovação</td>
<td> NO </td>
<td>Índice de Reprovação</td>
<td> {{admission_info.taxa_reprovacao|floatformat:2}} </td>
</tr>
<tr>
<td>Indice de Evasão</td>
<td> NO </td>
<td> {{admission_info.taxa_evasao|floatformat:2}} </td>
</tr>
<tr>
<td>Quantidade de Evadidos</td>
......
......@@ -29,7 +29,7 @@
</a>
</td>
<td>{{ti.ira|floatformat:2}} &plusmn {{ti.std|floatformat:2}}</td>
<td> NO </td>
<td> {{ti.quantidade_alunos}} </td>
<td> {{ti.alunos_evadidos}} </td>
<td> {{ti.formatura}} </td>
<td> {{ti.ativos}} </td>
......
......@@ -21,7 +21,7 @@ def detail(request, submission_id, ano, semestre):
if(admission["ano"] == ano and admission["semestre"] == semestre):
admission_info = admission
break
admission_detail = get_admission_detail(
request.session,
degree,
......@@ -32,6 +32,9 @@ def detail(request, submission_id, ano, semestre):
for x in admission_detail:
admission_info[x] = admission_detail[x]
if(admission_info["formatura_media"] == -1):
admission_info["formatura_media"] = "Não há alunos formados nesta turma"
return render(request, 'admission/detail.html',{
"degree": degree,
"admission_info": admission_info,
......
This diff is collapsed.
......@@ -22,11 +22,11 @@ except NameError:
to_unicode = str
student_analysis = None
def build_cache(dataframe,path):
# os.chdir("../src")
def build_cache(dataframe, path):
# os.chdir("../src")
ensure_path_exists(path)
student_analysis = StudentAnalysis(dataframe)
......@@ -34,25 +34,27 @@ def build_cache(dataframe,path):
for cod, df in dataframe.groupby('COD_CURSO'):
path = path + '/'
generate_degree_data(path, df)
generate_student_data(path+'students/',df,student_analysis)
generate_admission_data(path+'admissions/',df)
generate_course_data(path+'courses/' ,dataframe)
generate_cepe_data(path+'/others/',df)
generate_student_data(path + 'students/', df, student_analysis)
generate_admission_data(path + 'admissions/', df)
generate_course_data(path + 'courses/', dataframe)
generate_cepe_data(path + '/others/', df)
def generate_cepe_data(path,df):
def generate_cepe_data(path, df):
cepe_dict = {}
cepe_dict["student_fails_course"] = student_fails_course(df)
cepe_dict["fails_semester"] = fails_semester(df)
cepe_dict["fails_by_freq"] = fails_by_freq(df)
save_json(path+"cepe9615.json", cepe_dict)
save_json(path + "cepe9615.json", cepe_dict)
def generate_degree_data(path, dataframe):
ensure_path_exists(path)
ensure_path_exists(path+'students')
ensure_path_exists(path + 'students')
students = dataframe[['MATR_ALUNO', 'FORMA_EVASAO']].drop_duplicates()
build_degree_json(path,dataframe)
build_degree_json(path, dataframe)
def historico(dataframe):
res = []
......@@ -65,7 +67,8 @@ def historico(dataframe):
def process_semestre(per, df):
ira = df[df.SITUACAO.isin(Situation.SITUATION_AFFECT_IRA)].MEDIA_FINAL.mean()
ira = df[df.SITUACAO.isin(
Situation.SITUATION_AFFECT_IRA)].MEDIA_FINAL.mean()
completas = df[df.SITUACAO.isin(Situation.SITUATION_PASS)].shape[0]
tentativas = df[df.SITUACAO.isin(Situation.SITUATION_COURSED)].shape[0]
......@@ -74,12 +77,11 @@ def process_semestre(per, df):
'ira': ira,
'completas': completas,
'tentativas': tentativas,
'aprovacao': completas/tentativas if tentativas else 0,
'ira_por_quantidade_disciplinas': ira/tentativas if tentativas else 0
'aprovacao': completas / tentativas if tentativas else 0,
'ira_por_quantidade_disciplinas': ira / tentativas if tentativas else 0
}
def generate_student_data(path, dataframe, student_analysis):
student_data = defaultdict(dict)
all_grrs = list(dataframe["MATR_ALUNO"].drop_duplicates())
......@@ -92,37 +94,37 @@ def generate_student_data(path, dataframe, student_analysis):
# that this analysis will have in json
(student_analysis.posicao_turmaIngresso_semestral(),
"posicao_turmaIngresso_semestral"),
"posicao_turmaIngresso_semestral"),
(student_analysis.periodo_real(),
"periodo_real"),
"periodo_real"),
(student_analysis.periodo_pretendido(),
"periodo_pretendido"),
"periodo_pretendido"),
(student_analysis.ira_semestral(),
"ira_semestral"),
"ira_semestral"),
(student_analysis.ira_por_quantidade_disciplinas(),
"ira_por_quantidade_disciplinas"),
"ira_por_quantidade_disciplinas"),
(student_analysis.indice_aprovacao_semestral(),
"indice_aprovacao_semestral"),
"indice_aprovacao_semestral"),
(student_analysis.aluno_turmas(),
"aluno_turmas"),
"aluno_turmas"),
(student_analysis.taxa_aprovacao(),
"taxa_aprovacao"),
"taxa_aprovacao"),
(student_analysis.student_info(),
"student"),
"student"),
]
for x in student_data:
for a in analysis: # Use this to verify
student_data[x][a[1]] = a[0][x] # null fields in analysis
save_json(path+x+".json", student_data[x])
save_json(path + x + ".json", student_data[x])
files_list = [
EvasionForm.EF_ABANDONO,
......@@ -139,16 +141,15 @@ def generate_student_data(path, dataframe, student_analysis):
if(fl in list_situations):
list_content = list_situations[fl]
save_json(path+"list/"+list_name+".json", list_content)
save_json(path + "list/" + list_name + ".json", list_content)
# Falta verificar se alguem nao recebeu algumas analises
#Falta verificar se alguem nao recebeu algumas analises
def generate_student_list(path):
pass
def generate_admission_data(path, df):
listagem = []
......@@ -156,9 +157,8 @@ def generate_admission_data(path, df):
a.build_analysis()
admissions = a.build_cache()
for i in admissions:
save_json(path+i["ano"]+"/"+i["semestre"]+".json", i)
save_json(path + i["ano"] + "/" + i["semestre"] + ".json", i)
evasion_count = a.build_cache_evasion_count()
analises = [
......@@ -167,6 +167,7 @@ def generate_admission_data(path, df):
("ira_per_semester", admission_class_ira_per_semester(df)),
("evasion_per_semester", evasion_per_semester(df)),
("students_per_semester", students_per_semester(df)),
("quantidade_alunos", evasion_count["quantidade_alunos"]),
("abandono", evasion_count["abandono"]),
("ativos", evasion_count["ativos"]),
("formatura", evasion_count["formatura"]),
......@@ -178,8 +179,8 @@ def generate_admission_data(path, df):
for a in analises:
for x in a[1]:
valor = a[1][x]
x = ( str(x[0]), str(x[1]))
turmas[x][ a[0] ] = valor
x = (str(x[0]), str(x[1]))
turmas[x][a[0]] = valor
listagem = []
......@@ -194,19 +195,18 @@ def generate_admission_data(path, df):
listagem.append(resumo_turma)
save_json(path + "lista_turma_ingresso.json", listagem)
save_json(path+"lista_turma_ingresso.json", listagem)
def generate_admission_list(path,df):
def generate_admission_list(path, df):
pass
def generate_course_data(path, df):
course = Course(df)
course.build_analysis()
courses = course.build_general_course()
save_json(path+"disciplinas.json", courses)
save_json(path + "disciplinas.json", courses)
course_list = course.build_course()
for i in course_list:
save_json(path+i["disciplina_codigo"]+".json", i)
save_json(path + i["disciplina_codigo"] + ".json", i)
......@@ -26,11 +26,12 @@ def analyze(submission, debug=True):
print("--- Tempo de CPU: {} ---".format(cpu_time))
print("--- Tempo total: {} ---".format(run_time))
except:
except Exception as e:
if(debug):
print("Error on submission analysis:",ValueError)
print("Error on submission analysis:",e)
submission.set_fail(round(time.clock() - start_time))
submission.set_fail(round(time.clock() - start_time), error_message=str(e))
......
......@@ -37,6 +37,7 @@ class Submission(models.Model):
historico = models.FileField(upload_to=get_path)
matricula = models.FileField(upload_to=get_path)
degree = models.ForeignKey(Degree)
timestamp = models.DateTimeField(default=timezone.now)
......@@ -49,6 +50,8 @@ class Submission(models.Model):
analysis_status = models.IntegerField(default=0, choices=ANALYSIS_STATUS_CHOICES)
last_error = models.CharField(default="", max_length=4096)
relative_year = models.IntegerField(null=True)
relative_semester = models.IntegerField(null=True)
......@@ -91,11 +94,12 @@ class Submission(models.Model):
self.analysis_status = 1
self.save()
def set_fail(self,time):
def set_fail(self,time, error_message):
self.processed = False
self.process_time = time
self.done_in = timezone.now()
self.analysis_status = 2
self.last_error = error_message
self.save()
# @receiver(models.signals.post_save, sender=Submission)
......
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