Skip to main content

eLearning API Documentation

eLearning 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.

Installation

Assuming, Python 3 (>=3.6) is already installed and a MongoDB Cluster connection is working, eLearning API needs the next requirements:

  1. pymongo 3.9.0. Or, it can be easily installed with:

    $ python -m pip install pymongo
    
  2. dnspython. Or, it can be easily installed with:

    $ python -m pip install pymongo[srv]
    
  3. pip. Or, it can be easily installed with:

    $ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
    $ python get-pip.py
    
  4. Install with:

    $ pip install eLearning
    
  5. Import 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' )
    

Testing

To test the API, please try the next lines at your Python command-line interface:

import eLearning as el
el.eLearning_test.run()

eLearning API documentation

Connector level operations

class eLearning_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 given fullname and email was 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 given fullname and email was 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 given email was deleted successfully from the database. Otherwise, return ('409 - Conflict',"Deletion error.").

eLearning_connector.get_user_by_email ( email )

Return a class eLearning_professor instance if the given email results of a professor-user. Return a class eLearning_student instance if the given email results of a student-user. Otherwise, return None.

eLearning_connector.list_professors ()

Return a Python list object with all existing professor-user documents, each document is arranged into a Python dict object. If there are not professor-users in database, an empty list is returned.

eLearning_connector.list_students ()

Return a Python list object with all existing student-user documents, each document is arranged into a Python dict object. If there are not student-users in database, an empty list is returned.

eLearning_connector.list_courses ()

Return a Python list object with all existing course documents, each document is arranged into a Python dict object. If there are not courses in database, an empty list is returned.

eLearning_connector.list_lessons ( parent_course_code )

Return a Python list object with all associated lesson documents to a given parent_course_code, each document is arranged into a Python dict object. If there are not such lessons in database, an empty list is returned.

eLearning_connector.list_questions ( parent_lesson_code )

Return a Python list object with all associated question documents to a given parent_lesson_code, each document is arranged into a Python dict object. If there are not such questions in database, an empty list is returned.


User level operations

class eLearning_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 between 0.0 (minimal score) and 1.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 object list with all current courses.

eLearning_professor.read_course ( code, full=False )

Parameters :

  • code: <str> Code of the course.
  • full: <bool> False or True.

Return the Python object dict with the given course attributes at creation time. Moreover, if full is set to True, 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> False or True.

Return the Python object dict with the given lesson attributes at creation time. Moreover, if full is set to True, the information of all subscribed questions will be included.

eLearning_professor.read_question ( code )

Parameters :

  • code: <str> Code of the question.

Return the Python object dict with 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.


class eLearning_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 object list with informative dict about 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 object list with all current courses. Every course is represented by an informative dict, where the key 'available' indicate with True, whether the course is available for the student or with False otherwise.

eLearning_student.list_lessons_and_availability ( parent_course_code )

Parameters :

  • parent_course_code: <str> Code of the parent-course.

Return a Python object list with all current lessons. Every lesson is represented by an informative dict, where the key 'available' indicate with True, whether the lesson is available for the student or with False otherwise.

eLearning_student.get_full_lesson ( code )

Parameters :

  • code: <str> Code of the claimed lesson.

Return a Python object dict with 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 object dict resuming the score, status of the taken lesson and the parent-course status whether was approved.

Release files for eLearning 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eLearning 0.0.5
File Size Uploaded
eLearning-0.0.5.tar.gz 9.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for eLearning 0.0.5
File Interpreter ABI Platform
eLearning-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size:31.4 kB

Release files / eLearning-0.0.5.tar.gz

Download URL eLearning-0.0.5.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3e033cc9bf1c04c277d61cb265f6e81a3fb8f832db2f97fac4fb378c9c42fd55
BLAKE2b-256 checksum
How to use checksums
a7b28f369f0d467e04c34a82a536adc846dce87900c10ca076f0708ab534d1c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.6.5

Release files / eLearning-0.0.5-py3-none-any.whl

Download URL eLearning-0.0.5-py3-none-any.whl
Size 22.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b302c02c5c4a4f0cdcfd0b9d778609492cd284c89d10c69313a3c250b6c08e76
BLAKE2b-256 checksum
How to use checksums
404a0e3361dc3111f67996293f6037a145411931858c53b907aa924b064115fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.6.5

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page