An application which categorizes people based on the vitals (height and weight). It computes the health risk and category under which the people fall based n BMI(Body Mass Index).
People fall into category/health risk based on the bmi computed by height and weight vitals.
BMI Range | Category | Health Risk |
---|---|---|
18.4 and below | Underweight | Malnutrition risk |
18.5 - 24.9 | Normal weight | Low risk |
24.9 - 29.9 | Overweight | Enhanced risk |
29.9 - 34.9 | Moderately obese | Medium risk |
34.9 - 39.9 | Severely obese | High risk |
34.9 and above | Very severely obese | Very High risk |
This is a node application which runs with express, it loads the one-million-input.json
file found in src/resources
which contains one million sample vital data set that the app uses and serves the request through below mentioned endpoints. The data set is generated by a python script data_set_creator.py
.
There are two routes to the application
- Route to show people vitals http://localhost:3000/peopleVitals/10
- Route to show count of people classified as overweight along with the people vitals http:/localhost:3000/overweight/people/10
python3 data_set_creator.py
mv src/resources/one-million-input-1.json src/resources/one-million-input.json
- Ensure you have
npm
installed.
Follow the instructions for your platform here.
- Install all dependencies:
npm install
- To run jest tests
npm test
- To start the express application
npm start
The server is now running at localhost:3000
- Ensure you have
docker
installed.
Follow the instructions for your platform here.
- Build the container
docker build -t ${user-name}/${application-name}:${version} .
# example
docker build -t shra012/simple-vitals-calculator:latest .
- Run the container
docker run --name ${container-name} -p 8080:8080 -d ${user-name}/${application-name}:${version}
# example
docker run --name simple-vitals-calculator -p 8080:8080 -d shra012/simple-vitals-calculator:latest
This application is built with github actions and published to docker hub as a image. CI has a two individual jobs "test" and "docker".
- Test work flow runs npm tests on the current commit.
- Docker work flow builds and publishes the docker image to docker hub under the tag shra012/simple-vitals-calculator:latest.
- Data set file path is hard coded in the
app.js
which makes test use the actual data set.