Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-049
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
2021-049
2021-049
Commits
04aac35c
Commit
04aac35c
authored
Nov 23, 2021
by
Gihan Tharaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass/Fail Prediction & Grade Prediction with Flask API done
parent
9d437dbb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
162 additions
and
12 deletions
+162
-12
BackEnd/WebBackEnd/routes/studper.route.js
BackEnd/WebBackEnd/routes/studper.route.js
+61
-1
WebFrontEnd/smartcoach-frontend/src/Components/Admin/Dashboard.js
...End/smartcoach-frontend/src/Components/Admin/Dashboard.js
+2
-0
WebFrontEnd/smartcoach-frontend/src/Components/Admin/view_progress.js
...smartcoach-frontend/src/Components/Admin/view_progress.js
+99
-11
No files found.
BackEnd/WebBackEnd/routes/studper.route.js
View file @
04aac35c
...
...
@@ -50,8 +50,9 @@ router.route('/student/:id').get((req , res) =>{
.
catch
(
err
=>
res
.
status
(
400
).
json
(
'
Error :
'
+
err
));
});
//--------------------------Flask API Routes-------------------------------
router
.
route
(
'
/predict_quiz_marks
'
).
post
(
async
(
req
,
res
)
=>
{
console
.
log
(
"
called
"
);
console
.
log
(
"
marks route
called
"
);
let
predictDetails
=
{
sex
:
req
.
body
.
sex
,
...
...
@@ -78,7 +79,66 @@ router.route('/predict_quiz_marks').post(async (req ,res) =>{
let
response
=
await
axios
.
post
(
options
.
uri
,
options
.
body
)
console
.
log
(
response
.
data
);
res
.
json
(
response
.
data
)
});
router
.
route
(
'
/predict_pass_fail
'
).
post
(
async
(
req
,
res
)
=>
{
console
.
log
(
"
status route called
"
);
let
predictStatusDetails
=
{
sex
:
req
.
body
.
sex
,
guardian
:
req
.
body
.
guardian
,
studytime
:
req
.
body
.
studytime
,
activities
:
req
.
body
.
activities
,
internet
:
req
.
body
.
internet
,
freetime
:
req
.
body
.
freetime
,
absences
:
req
.
body
.
absences
,
G1
:
req
.
body
.
G1
,
G2
:
req
.
body
.
G2
,
}
console
.
log
(
predictStatusDetails
);
let
options
=
{
uri
:
'
http://localhost:5000/predict_pass_fail
'
,
body
:
JSON
.
stringify
(
predictStatusDetails
),
method
:
'
POST
'
,
headers
:
{
'
Content-Type
'
:
'
application/json
'
}
}
let
response
=
await
axios
.
post
(
options
.
uri
,
options
.
body
)
console
.
log
(
response
.
data
);
res
.
json
(
response
.
data
)
});
router
.
route
(
'
/predict_grade
'
).
post
(
async
(
req
,
res
)
=>
{
console
.
log
(
"
grade route called
"
);
let
predictGradeDetails
=
{
sex
:
req
.
body
.
sex
,
guardian
:
req
.
body
.
guardian
,
studytime
:
req
.
body
.
studytime
,
activities
:
req
.
body
.
activities
,
internet
:
req
.
body
.
internet
,
freetime
:
req
.
body
.
freetime
,
absences
:
req
.
body
.
absences
,
G1
:
req
.
body
.
G1
,
G2
:
req
.
body
.
G2
,
}
console
.
log
(
predictGradeDetails
);
let
options
=
{
uri
:
'
http://localhost:5000/predict_grade
'
,
body
:
JSON
.
stringify
(
predictGradeDetails
),
method
:
'
POST
'
,
headers
:
{
'
Content-Type
'
:
'
application/json
'
}
}
let
response
=
await
axios
.
post
(
options
.
uri
,
options
.
body
)
console
.
log
(
response
.
data
);
res
.
json
(
response
.
data
)
});
module
.
exports
=
router
;
\ No newline at end of file
WebFrontEnd/smartcoach-frontend/src/Components/Admin/Dashboard.js
View file @
04aac35c
...
...
@@ -540,6 +540,8 @@ export default class Dashboard extends Component {
<
Route
path
=
"
/admin/studper/tutor/:id
"
exact
component
=
{
ProgressStudents
}
/
>
<
Route
path
=
"
/admin/studper/student/:id
"
exact
component
=
{
ViewProgress
}
/
>
<
Route
path
=
"
/admin/predict_quiz_marks
"
exact
component
=
{
ViewProgress
}
/
>
<
Route
path
=
"
/admin/predict_pass_fail
"
exact
component
=
{
ViewProgress
}
/
>
<
Route
path
=
"
/admin/predict_grade
"
exact
component
=
{
ViewProgress
}
/
>
<
/div
>
{
/* Footer */
}
...
...
WebFrontEnd/smartcoach-frontend/src/Components/Admin/view_progress.js
View file @
04aac35c
...
...
@@ -11,7 +11,9 @@ export default class ViewProgress extends Component{
this
.
state
=
{
student_details
:
[],
predi_marks
:
''
predi_marks
:
''
,
predi_status
:
''
,
predi_grade
:
''
};
}
...
...
@@ -41,25 +43,73 @@ export default class ViewProgress extends Component{
G2
:
this
.
state
.
student_details
[
0
].
g2
,
}
console
.
log
(
`sex:
${
this
.
state
.
student_details
[
0
].
sex
}
`
);
console
.
log
(
`guardian:
${
this
.
state
.
student_details
[
0
].
guardian
}
`
);
console
.
log
(
`studytime:
${
this
.
state
.
student_details
[
0
].
study_time
}
`
);
console
.
log
(
`activities:
${
this
.
state
.
student_details
[
0
].
activities
}
`
);
console
.
log
(
`internet:
${
this
.
state
.
student_details
[
0
].
internet
}
`
);
console
.
log
(
`freetime:
${
this
.
state
.
student_details
[
0
].
free_time
}
`
);
console
.
log
(
`absences:
${
this
.
state
.
student_details
[
0
].
absences
}
`
);
console
.
log
(
`G1:
${
this
.
state
.
student_details
[
0
].
g1
}
`
);
console
.
log
(
`G2:
${
this
.
state
.
student_details
[
0
].
g2
}
`
);
//
console.log(`sex: ${this.state.student_details[0].sex}`);
//
console.log(`guardian: ${this.state.student_details[0].guardian}`);
//
console.log(`studytime: ${this.state.student_details[0].study_time}`);
//
console.log(`activities: ${this.state.student_details[0].activities}`);
//
console.log(`internet: ${this.state.student_details[0].internet}`);
//
console.log(`freetime: ${this.state.student_details[0].free_time}`);
//
console.log(`absences: ${this.state.student_details[0].absences}`);
//
console.log(`G1: ${this.state.student_details[0].g1}`);
//
console.log(`G2: ${this.state.student_details[0].g2}`);
axios
.
post
(
configs
.
BASE_URL
+
'
/admin/studper/predict_quiz_marks
'
,
predictDetails
)
.
then
(
res
=>
// console.log(res.data)
// console.log(
"Marks :"+
res.data)
this
.
setState
({
predi_marks
:
res
.
data
})
);
}
onSubmitStatusHandler
=
e
=>
{
e
.
preventDefault
();
const
predictStatusDetails
=
{
sex
:
this
.
state
.
student_details
[
0
].
sex
,
guardian
:
this
.
state
.
student_details
[
0
].
guardian
,
studytime
:
this
.
state
.
student_details
[
0
].
study_time
,
activities
:
this
.
state
.
student_details
[
0
].
activities
,
internet
:
this
.
state
.
student_details
[
0
].
internet
,
freetime
:
this
.
state
.
student_details
[
0
].
free_time
,
absences
:
this
.
state
.
student_details
[
0
].
absences
,
G1
:
this
.
state
.
student_details
[
0
].
g1
,
G2
:
this
.
state
.
student_details
[
0
].
g2
,
}
axios
.
post
(
configs
.
BASE_URL
+
'
/admin/studper/predict_pass_fail
'
,
predictStatusDetails
)
.
then
(
res
=>
// console.log("Status :"+res.data.toString())
this
.
setState
({
predi_status
:
res
.
data
.
toString
()
})
);
}
onSubmitGradeHandler
=
e
=>
{
e
.
preventDefault
();
const
predictGradeDetails
=
{
sex
:
this
.
state
.
student_details
[
0
].
sex
,
guardian
:
this
.
state
.
student_details
[
0
].
guardian
,
studytime
:
this
.
state
.
student_details
[
0
].
study_time
,
activities
:
this
.
state
.
student_details
[
0
].
activities
,
internet
:
this
.
state
.
student_details
[
0
].
internet
,
freetime
:
this
.
state
.
student_details
[
0
].
free_time
,
absences
:
this
.
state
.
student_details
[
0
].
absences
,
G1
:
this
.
state
.
student_details
[
0
].
g1
,
G2
:
this
.
state
.
student_details
[
0
].
g2
,
}
axios
.
post
(
configs
.
BASE_URL
+
'
/admin/studper/predict_grade
'
,
predictGradeDetails
)
.
then
(
res
=>
// console.log("Grade :"+res.data)
this
.
setState
({
predi_grade
:
res
.
data
})
);
}
render
()
{
return
(
<
div
>
...
...
@@ -214,12 +264,50 @@ export default class ViewProgress extends Component{
<
form
onSubmit
=
{
this
.
onSubmitHandler
}
>
<
Button
type
=
"
submit
"
>
Predict
Marks
of
Next
Test
<
/Button
>
<
/form
>
<
form
onSubmit
=
{
this
.
onSubmitStatusHandler
}
style
=
{{
marginTop
:
"
10px
"
}}
>
<
Button
type
=
"
submit
"
>
Predict
Status
of
Student
<
/Button
>
<
/form
>
<
form
onSubmit
=
{
this
.
onSubmitGradeHandler
}
style
=
{{
marginTop
:
"
10px
"
}}
>
<
Button
type
=
"
submit
"
>
Predict
Grade
of
the
Student
<
/Button
>
<
/form
>
<
/div
>
:
''
}
<
/div
>
{
this
.
state
.
predi_status
==
''
?
''
:
<
div
className
=
"
col-md-12 col-lg-4
"
>
<
div
className
=
"
card-shadow-success mb-3 widget-chart widget-chart2 text-left card
"
>
<
div
className
=
"
widget-content
"
>
<
div
className
=
"
widget-content-outer
"
>
<
div
className
=
"
widget-content-left fsize-1
"
>
<
div
className
=
"
text-muted opacity-6
"
style
=
{{
fontWeight
:
"
bold
"
}}
>
Predicted
Status
of
Student
:
{
this
.
state
.
predi_status
==
1
?
"
Pass
"
:
"
Fail
"
}
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
}
{
this
.
state
.
predi_grade
==
''
?
''
:
<
div
className
=
"
col-md-12 col-lg-4
"
>
<
div
className
=
"
card-shadow-success mb-3 widget-chart widget-chart2 text-left card
"
>
<
div
className
=
"
widget-content
"
>
<
div
className
=
"
widget-content-outer
"
>
<
div
className
=
"
widget-content-left fsize-1
"
>
<
div
className
=
"
text-muted opacity-6
"
style
=
{{
fontWeight
:
"
bold
"
}}
>
Predicted
Grade
of
the
Student
:
{
this
.
state
.
predi_grade
}
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
}
<
/div
>
);
})}
...
...
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