Skip to content

About

Second generation eval function for general comparison of expressions

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

651 Commits

Folders and files

Repository files navigation

Compare Expressions

This function utilises the SymPy to provide a maths-aware comparison of a student's response to the correct answer. This means that mathematically equivalent inputs will be marked as correct. Note that pi is a reserved constant and cannot be used as a symbol name.

For more information, look at the docs here or in docs/.

This version is specifically for python, however the ultimate goal is to make similar boilerplate repositories in any language, allowing tutors the freedom to code in what they feel most comfortable with.

Deployment

Create Release Request

Getting Started

  1. Clone this repository

  2. Change the name of the evaluation function in config.json

  3. The name must be unique. To view existing grading functions, go to:

  4. Merge commits into the default branch

    • This will trigger the staging-deploy.yml workflow (and production-deploy.yml on release), which will build the docker image, push it to a shared ECR repository, then call the backend grading-function/ensure route to build the necessary infrastructure to make the function available from the client app.
  5. You are now ready to start developing your function:

    • Edit the app/evaluation.py file, which ultimately gets called when the function is given the eval command
    • Add pytest tests to app/tests/. They get run:
      • On every pull request and before the image is built and deployed (pytest from the repo root)
      • Whenever the healthcheck command is supplied to the deployed function (via app/evaluation_tests.py)
    • Edit app/docs/user.md and app/docs/dev.md to reflect your changes. These files are baked into the function's image, and is made available using the docs command. This feature is used to display this function's documentation on our Documentation website once it's been hooked up!

How it works

The function is built on top of a custom base layer, BaseEvaluationFunctionLayer, which tools, tests and schema checking relevant to all evaluation functions.

Packages

Expression parsing, unit handling and the criteria machinery come from the lambda-feedback-packages repository (currently the v0.3.0-rc.5 release candidate), installed as git dependencies in app/requirements.txt. See the "Packages" section of app/docs/dev.md for what each package does and how to develop against a local checkout.

Docker & Amazon Web Services (AWS)

The grading scripts are hosted AWS Lambda, using containers to run a docker image of the app. Docker is a popular tool in software development that allows programs to be hosted on any machine by bundling all its requirements and dependencies into a single file called an image.

Images are run within containers on AWS, which give us a lot of flexibility over what programming language and packages/libraries can be used. For more information on Docker, read this introduction to containerisation. To learn more about AWS Lambda, click here.

Middleware Functions

In order to run the algorithm and schema on AWS Lambda, some middleware functions have been provided to handle, validate and return the data so all you need to worry about is the evaluation script and testing.

The code needed to build the image using all the middleware functions are available in the BaseEvaluationFunctionLayer repository.

GitHub Actions

Whenever a commit is made to the GitHub repository, the new code will go through a pipeline, where it will be tested for syntax errors and code coverage. The pipeline used is called GitHub Actions and the scripts for these can be found in .github/workflows/.

On top of that, when starting a new evaluation function, you will have to complete a set of unit test scripts, which not only make sure your code is reliable, but also helps you to build a specification for how the code should function before you start programming.

Once the code passes all these tests, it will then be uploaded to AWS and will be deployed and ready to go in only a few minutes.

Pre-requisites

Although all programming can be done through the GitHub interface, it is recommended you do this locally on your machine. To do this, you must have installed:

  • Python 3.12 (the version used by CI and the production image).

  • GitHub Desktop or the git CLI.

  • A code editor such as Atom, VS Code, or Sublime.

About

Second generation eval function for general comparison of expressions

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages