Skip to content

papaemmelab/aml_webapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

321 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

doi badge

Website Health

Test mutations of API

AML Risk Prediction Web App

Web app Risk Calculator that takes in demographic / clinical / genetic variables of an AML patient, and outputs risk classifications: Tazi et al. Nature Communications 2022 and the ELN 2017. As well as cohort-level risk stratifications.

AML Web Logo See it live at: https://aml-risk-model.com

๐Ÿ‘ฉ๐Ÿผโ€๐Ÿ’ป Development

# Install python deps and start flask api
pip install -r requirements.txt
./run_api                # On port 5000

# Install node deps and start Vue dev server
nvm use v14.21
yarn --cwd web install
yarn --cwd web serve     # On port 8080

๐Ÿš€ Deployments

# Install serveless
nvm use v14.21
npm i -g serverless

# Install serverless plugins
sls plugin install -n serverless-wsgi
sls plugin install -n serverless-python-requirements
  • Authenticate: The different components are deployed in several AWS services, and using serverless. Make sure to have in your environment the following variables:
# .env
export AWS_ACCESS_KEY_ID=<aws-access-key-id>
export AWS_SECRET_ACCESS_KEY=<aws-secret-key>

export SERVERLESS_ACCESS_KEY=<serverless-secret-key>

โ—๏ธ Make sure to authenticate to both, by running aws configure and sls login.

๐Ÿ—ƒ๏ธ Backend

  • Python API: The API is deployed using serverless to AWS lambda and API Gateway.
nvm use v14.21
sls deploy
  • R Risk Model: the R script is deployed to AWS lambda as a function:
cd model
sh update-handler.sh
  • Static assets: like cached dataframes and images are deployed to an S3 bucket:
sh sync-s3.sh
# or
aws s3 sync s3/static s3://aml-app/static --acl public-read

๐Ÿ–ผ Frontend

  • Vue Webapp: It has CI/CD to be automatically deployed through AWS Amplify. Even each Pull Request get its own Preview hosted site. So you just need to commit to master or create a new PR to get this deployed.

Other useful information

๐ŸŒ Deploy to Custom Domain

Register a domain using AWS Route 53, and register a subdomain api.<your-domain> as a simple

๐Ÿฆพ Lambda Config

Required ARN are in model/update-handler.sh to build a basic R lambda layer.

How to build a custom R layer and add packages:

  1. Use docker lambda R image: docker run --entrypoint '' -it -v $PWD:/mnt lambda-r:build-3.6.2 bash.
  2. Get where R lib are by .libPaths() /opt/R/library.
  3. Install addtional packages in /home by setting .libPaths(c("/home", .libPaths())).
  4. Copy the package folder from /mnt to build/r/build/library
  5. Add package name in build/aml_app_n/build.sh (each layer is limited to 70MB. If the script has a lot of packages, split it into many layers. The maximum number of layers is 5 and the max cumulative size is 250MB)
  6. Run build/build.sh
  7. Run build/deploy.sh 3.6.2
  8. Add ARN to Lambda

๐Ÿงฎ Quickly create aml-model Lambda function

You can use the aml-model.yaml file to quickly create the aml-model Lambda function using AWS CloudFormation

๐Ÿ‘€ Cloudwatch

Debug Queries in AWS console.

About

๐ŸŽฏ AML Risk Predictor App

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors