Skip to content

Commit 14e10d4

Browse files
Complete initial setup
** Why are these changes being introduced: * The template repo has a checklist of steps to perform for initial setup, which were not all completed in the last PR. ** Relevant ticket(s): n/a ** How does this address that need: This updates the project readme to remove that checklist, now that all the steps have been completed (at least initially - some steps, like the repo settings, are subject to further change). ** Document any side effects to this change: This also performs some additional cleanup to the readme, including an interaction diagram from the engineering plan as well as some other introductory text.
1 parent d044eac commit 14e10d4

File tree

1 file changed

+27
-31
lines changed

1 file changed

+27
-31
lines changed

README.md

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,38 @@
11
# TACOS citation detector
22

3-
A lambda to apply a pre-trained algorithm to predict whether a given search string is in the form of a citation.
4-
5-
## Repo Setup (delete this section and above after initial function setup)
6-
7-
1. Rename "my_function" to the desired initial function name across the repo. (May be helpful to do a project-wide find-and-replace).
8-
2. Update Python version if needed (note: AWS lambda cannot currently support versions higher than 3.9).
9-
3. Install all dependencies with `make install` to create initial Pipfile.lock with latest dependency versions.
10-
4. Add initial function description to README and update initial required ENV variable documentation as needed.
11-
5. Update license if needed (check app-specific dependencies for licensing terms).
12-
6. Check Github repository settings:
13-
- Confirm repo branch protection settings are correct (see [dev docs](https://mitlibraries.github.io/guides/basics/github.html) for details)
14-
- Confirm that all of the following are enabled in the repo's code security and analysis settings:
15-
- Dependabot alerts
16-
- Dependabot security updates
17-
- Secret scanning
18-
7. Create a Sentry project for the app if needed (we want this for most apps):
19-
- Send initial exceptions to Sentry project for dev, stage, and prod environments to create them.
20-
- Create an alert for the prod environment only, with notifications sent to the appropriate team(s).
21-
- If *not* using Sentry, delete Sentry configuration from my_function.py and test_my_function_.py, and remove sentry_sdk from project dependencies.
22-
23-
# predict
24-
25-
This function will perform the following work:
3+
A lambda to apply a pre-trained algorithm to predict whether a given search string is in the form of a citation. This
4+
function will perform the following work:
265

276
1. Receives a set of parameters (submitted to the lambda via POST)
287
2. Loads a pickle file containing a pre-trained machine learning model.
298
3. Submits the parameters to the model to generate a binary prediction.
309
4. Returns the result of that prediction.
3110

11+
This lambda's operation is placed in context of our larger discovery ecosystem in the following diagram. The lambda is
12+
responsible for the shaded region.
13+
14+
```mermaid
15+
sequenceDiagram
16+
participant User
17+
participant UI
18+
participant Tacos
19+
box PaleVioletRed Citation detector
20+
participant Lambda
21+
participant S3
22+
end
23+
User->>UI: "popcorn"
24+
UI->>Tacos: "popcorn"
25+
Tacos-->Tacos: Extract features from "popcorn"
26+
Tacos-->Tacos: Load Lambda URL from Config Vars
27+
Tacos->>Lambda: {"features": {...}}
28+
Lambda-->Lambda: Load S3 address from ENV
29+
Lambda-->Lambda: Load default model filename "knn" from ENV
30+
Lambda-->>S3: Request "knn" model
31+
S3-->>Lambda: pkl file
32+
Lambda-->Lambda: Generate prediction
33+
Lambda->>Tacos: {"prediction": false}
34+
```
35+
3236
## Development
3337

3438
- To preview a list of available Makefile commands: `make help`
@@ -65,14 +69,6 @@ This function will perform the following work:
6569
"You have successfully called this lambda!"
6670
```
6771

68-
## Running a Specific Handler Locally with Docker
69-
70-
If this repo contains multiple lambda functions, you can call any handler you copy into the container (see Dockerfile) by name as part of the `docker run` command:
71-
72-
```bash
73-
docker run -p 9000:8080 predict:latest lambdas.<a-different-module>.lambda_handler
74-
```
75-
7672
## Environment Variables
7773

7874
### Required

0 commit comments

Comments
 (0)