Commit 6ddbc120 authored by Antoine PIGEAU's avatar Antoine PIGEAU
Browse files

start OCR integration

parent 62f50c51
......@@ -29,7 +29,15 @@ class DataManager:
def __init__(self):
pass
def getAllCourses(self):
'''
retrieve all the courses
@return Pandas dataframe with all the courses
'''
raise NotImplementedError
def getCourse(self, idCourse):
'''
retrieve the course idCourse. The course contains the exercises.
......@@ -44,13 +52,11 @@ class DataManager:
'''
raise NotImplementedError
def getAllCourses(self):
'''
retrieve all the courses
@return Pandas dataframe with all the courses
'''
raise NotImplementedError
def getAllUsers(self):
pass
def getUsers(self, idCourse, groupName=None):
pass
def getResultUser(self, idCourse, idUser):
'''
......@@ -62,13 +68,6 @@ class DataManager:
@return: Pandas dataFrame with columns (idUser, idCourse, result)
'''
raise NotImplementedError
def getAllResultUser(self, idUser):
'''
retrieve all the results for all the courses
@return: Pandas dataFrame with columns (idUser, idCourse, result)
'''
def getTraces(self, idCourse, groupName):
'''
......
# -*- coding: UTF-8 -*-
'''
Created on 29-Apr-2014
This file is part of Hubble-UserProfile.
Hubble-UserProfile is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Hubble-UserProfile is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with Hubble-UserProfile. If not, see <http://www.gnu.org/licenses/>.
@author: Antoine Pigeau
'''
import json
import os
import csv
import operator
from model.ocr.constant import Constant
class DataManager:
'''
class to load the raw data of the Open Class Room Dataset
'''
@staticmethod
def getFileName(idCourse):
if idCourse == Constant.COURSE_ID_API_REST:
return Constant.COURSE_FILE_API_REST
if idCourse == Constant.COURSE_ID_ARDUINO:
return Constant.COURSE_FILE_ARDUINO
if idCourse == Constant.COURSE_ID_BOOTSTRAP:
return Constant.COURSE_FILE_BOOTSTRAP
if idCourse == Constant.COURSE_ID_GESTION_PROJET:
return Constant.COURSE_FILE_GESTION_PROJET
if idCourse == Constant.COURSE_ID_HTML_CSS:
return Constant.COURSE_FILE_HTML_CSS
if idCourse == Constant.COURSE_ID_IONIC:
return Constant.COURSE_FILE_IONIC
if idCourse == Constant.COURSE_ID_JAVA_SCRIPT:
return Constant.COURSE_FILE_JAVA_SCRIPT
if idCourse == Constant.COURSE_ID_RUBY:
return Constant.COURSE_FILE_RUBY
if idCourse == Constant.COURSE_ID_TWITTER:
return Constant.COURSE_FILE_TWITTER
if idCourse == Constant.COURSE_ID_WEB:
return Constant.COURSE_FILE_WEB
if idCourse == Constant.COURSE_ID_AUDACE:
return Constant.COURSE_FILE_AUDACE
if idCourse == Constant.COURSE_ID_XML:
return Constant.COURSE_FILE_XML
if idCourse == Constant.COURSE_ID_JAVA:
return Constant.COURSE_FILE_JAVA
if idCourse == Constant.COURSE_ID_NODE_JS:
return Constant.COURSE_FILE_NODE_JS
DATE_FORMAT_OUTPUT = "%Y-%m-%d %H:%M:%S"
def __init__(self):
pass
def getAllCourses(self):
'''
retrieve all the courses
@return Pandas dataframe with all the courses
'''
raise NotImplementedError
def getCourse(self, idCourse):
'''
retrieve the course idCourse. The course contains the exercises.
The type of a resource is an exercise or a part/chapter/section, ...
Each resource is numbered depending on its order in the resource's sequence of the course
@param idCourse: id of the course to retrieve
@return: a Pandas dataFrame with the course (columns idCourse, idRessource, sequenceNumberOfTheRessource, typeResource)
'''
fileName = Course.getFileName(self.idCourse)
fileCourse = open(os.path.join(Course.DIRECTORY, fileName), 'r', encoding='utf-8')
self.data = json.load(fileCourse, encoding='utf-8')
self.id = self.data["id"]
self.title = self.data["title"].encode('utf-8')
self.sequence = []
children = self.data["children"]
for part in children:
self.sequence.append((part["id"], part["title"].encode('utf-8'), Course.PART))
for chapter in part["children"]:
self.sequence.append((chapter["id"], chapter["title"].encode('utf-8'), Course.CHAPTER))
for section in chapter["children"]:
self.sequence.append((section["id"], section["title"].encode('utf-8'), Course.SECTION))
fileCourse.close()
self.addExercises()
if (self.idCourse in [Course.COURSE_ID_API_REST,
Course.COURSE_ID_HTML_CSS,
Course.COURSE_ID_AUDACE,
Course.COURSE_ID_XML,
Course.COURSE_ID_JAVA,
Course.COURSE_ID_NODE_JS]):
self.dictMaxDuration = None
self.typeContent = Course.SECTION
else:
self.typeContent = Course.CHAPTER
self.dictMaxDuration = self.__loadDictMaxDuration()
def getAllUsers(self):
pass
def getUsers(self, idCourse, groupName=None):
pass
def getResultUser(self, idCourse, idUser):
'''
retrieve the results of the user idUser from the course idCourse
@param idUser: user to retrieve the results
@param idCourse: course from which to retrieve the user's result
@return: Pandas dataFrame with columns (idUser, idCourse, result)
'''
raise NotImplementedError
def getTraces(self, idCourse, groupName):
'''
retrieve the traces of the group groupName
For a specific user, the sequence number is the order of the event in hs/her traces
@param idCourse: course to load
@param groupName: group to load
@return: a Pandas dataFrame with columns (idUser, idCourse, idResource, date, sequenceNumber)
'''
raise NotImplementedError
def getTracesUser(self, idCourse, idUser):
'''
retrieve the traces of the user idUser for the course idCourse
@return Pandas dataFrame with columns (idUser, idCourse, idResource, date, sequenceNumber)
'''
raise NotImplementedError
\ No newline at end of file
# -*- coding: UTF-8 -*-
'''
Created on 29-Apr-2014
This file is part of Hubble-UserProfile.
Hubble-UserProfile is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Hubble-UserProfile is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with Hubble-UserProfile. If not, see <http://www.gnu.org/licenses/>.
@author: Antoine Pigeau
'''
import os
from project.projectParameters import ProjectParameters
class Constant:
COURSE_ID_BOOTSTRAP = 1885491 # chapter
COURSE_ID_IONIC = 3013711
COURSE_ID_GESTION_PROJET = 3522386
COURSE_ID_RUBY = 3432066
COURSE_ID_WEB = 1946386 # chapter
COURSE_ID_TWITTER = 2766951
COURSE_ID_ARDUINO = 2778161
COURSE_ID_API_REST = 3449001 # not used in session
COURSE_ID_JAVA_SCRIPT = 2984401
COURSE_ID_HTML_CSS = 1603881 # not used in session
''' data 3 - section level '''
COURSE_ID_NODE_JS = 1056721
COURSE_ID_AUDACE = 1946116
COURSE_ID_XML = 1766341
COURSE_ID_JAVA = 26832
COURSE_NAME_BOOTSTRAP = 'Prenez en main Bootstrap'
COURSE_NAME_IONIC = 'Developpez une application mobile multi-plateforme avec Ionic'
COURSE_NAME_GESTION_PROJET = 'Decouvrez les bases de la gestion de projet'
COURSE_NAME_RUBY = 'Continuez avec Ruby on Rails'
COURSE_NAME_WEB = 'Comprendre le Web'
COURSE_NAME_TWITTER = 'Animez une communaute Twitter'
COURSE_NAME_ARDUINO = 'Programmez vos premiers montages avec Arduino'
COURSE_NAME_API_REST = 'Utilisez des API REST dans vos projets web'
COURSE_NAME_JAVA_SCRIPT = 'Apprenez a coder avec JavaScript'
COURSE_NAME_HTML_CSS = 'Apprenez a creer votre site web avec HTML5 et CSS3'
COURSE_NAME_NODE_JS = 'Des applications ultra rapides avec Node JS'
COURSE_NAME_AUDACE = 'Avoir l audace d entreprendre'
COURSE_NAME_XML = 'Structurez vos donnees avec XML'
COURSE_NAME_JAVA = 'Apprenez a programmer en Java'
COURSE_NAME_SHORT_BOOTSTRAP = 'Bootstrap'
COURSE_NAME_SHORT_IONIC = 'Ionic'
COURSE_NAME_SHORT_GESTION_PROJET = 'Gestion Projet'
COURSE_NAME_SHORT_RUBY = 'Rubys'
COURSE_NAME_SHORT_WEB = 'Web'
COURSE_NAME_SHORT_TWITTER = 'Twitter'
COURSE_NAME_SHORT_ARDUINO = 'Arduino'
COURSE_NAME_SHORT_API_REST = 'API REST'
COURSE_NAME_SHORT_JAVA_SCRIPT = 'JavaScript'
COURSE_NAME_SHORT_HTML_CSS = 'HTML5 CSS3'
COURSE_NAME_SHORT_NODE_JS = 'Node JS'
COURSE_NAME_SHORT_AUDACE = 'Audace Entreprendre'
COURSE_NAME_SHORT_XML = 'XML'
COURSE_NAME_SHORT_JAVA = 'Java'
COURSE_NAME_NODE_JS = 'Node JS'
COURSE_NAME_AUDACE = 'Audace Entreprendre'
COURSE_NAME_XML = 'XML'
COURSE_NAME_JAVA = 'Java'
COURSE_FILE_BOOTSTRAP = 'export-prenez-en-main-bootstrap.json'
COURSE_FILE_IONIC = 'export-developpez-une-application-mobile-multi-plateforme-avec-ionic.json'
COURSE_FILE_GESTION_PROJET = 'export-decouvrez-les-bases-de-la-gestion-de-projet.json'
COURSE_FILE_RUBY = 'export-continuez-avec-ruby-on-rails.json'
COURSE_FILE_WEB = 'export-comprendre-le-web.json'
COURSE_FILE_TWITTER = 'export-animez-une-communaute-twitter.json'
COURSE_FILE_ARDUINO = 'export-programmez-vos-premiers-montages-avec-arduino.json'
COURSE_FILE_API_REST = 'export-utilisez-des-api-rest-dans-vos-projets-web.json'
COURSE_FILE_JAVA_SCRIPT = 'export-apprenez-a-coder-avec-javascript.json'
COURSE_FILE_HTML_CSS = 'export-apprenez-a-creer-votre-site-web-avec-html5-et-css3.json'
COURSE_FILE_NODE_JS = 'course_des-applications-ultra-rapides-avec-node-js.json'
COURSE_FILE_AUDACE = 'course_avoir-l-audace-d-entreprendre.json'
COURSE_FILE_XML = 'course_structurez-vos-donnees-avec-xml.json'
COURSE_FILE_JAVA = 'course_apprenez-a-programmer-en-java.json'
\ No newline at end of file
......@@ -473,3 +473,5 @@ class Course():
def __str__(self):
return "id:"+str(self.id)+" title:"+self.title+" sequence:"+str(self.sequence)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment