Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
21_22-J 31
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
3
Merge Requests
3
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
21_22-J 31
21_22-J 31
Commits
f9f1b865
Commit
f9f1b865
authored
May 01, 2022
by
chalaka78
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
service charge prediction completed
parent
9c42be55
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
339 additions
and
94 deletions
+339
-94
Data/MaintainData.csv
Data/MaintainData.csv
+274
-0
User/views.py
User/views.py
+19
-38
db.sqlite3
db.sqlite3
+0
-0
templates/Admin/MaintainData.html
templates/Admin/MaintainData.html
+26
-42
templates/Admin/NextMaintain.html
templates/Admin/NextMaintain.html
+20
-14
No files found.
Data/MaintainData.csv
View file @
f9f1b865
This diff is collapsed.
Click to expand it.
User/views.py
View file @
f9f1b865
...
...
@@ -912,33 +912,24 @@ def NextMaintain(request):
# message_count = int(parts[0])
# print(message_count)
# ARIMA SECTION
# inputdate = '12/01/2020'
# HERE I USE AN EXMAMPLE FROM MATPLOTLIB SITE
# Data for plotting
# t = np.arange(0.0, 2.0, 0.01)
# s = 1 + np.sin(2 * np.pi * t)
import
numpy
as
np
import
matplotlib.pyplot
as
plt
#ARIMA SECTION
df2
=
pd
.
read_csv
(
'Data/MaintainData.csv'
)
df2
=
df2
[(
df2
[
"Customer"
]
==
customerid
)]
df2
=
df2
[(
df2
[
"Service"
]
==
ServiceType
)]
df
=
df2
[(
df2
[
"VehicleNumber"
]
==
Vnumber
)]
#df.drop('Service','ServiceName','TakenTime','Customer','VehicleType','VehicleMake','VehicleModel','VehicleNumber','MeterReading','VehicleManufacturedYear','AvergeUsage','mailID', axis=1, inplace=True)
df
=
df
.
drop
(
columns
=
[
'Service'
,
'ServiceName'
,
'TakenTime'
,
'Customer'
,
'VehicleType'
,
'VehicleMake'
,
'VehicleModel'
,
'VehicleNumber'
,
'MeterReading'
,
'VehicleManufacturedYear'
,
'AvergeUsage'
,
'mailID'
,
])
# df.drop('Service','ServiceName','TakenTime','Customer','VehicleType','VehicleMake','VehicleModel','VehicleNumber','MeterReading','VehicleManufacturedYear','AvergeUsage','mailID', axis=1, inplace=True)
df
=
df
.
drop
(
columns
=
[
'Service'
,
'ServiceName'
,
'TakenTime'
,
'Customer'
,
'VehicleType'
,
'VehicleMake'
,
'VehicleModel'
,
'VehicleNumber'
,
'MeterReading'
,
'VehicleManufacturedYear'
,
'AvergeUsage'
,
'mailID'
,
])
df
.
head
()
## Cleaning up the data
df
.
columns
=
[
"Date"
,
"Price"
]
rrr
=
df
.
head
()
## Drop last 2 rows
#df.drop(106, axis=0, inplace=True)
#df.tail()
#
df.drop(106, axis=0, inplace=True)
#
df.tail()
# df.drop(105, axis=0, inplace=True)
# df.tail()
...
...
@@ -996,26 +987,23 @@ def NextMaintain(request):
future_df
=
pd
.
concat
([
df
,
future_datest_df
])
print
(
future_df
)
Datefinding
=
int
(
df
.
shape
[
1
]
+
15
)
print
(
Datefinding
)
forecastedPrice
=
future_df
[
'forecast'
]
=
results
.
predict
(
start
=
Datefinding
,
end
=
Datefinding
,
dynamic
=
True
)
print
(
"its Arima output"
)
forecastedPrice
=
(
forecastedPrice
.
to_string
())
print
(
"Arima output - Servport price prediction"
)
forecastedPrice
=
str
(
forecastedPrice
.
to_list
()[
0
])
forecastedPrice
=
int
(
float
(
forecastedPrice
))
forecastedPrice
=
str
(
forecastedPrice
)
print
(
forecastedPrice
)
print
(
forecastedPrice
[
5
:
13
])
else
:
form
=
MyFormServices
()
context
=
{
'form'
:
form
,
'd'
:
"CUSTOMER NOT FOUND"
}
context
=
{
'form'
:
form
,
'd'
:
"CUSTOMER NOT FOUND"
}
return
render
(
request
,
'Admin/NextMaintain.html'
,
context
)
context
=
{
'form'
:
form
,
'd'
:
enddate
,
'forecastedPrice'
:
' Rs '
+
forecastedPrice
[
5
:
13
]
}
context
=
{
'form'
:
form
,
'd'
:
enddate
,
'forecastedPrice'
:
' Rs '
+
forecastedPrice
}
return
render
(
request
,
'Admin/NextMaintain.html'
,
context
)
else
:
...
...
@@ -1027,7 +1015,7 @@ def NextMaintain(request):
def
MaintainData
(
request
):
data1
=
pd
.
read_csv
(
'Data/MaintainData.csv'
)
finalpt
=
data1
.
head
(
10
)
finalpt
=
data1
.
head
(
518
)
json_records
=
finalpt
.
reset_index
()
.
to_json
(
orient
=
'records'
)
arr
=
[]
arr
=
json
.
loads
(
json_records
)
...
...
@@ -1062,10 +1050,3 @@ def AdminHome(request):
db.sqlite3
View file @
f9f1b865
No preview for this file type
templates/Admin/MaintainData.html
View file @
f9f1b865
...
...
@@ -24,7 +24,7 @@
{% endif %}
<div
class=
"card-heading"
>
<h2
class=
"title
"
>
MAINTAINS DATA
</h2>
<h2
class=
"title
mt-3"
style=
"color: #02111f;"
>
MAINTENANCE DATA
</h2>
</div>
...
...
@@ -33,57 +33,41 @@
<div
class=
"card card-body printableArea"
>
<div
class=
"container"
style=
"overflow-x:auto;"
>
Customer Maintains Data
<table
class=
"table table-striped"
>
<thead>
<tr>
<th>
Service Date
</th>
<th>
Service
</th>
<th>
Taken Time
</th>
<th>
Price
</th>
<th>
Customer
</th>
<th>
Vehicle Type
</th>
<th>
Vehicle Make
</th>
<th>
Vehicle Model
</th>
<th>
Vehicle Number
</th>
<th>
Meter Reading
</th>
<th>
Vehicle Manufactured Year
</th>
<th>
Average Usage
</th>
<th>
Service Date
</th>
<th>
Service
</th>
<th>
Taken Time
</th>
<th>
Price
</th>
<th>
Customer
</th>
<th>
Vehicle Type
</th>
<th>
Vehicle Make
</th>
<th>
Vehicle Model
</th>
<th>
Vehicle Number
</th>
<th>
Meter Reading
</th>
<th>
Vehicle Manufactured Year
</th>
<th>
Average Usage
</th>
</tr>
</thead>
<tbody>
{% if d %}
{% for i in d %}
<tr>
<td>
{{i.Date}}
</td>
<td>
{{i.ServiceName}}
</td>
<td>
{{i.TakenTime}}
</td>
<td>
{{i.Price}}
</td>
<td>
{{i.Customer}}
</td>
<td>
{{i.VehicleType}}
</td>
<td>
{{i.VehicleMake}}
</td>
<td>
{{i.VehicleModel}}
</td>
<td>
{{i.VehicleNumber}}
</td>
<td>
{{i.MeterReading}}
</td>
<td>
{{i.VehicleManufacturedYear}}
</td>
<td>
{{i.AverageUsage}}
</td>
<td>
{{i.VehicleType}}
</td>
<td>
{{i.VehicleMake}}
</td>
<td>
{{i.VehicleModel}}
</td>
<td>
{{i.VehicleNumber}}
</td>
<td>
{{i.MeterReading}}
</td>
<td>
{{i.VehicleManufacturedYear}}
</td>
<td>
{{i.AverageUsage}}
</td>
</tr>
{% endfor %}
{% endif %}
...
...
@@ -115,10 +99,10 @@
<div
class=
"card-body"
>
<input
name=
"b_print"
type=
"button"
class=
"btn btn-pri
mary btn-print"
onClick=
"printdiv('div_print');"
value=
" Print
"
>
<input
name=
"b_print"
type=
"button"
class=
"btn btn-pri
nt"
onClick=
"printdiv('div_print');"
value=
" Print "
style=
"background: #02111f;
"
>
</div>
<div
class=
"alert alert-primary
"
role=
"alert"
>
© SMART SERVICE STATION 2022
</div>
<div
class=
"alert alert-primary
fixed-bottom mb-0 text-center"
style=
"background: #747578; border: none; color: white;"
role=
"alert"
>
© SERVPORT 2022
</div>
</div>
...
...
templates/Admin/NextMaintain.html
View file @
f9f1b865
...
...
@@ -15,16 +15,18 @@
<div
style=
"margin-left: 0px;"
class=
"card card-5"
>
<br/><br/>
{% if messages %}
<ul
class=
"messages"
>
<div
class=
"alert alert-danger"
role=
"alert"
>
{% for message in messages %}
<li
{%
if
message
.
tags
%}
class=
" {{ message.tags }} "
{%
endif
%}
>
{{ message }}
</li>
{% if message.tags %} {% endif %} {{ message }}
{% endfor %}
</ul
>
</div
>
{% endif %}
<div
class=
"card-heading"
>
<h2
class=
"title"
>
NEXT MAINTAIN DATE
PREDICTION
</h2>
<h2
class=
"title"
style=
"color:#02111f"
>
NEXT MAINTAIN DATE
PREDICTION
</h2>
</div>
...
...
@@ -40,38 +42,42 @@
</table>
<input
type=
"submit"
value=
"NEXT MAINTAIN DATE"
class=
"btn btn--radius-2 btn
-primary
"
/>
<input
type=
"submit"
value=
"NEXT MAINTAIN DATE"
class=
"btn btn--radius-2 btn
"
style=
"background:#02111f
"
/>
</form>
<br>
{% if d %}
<center>
<div
class=
"alert alert-success"
>
{{ d }}
{{ forecastedPrice }}
Predicted Date:
{{ d }}
<br/>
Approximate Price:
{{ forecastedPrice }}
</div>
</center>
{% endif %}
<br>
</div>
</div>
</div>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</div>
</div>
</div>
<div
class=
"alert alert-primary"
role=
"alert"
>
© SMART SERVICE STATION 2022
</div>
<div
class=
"alert alert-primary fixed-bottom mb-0 text-center"
style=
"background: #747578; border: none; color: white;"
role=
"alert"
>
© SERVPORT 2022
</div>
</div>
{% endblock content %}
...
...
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