Giter VIP home page Giter VIP logo

heart_rate_databases_starter's Introduction

heart_rate_databases_starter

Starter codebase for BME590 Databases Assignment (which can be found here).

To get started with this sample code, you first need to get the mongodb program running. To do this, simply run

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

either on your local machine (if you have docker installed there) or on a virtual machine you have access to where you can first install docker.

๐Ÿ‘€ if you are running your mongodb database on a virtual machine, you need to replace the connect URI string in main.py. Replace localhost with a VM address, like so:

connect("mongodb://vcm-0000.vm.duke.edu:27017/heart_rate_app") # open up connection to db

once your database is running and your connection string is set, you can run the starter program by running main.py after activating your virtualenv and installing all the dependencies listed in requirements.txt.

python main.py

The Assignment + Hints

This starter code is not a flask server like you need to build in your assignment--main.py is an example module that contains several useful functions for creating a User (create_user) and updating a User with a new heart rate and heart rate timestamp (add_heart_rate).

models.User is a data model that represents the entity we want to store and retreive from the database. You can see that User is just a python class with some properties.

๐Ÿ‘€ When writing the POST /api/heart_rate endpoint, you need to first check if the user with the given email already exists in the database. If so, then you can use add_heart_rate to append a heart rate measurement to that user. If not, then you would want to create_user. I did not explicitly show you how to check if a user already exists in the database, but this is something you should be able to figure out based on the sample code + google + office hours!

heart_rate_databases_starter's People

Contributors

suyashkumar avatar davidbradway avatar

Stargazers

 avatar gz_f avatar Parul Singh avatar Mark Palmeri avatar  avatar

Watchers

James Cloos avatar  avatar  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.