Skip to content

Commit

Permalink
Merge pull request #10 from papaemmelab/add-file-endpoint
Browse files Browse the repository at this point in the history
🗂️ Add endpoint for file annotation
  • Loading branch information
juanesarango authored Dec 20, 2023
2 parents b78bc9c + a3e2ab5 commit c55b327
Show file tree
Hide file tree
Showing 9 changed files with 223 additions and 34 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Deploy to AWS Lambda using Serverless

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 18

- name: Install dependencies
run: npm ci

- name: Build and Compile
run: npm build

- name: Run Tests
run: npm test

- name: Deploy
run: npx serverless deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ test/data/*-out.*
test.csv

# Serverless artifacts
.serverless
.serverless

# API uploads
uploads
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ API and CLI of the Molecular International Prognostic Scoring System (IPSS-M) fo

- [📖 IPSS-M Publication](#page_with_curl-ipss-m-publication)
- [🚀 API Usage](#rocket-api-usage)
- [👾 CLI Usage](#alien-cli-usage)
- [🤖 CLI Usage](#robot-cli-usage)
- [🔥 Using it as a node/javascript package](#fire-using-it-as-a-nodejavascript-package)
- [💥 IPSS-M](#boom-ipss-m)
- [⚡️ IPSS-R and IPSS-R (Age adjusted)](#zap-ipss-r-and-ipss-r-age-adjusted)
Expand Down Expand Up @@ -139,7 +139,7 @@ $ curl \
}
```
## :alien: CLI Usage
## :robot: CLI Usage
You can use the command line interface to annotate a file with patients, where each row is a patient and each column is a variable.
Expand Down
25 changes: 25 additions & 0 deletions openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,31 @@ paths:
$ref: '#/components/schemas/IpssrResponse'
'500':
description: An error occurred while calculating IPSS-R risk score
/annotateFile:
post:
summary: Annotate a file with patients, with IPSS-M and IPSS-R risk scores.
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
properties:
file:
type: string
format: binary
description: csv/tsv or excel file to be annotated. One patient per row.
responses:
'200':
description: Successful operation. Stream the annotated file as CSV.
content:
text/plain:
schema:
type: string
'400':
description: Bad request
'500':
description: An error occurred while annotating the file.
components:
schemas:
Clinical:
Expand Down
126 changes: 107 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@
"vitest": "^0.34.4"
},
"dependencies": {
"@types/multer": "^1.4.11",
"exceljs": "^4.3.0",
"express": "^4.18.2",
"ipssm": "^1.0.4",
"joi": "^17.11.0",
"multer": "^1.4.5-lts.1",
"papaparse": "^5.4.1",
"serverless-http": "^3.2.0",
"yargs": "^17.7.2"
Expand Down
Loading

0 comments on commit c55b327

Please sign in to comment.