Overview of the Oppia codebase (Oppia Code Library Overview)

Source: Internet
Author: User
Tags types of extensions

Oppia is built with Google App Engine. Its backend are written in Python, and their frontend is written using AngularJS.

Oppia is based on the development of Google APP engine. Its background is written in Python, and the front end is written in Angularjs.

The core

The most of Oppia ' s functionality core/ are in the directory, which is arranged as follows:

Most of the Oppia features are placed in the core directory, as shown in the scope below

Backend Backstage

One-to understand-diagram means is-to-look at the lifecycle of a typical request. A user makes a request to the Oppia server by performing some action (like clicking a button) that causes some JavaScript Code to issue a POST request. This request was made to a particular URL, which main.py matches to a handler in the core/controllers directory.

One way to understand the meaning of this diagram is through the life cycle of a typical request. A user makes a request to the Oppia server by performing some action (like clicking on a button), which causes some JavaScript code to process a POST request. This request points to a specific url,main.py matching processor in the Core/controllers directory.

Each controller was meant to being a thin layer that understands and validates the request, and then calls methods in to core/domain Actually perform the computation/query, or change the state of the the the server. The files in constitute the core functionality of Oppia and is where most of the core/domain logical operations occur.

Each controller means a thin layer that is used to understand and validate the request, and then call the Core/domain method to actually perform the calculation or query, changing the state of the data on the server. The files in the Core/domain directory make up the core function of Oppia, which is where the logical operation takes place.

core/domainin, there is generally, types of files:those whose names end _domain.py in, and those whose names end in _services.py . Files of the form is *_services.py mostly comprised of functions that act on data. On the other hand, files of the form *_domain.py define transient classes this represent Oppia objects (like explorations, state S/cards, and so on); These classes is generally initialized using data from persistent storage, and is then operated on by functions in the c5/> files.

In the Core/domain directory, there are usually two types of files: A file that ends in _domain.py, and a file that ends in _services.py. The vast majority of files ending with _services.py contain the ability to manipulate data. On the other hand, files ending in _domain.py define temporary classes (like exploration, State/card, etc.) that represent Oppia objects, which are typically initialized with data obtained from persistent storage and then manipulated by functions in the *_services.py file.

Methods in the domain layer often need to access storage, memcache and other services provided by the application Framewor K. All framework-dependent code (such as anything with a dependency on NDB or google.appengine) should go in Core/platform . The platforms/models.py class provides a interface to these services, and refers to the correct classes based on what the Underlying framework is at runtime. All files in the templates, controllers and domain layers should be independent of the underlying framework.

Methods in the domain layer often require access to storage, memory, and other application frameworks that provide services. All framework-dependent code (such as any that relies on NDB or gae) should be placed in the Core/platform directory. The platforms/models.py class provides an interface to these services, referencing the correct classes based on the framework at run time. All files in the templates, controllers, and domain layers should be based on framework dependencies.

The backend codebase is heavily tested. Tests is contained in *_test.py files next to the Python module they test. This naming convention allows them to being automatically detected and compiled into a test suite by Python S unittest module. F or more information, see Running Tests.

The background code base has been seriously tested. The tests contained in the *_test.py file point to the Python module. This naming habit requires them to be automatically detected and compiled in Python's unittest module test suite. For more information, see Running Tests.

Frontend Front End

The developer version of the Frontend code is contained in core/templates/dev/head . (When Oppia was deployed, a core/templates/prod/head directory is also produced that contains minified versions of the code, and this was not G Enerally of concern during development.) The Frontend code contains the following sub-directories:.

The developer version of the front-end code is included in the Core/templates/dev/head folder (when Oppia is deployed, the core/templates/prod/head/directory is generated, containing the reduced version of the code, But this is generally not a concern during development) the front-end code is contained in the following subdirectory:

  • admin: This provides the/admin page which exposes admin controls, e.g. for adding new moderators. Admin Directory: It provides/admin pages, exposing admin controls, such as adding new partners.
  • components: This provides certain components, mostly for the editor. In particular there is for the rule editor and for the state rule_editor.html visualizations.html graph. Components: It provides a certain component, primarily the editor. In special cases, there are rule_editor.html to the rule editor,visualizations.html to the state diagram.
  • css: Site-wide CSS. There may is other CSS blocks within individual HTML files. CSS: web-scoped CSS. There may be other CSS blocks in the respective HTML file.
  • dashboard: The Per-user notifications Dashboard. Dashboard: Each user notifies the dashboard.
  • editor: the editor; This constitutes by far the largest and most complex section of code. Editor : Editors, this has the largest and most complex code sections.
  • error: Pages to display when a page cannot is loaded (e.g. due to unauthorised access). Error: The page is displayed when a page cannot be loaded (such as no access).
  • expressions: Code to parse and evaluate expressions (which may use parameters). Expressions: Code Parsing and Evaluation Expressions (parameters can be used)
  • forms: Certain standard objects is used in various places throughout the website, such as rich text, lists and dictionaries. Code used to display editors for these objects are collected here. forms: A form that determines the standard object chant used in many places throughout the site, such as rich text, lists, dictionaries. The code used to display the editor is collected here.
  • galleries: The gallery page, allows users to browse explorations. Galleries: Category page allows users to explore.
  • moderator: The/moderator page, provides functionality for moderators. Moderator: The homepage provides functionality for moderators.
  • pages: Various static pages, such as the site guidelines. Pages: A large number of static pages, such as site guides
  • player: Services for the learner view. (The actual learner view templates is in extensions/skins .) Player: Learner View Service (actual learner template in Extensiongs/skins)
  • profile: Used when a new user registers, and to the display usernames for logged-in users. profile: When a new user registration is used, the login username is displayed.
  • services: JavaScript handling the embedding of explorations in other websites, user warnings and other matters. Services:javascript handles encapsulation of exploration at other sites, user warnings and other content.

Files generally come state_editor.html in triples of the form, StateEditor.js and StateEditorSpec.js . The spec file contains Karma unit tests for the JavaScript file.

Files generally appear as tuples: State_editor.html,stateeditor.js and Stateeditorspec.js. This spec file contains the JavaScript file for Karma Unit test.

In general, within the HTML file, sections of the DOM is bound to particular JavaScript controllers. However, some JavaScript files cover multiple HTML files, and others provide general services and so has no HTML file.

Typically, in an HTML file, a portion of the DOM is bound to a specific JavaScript controller. However, some JavaScript files cover multiple HTML files, and others provide a General Service, so there is no HTML file.

ExtensionsExtended

Oppia have a number of extension points that allow developers to augment their functionality, all of which is located in the extensions/folder.

Oppia has a large number of extensibility points that allow developers to enhance its functionality, all of which are placed in the extensions/directory.

There is several different types of extensions:

Several different types of extensions:

  • Objects represent object types that Oppia recognizes, such as Nonnegativeint, UnicodeString and Filepath. In general, they each come with an editor view, a readonly view, and a normalizer which tries to convert a Python object T o the given type. objects represents the types of objects recognized by Oppia, such as nonnegative integers, Unicode strings, and file paths. Typically, each of them follows an editor view, a read-only view, and a converter to convert a Python object to a given type.
  • Rules allow learner answers to be classified, so, Oppia can provide appropriate feedback in response. The rules rule, which requires learners ' answers to be categorized so that Oppia can provide approximate feedback as a response.
  • Skins provide different user interfaces for the Oppia learner view. Skins provides different user interfaces for Oppia learner views.
  • Value generators is essentially functions which take some inputs and produce a single output. They is used when defining parameter Changes:for example, they allow a exploration author to specify a exact value for The parameter, or a range of values, one of which is selected at random. the value generators values generator is a must function that obtains some input and produces a single output. They are used when defining parameter changes: For example, they require some exploration authors to specify an exact value for the parameter, or a range of values, one of which is randomly selected.
  • Rich-text-editor Extensions provide additional functionality for content that's shown to the learner. They is accessed via control buttons in the Rich-text Editor toolbar, and include things like videos, images, links and L ATeX math expressions. The rich-text-editor extensions Rich Text Editor extension provides additional functionality to the content that is displayed to learners. They are accessed through the control buttons in the Rich Text editor, which contains mathematical expressions like videos, images, links and latex.
  • Interactions, such as interactive maps and numeric input, allow the learner to submit a answer, which is then SE NT to the server for Oppia to respond. interactions interactions, such as interactive maps and digital inputs, require learners to submit an answer that is sent to the server for Oppia feedback.
Other files and foldersother files and folders
    • feconf.pyContains various constantsthat is referred to by miscellaneous backend files in the app. feconf.py contains a large number of constraints referenced by other background files.
    • The data/explorations folder contains sample explorations that is bundled with the Oppia distribution. Data/explorations folder contains examples to explore bindings to Oppia shares
    • scripts/The folder contains several utility scripts that automate processes like starting a development server, running test s, and deploying a copy of Oppia to a production server. The Scripts folder contains several tool scripts that are automatically processed like starting a development server, running tests, and deploying a copy of Oppia as a product.

Todo:in the boxes in the diagram, consider giving a concrete example of a controller, domain model, etc. and walk up and Down through the stack, maybe pointing to code examples. (This is useful for new contributors who is not familiar with the codebase.)

Overview of the Oppia codebase (Oppia Code Library Overview)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.