Commit bc92365b authored by Antoine PIGEAU's avatar Antoine PIGEAU
Browse files

Merge remote-tracking branch 'origin/master' into 2016-2017-Indicators

Conflicts:
	2015-Hubble-UserProfile/statisticManager/userStatistic.py
parents e6482245 91511e65
...@@ -27,6 +27,7 @@ import operator ...@@ -27,6 +27,7 @@ import operator
from _sqlite3 import DatabaseError from _sqlite3 import DatabaseError
from dataManager.databaseManagerData4 import DatabaseManager from dataManager.databaseManagerData4 import DatabaseManager
from scriptDatabaseManager4 import ScriptDatabaseManager from scriptDatabaseManager4 import ScriptDatabaseManager
from setuptools.dist import sequence
class Course: class Course:
''' '''
...@@ -269,6 +270,10 @@ class Course: ...@@ -269,6 +270,10 @@ class Course:
idExercises.append(idExercise) idExercises.append(idExercise)
return idExercises; return idExercises;
def getNumberofExercise(self):
return len(self.getAllExercisesId())
def getSequenceId(self, filterType=[]): def getSequenceId(self, filterType=[]):
''' '''
...@@ -331,5 +336,16 @@ class Course: ...@@ -331,5 +336,16 @@ class Course:
return dictDuration return dictDuration
def isConsecutive(self, currentPart, nextPart):
sequenceWithoutExercise = self.getSequenceId(filterType=[Course.CHAPTER])
for i in range(len(sequenceWithoutExercise)-1):
if (sequenceWithoutExercise[i] == currentPart and
sequenceWithoutExercise[i+1] == nextPart):
return True
return False
def __str__(self): def __str__(self):
return "id:"+str(self.id)+" title:"+self.title+" sequence:"+str(self.sequence) return "id:"+str(self.id)+" title:"+self.title+" sequence:"+str(self.sequence)
\ No newline at end of file
...@@ -807,7 +807,38 @@ class DatabaseManager: ...@@ -807,7 +807,38 @@ class DatabaseManager:
clear the table Result clear the table Result
''' '''
self.removeAllTuples(DatabaseManager.TABLE_RESULT_NAME) self.removeAllTuples(DatabaseManager.TABLE_RESULT_NAME)
def getResultOfUser(self, idUser, idCourse):
'''
retrieve the result of the user idUser
'''
result = None
try:
self.connection.text_factory = str
cursor = self.connection.cursor()
query = ("SELECT r."+DatabaseManager.RESULT_COLUMN_USER_SCORE+
" FROM "+DatabaseManager.TABLE_RESULT_NAME+" r WHERE r."+
DatabaseManager.RESULT_COLUMN_USER_ID+" = \'"+str(idUser)+"\' AND r."+
DatabaseManager.RESULT_COLUMN_COURSE_ID+" = "+str(idCourse))
print str(query)
cursor.execute(query)
rows = cursor.fetchall()
for row in rows:
result = row[0]
except:
print "DatabaseManager - getResultOfUser(idUser, idCourse) error:", sys.exc_info()[0], sys.exc_info()[1]
return result
''' '''
******************************************************************************************* *******************************************************************************************
...@@ -1230,7 +1261,7 @@ class DatabaseManager: ...@@ -1230,7 +1261,7 @@ class DatabaseManager:
def getPremium(self, idCourse): def getPremium(self, idCourse):
''' '''
retrieve all the users that follows a course idCourse as a premium, even the premium isers without a mark retrieve all the users that follows a course idCourse as a premium, even the premium users without a mark
@param idCourse: the id of the course followed @param idCourse: the id of the course followed
...@@ -1264,7 +1295,7 @@ class DatabaseManager: ...@@ -1264,7 +1295,7 @@ class DatabaseManager:
''' '''
retrieve the premium users that take the course courseId and got a mark higher or equal to minScore and strictly lower than maxScore retrieve the premium users that take the course courseId and got a mark higher or equal to minScore and strictly lower than maxScore
The user is considered as a premium for a course if the user is registered as premium if he passed the exam in the interval of Old version : The user is considered as a premium for a course if the user is registered as premium if he passed the exam in the interval of
the premium registration + 15 days: [startedat, endedat + 15 days] the premium registration + 15 days: [startedat, endedat + 15 days]
@return: a list (userId, ...userId) @return: a list (userId, ...userId)
...@@ -1280,9 +1311,11 @@ class DatabaseManager: ...@@ -1280,9 +1311,11 @@ class DatabaseManager:
"SELECT DISTINCT(p.userid) FROM premium p, result r WHERE "+ "SELECT DISTINCT(p.userid) FROM premium p, result r WHERE "+
"p.userid = r.userid AND "+ "p.userid = r.userid AND "+
"r.courseid = "+str(courseId)+" AND "+ "r.courseid = "+str(courseId)+" AND "+
"DATE(r.createdat) BETWEEN DATE(p.startedat) AND DATE(p.endedat, '+15 day') AND r.score >= "+ #"DATE(r.createdat) BETWEEN DATE(p.startedat) AND DATE(p.endedat, '+15 day') AND r.score >= "+
str(DatabaseManager.BOUNDARY_SCORE_FAILED)+" AND r.score < "+str(DatabaseManager.BOUNDARY_SCORE_SUCCEED)) str(DatabaseManager.BOUNDARY_SCORE_FAILED)+" AND r.score < "+str(DatabaseManager.BOUNDARY_SCORE_SUCCEED))
print str(query) print str(query)
cursor.execute(query) cursor.execute(query)
......
...@@ -50,7 +50,7 @@ if __name__ == "__main__": ...@@ -50,7 +50,7 @@ if __name__ == "__main__":
print("start of the process testCheck") print("start of the process testCheck")
startTime = datetime.now() startTime = datetime.now()
course = Course(Course.COURSE_ID_BOOTSTRAP) course = Course(Course.COURSE_ID_ARDUINO)
databaseManager = DatabaseManager() databaseManager = DatabaseManager()
similarity = Similarity() similarity = Similarity()
frequentSequence = FrequentSequenceLaptop() frequentSequence = FrequentSequenceLaptop()
...@@ -67,30 +67,46 @@ if __name__ == "__main__": ...@@ -67,30 +67,46 @@ if __name__ == "__main__":
display a specific sequence display a specific sequence
''' '''
l = sequenceSession.loadSavedSequences(Course.COURSE_ID_ARDUINO) l = sequenceSession.loadSavedSequences(Course.COURSE_ID_ARDUINO)
for (userId, seq) in l: # for (userId, seq) in l:
print(str(seq)) # print(str(seq))
i = 0 i = 0
for (userId, seq) in l : for (userId, seq) in l :
if(userId == 'f4e11762405de6a8491e2516d61dee37'): # d349d66bbba4eb559840b4bb279b2c64 if(userId == 'f4e11762405de6a8491e2516d61dee37'):
#if(len(seq) < 5): # d349d66bbba4eb559840b4bb279b2c64
for item in seq: for item in seq:
print(str(item)) print(str(item))
course = Course(Course.COURSE_ID_ARDUINO)
userStatistic = UserStatistic(Course.COURSE_ID_ARDUINO) userStatistic = UserStatistic(Course.COURSE_ID_ARDUINO)
print(str(dir(userStatistic)))
userStatistic.setUserSequence((userId, seq)) userStatistic.setUserSequence((userId, seq))
print("total duration:"+str(userStatistic.computeTotalDuration())) print("total duration:"+str(userStatistic.getTotalDuration()))
print("computeAverageDurationOnEachPart:"+str(userStatistic.computeAverageDurationOnEachPart(filterType=[Course.CHAPTER]))) print("getAverageDurationOnEachPart:"+str(userStatistic.getAverageDurationOnEachPart(filterType=[Course.CHAPTER])))
print("AverageIndicatorTimeSession:"+str(userStatistic.computeIndicatorInterTimeSession())) print("getIndicatorInterTimeSession:"+str(userStatistic.getIndicatorInterTimeSession()))
print("computeNumberAccessPerPartID:"+str(userStatistic.computeNumberAccessPerPartID(filterType=[Course.CHAPTER]))) print("getNumberAccessPerPartID:"+str(userStatistic.getNumberAccessPerPartID(filterType=[Course.CHAPTER])))
print("computeNumberOfSessions:"+str(userStatistic.computeNumberOfSessions())) print("getNumberOfSessions:"+str(userStatistic.getNumberOfSessions()))
print("All Marks:"+str(userStatistic.getAllMarks())) print("All Marks:"+str(userStatistic.getAllMarks()))
print("percent of course viewed:"+str(userStatistic.computePercentOfCourseViewed(filterTypeP=[Course.CHAPTER]))) print("Number of Marks:"+str(userStatistic.getNumberOfMarks()))
print("computeDurationBeforeEachAssessment:"+str(userStatistic.computeDurationBeforeEachAssessment())) print("percent of course viewed:"+str(userStatistic.getPercentOfCourseViewed(filterTypeP=[Course.CHAPTER])))
print("computeAverageTimeByAccess:"+str(userStatistic.computeAverageTimeByAccess())) print("getDurationBeforeEachAssessment:"+str(userStatistic.getDurationBeforeEachAssessment()))
(average, median, stdDeviation, interTimes) = userStatistic.computeIndicatorInterTimeSession() print("getAverageTimeByAccess:"+str(userStatistic.getAverageTimeByAccess()))
(average, median, stdDeviation, interTimes) = userStatistic.getIndicatorInterTimeSession()
print("inter session time, average/median, stdDeviation:"+str(average)+" "+str(median)+" "+str(stdDeviation)) print("inter session time, average/median, stdDeviation:"+str(average)+" "+str(median)+" "+str(stdDeviation))
print("inter session time, list inter times:"+str(interTimes)) print("inter session time, list inter times:"+str(interTimes))
print("stats session:"+str(userStatistic.getStatsSession()))
print("split list:"+str(userStatistic._UserStatistic__splitBySession()))
print("linearity:"+str(userStatistic.getLinearity()))
print("Course sequence"+str(course.getSequenceId(filterType=[Course.CHAPTER])))
print("Last event after 1 week:"+str(userStatistic.getTimeSinceLastEvent(7)))
print("Last event after 2 weeks:"+str(userStatistic.getTimeSinceLastEvent(14)))
print("Last event after 3 weeks:"+str(userStatistic.getTimeSinceLastEvent(21)))
print("# of events before each quizz:"+str(userStatistic.getNumberOfEventBeforeEachAssessment()))
print("# of sessions before each quizz:"+str(userStatistic.getNumberOfSessionBeforeEachAssessment()))
print("per day number of events, sessions:"+str(userStatistic._UserStatistic__getStatsPerDay()))
print("# of session/event per day before each quizz:"+str(userStatistic.getAverageStatsPerDayBeforeEachAssessment()))
print("\n\n")
else: else:
pass pass
......
...@@ -22,25 +22,31 @@ This file is part of Hubble-UserProfile. ...@@ -22,25 +22,31 @@ This file is part of Hubble-UserProfile.
import sys import sys
from datetime import datetime from datetime import datetime
from statisticManager import scriptTimeBetweenSession from statisticManager import scriptTimeBetweenSession
from statisticManager.userStatistic import UserStatistic
sys.setrecursionlimit(10000) sys.setrecursionlimit(10000)
from dataManager.course import Course from dataManager.course import Course
from dataManager.scriptDatabaseManager4 import ScriptDatabaseManager from dataManager.scriptDatabaseManager4 import ScriptDatabaseManager
from dataManager.databaseManagerData4 import DatabaseManager from dataManager.databaseManagerData4 import DatabaseManager
from sequenceManager.sequenceInterface import SequenceInterface from sequenceManager.sequenceInterface import SequenceInterface
from sequenceManager.sequenceVisualisation import SequenceVisualisation from sequenceManager.sequenceVisualisation import SequenceVisualisation
from sequenceManager.sequenceSession import SequenceSession from sequenceManager.sequenceSession import SequenceSession
from sequenceManager.scriptSequence import ScriptSequence from sequenceManager.scriptSequence import ScriptSequence
from sequenceManager.similarity import Similarity from sequenceManager.similarity import Similarity
from sequenceManager.frequentSequence import FrequentSequenceLaptop
from userManager.userManagerSession import UserManagerSession from userManager.userManagerSession import UserManagerSession
from userManager.userManagerProxy import UserManagerProxy from userManager.userManagerProxy import UserManagerProxy
from statisticManager.plotHistogram import PlotHistogram from statisticManager.plotHistogram import PlotHistogram
from statisticManager.countHistogram import CountHistogram from statisticManager.countHistogram import CountHistogram
from statisticManager.durationHistogram import DurationHistogram from statisticManager.durationHistogram import DurationHistogram
from statisticManager.scriptHistogram import ScriptHistogram from statisticManager.scriptHistogram import ScriptHistogram
from sequenceManager.frequentSequence import FrequentSequenceLaptop
from statisticManager.userDurationCurve import UserDurationCurve from statisticManager.userDurationCurve import UserDurationCurve
from statisticManager.scriptUserDurationCurve import ScriptUserDurationCurve from statisticManager.scriptUserDurationCurve import ScriptUserDurationCurve
from statisticManager.scriptTimeBetweenSession import ScriptTimeBetweenSession from statisticManager.scriptTimeBetweenSession import ScriptTimeBetweenSession
from statisticManager.scriptUserDeviationAveragePoint import ScriptUserDeviationAveragePoint from statisticManager.scriptUserDeviationAveragePoint import ScriptUserDeviationAveragePoint
...@@ -48,7 +54,12 @@ from statisticManager.scriptNumberSessionHistogram import ScriptNumberSessionHis ...@@ -48,7 +54,12 @@ from statisticManager.scriptNumberSessionHistogram import ScriptNumberSessionHis
from statisticManager.scriptSimpleStatistic import ScriptSimpleStatistic from statisticManager.scriptSimpleStatistic import ScriptSimpleStatistic
from statisticManager.scriptFrequentSequenceStatistic import ScriptFrequentSequenceStatistic from statisticManager.scriptFrequentSequenceStatistic import ScriptFrequentSequenceStatistic
from statisticManager.interTimeBoxPlot import InterTimeBoxPlot from statisticManager.interTimeBoxPlot import InterTimeBoxPlot
from statisticManager.scriptInterTimeBoxPlot import ScriptInterTimeBoxPlot
from statisticManager.scriptUserMarksPerQuizBoxPlot import ScriptUserMarkdsPerQuizBoxPlot
from statisticManager.scriptAccessPerSessionBoxPlot import ScriptAccessPerSessionBoxPlot
from statisticManager.scriptDurationOnEachPartBoxPlot import ScriptDurationOnEachPartBoxPlot
from statisticManager.scriptDurationBeforeEachQuizz import ScriptDurationBeforeEachQuizz
from statisticManager.scriptPercentCourseViewed import ScriptPercentCourseViewed
if __name__ == "__main__": if __name__ == "__main__":
...@@ -64,7 +75,7 @@ if __name__ == "__main__": ...@@ -64,7 +75,7 @@ if __name__ == "__main__":
scriptDatabaseManager = ScriptDatabaseManager() scriptDatabaseManager = ScriptDatabaseManager()
sequenceSession = SequenceSession() sequenceSession = SequenceSession()
userManagerSession = UserManagerSession() userManagerSession = UserManagerSession()
userManagerProxy = UserManagerProxy(userManagerSession) userManagerProxySession = UserManagerProxy(userManagerSession)
scriptSequence = ScriptSequence(sequenceSession, frequentSequence, similarity) scriptSequence = ScriptSequence(sequenceSession, frequentSequence, similarity)
sequenceVisualisation = SequenceVisualisation() sequenceVisualisation = SequenceVisualisation()
scriptUserDurationCurve = ScriptUserDurationCurve() scriptUserDurationCurve = ScriptUserDurationCurve()
...@@ -73,10 +84,44 @@ if __name__ == "__main__": ...@@ -73,10 +84,44 @@ if __name__ == "__main__":
scriptNumberSessionHistogram = ScriptNumberSessionHistogram() scriptNumberSessionHistogram = ScriptNumberSessionHistogram()
scriptSimpleStatistic = ScriptSimpleStatistic() scriptSimpleStatistic = ScriptSimpleStatistic()
scriptFrequentSequenceStatistic = ScriptFrequentSequenceStatistic(frequentSequence) scriptFrequentSequenceStatistic = ScriptFrequentSequenceStatistic(frequentSequence)
scriptInterTimeBoxPlot = ScriptInterTimeBoxPlot()
scriptUserMarkdsPerQuizBoxPlot = ScriptUserMarkdsPerQuizBoxPlot()
scriptAccessPerSessionBoxPlot = ScriptAccessPerSessionBoxPlot()
scriptDurationOnEachPartBoxPlot = ScriptDurationOnEachPartBoxPlot()
scriptDurationBeforeEachQuizz = ScriptDurationBeforeEachQuizz()
scriptPercentCourseViewed = ScriptPercentCourseViewed()
scriptSimpleStatistic.generateAllGroup(sequenceSession)
scriptSimpleStatistic.exportLatexSecondTable()
# (idUser, sequence) = sequenceSession.getSequenceUser(Course.COURSE_ID_BOOTSTRAP, 'c05e3a015c60bc29218c81e275ff0d34')
#
# userStatistic.setUserSequence((idUser, sequence))
#
# print("\n\n\nidUser:"+str(idUser))
# print("Marks: "+str(userStatistic.getAllMarks()))
# print("final result: "+str(databaseManager.getResultOfUser(idUser, idCourse)))
# print("number of session: "+str(userStatistic.getNumberOfSessions()))
# print("all exercise of user:"+str(databaseManager.getAllExerciseOfUser(idUser)))
# print("date start: "+str(sequence[0][SequenceInterface.INDEX_STARTDATE]))
#
# print("sequence: "+str(sequence))
#sequenceSession.removeOldUserFromAllCourse()
#scriptUserMarkdsPerQuizBoxPlot.generateAllGroup(sequenceSession)
#scriptNumberSessionHistogram.generateAllGroup(sequenceSession)
#scriptPercentCourseViewed.generateAllGroup(sequenceSession)
#scriptAccessPerSessionBoxPlot.generateAllGroup(sequenceSession)
#scriptDurationOnEachPartBoxPlot.generateAllGroup(sequenceSession)
#scriptInterTimeBoxPlot.generateAllGroup(sequenceSession)
#scriptUserMarkdsPerQuizBoxPlot.generateAllGroup(sequenceSession)
#scriptDurationBeforeEachQuizz.generateAllGroup(sequenceSession)
interTimeBoxPlot = InterTimeBoxPlot(Course.COURSE_ID_ARDUINO, "title") #scriptInterTimeBoxPlot.generateAllGroup(sequenceSession)
interTimeBoxPlot.setData(sequenceSession) #userManagerProxySession.printStats()
interTimeBoxPlot.show()
#scriptSequence.launchTest([5], crossValidation=1) #scriptSequence.launchTest([5], crossValidation=1)
#scriptSequence.launchTest([5], crossValidation=1) #scriptSequence.launchTest([5], crossValidation=1)
#scriptSequence.launchTest([3,4,5,6,7,8,9,10], crossValidation=10) #scriptSequence.launchTest([3,4,5,6,7,8,9,10], crossValidation=10)
......
...@@ -29,31 +29,47 @@ sys.setrecursionlimit(10000) ...@@ -29,31 +29,47 @@ sys.setrecursionlimit(10000)
from dataManager.course import Course from dataManager.course import Course
from dataManager.scriptDatabaseManager4 import ScriptDatabaseManager from dataManager.scriptDatabaseManager4 import ScriptDatabaseManager
from dataManager.databaseManagerData4 import DatabaseManager from dataManager.databaseManagerData4 import DatabaseManager
from sequenceManager.sequenceInterface import SequenceInterface from sequenceManager.sequenceInterface import SequenceInterface
from sequenceManager.sequenceVisualisation import SequenceVisualisation from sequenceManager.sequenceVisualisation import SequenceVisualisation
from sequenceManager.sequenceSession import SequenceSession from sequenceManager.sequenceSession import SequenceSession
from sequenceManager.scriptSequence import ScriptSequence from sequenceManager.scriptSequence import ScriptSequence
from sequenceManager.similarity import Similarity from sequenceManager.similarity import Similarity
from sequenceManager.frequentSequence import FrequentSequenceDesktop
from userManager.userManagerSession import UserManagerSession from userManager.userManagerSession import UserManagerSession
from userManager.userManagerVisualisation import UserManagerVisualisation from userManager.userManagerVisualisation import UserManagerVisualisation
from userManager.userManagerProxy import UserManagerProxy from userManager.userManagerProxy import UserManagerProxy
from statisticManager.plotHistogram import PlotHistogram from statisticManager.plotHistogram import PlotHistogram
from statisticManager.countHistogram import CountHistogram from statisticManager.countHistogram import CountHistogram
from statisticManager.durationHistogram import DurationHistogram from statisticManager.durationHistogram import DurationHistogram
from statisticManager.scriptHistogram import ScriptHistogram from statisticManager.scriptHistogram import ScriptHistogram
from sequenceManager.frequentSequence import FrequentSequenceLaptop
from statisticManager.userDurationCurve import UserDurationCurve from statisticManager.userDurationCurve import UserDurationCurve
from statisticManager.scriptUserDurationCurve import ScriptUserDurationCurve from statisticManager.scriptUserDurationCurve import ScriptUserDurationCurve
from statisticManager.numberSessionHistogram import NumberSessionHistogram
from statisticManager.scriptNumberSessionHistogram import ScriptNumberSessionHistogram from statisticManager.scriptNumberSessionHistogram import ScriptNumberSessionHistogram
from statisticManager import numberSessionHistogram, scriptNumberSessionHistogram
from statisticManager.scriptSimpleStatistic import ScriptSimpleStatistic from statisticManager.scriptSimpleStatistic import ScriptSimpleStatistic
from statisticManager.scriptFrequentSequenceStatistic import ScriptFrequentSequenceStatistic from statisticManager.scriptFrequentSequenceStatistic import ScriptFrequentSequenceStatistic
from statisticManager.scriptMarksCurve import ScriptMarksCurve from statisticManager.scriptMarksCurve import ScriptMarksCurve
from statisticManager.scriptPercentCourseViewed import ScriptPercentCourseViewed from statisticManager.scriptPercentCourseViewed import ScriptPercentCourseViewed
from statisticManager.scriptDurationBeforeEachQuizz import ScriptDurationBeforeEachQuizz from statisticManager.scriptDurationBeforeEachQuizz import ScriptDurationBeforeEachQuizz
from statisticManager.scriptUserDurationBoxPlot import ScriptUserDurationBoxPlot
from statisticManager.scriptUserDeviationAveragePoint import ScriptUserDeviationAveragePoint from statisticManager.scriptUserDeviationAveragePoint import ScriptUserDeviationAveragePoint
from statisticManager.scriptInterTimeBoxPlot import ScriptInterTimeBoxPlot
from statisticManager.scriptDurationOnEachPartBoxPlot import ScriptDurationOnEachPartBoxPlot
from statisticManager.scriptUserMarksPerQuizBoxPlot import ScriptUserMarkdsPerQuizBoxPlot
from statisticManager.scriptAccessPerSessionBoxPlot import ScriptAccessPerSessionBoxPlot
from statisticManager.scriptDurationBeforeEachQuizz import ScriptDurationBeforeEachQuizz
from statisticManager.scriptTotalDurationHistogram import ScriptTotalDurationHistogram
from statisticManager.scriptNumberOfEventBoxPlot import ScriptNumberOfEventBoxPlot
from statisticManager.scriptNumberOfSessionBoxPlot import ScriptNumberOfSessionBoxPlot
from statisticManager.scriptNumberOfAccessOnEachPartBoxPlot import ScriptNumberOfAccessOnEachPartBoxPlot
from statisticManager.scriptLinearityBoxPlot import LinearityBoxPlot, ScriptLinearityBoxPlot
from statisticManager.scriptTimeSinceLastEventBoxPlot import ScriptTimeSinceLastEventBoxPlot
from statisticManager.scriptEventBeforeEachQuizz import ScriptEventBeforeEachQuizz
from statisticManager.scriptSessionBeforeEachQuizz import ScriptSessionBeforeEachQuizz
from statisticManager.scriptSessionPerDayBeforeEachQuizz import ScriptSessionPerDayBeforeEachQuizz
from statisticManager.scriptFinalMarkBoxPlot import ScriptFinalMarkBoxPlot
if __name__ == "__main__": if __name__ == "__main__":
...@@ -62,10 +78,11 @@ if __name__ == "__main__": ...@@ -62,10 +78,11 @@ if __name__ == "__main__":
course = Course(Course.COURSE_ID_BOOTSTRAP) course = Course(Course.COURSE_ID_BOOTSTRAP)
databaseManager = DatabaseManager() databaseManager = DatabaseManager()
similarity = Similarity() similarity = Similarity()
frequentSequence = FrequentSequenceLaptop() frequentSequence = FrequentSequenceDesktop()
scriptDatabaseManager = ScriptDatabaseManager() scriptDatabaseManager = ScriptDatabaseManager()
sequenceSession = SequenceSession() sequenceSession = SequenceSession()
userManagerSession = UserManagerSession() userManagerSession = UserManagerSession()
userManagerProxySession = UserManagerProxy(userManagerSession)
userManagerVisualisation = UserManagerVisualisation() userManagerVisualisation = UserManagerVisualisation()
userManagerProxyVisualisation = UserManagerProxy(userManagerVisualisation) userManagerProxyVisualisation = UserManagerProxy(userManagerVisualisation)
scriptSequence = ScriptSequence(sequenceSession, frequentSequence, similarity) scriptSequence = ScriptSequence(sequenceSession, frequentSequence, similarity)
...@@ -87,12 +104,59 @@ if __name__ == "__main__": ...@@ -87,12 +104,59 @@ if __name__ == "__main__":
scriptFrequentSequenceStatistic = ScriptFrequentSequenceStatistic(frequentSequence) scriptFrequentSequenceStatistic = ScriptFrequentSequenceStatistic(frequentSequence)
scriptPercentCourseViewed = ScriptPercentCourseViewed() scriptPercentCourseViewed = ScriptPercentCourseViewed()
scriptDurationBeforeEachQuizz = ScriptDurationBeforeEachQuizz() scriptDurationBeforeEachQuizz = ScriptDurationBeforeEachQuizz()
scriptUserDeviationAveragePoint = ScriptUserDeviationAveragePoint()
scriptInterTimeBoxPlot = ScriptInterTimeBoxPlot()
scriptUserMarkdsPerQuizBoxPlot = ScriptUserMarkdsPerQuizBoxPlot()
scriptAccessPerSessionBoxPlot = ScriptAccessPerSessionBoxPlot()
scriptDurationBeforeEachQuizz = ScriptDurationBeforeEachQuizz()
scriptTotalDurationHistogram = ScriptTotalDurationHistogram()
scriptNumberSessionHistogram = ScriptNumberSessionHistogram()
scriptNumberOfEventBoxPlot = ScriptNumberOfEventBoxPlot()
scriptNumberOfSessionBoxPlot = ScriptNumberOfSessionBoxPlot()
scriptNumberOfAccessOnEachPartBoxPlot = ScriptNumberOfAccessOnEachPartBoxPlot()
scriptLinearityBoxPlot = ScriptLinearityBoxPlot()
scriptTimeSinceLastEventBoxPlot = ScriptTimeSinceLastEventBoxPlot()
scriptEventBeforeEachQuizz = ScriptEventBeforeEachQuizz()
scriptSessionBeforeEachQuizz = ScriptSessionBeforeEachQuizz()
scriptSessionPerDayBeforeEachQuizz = ScriptSessionPerDayBeforeEachQuizz()
scriptFinalMarkBoxPlot = ScriptFinalMarkBoxPlot()
#scriptSimpleStatistic.generateAllGroup(sequenceSession) #scriptNumberSessionHistogram.generateAllGroup(sequenceSession)
#scriptSimpleStatistic.exportLatex()
scriptUserDeviationAveragePoint = ScriptUserDeviationAveragePoint() #scriptNumberOfEventBoxPlot.generateAllGroup(sequenceSession)
scriptUserDeviationAveragePoint.generateAllGroup(sequenceSession) #scriptNumberOfSessionBoxPlot.generateAllGroup(sequenceSession)
#scriptDurationBeforeEachQuizz.generateAllGroup(sequenceSession)
#scriptNumberOfAccessOnEachPartBoxPlot.generateAllGroup(sequenceSession)
#scriptLinearityBoxPlot.generateAllGroup(sequenceSession)
#sequenceSession.exportAllCSVFile()
#scriptTimeSinceLastEventBoxPlot.generateAllGroup(sequenceSession)
#scriptEventBeforeEachQuizz.generateAllGroup(sequenceSession)
#scriptSessionBeforeEachQuizz.generateAllGroup(sequenceSession)
#scriptTotalDurationHistogram.generateAllGroup(sequenceSession)
#scriptSessionPerDayBeforeEachQuizz.generateAllGroup(sequenceSession)
scriptFinalMarkBoxPlot.generateAllGroup(sequenceSession)
#scriptUserMarkdsPerQuizBoxPlot.generateAllGroup(sequenceSession)
#scriptDurationBeforeEachQuizz.generateAllGroup(sequenceSession)
#scriptInterTimeBoxPlot.generateAllGroup(sequenceSession)
#scriptDurationBeforeEachQuizz.generateAllGroup(sequenceSession)
# userManagerProxySession.refresh = True
# userManagerProxySession.generateAllUserIds()
# userManagerProxySession.printStats()
# scriptSimpleStatistic.generateAllGroup(sequenceSession)
# scriptSimpleStatistic.exportLatexFirstTable()
# print("\n\n\n")
# scriptSimpleStatistic.exportLatexSecondTable()
# print("\n\n\n")
# scriptSimpleStatistic.exportLatexThirdTable()
#scriptUserDeviationAveragePoint.generateAllGroup(sequenceSession)
# userSequences = sequenceSession.getSequencesAllSucceed(Course.COURSE_ID_ARDUINO) # userSequences = sequenceSession.getSequencesAllSucceed(Course.COURSE_ID_ARDUINO)
# #
......
...@@ -58,7 +58,7 @@ class SequenceInterface: ...@@ -58,7 +58,7 @@ class SequenceInterface:
INDEX_PART_ID = 0 INDEX_PART_ID = 0
INDEX_SESSION_NUMBER = 1 INDEX_SESSION_NUMBER = 1
INDEX_NUMBER_SEQUENCE = 2 INDEX_SEQUENCE_NUMBER = 2
INDEX_DURATION = 3 INDEX_DURATION = 3
INDEX_STARTDATE = 4 INDEX_STARTDATE = 4
INDEX_ENDDATE = 5 INDEX_ENDDATE = 5
...@@ -169,7 +169,7 @@ class SequenceInterface: ...@@ -169,7 +169,7 @@ class SequenceInterface:
''' '''
get the sequences of the users included in idUsers for a specific course and a score in [minscore, maxScore[ get the sequences of the users included in idUsers for a specific course and a score in [minscore, maxScore[
return: a tuple (idCourse, [(idUser, [(idPart, idSession, duration), (), ...,()]) , ...]). Second argument is a list. @return: a tuple (idCourse, [(idUser, [(idPart, idSession, duration), (), ...,()]) , ...]). Second argument is a list.
''' '''
allSequences = self.loadSavedSequences(idCourse) allSequences = self.loadSavedSequences(idCourse)
...@@ -247,7 +247,7 @@ class SequenceInterface: ...@@ -247,7 +247,7 @@ class SequenceInterface:
''' '''
get the sequences of all users for a specific course get the sequences of all users for a specific course
@return: a list [(idUser, [(idPart, ..., idSession, duration), (), ...,()]) , ...] @return: a list (idCourse, [(idUser, [(idPart, ..., idSession, duration), (), ...,()]) , ...])
''' '''
idUsers = self.userManagerInterface.getAll(idCourse) idUsers = self.userManagerInterface.getAll(idCourse)
...@@ -292,6 +292,21 @@ class SequenceInterface: ...@@ -292,6 +292,21 @@ class SequenceInterface:
return self.getFilteredSequences(idUsers, idCourse) return self.getFilteredSequences(idUsers, idCourse)
def getSequenceUser(self, idCourse, idUser):
'''
retrieve the sequence of the user idUser for the course idCourse
@return: (idUser, sequences)
'''
sequences = self.loadSavedSequences(idCourse)
for (idUserSequence, sequence) in sequences:
if(idUserSequence == idUser):
return (idUser, sequence)
return None
def getSequences(self, idCourse, group): def getSequences(self, idCourse, group):
''' '''
get the sequences of all failed users for a specific course get the sequences of all failed users for a specific course
...@@ -459,6 +474,7 @@ class SequenceInterface: ...@@ -459,6 +474,7 @@ class SequenceInterface:
for (idExo, createdAt, completedAt, scoreExo) in filteredIdExercise: for (idExo, createdAt, completedAt, scoreExo) in filteredIdExercise: