You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This template repository contains the boilerplate code needed in order to create an AWS Lambda function that can be written by any tutor to grade a response area in any way they like.
3
+
This function checks whether a student's numeric response is within an acceptable tolerance of the correct answer, using absolute (`atol`) and relative (`rtol`) tolerance parameters. The comparison follows the formula: `|response - answer| ≤ atol + rtol × |answer|`. By default both tolerances are 0, requiring an exact match (within floating-point precision).
5
4
6
-
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.
5
+
For more information, look at the docs in `app/docs/`.
-[Evaluation Function Template Repository](#evaluation-function-template-repository)
11
-
-[Table of Contents](#table-of-contents)
12
-
-[Repository Structure](#repository-structure)
13
-
-[Usage](#usage)
14
-
-[Getting Started](#getting-started)
15
-
-[How it works](#how-it-works)
16
-
-[Docker & Amazon Web Services (AWS)](#docker--amazon-web-services-aws)
17
-
-[Middleware Functions](#middleware-functions)
18
-
-[GitHub Actions](#github-actions)
19
-
-[Pre-requisites](#pre-requisites)
20
-
-[Contact](#contact)
21
-
22
-
## Repository Structure
23
-
24
-
```bash
25
-
app/
26
-
__init__.py
27
-
evaluation.py # Script containing the main evaluation_function
28
-
docs.md # Documentation page for this function (required)
29
-
evaluation_tests.py # Unittests for the main evaluation_function
30
-
requirements.txt # list of packages needed for algorithm.py
31
-
Dockerfile # for building whole image to deploy to AWS
32
-
33
-
.github/
34
-
workflows/
35
-
test-and-deploy.yml # Testing and deployment pipeline
36
-
37
-
config.json # Specify the name of the evaluation function in this file
38
-
.gitignore
39
-
```
40
-
41
-
## Usage
42
10
43
11
### Getting Started
44
12
@@ -50,16 +18,15 @@ config.json # Specify the name of the evaluation function in this file
50
18
-[Production API Gateway Integrations](https://eu-west-2.console.aws.amazon.com/apigateway/main/develop/integrations/attach?api=cttolq2oph&integration=qpbgva8®ion=eu-west-2&routes=0xsoy4q)
51
19
52
20
4. Merge commits into the default branch
53
-
54
-
- This will trigger the `test-and-deploy.yml` workflow, 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.
21
+
- This will trigger the `staging-deploy.yml` workflow, 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.
55
22
56
23
5. You are now ready to start developing your function:
57
-
24
+
58
25
- Edit the `app/evaluation.py` file, which ultimately gets called when the function is given the `eval` command
59
26
- Edit the `app/evaluation_tests.py` file to add tests which get run:
60
-
- Every time you commit to this repo, before the image is built and deployed
61
-
- Whenever the `healthcheck` command is supplied to the deployed function
62
-
- Edit the `app/docs.md` file to reflect your changes. This file is 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](https://lambda-feedback.github.io/Documentation/) website once it's been hooked up!
27
+
- On every pull request, via the `test-lint.yml` workflow, before the image is built and deployed
28
+
- Whenever the `healthcheck` command is supplied to the deployed function
29
+
- Edit the `app/docs/` files to reflect your changes. These files are baked into the function's image, and are made available using the `docs` command. This feature is used to display this function's documentation on our [Documentation](https://lambda-feedback.github.io/Documentation/) website once it's been hooked up!
63
30
64
31
---
65
32
@@ -74,31 +41,22 @@ The grading scripts are hosted AWS Lambda, using containers to run a docker imag
74
41
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](https://www.freecodecamp.org/news/a-beginner-friendly-introduction-to-containers-vms-and-docker-79a9e3e119b/). To learn more about AWS Lambda, click [here](https://geekflare.com/aws-lambda-for-beginners/).
75
42
76
43
### Middleware Functions
77
-
78
44
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.
79
45
80
46
The code needed to build the image using all the middleware functions are available in the [BaseEvaluationFunctionLayer](https://github.com/lambda-feedback/BaseEvalutionFunctionLayer) repository.
81
47
82
48
### GitHub Actions
83
-
84
-
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/`.
49
+
Whenever a pull request is opened or updated, 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/`.
85
50
86
51
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.
87
52
88
53
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.
89
54
90
55
## Pre-requisites
91
-
92
56
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:
93
57
94
58
- Python 3.8 or higher.
95
59
96
60
- GitHub Desktop or the `git` CLI.
97
61
98
-
- A code editor such as Atom, VS Code, or Sublime.
99
-
100
-
Copy this template over by clicking **Use this template** button found in the repository on GitHub. Save it to the `lambda-feedback` Organisation.
101
-
102
-
## Contact
103
-
104
-
# TBC
62
+
- A code editor such as Atom, VS Code, or Sublime.
0 commit comments