Skip to content
Ashutosh Sahu edited this page Jun 16, 2021 · 1 revision

Welcome to the Health Predictor API wiki here you can find all API calls and how they work.

base url = https://nutrihelpb.herokuapp.com

You can access the database sample using https://nutrihelpb.herokuapp.com/col/test for any testing references.

Login API

The login process is available at API https://nutrihelpb.herokuapp.com with endpoint /login. This endpoint works for all POST requests having payload format -

{
   "email" :  "string", //required
   "otp" :  "string"    //optional
}
  • if only the email field is provided, a user gets created (if not exists) and an OTP is mailed to that user.
  • again requesting the same endpoint with the above format, will match the top, and gives a response.

patient activities API.

  • When a patient logins, an userid will be sent to the response.
  • this userid will be used for all requests and further API calls.
  • save It in shared preferences for use.

patient schema format example

{
    "age" : 33,      # integer
    "gender" : "M",  # valid types ["M", "F"]
    "id" : { "$oid": "60978a1146ec034af162591d" },   #MongoDB ObjectId instance.
    "mobile" : "9109087293",   # string
    "name" : "Amit Sharma",   # string
    "stats" : {
        "family_diabetes" : (true, false),  # bool
        "bp" : 223,   # (unit : mmHg) integer
        "physically_active" : ("no","low","mid","high"),  # any one string
        "weight" : 78,   # (unit : kg) integer
        "height" : 5.6,  # (unit : inch) integer
        "smoke" : (true, false),    # bool
        "alcolol" : (true, false), # bool
        "sleep" : 8,  # (unit: hours, range = (4,11))  integer
        "sound_sleep" : (true,false),  # bool
        "medicine" : (true,false),     # bool;
        "junk_food" : ("no","low","mid","high"),   # any one string
        "stress" : ("no","low","mid","high"),   # any one string
        "pregnancies" : 0, # integer
        "gestational" : (true,false), # bool
        "urination" : ("normal","high") # any one string
    }
}

Api Calls

POST /patients

  • adds a patient to the given user's patient list. request format:
{
        "userid": "60978a1146ec034af162591d",  # string
        "patient": {
            # as given in above schema.
            # don't provide fields => id
            # required  => age, gender, mobile, name
            # stats are optional, but still providing them with default values will reduce chances of error.
        }
}

GET /patients/{userid}

  • gives a list of all patients who belong to a given userid
  • return only name, age, gender, mobile of patient

GET /patients/{userid}/{patientid}

  • gives the whole details of a single patient.

PUT /patients/{userid}/{patientid}

  • modifies a single patient with the provided fields.
  • provide only those fields which need to be modified. request payload example:
{
    "age" : 24,   
    "mobile" : "91090873343",  
    "name" : "Amit Verma", 
    "stats" : {
        "family_diabetes" : true, 
        "physically_active" : "mid"
}

DELETE /patients/{userid}/{patientid}

  • deletes a patient from the user who matches the given patient id.

Reports Api Calls

GET /reports/diabetes/{userid}/{patientid}

  • generate and return diabetes report of a patient.
  • the response contains id, type of report, probability of disease, patient_name and patient_id

GET /reports/{userid}

  • gives a list of all reports generated by a given user

GET /reports/{userid}/recent

  • gives recently generated reports

GET /reports/{userid}/{reportid}

  • returns a specific report.

DELETE /reports/{userid}/{reportid}

  • deletes the specified report

Tips of the DAy

GET /daily_tips

  • return a random health tip.