Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2020-101
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sachith Fernando
2020-101
Commits
befed521
Commit
befed521
authored
Jan 06, 2021
by
LiniEisha
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'QA_RELEASE' into IT17100908_Lecture_Summarizing
parents
7344a4b5
508f6c16
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
194 additions
and
38 deletions
+194
-38
FirstApp/api.py
FirstApp/api.py
+77
-0
FirstApp/logic/batch_process.py
FirstApp/logic/batch_process.py
+51
-8
FirstApp/templates/FirstApp/Home.html
FirstApp/templates/FirstApp/Home.html
+1
-1
FirstApp/templates/FirstApp/activity.html
FirstApp/templates/FirstApp/activity.html
+62
-29
FirstApp/urls.py
FirstApp/urls.py
+3
-0
No files found.
FirstApp/api.py
View file @
befed521
...
@@ -1570,3 +1570,80 @@ class TestRandom(APIView):
...
@@ -1570,3 +1570,80 @@ class TestRandom(APIView):
"response"
:
random
"response"
:
random
})
})
# this API will display the upcoming lectures for the lecturer (temporary API)
class
DisplayUpcomingLecturesAPI
(
APIView
):
def
get
(
self
,
request
):
lecturer
=
request
.
query_params
.
get
(
'lecturer'
)
lecturer
=
int
(
lecturer
)
cur_date
=
datetime
.
datetime
.
now
()
.
date
()
cur_time
=
datetime
.
datetime
.
now
()
.
time
()
eligible_start_time
=
''
eligible_end_time
=
''
subject_id
=
0
subject_name
=
''
subject_code
=
''
# retrieve the faculty timetable
faculty_timetable
=
FacultyTimetable
.
objects
.
all
()
# serialize the timetable
faculty_timetable_serialized
=
FacultyTimetableSerializer
(
faculty_timetable
,
many
=
True
)
# get the serialized timetable data
faculty_timetable_serialized_data
=
faculty_timetable_serialized
.
data
# iterate through the serialized timetable data
for
timetable
in
faculty_timetable_serialized_data
:
# get the 'timetable' field
daily_timetable
=
timetable
[
'timetable'
]
# iterate through the 'timetable' field
for
day_timetable
in
daily_timetable
:
# get the 'time_slots' field for a given day
time_slots
=
day_timetable
[
'time_slots'
]
# iterate through the time slots
for
time_slot
in
time_slots
:
# if the lecturer is the currently logged in lecturer
if
lecturer
==
time_slot
[
'lecturer'
][
'id'
]:
# find the upcoming lecture for the logged-in lecturer
if
cur_date
==
day_timetable
[
'date'
]:
# get the start and end times
start_time
=
time_slot
[
'start_time'
]
end_time
=
time_slot
[
'end_time'
]
start_time_list
=
str
(
start_time
)
.
split
(
":"
)
start_time_date
=
datetime
.
datetime
.
now
()
.
replace
(
hour
=
int
(
start_time_list
[
0
]),
minute
=
int
(
start_time_list
[
1
]),
second
=
int
(
start_time_list
[
2
]))
end_time_list
=
str
(
end_time
)
.
split
(
":"
)
end_time_date
=
datetime
.
datetime
.
now
()
.
replace
(
hour
=
int
(
end_time_list
[
0
]),
minute
=
int
(
end_time_list
[
1
]),
second
=
int
(
end_time_list
[
2
]))
# check for the upcoming time slot
if
(
start_time_date
.
time
()
>
cur_time
):
eligible_start_time
=
start_time_date
.
time
()
eligible_end_time
=
end_time_date
.
time
()
subject_id
=
time_slot
[
'subject'
][
'id'
]
subject_name
=
time_slot
[
'subject'
][
'name'
]
subject_code
=
time_slot
[
'subject'
][
'subject_code'
]
return
Response
({
"start_time"
:
eligible_start_time
,
"end_time"
:
eligible_end_time
,
"subject_id"
:
subject_id
,
"subject_name"
:
subject_name
,
"subject_code"
:
subject_code
,
})
FirstApp/logic/batch_process.py
View file @
befed521
import
requests
import
requests
import
json
def
batch_process
(
video_id
,
video_name
):
def
student_behavior_
batch_process
(
video_id
,
video_name
):
is_all_processed
=
False
# call the activity process
# call the activity process
activity_resp
=
requests
.
get
(
'http://127.0.0.1:8000/process-lecture-activity/?lecture_video_name='
+
video_name
+
'&lecture_video_id='
+
video_id
)
activity_resp
=
requests
.
get
(
'http://127.0.0.1:8000/process-lecture-activity/'
,
params
=
{
'lecture_video_name'
:
video_name
,
'lecture_video_id'
:
video_id
})
# if the activity process is success
if
activity_resp
.
json
()[
'response'
]:
# call the emotion process
# call the emotion process
emotion_resp
=
requests
.
get
(
'http://127.0.0.1:8000/process-lecture-emotion/?lecture_video_name='
+
video_name
+
'&lecture_video_id='
+
video_id
)
emotion_resp
=
requests
.
get
(
'http://127.0.0.1:8000/process-lecture-emotion/?lecture_video_name='
,
params
=
{
'lecture_video_name'
:
video_name
,
'lecture_video_id'
:
video_id
})
# if the emotion process is success
if
emotion_resp
.
json
()[
'response'
]:
# call the gaze process
# call the gaze process
gaze_resp
=
requests
.
get
(
'http://127.0.0.1:8000/process-lecture-gaze-estimation/?lecture_video_name='
+
video_name
+
'&lecture_video_id='
+
video_id
)
gaze_resp
=
requests
.
get
(
'http://127.0.0.1:8000/process-lecture-gaze-estimation/?lecture_video_name='
,
params
=
{
'lecture_video_name'
:
video_name
,
'lecture_video_id'
:
video_id
}
)
# if the gaze estimation process is successful
if
gaze_resp
.
json
()[
'response'
]:
is_all_processed
=
True
pass
return
is_all_processed
# this method will save the lecture video
# this method will save the lecture video
def
save_student_lecture_video
(
student_video
):
def
save_student_lecture_video
(
student_video
):
data_dumps
=
json
.
dumps
(
student_video
)
headers
=
{
'Content-Type'
:
'application/json'
}
# call the API
# call the API
student_video_save_resp
=
requests
.
post
(
'http://127.0.0.1:8000/lecture-video'
,
student_video
)
# student_video_save_resp = requests.post('http://127.0.0.1:8000/lecture-video', student_video)
\ No newline at end of file
student_video_save_resp
=
requests
.
post
(
url
=
'http://127.0.0.1:8000/lecture-video'
,
data
=
data_dumps
,
headers
=
headers
)
data
=
student_video_save_resp
.
json
()
return
data
[
0
]
if
__name__
==
'__main__'
:
# content = {
# "lecturer": 1,
# "subject": 16,
# "date": "2020-12-09",
# "video_name": "Video_test_19.mp4",
# "video_length": "00:45:06"
# }
#
#
# data_dumps = json.dumps(content)
# data_json = json.loads(data_dumps)
#
#
# save_student_lecture_video(content)
student_behavior_batch_process
(
8
,
"Video_test_8.mp4"
)
FirstApp/templates/FirstApp/Home.html
View file @
befed521
...
@@ -2687,7 +2687,7 @@
...
@@ -2687,7 +2687,7 @@
</button>
</button>
</div>
</div>
<div
class=
"modal-body text-center"
>
<div
class=
"modal-body text-center"
>
<h3
class=
"font-weight-bold"
>
Student Activity vs. Student
Emotions
</h3>
<h3
class=
"font-weight-bold"
>
Student Activity vs. Student
Gaze
</h3>
<!-- ajax loader -->
<!-- ajax loader -->
<div
class=
"text-center"
id=
"student_activity_gaze_corr_loader"
hidden
>
<div
class=
"text-center"
id=
"student_activity_gaze_corr_loader"
hidden
>
...
...
FirstApp/templates/FirstApp/activity.html
View file @
befed521
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
var
lecturer_fps
=
0
;
var
lecturer_fps
=
0
;
var
lecture_activity_frame_group_percentages
=
{};
var
lecture_activity_frame_group_percentages
=
{};
var
lecture_video_time_landmarks
=
[];
var
lecture_video_time_landmarks
=
[];
var
CHART
=
''
;
//jquery
//jquery
...
@@ -47,6 +48,10 @@
...
@@ -47,6 +48,10 @@
//disable the 'integrate_activity' button
//disable the 'integrate_activity' button
$
(
'
#integrate_activity
'
).
hide
();
$
(
'
#integrate_activity
'
).
hide
();
//hide the 'Generate Report' button
{
#
$
(
'
#generate_report_before
'
).
hide
();
#
}
$
(
'
#generate_report
'
).
hide
();
//select a particular subject
//select a particular subject
$
(
'
input[type=radio]
'
).
click
(
function
()
{
$
(
'
input[type=radio]
'
).
click
(
function
()
{
let
subject_id
=
$
(
this
).
attr
(
'
id
'
);
let
subject_id
=
$
(
this
).
attr
(
'
id
'
);
...
@@ -582,8 +587,6 @@
...
@@ -582,8 +587,6 @@
let
comment_list
=
response
.
comments
;
let
comment_list
=
response
.
comments
;
//render the chart onto the modal body
//render the chart onto the modal body
renderActivityChart
(
activity_labels
);
renderActivityChart
(
activity_labels
);
}
}
...
@@ -637,7 +640,7 @@
...
@@ -637,7 +640,7 @@
}
}
var
chart
=
new
CanvasJS
.
Chart
(
"
ActivityChartContainer
"
,
{
CHART
=
new
CanvasJS
.
Chart
(
"
ActivityChartContainer
"
,
{
animationEnabled
:
true
,
animationEnabled
:
true
,
theme
:
"
light2
"
,
theme
:
"
light2
"
,
title
:
{
title
:
{
...
@@ -671,7 +674,11 @@
...
@@ -671,7 +674,11 @@
},
},
data
:
data
data
:
data
});
});
chart
.
render
();
{
#
chart
.
render
();
#
}
CHART
.
render
();
//show the 'generate report' button
$
(
'
#generate_report
'
).
show
();
}
}
//this function will generate random colors
//this function will generate random colors
...
@@ -695,6 +702,28 @@
...
@@ -695,6 +702,28 @@
}
}
//this method will handle the 'Generate Report' button
$
(
'
#generate_report
'
).
click
(
function
()
{
let
script
=
"
<script src='https://canvasjs.com/assets/script/canvasjs.min.js'><
\
/script>
"
;
CHART
.
print
();
{
#
var
prtContent
=
document
.
getElementById
(
"
ActivityChartContainer
"
);
#
}
{
#
var
WinPrint
=
window
.
open
(
''
,
''
,
'
left=0,top=0,width=800,height=900,toolbar=0,scrollbars=0,status=0
'
);
#
}
{
#
var
WinPrint
=
window
.
open
(
''
);
#
}
{
#
WinPrint
.
document
.
write
(
prtContent
.
innerHTML
);
#
}
{
#
WinPrint
.
document
.
write
(
script
);
#
}
{
#
WinPrint
.
document
.
write
(
'
<h1>This is Ishan</h1>
'
);
#
}
{
#
WinPrint
.
document
.
close
();
#
}
{
#
WinPrint
.
focus
();
#
}
{
#
WinPrint
.
print
();
#
}
{
#
WinPrint
.
close
();
#
}
});
});
});
</script>
</script>
...
@@ -719,8 +748,12 @@
...
@@ -719,8 +748,12 @@
<!-- Page Heading -->
<!-- Page Heading -->
<div
class=
"d-sm-flex align-items-center justify-content-between mb-4"
>
<div
class=
"d-sm-flex align-items-center justify-content-between mb-4"
>
<h1
class=
"h3 mb-0 text-gray-800"
>
Student Activity Recognition
</h1>
<h1
class=
"h3 mb-0 text-gray-800"
>
Student Activity Recognition
</h1>
{#
<button
type=
"button"
data-target=
"#generateReportModal"
data-toggle=
"modal"
class=
"d-none d-sm-inline-block btn btn-sm btn-primary shadow-sm"
id=
"generate_report_before"
disabled
><i
#
}
<button
type=
"button"
class=
"btn btn-primary"
id=
"generate_report"
>
Generate Report
</button>
{
#
class=
"fas fa-download fa-sm text-white-50"
></i>
Generate Report
</button>
#}
{#
<button
type=
"button"
#
}
{
#
class=
"d-none d-sm-inline-block btn btn-sm btn-primary shadow-sm"
#
}
{
#
id=
"generate_report_before"
><i
#
}
{
#
class=
"fas fa-download fa-sm text-white-50"
></i>
Generate Report#}
{#
</button>
#}
</div>
</div>
...
@@ -947,26 +980,26 @@
...
@@ -947,26 +980,26 @@
<!--card content -->
<!--card content -->
<div
class=
"card shadow mb-4 p-3"
>
<div
class=
"card shadow mb-4 p-3"
>
{#
<!-- Card Header - Dropdown -->
#}
{#
<!-- Card Header - Dropdown -->
#}
{#
<div
class=
"card-header py-3 d-flex flex-row align-items-center justify-content-between"
>
#}
{#
<div
class=
"card-header py-3 d-flex flex-row align-items-center justify-content-between"
>
#}
{#
<h6
class=
"m-0 font-weight-bold text-primary"
>
Student#}
{#
<h6
class=
"m-0 font-weight-bold text-primary"
>
Student#}
{# Activities
</h6>
#}
{# Activities
</h6>
#}
{#
<div
class=
"dropdown no-arrow"
>
#}
{#
<div
class=
"dropdown no-arrow"
>
#}
{#
<a
class=
"dropdown-toggle"
href=
"#"
role=
"button"
#
}
{#
<a
class=
"dropdown-toggle"
href=
"#"
role=
"button"
#
}
{
#
id=
"dropdownMenuLink"
data-toggle=
"dropdown"
#
}
{
#
id=
"dropdownMenuLink"
data-toggle=
"dropdown"
#
}
{
#
aria-haspopup=
"true"
aria-expanded=
"false"
>
#}
{
#
aria-haspopup=
"true"
aria-expanded=
"false"
>
#}
{#
<i
class=
"fas fa-ellipsis-v fa-sm fa-fw text-gray-400"
></i>
#}
{#
<i
class=
"fas fa-ellipsis-v fa-sm fa-fw text-gray-400"
></i>
#}
{#
</a>
#}
{#
</a>
#}
{#
<div
class=
"dropdown-menu dropdown-menu-right shadow animated--fade-in"
#
}
{#
<div
class=
"dropdown-menu dropdown-menu-right shadow animated--fade-in"
#
}
{
#
aria-labelledby=
"dropdownMenuLink"
>
#}
{
#
aria-labelledby=
"dropdownMenuLink"
>
#}
{#
<div
class=
"dropdown-header"
>
Dropdown Header:
</div>
#}
{#
<div
class=
"dropdown-header"
>
Dropdown Header:
</div>
#}
{#
<a
class=
"dropdown-item"
href=
"#"
>
Action
</a>
#}
{#
<a
class=
"dropdown-item"
href=
"#"
>
Action
</a>
#}
{#
<a
class=
"dropdown-item"
href=
"#"
>
Another action
</a>
#}
{#
<a
class=
"dropdown-item"
href=
"#"
>
Another action
</a>
#}
{#
<div
class=
"dropdown-divider"
></div>
#}
{#
<div
class=
"dropdown-divider"
></div>
#}
{#
<a
class=
"dropdown-item"
href=
"#"
>
Something else here
</a>
#}
{#
<a
class=
"dropdown-item"
href=
"#"
>
Something else here
</a>
#}
{#
</div>
#}
{#
</div>
#}
{#
</div>
#}
{#
</div>
#}
{#
</div>
#}
{#
</div>
#}
<!-- Card Body -->
<!-- Card Body -->
<div
class=
"card-body"
>
<div
class=
"card-body"
>
...
...
FirstApp/urls.py
View file @
befed521
...
@@ -192,6 +192,9 @@ urlpatterns = [
...
@@ -192,6 +192,9 @@ urlpatterns = [
# perform random task (delete later)
# perform random task (delete later)
url
(
r'^get-random-number/$'
,
api
.
TestRandom
.
as_view
()),
url
(
r'^get-random-number/$'
,
api
.
TestRandom
.
as_view
()),
# perform random task (delete later)
url
(
r'^display-upcoming-lectures/$'
,
api
.
DisplayUpcomingLecturesAPI
.
as_view
()),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment