Package: eLearning
eLearning API DocumentationeLearning is an API dedicated to managing the backend infrastructure of an e-learning system. eLearning is totally developed with Python 3.6+ and the data storing is a MongoDB implementation through the third-party API pymongo 3.9.0.InstallationAssuming, Python 3 (>=3.6) is already installed and aMongoDBCluster connection is working, eLearning API needs the next requirements:pymongo 3.9.0. Or, it can be easily installed with:$ python -m pip install pymongodnspython. Or, it can be easily installed with:$ python -m pip install pymongo[srv]pip. Or, it can be easily installed with:$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$ python get-pip.pyInstall with:$ pip install eLearningImport and hello-world:import eLearning as el
elc = el.eLearning_connector()
print(elc.client)
print(elc.db)
print(elc.db.list_collection_names())
elc._tabula_rasa()
elc.insert_professor( 'Paul ErdÅ‘s', 'erdos@princeton.edu' )
elc.insert_student( 'Terence Tao', 'tao@princeton.edu' )TestingTo test the API, please try the next lines at your Python command-line interface:import eLearning as el
el.eLearning_test.run()eLearning API documentationConnector level operationsclasseLearning_connector( )An eLearning_connector is the object used to communicate with MongoDB cluster and databases. eLearning_connector object has the next attributes:eLearning_connector.client: informative dictionary about the connector.eLearning_connector.db: informative dictionary about the database.eLearning_connector.course_collection: MongoDB collection object with the courses information.eLearning_connector.lesson_collection: MongoDB collection object with the lessons information.eLearning_connector.question_collection: MongoDB collection object with the questions information.eLearning_connector.binnacle_collection: MongoDB collection object with the binnacles information.eLearning_connector.record_collection: MongoDB collection object with the records information.eLearning_connector.user_collection: MongoDB collection object with the users information.eLearning_connector.insert_professor( fullname, email )Return the tuple('200 - OK',"")if the professor-user with givenfullnameandemailwas inserted successfully in the database. Otherwise, return('409 - Conflict',"Insertion error.").eLearning_connector.insert_student( fullname, email )Return the tuple('200 - OK',"")if the student-user with givenfullnameandemailwas inserted successfully in the database. Otherwise, return('409 - Conflict',"Insertion error.").eLearning_connector.delete_user_by_email( email )Return the tuple('200 - OK',"")if the user with givenemailwas deleted successfully from the database. Otherwise, return('409 - Conflict',"Deletion error.").eLearning_connector.get_user_by_email( email )Return aclasseLearning_professorinstance if the givenemailresults of a professor-user. Return aclasseLearning_studentinstance if the givenemailresults of a student-user. Otherwise, returnNone.eLearning_connector.list_professors()Return a Pythonlistobject with all existing professor-user documents, each document is arranged into a Pythondictobject. If there are not professor-users in database, an empty list is returned.eLearning_connector.list_students()Return a Pythonlistobject with all existing student-user documents, each document is arranged into a Pythondictobject. If there are not student-users in database, an empty list is returned.eLearning_connector.list_courses()Return a Pythonlistobject with all existing course documents, each document is arranged into a Pythondictobject. If there are not courses in database, an empty list is returned.eLearning_connector.list_lessons( parent_course_code )Return a Pythonlistobject with all associated lesson documents to a givenparent_course_code, each document is arranged into a Pythondictobject. If there are not such lessons in database, an empty list is returned.eLearning_connector.list_questions( parent_lesson_code )Return a Pythonlistobject with all associated question documents to a givenparent_lesson_code, each document is arranged into a Pythondictobject. If there are not such questions in database, an empty list is returned.User level operationsclasseLearning_professor( )An eLearning_professor instance corresponds to the valid professor-users' attributes and methods:eLearning_professor.fullname:<str>Fullname of the user.eLearning_professor.email:<str>e-mail address of the user.eLearning_professor.role:<str>it always set as "professor".eLearning_professor.create_course( title, code, description=None, required_course_code=None)Parameters :title:<str>Customized title for the course.code:<str>Customized code for the course.description:<str>Description of the course.required_course_code:<str>Code of required approved-course.Return the tuple('200 - OK',"")if the course with given parameters was created successfully in the database.  Otherwise, return('400 - Bad Request',"Course's code already exists."),('404 - Not Found',"Required-course's code not found.")or('409 - Conflict',"Insertion error.").eLearning_professor.create_lesson( title, code, content, parent_course_code, approval_score=1.0, required_lesson_code=None)Parameters :title:<str>Customized title for the lesson.code:<str>Customized code for the lesson.content:<str>Description of the lesson.correct_answers:<list>List of the correct answer labels (<str>).parent_course_code:<str>Code of the parent-course.approval_score:<float>Floating number between0.0(minimal score) and1.0(maximal score).required_lesson_code:<str>Code of required approved-lesson.Return the tuple('200 - OK',"")if the lesson with given parameters was created successfully in the database.  Otherwise, return('400 - Bad Request',"Lesson's code already exists."),('404 - Not Found',"Required-lesson's code not found."),('404 - Not Found',"Parent-course's code not found.")or('409 - Conflict',"Insertion error.").eLearning_professor.create_question( code, mode, content, correct_answers, parent_lesson_code )Parameters :code:<str>Customized code for the question.mode:<str>"Bool","MC1A","MCMA+","MCMA*" only.content:<str>Description of the question.correct_answers:<list>List of option labels.parent_lesson_code:<str>Code of the parent-course.Return the tuple('200 - OK',"")if the question with given parameters was created successfully in the database.  Otherwise, return('400 - Bad Request',"Invalid question mode."),('400 - Bad Request',"Answers have to be a list of strings."),('404 - Not Found',"Parent-lesson's code not found.")or('409 - Conflict',"Insertion error.").eLearning_professor.list_courses( )Return the Python objectlistwith all current courses.eLearning_professor.read_course( code, full=False)Parameters :code:<str>Code of the course.full:<bool>FalseorTrue.Return the Python objectdictwith the given course attributes at creation time. Moreover, iffullis set toTrue, the information of all subscribed lessons and questions will be included.eLearning_professor.read_lesson( code, full=False)Parameters :code:<str>Code of the lesson.full:<bool>FalseorTrue.Return the Python objectdictwith the given lesson attributes at creation time. Moreover, iffullis set toTrue, the information of all subscribed questions will be included.eLearning_professor.read_question( code )Parameters :code:<str>Code of the question.Return the Python objectdictwith the given question attributes at creation time.eLearning_professor.update_course( code, **kwards )Parameters :code:<str>Code of the course.**kwards:<dict>Dictionary with the attributes to update for the given course.Return an integer with the count of modified attributes.eLearning_professor.update_lesson( code, **kwards )Parameters :code:<str>Code of the lesson.**kwards:<dict>Dictionary with the attributes to update for the given lesson.Return an integer with the count of modified attributes.eLearning_professor.update_question( code, **kwards )Parameters :code:<str>Code of the question.**kwards:<dict>Dictionary with the attributes to update for the given question.Return an integer with the count of modified attributes.eLearning_professor.delete_course( code, **kwards )Parameters :code:<str>Code of the course.Return an integer with the count of deleted objects.eLearning_professor.delete_lesson( code, **kwards )Parameters :code:<str>Code of the lesson.Return an integer with the count of deleted objects.eLearning_professor.delete_question( code, **kwards )Parameters :code:<str>Code of the question.Return an integer with the count of deleted objects.classeLearning_student( )An eLearning_student instance corresponds to the valid student-users' attributes and methods:eLearning_student.fullname:<str>Fullname of the user.eLearning_student.email:<str>e-mail address of the user.eLearning_student.role:<str>it always set as "student".eLearning_student.score:<float>Main score.eLearning_student.get_record_summary( )Return a Python objectlistwith informativedictabout the type, code, status, score and datetime of all courses and lessons taken by the student.eLearning_student.list_courses_and_availability( )Return a Python objectlistwith all current courses. Every course is represented by an informativedict, where the key'available'indicate withTrue, whether the course is available for the student or withFalseotherwise.eLearning_student.list_lessons_and_availability( parent_course_code )Parameters :parent_course_code:<str>Code of the parent-course.Return a Python objectlistwith all current lessons. Every lesson is represented by an informativedict, where the key'available'indicate withTrue, whether the lesson is available for the student or withFalseotherwise.eLearning_student.get_full_lesson( code )Parameters :code:<str>Code of the claimed lesson.Return a Python objectdictwith the claimed lesson information and its subscrited questions.eLearning_student.take_lesson( code, answers_list )Parameters :code:<str>Code of the taken lesson.answer_list:<list>List with lists of the correct answers labels;e.g.[['A','C'],['A'],[True]].Return a Python objectdictresuming the score, status of the taken lesson and the parent-course status whether was approved.