This application can calculate any person's BMI using their Weight (in kg) and Height (in cm). In addition to this the application can also provide an information regarding the BMI Category and Health risk based on the calculated BMI.
This application can be used as a standalone data processor from the Database or can be exposed externally as an API.
- 18.4 and below
- 18.5 - 24.9
- 25 - 29.9
- 30 - 34.9
- 35 - 39.9
- 40 and above
BMI Range | BMI Category | Health Risk |
---|---|---|
18.4 and below | Underweight | Malnutrition risk |
18.5 - 24.9 | Normal weight | Low risk |
25 - 29.9 | Overweight | Enhanced risk |
30 - 34.9 | Moderately Obese | Medium risk |
35 - 39.9 | Severely Obese | High risk |
40 and above | Very Severely Obese | Very High risk |
To run this application on your location system, the following installations are needed:
- Node.Js
- NPM Module
- MongoDB
-
Clone the repository
-
Add your MongoDB localhost path in .env.example and rename it to .env
-
Run
npm run setup-app
- This is will do a clean installation of all the node modules and setup your MongoDB database with sample documents which can be used to calculate BMI.
-
Either run
npm run dev
to start the server in Development mode -
Or run
npm run start
to start the server in Production mode
URL: http://(localhost):(port)
{URL}/patients
Description: This request will fetch all the records from the Database
Authorization: Basic Auth (Username & Password)
{URL}/patients
Description: This request will calculate the BMI, BMI Category and Health Risk in the Database for documents where BMI is null
Authorization: Basic Auth (Username & Password)
Request Sample
{}
Response Sample
{ "status": 200, "message": "6 Documents Modified" }
{URL}/calculate
Description: This request will calculate the BMI, BMI Category and Health Risk
Authorization: Basic Auth (Username & Password)
Request Sample
{ "Gender": "Male", "HeightCm": 135, "WeightKg": 97 }
Response Sample
{ "HeightCm": 135, "WeightKg": 97, "BMI": 53.22, "Health Risk": "Very High risk", "BMI Category": "Very severely Obese" }
{URL}/insert
Description: This request will calculate the BMI, BMI Category and Health Risk for the request data and insert into the database
Authorization: Basic Auth (Username & Password)
Request Sample
{ "Gender": "Male", "HeightCm": 135, "WeightKg": 97 }
Response Sample
{ "HeightCm": 135, "WeightKg": 97, "BMI": 53.22, "Health Risk": "Very High risk", "BMI Category": "Very severely Obese" }