Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
adega
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Odair M.
adega
Commits
033c6b82
Commit
033c6b82
authored
7 years ago
by
João Denis Rodrigues
Browse files
Options
Downloads
Patches
Plain Diff
Cache student + merge_dcits
parent
8c119d4c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/script.py
+19
-9
19 additions, 9 deletions
src/script.py
src/student/analysis.py
+7
-11
7 additions, 11 deletions
src/student/analysis.py
src/utils/data.py
+11
-6
11 additions, 6 deletions
src/utils/data.py
with
37 additions
and
26 deletions
src/script.py
+
19
−
9
View file @
033c6b82
...
@@ -67,8 +67,14 @@ def generate_data():
...
@@ -67,8 +67,14 @@ def generate_data():
def
generate_degree_data
(
degree
,
path
):
def
generate_degree_data
(
degree
,
path
):
print
(
"
Fazendo analises do Curso - {}
"
.
format
(
degree
.
name
))
print
(
"
Fazendo analises do Curso - {}
"
.
format
(
degree
.
name
))
average_grad
=
average_graduation
(
degree
)
# media_formandos
average_grad
=
average_graduation
(
degree
)
# media_formandos
dic
=
merge_dicts
(
graph_average_ira
(
degree
),
graph_average_ira_evasion_semester
(
degree
),
graph_average_ira_graduation
(
degree
),
[
'
average_ira
'
,
'
semester_evasion
'
,
'
graduation
'
])
dic
=
merge_dicts
(
[
'
average_ira
'
,
'
semester_evasion
'
,
'
graduation
'
],
graph_average_ira
(
degree
),
graph_average_ira_evasion_semester
(
degree
),
graph_average_ira_graduation
(
degree
)
)
degree_data
=
{
degree_data
=
{
'
time_graduation
'
:
average_time_graduation_degree
(
degree
),
'
time_graduation
'
:
average_time_graduation_degree
(
degree
),
'
graduation_rate
'
:
average_grad
[
0
],
'
graduation_rate
'
:
average_grad
[
0
],
...
@@ -104,11 +110,15 @@ def generate_student_data(degree, path):
...
@@ -104,11 +110,15 @@ def generate_student_data(degree, path):
student_klasses
=
StudentKlass
.
objects
.
filter
(
student
=
student
)
student_klasses
=
StudentKlass
.
objects
.
filter
(
student
=
student
)
amount_courses_semester
=
get_student_courses_completed
(
student_klasses
)
amount_courses_semester
=
get_student_courses_completed
(
student_klasses
)
failures_semester
=
semester_pass_rate
(
student
)
failures_semester
=
semester_pass_rate
(
student
)
# failures_amount_courses_semester = merge_dicts(failures_semester, amount_courses_semester)
failures_amount_courses_semester
=
merge_dicts
(
[
'
reprovacoes
'
,
'
cursadas
'
],
failures_semester
,
amount_courses_semester
,
)
ira_courses
=
sorted
(
ira_amount_courses
(
student
).
items
())
ira_courses
=
sorted
(
ira_amount_courses
(
student
).
items
())
pass_rate
=
pass_rate
(
student_klasses
)
pass_rate
=
calculate_
pass_rate
(
student_klasses
)
pass_rate_semester
=
sorted
(
failures_semester
.
items
())
pass_rate_semester
=
sorted
(
failures_
amount_courses_
semester
.
items
())
position
=
sorted
(
get_student_position
(
student
).
items
())
position
=
sorted
(
get_student_position
(
student
).
items
())
real_period
=
get_real_period
(
student
)
real_period
=
get_real_period
(
student
)
intended_period
=
get_intended_period
(
student
)
intended_period
=
get_intended_period
(
student
)
...
@@ -118,12 +128,12 @@ def generate_student_data(degree, path):
...
@@ -118,12 +128,12 @@ def generate_student_data(degree, path):
dict_position
=
{}
dict_position
=
{}
dict_pass
=
{}
dict_pass
=
{}
for
item
,
course_pass
,
pos
in
zip
(
ira_courses
,
pass_rate_semester
,
position
):
for
item
,
course_pass
,
pos
in
zip
(
ira_courses
,
pass_rate_semester
,
position
):
ca
=
list
(
course_pass
)
ca
=
list
(
course_pass
)
i
=
list
(
item
)
i
=
list
(
item
)
p
=
list
(
pos
)
p
=
list
(
pos
)
d_pass
,
d_done
=
a
p
[
1
]
d_pass
,
d_done
=
c
a
[
1
]
date
=
a
p
[
0
].
split
(
'
/
'
)
date
=
c
a
[
0
].
split
(
'
/
'
)
semester_data
=
{}
semester_data
=
{}
data
=
'
{}/{}
'
.
format
(
date
[
0
],
date
[
1
])
data
=
'
{}/{}
'
.
format
(
date
[
0
],
date
[
1
])
...
@@ -157,7 +167,7 @@ def generate_student_data(degree, path):
...
@@ -157,7 +167,7 @@ def generate_student_data(degree, path):
}
}
counter
+=
1
counter
+=
1
with
io
.
open
(
student_path
+
'
/
'
+
student
.
grr
+
'
.json
'
,
'
w
'
,
enco
n
dig
=
'
utf8
'
)
as
output
:
with
io
.
open
(
student_path
+
'
/
'
+
student
.
grr
+
'
.json
'
,
'
w
'
,
encodi
n
g
=
'
utf8
'
)
as
output
:
str_
=
json
.
dumps
(
student_data
,
indent
=
3
,
sort_keys
=
True
,
str_
=
json
.
dumps
(
student_data
,
indent
=
3
,
sort_keys
=
True
,
separators
=
(
'
,
'
,
'
:
'
),
ensure_ascii
=
False
)
separators
=
(
'
,
'
,
'
:
'
),
ensure_ascii
=
False
)
output
.
write
(
to_unicode
(
str_
))
output
.
write
(
to_unicode
(
str_
))
...
@@ -177,7 +187,7 @@ def generate_admission_list_data(degree, path):
...
@@ -177,7 +187,7 @@ def generate_admission_list_data(degree, path):
return
return
def
generate_course_data
(
degree
,
path
):
def
generate_course_data
(
degree
,
path
):
print
(
"
\t
- Fazendo analises das disciplinas
"
)
print
(
"
\t
- Fazendo analises das disciplinas
"
)
return
return
def
generate_course_general_data
(
degree
,
path
):
def
generate_course_general_data
(
degree
,
path
):
...
...
This diff is collapsed.
Click to expand it.
src/student/analysis.py
+
7
−
11
View file @
033c6b82
...
@@ -16,12 +16,11 @@ def pass_amount(student_klasses): # calcular_indice_aprovacao
...
@@ -16,12 +16,11 @@ def pass_amount(student_klasses): # calcular_indice_aprovacao
if
student_klass
.
situation
in
SITUATION_PASS
:
if
student_klass
.
situation
in
SITUATION_PASS
:
amount_pass
+=
1
amount_pass
+=
1
return
-
1
if
amount_courses
==
0
else
amount_pass
return
-
1
if
amount_courses
==
0
else
amount_pass
def
pass_rate
(
student_klasses
):
# indice_aprovacao
def
calculate_
pass_rate
(
student_klasses
):
# indice_aprovacao
amount_pass
=
0
amount_pass
=
0
amout_courses
=
0
amou
n
t_courses
=
0
for
sk
in
student_klasses
:
for
sk
in
student_klasses
:
if
sk
.
situation
in
SITUATIONS_COURSE_COMPLETED
:
if
sk
.
situation
in
SITUATIONS_COURSE_COMPLETED
:
amount_courses
+=
1
amount_courses
+=
1
...
@@ -31,22 +30,19 @@ def pass_rate(student_klasses): # indice_aprovacao
...
@@ -31,22 +30,19 @@ def pass_rate(student_klasses): # indice_aprovacao
def
semester_pass_rate
(
student
):
# calcular_indice_aprovacao_semestral
def
semester_pass_rate
(
student
):
# calcular_indice_aprovacao_semestral
index
=
{}
index
=
{}
amount_semesters
=
student
.
get_time_in_degree
()
amount_semesters
=
student
.
get_time_in_degree
()
year
=
student
.
admission
.
year
year
=
student
.
admission
.
year
semester
=
student
.
admission
.
semester
semester
=
student
.
admission
.
semester
for
i
in
range
(
0
,
amount_semesters
):
for
i
in
range
(
0
,
amount_semesters
):
#semester_student_klass = student.studentklass_set.filter(klass__year = year, klass__semester = semester
#semester_index = pass_amount
semester_index
=
student
.
studentklass_set
.
filter
(
klass__year
=
year
,
klass__semester
=
semester
,
situation__in
=
SITUATION_PASS
).
count
()
semester_index
=
student
.
studentklass_set
.
filter
(
klass__year
=
year
,
klass__semester
=
semester
,
situation__in
=
SITUATION_PASS
).
count
()
if
semester_index
>
0
:
if
semester_index
>
0
:
key
=
"
{}/{}
"
.
format
(
year
,
semester
)
key
=
"
{}/{}
"
.
format
(
year
,
semester
)
index
[
key
]
=
semester_index
index
[
key
]
=
semester_index
semester
=
(
semester
%
2
)
+
1
semester
=
(
semester
%
2
)
+
1
semester
+=
semester
%
2
semester
+=
semester
%
2
return
index
return
index
def
get_student_courses_completed
(
student_klasses
):
def
get_student_courses_completed
(
student_klasses
):
...
@@ -129,7 +125,7 @@ def get_student_position(student):
...
@@ -129,7 +125,7 @@ def get_student_position(student):
positions
=
{
semester
:
value
[
'
position
'
]
/
value
[
'
amount_student
'
]
for
semester
,
value
in
positions
.
items
()}
positions
=
{
semester
:
value
[
'
position
'
]
/
value
[
'
amount_student
'
]
for
semester
,
value
in
positions
.
items
()}
return
position
return
position
s
def
ira_amount_courses
(
student
):
def
ira_amount_courses
(
student
):
ira_semesters
=
get_ira_semester
(
student
)
ira_semesters
=
get_ira_semester
(
student
)
...
@@ -145,15 +141,15 @@ def ira_amount_courses(student):
...
@@ -145,15 +141,15 @@ def ira_amount_courses(student):
def
get_real_period
(
student
,
last_period
=
None
):
def
get_real_period
(
student
,
last_period
=
None
):
if
last_period
is
None
:
if
last_period
is
None
:
last_period
=
student
.
curriculum
.
get_amount_of_semesters
()
last_period
=
student
.
current_
curriculum
.
get_amount_of_semesters
()
real_period
=
0
real_period
=
0
period_completed
=
True
period_completed
=
True
while
period_completed
and
real_period
<=
last_period
:
while
period_completed
and
real_period
<=
last_period
:
real_period
+=
1
real_period
+=
1
courses_period
=
student
.
current_curriculum
.
courses
.
filter
(
coursecurriculum__period
=
real_period
)
courses_passed_period
=
StudentKlass
.
objects
.
filter
(
klass__course__in
=
courses_period
,
student
=
student
,
situation__in
=
SITUATION_CONCLUDED
)
courses_period
=
student
.
current_grade
.
courses
.
filter
(
coursecurriculum__period
=
real_period
)
courses_passed_period
=
courses_period
.
filter
(
klass__studentklass__student
=
student
,
klass__studentkass__situation__in
=
SITUATION_CONCLUDED
)
period_completed
=
len
(
courses_passed_period
)
==
len
(
courses_period
)
period_completed
=
len
(
courses_passed_period
)
==
len
(
courses_period
)
if
real_period
>
last_period
:
if
real_period
>
last_period
:
...
...
This diff is collapsed.
Click to expand it.
src/utils/data.py
+
11
−
6
View file @
033c6b82
...
@@ -23,7 +23,7 @@ SITUATION_CONCLUDED = ( # Situacoes concluidas
...
@@ -23,7 +23,7 @@ SITUATION_CONCLUDED = ( # Situacoes concluidas
)
)
SITUATION_PASS
=
(
# Situacoes aprovacao
SITUATION_PASS
=
(
# Situacoes aprovacao
u
'
Aprovado
'
u
'
Aprovado
'
,
u
'
Aprovado Adiantamento
'
,
u
'
Aprovado Adiantamento
'
,
u
'
Equivalência de Disciplinas
'
,
u
'
Equivalência de Disciplinas
'
,
u
'
Aprovado Conhecimento
'
,
u
'
Aprovado Conhecimento
'
,
...
@@ -90,11 +90,16 @@ SITUATION_FAILURE_COMPLETED = ( # Situacoes reprovacao cursada ate o fim
...
@@ -90,11 +90,16 @@ SITUATION_FAILURE_COMPLETED = ( # Situacoes reprovacao cursada ate o fim
def
difference_between_semesters
(
year_start
,
semester_start
,
year_end
,
semester_end
):
def
difference_between_semesters
(
year_start
,
semester_start
,
year_end
,
semester_end
):
return
2
*
(
year_end
-
year_start
)
+
(
semester_end
-
semester_start
)
+
1
return
2
*
(
year_end
-
year_start
)
+
(
semester_end
-
semester_start
)
+
1
def
merge_dicts
(
dict1
,
dict2
,
dict3
,
key
s
):
def
merge_dicts
(
keys
,
*
arg
s
):
dict_out
=
{}
dict_out
=
{}
for
key
,
value
in
dict1
.
items
():
size
=
len
(
args
)
v2
=
dict2
[
key
]
if
key
in
dict2
else
None
v3
=
dict3
[
key
]
if
key
in
dict3
else
None
for
key
,
value
in
args
[
0
].
items
():
dict_out
[
key
]
=
{
keys
[
0
]:
value
,
keys
[
1
]:
v2
,
keys
[
2
]:
v3
}
values
=
[]
values
.
append
(
value
)
for
i
in
range
(
1
,
size
):
values
.
append
(
args
[
i
][
key
]
if
key
in
args
[
i
]
else
None
)
dict_out
[
key
]
=
{
keys
[
i
]:
values
[
i
]
for
i
in
range
(
0
,
size
)}
return
dict_out
return
dict_out
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment