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.
See it live at: https://aml-risk-model.com
# 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- Install deployment tools: Make sure you have aws-cli and serverless installed:
# 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.
- 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- 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.
Register a domain using AWS Route 53, and register a subdomain api.<your-domain> as a simple
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:
- Use docker lambda R image:
docker run --entrypoint '' -it -v $PWD:/mnt lambda-r:build-3.6.2 bash. - Get where R lib are by
.libPaths()/opt/R/library. - Install addtional packages in
/homeby setting.libPaths(c("/home", .libPaths())). - Copy the package folder from
/mnttobuild/r/build/library - 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) - Run
build/build.sh - Run
build/deploy.sh 3.6.2 - Add ARN to Lambda
You can use the aml-model.yaml file to quickly create the aml-model Lambda function using AWS CloudFormation
Debug Queries in AWS console.