Skip to content

Praneet460/20210413-praneetnigam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BMI Calculator API

It is a bmi API, build purely using Python (programming language), Django and Django-Rest-Framework (opensource framework written in python).

Current Features

Listing the features of the API

  • Given weight and height, calculates bmi index, bmi category and health risk
  • Gives the stats of count of each category of bmi category and health risk

API EndPoints

API Endpoints defines the structure of the API and how end users access data from our application using the HTTP methods - POST

Endpoint HTTP Method CURD Method Result
api/v1/bmi POST CREATE Create 3 new key-value pair bmi index, bmi catg and health risk
api/v1/bmi/stats POST CREATE Gives back common stats of the data

URL of Main Code

  • API View Ends Path : core.bmi.views
  • BMI Business Logic Path : core.bmi.utils
  • API Tests Path : core.bmi.tests

Run Tests

  • python manage.py test bmi.tests.view.BMITests
    • 2 Tests Passed

Example

  • BMI Details
    • POST http://localhost:8000/api/v1/bmi/

      • Body
        [{"Gender": "Male", "HeightCm": 171, "WeightKg": 96 }, 
        { "Gender": "Male", "HeightCm": 161, "WeightKg":85 }]
        
      • Response
        [
            {
                "Gender": "Male",
                "HeightCm": 171,
                "WeightKg": 96,
                "bmi": 56.14,
                "bmi_catg": "Very Severely Obese",
                "health_risk": "Very High Risk"
            },
            {
                "Gender": "Male",
                "HeightCm": 161,
                "WeightKg": 85,
                "bmi": 52.8,
                "bmi_catg": "Very Severely Obese",
                "health_risk": "Very High Risk"
            }
        ]
        
    • POST http://localhost:8000/api/v1/bmi/stats

      • Body
        [{"Gender": "Male", "HeightCm": 171, "WeightKg": 96 }, 
        { "Gender": "Male", "HeightCm": 161, "WeightKg":85 }]
        
      • Response
        {
            "Very Severely Obese": 2,
            "Very High Risk": 2
        }
        

About

BMI Calculator API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages