Giter VIP home page Giter VIP logo

heart_rate_databases_introduction's Introduction

heart_rate_databases_introduction Build Status

Databases Assignment (here).

ABOUT

Server code can be found in flaskhandler.py. The accompanying client program is found in client.py.

This server handles GET and POST requests for the following instances:

  • POST /api/heart_rate : finds and adds user information or creates a new user given json input from client.py
  • GET /api/heart_rate/<user_email> : finds heart rate information associated with the specified user email and outputs all of the user's heart rates
  • GET /api/heart_rate/average/<user_email> : finds user information associated with the specified user email and outputs the average user heart rate over all heart rates within the database
  • POST /api/heart_rate/interval_average : finds user information and returns the average user heart rate over a user specified time interval that was sent to the server as json input data found within client.py ; also returns whether the average is considered tachycardic given the user's age
  • GET /api/heart_rate/get_data/<user_email> : finds user information associated with the specified user email and returns heart rate and accompanying time stamp information for the given user

The client.py file can be altered to reflect changing user input. Given the server and client files, the program should be able to handle all instances stated above.

GETTING STARTED

To get started with this program, you first need to clone this repository onto your local machine. Make sure that all python dependencies are installed onto your machine using

pip install -r requirements.txt

To start running the server, first you need to make sure the database is up and running using docker.

docker run -v $PWD/db:/data/db -p 27017:27017 mongo

Next, you can run flaskhandler.py with gunicorn to run the server using

gunicorn --bind 0.0.0.0:5000 flaskhandler:app

or substitute with the address of your virtual machine if you wish to run the server there instead of on your local machine. The client.py code will also need to be edited (lines 38, 48, 59-60, 79, and 90-91) based on where you choose to run your server and/or database. All other python files in this repo contain functions called by flaskhandler.py and are needed in order for the server to function properly. This includes:

  • average.py : calculates average heart rate
  • filtering.py : helps retrieve user-specified heart rate data
  • main.py : template for finding and creating a new user in mongo
  • models.py : model file for a user in the mongo database
  • tachycardia.py : determines whether a given heart rate is considered tachycardic given the patient's age

Once the database and server are running, you can run client.py using

python client.py

The client file contains a template json data setup for user POST requests that can be altered to reflect varied user input.

heart_rate_databases_introduction's People

Contributors

pcg15 avatar davidbradway avatar suyashkumar avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.