Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

Feedback #1

Open
wants to merge 2 commits into
base: feedback
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added 533_proj_briefing.pdf
Binary file not shown.
Binary file added 553_Project_Proposal.pdf
Binary file not shown.
97 changes: 97 additions & 0 deletions DLAdvisor/Analyzer/Advisor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
from DLAdvisor.ProfileBuilder import Collector
from DLAdvisor.Analyzer import Resource

def advice(stage) :
prepRes = populatePrepResources(stage)
OLRes = populateOLResources(stage)
if (stage == 1) :
objective = "pass the ICBC Knowledge Test"
elif (stage == 2) :
objective = "pass the ICBC Road Test 7"
elif (stage == 3) :
objective = "pass the ICBC Road Test 5"
else :
objective = "apply exchanging for your license from Reciprocal countries"

print(f'Your next step should be : {objective}' )
print(f'The following resources are suggested to achieve your above goals.\n##########')
prepRes.display()
print("")
OLRes.display()
print("########")

def populatePrepResources(stage):

res1 = [
['Knowledge Test Info','https://www.icbc.com/driver-licensing/new-drivers/Pages/Get-your-L.aspx'],
['Practice Knowledge Test', 'https://www.icbc.com/driver-licensing/new-drivers/Pages/practice-knowledge-test.aspx'],
['Download ICBC Apps for iOS','https://apps.apple.com/ca/app/icbc-practice-knowledge-test/id438491857'],
['Download ICBC Apps for Android','https://play.google.com/store/apps/details?id=com.icbc.knowledge'],
['Learn to Drive Smart', 'https://www.icbc.com/driver-licensing/driving-guides/Pages/Learn-to-Drive-Smart.aspx']
]

res2 = [
['RoadTest 7 Info','https://www.icbc.com/driver-licensing/new-drivers/Pages/Get-your-N.aspx'],
['Learn to Drive Smart', 'https://www.icbc.com/driver-licensing/driving-guides/Pages/Learn-to-Drive-Smart.aspx'],
['Kelowna Best Driving School','https://threebestrated.ca/driving-schools-in-kelowna-bc'],
['BC Driving Tips','https://www.youtube.com/watch?v=UohMY0CT_V8']
]

res3 = [
['RoadTest 5 Info','https://www.icbc.com/driver-licensing/new-drivers/Pages/Get-your-full-licence.aspx'],
['Learn to Drive Smart', 'https://www.icbc.com/driver-licensing/driving-guides/Pages/Learn-to-Drive-Smart.aspx'],
['Kelowna Best Driving School','https://threebestrated.ca/driving-schools-in-kelowna-bc'],
['BC Driving Tips','https://www.youtube.com/watch?v=UohMY0CT_V8']
]

res4 = [
['Reciprocal License Info','https://www.icbc.com/driver-licensing/moving-bc/Pages/Moving-from-another-country.aspx'],
['BC Driving Tips','https://www.youtube.com/watch?v=UohMY0CT_V8']
]

if (stage == 1) :
res = res1
elif (stage == 2) :
res = res2
elif (stage == 3) :
res = res3
else :
res = res4

return Resource.PrepResource(stage,res)


## Populate Online Resources (e.g. icbc application links to apply knowledge test/road test/reciprocal license exchange, knowledge test registration links, driving school registration link, etc)

def populateOLResources(stage):

res1 = [
['Book a ICBC Knowledge Test','https://onlinebusiness.icbc.com/qmaticwebbooking/#/'],
['ICBC Office Locator','https://www.icbc.com/locators/Pages/default.aspx?type=1&subtype=0']
]

res2 = [
['Book a Road Test 7','https://onlinebusiness.icbc.com/webdeas-ui/home'],
['ICBC Office Locator','https://www.icbc.com/locators/Pages/default.aspx?type=1&subtype=0']
]

res3 = [
['Book a Road Test 5','https://onlinebusiness.icbc.com/webdeas-ui/home'],
['ICBC Office Locator','https://www.icbc.com/locators/Pages/default.aspx?type=1&subtype=0']
]

res4 = [
['Book a ICBC License Exchange Appointment','https://onlinebusiness.icbc.com/qmaticwebbooking/#/'],
['ICBC Office Locator','https://www.icbc.com/locators/Pages/default.aspx?type=1&subtype=0']
]

if (stage == 1) :
res = res1
elif (stage == 2) :
res = res2
elif (stage == 3) :
res = res3
else :
res = res4

return Resource.OLResource(stage,res)
48 changes: 48 additions & 0 deletions DLAdvisor/Analyzer/Resource.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
class Resource:

def __init__(self,stage,resources):
self.stage = stage
self.resources = resources

def display(self):
print("Resouces List : ")
for r in self.resources :
print('- ' + r[0] + ' [' +
self.checkResourceType(r[1]) +
'] : ' + r[1])

def checkResourceType(self,resourceslink) :
if ("youtube.com" in resourceslink) :
return "YOUTUBE"
elif ("icbc.com" in resourceslink) :
return "ICBC Official"
elif (".pdf" in resourceslink) :
return "PDF"
else :
return "MISC"

#################

class PrepResource(Resource) :

def __init__(self,stage,resources):
Resource.__init__(self,stage,resources)
self.category = "P"

def display(self):
print("Resource Category : Preparatory Resources")
Resource.display(self)


##################

class OLResource(Resource) :

def __init__(self,stage,resources):
Resource.__init__(self,stage,resources)
self.category = "O"

def display(self):
print("Resource Category : Online Services Resources")
Resource.display(self)

Empty file added DLAdvisor/Analyzer/__init__.py
Empty file.
31 changes: 31 additions & 0 deletions DLAdvisor/Main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from DLAdvisor.ProfileBuilder import Collector, UserProfile
from DLAdvisor.Analyzer import Advisor
from time import sleep
from tqdm import tqdm

def execute():
Collector.greeting()
# if (!Collector.passBasicEligiblity()) :
# print("Sorry, not eligible! Bye!")
# return
if (not Collector.passBasicEligibility()) :
print("Sorry, you are not eligible!")
return
print("Great! you are eligible to proceed!")

user = Collector.gatherProfile()
user.formatName()
print("Here is your profile summary\n######" + str(user) +
"\n######")

print("Analyzing...")
for i in tqdm(range(5)):
sleep(0.5)

# TODO BY KENNY
# temp set all user.stage = 1, to skip the following line when UserProfile pkg is completed
# user.stage = 1
Advisor.advice(user.stage)



99 changes: 99 additions & 0 deletions DLAdvisor/ProfileBuilder/Collector.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
from .UserProfile import UserProfile
import datetime
from datetime import date

# This fuction will greet the applicant based onthe time of the day
def greeting():
currentTime = datetime.datetime.now()
if currentTime.hour < 12 :
print('Good morning!')
elif 12 <= currentTime.hour < 18 :
print('Good afternoon!')
else:
print('Good evening!')

#Calculate no. of years from current date based on a date input (like, age, driving license yrs, etc.)
def calculateAge(dateEntry):
days_in_year = 365.2425
age = int((date.today() - dateEntry).days / days_in_year)
return age

# This function takes input from user to create profile and check eligibility
# This returns True if eligible for license
def passBasicEligibility():
global name
global haveICBCLicense
global wantToExchange
global reciprocal
global stage
global knowledgeTest

try:
wantToExchange="No"
reciprocal="No"
bcres = input("Are you a BC resident?[Y/N]")#BC resident
if (bcres == "N") :
print("Only BC residents are eligible to get a BC Driving License")
return False
name = input("What is your full name?")# Full Name
dob = input("Enter your date of birth?[DD/MM/YYYY]") #Date of birth
birthday_list = dob.split("/")
day=int(birthday_list[0])
month=int(birthday_list[1])
year=int(birthday_list[2])
age = calculateAge(date(year, month, day)) #applicant age
if (age < 16) :
print("Your age is",age,"which is below 16 yrs, so you are not eligible for BC Driving license")
return False

#defines the stages
#1=No ICBC driving license (Opt for Learner's License)
#2=Learner's to Novice (Opt for Novice License)
#3=Novice to Full License (Opt for Full License)
#4=Exchanage license (Opt for Exchange)

haveICBCLicense = int(input("Which ICBC driver licence you have? [Enter 0 for None, 1 for Learners, 2 for Novice]"))
if haveICBCLicense == 0:
wantToExchange =input("Do you want to exchange your other licence? [Yes/No]")
if wantToExchange == "Yes":
reciprocal = input("Is your license from a reciprocal country? [Yes/No]")
if reciprocal == "Yes":
stage = 4
else:
knowledgeTest =input("Did you pass ICBC Knowledge Test? [Yes/No]")
if knowledgeTest == "Yes":
stage = 3
else:
stage = 1
else:
#reciprocal = input("Is your license from a reciprocal country? [Yes/No]")
stage = 1
elif haveICBCLicense == 1:
stage = 2
else:
stage = 3

#country = input("Where are you from? Canada/Your Country Name/Others")# Full Name
#haveDriveLic = input("Do you have a driving license from your country? [Yes/No]")# Have exiting license?
#if haveDriveLic == "Yes":
# drivingLicDate=input("Driving license date [DD/MM/YYYY]:")# country type
# driveDate = drivingLicDate.split("/")
# day=int(driveDate[0])
# month=int(driveDate[1])
# year=int(driveDate[2])
# drivingYears = calculateAge(date(year, month, day)) #driving years
#else:
# drivingYears = 0 #driving years
return True
except:
print("An exception occurred")

# After taking input from user in passBasicEligibility() it then constructs the UserProfile object
# call class modeule in the same pkg
# Return UserProfile object
def gatherProfile():
profile = UserProfile(name,haveICBCLicense,wantToExchange,reciprocal,stage)
#print(profile)
#UserProfile(self,name,current_icbc_lic,is_dl_exchange,is_recip_country,stage)
return profile

36 changes: 36 additions & 0 deletions DLAdvisor/ProfileBuilder/UserProfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
class UserProfile:

def __init__(self,name,current_icbc_lic,is_dl_exchange,is_recip_country,stage):
self.name = name
# 0 : None; 1 : Learner's; 2 : Novice
self.current_icbc_lic = current_icbc_lic
self.is_dl_exchange = is_dl_exchange
self.is_recip_country = is_recip_country
self.stage = stage

def __str__(self):

if (self.current_icbc_lic == 0) :
current_icbc_lic_str = "None"
elif (self.current_icbc_lic == 1) :
current_icbc_lic_str = "Learner's License"
else :
current_icbc_lic_str = "Novice's License"

# TODO : other attributes to be added ....

#is_dl_exchange_val = "Yes" if self.is_dl_exchange else "No"
#if (not self.is_dl_exchange) :
# is_recip_country_val = 'N/A'
#elif (self.is_recip_country) :
# is_recip_country_val = 'Yes'
#else :
# is_recip_country_val = 'No'

return f'User Details \nName : {self.name}\nCurrent ICBC License : {current_icbc_lic_str}\nWant to exchange : {self.is_dl_exchange}\nForeign License from Reciprocal Country: {self.is_recip_country}'


def formatName(self) :
self.name = self.name.capitalize()


Empty file.
Loading