Code Monkey home page Code Monkey logo

weight_tracker's Introduction

Weight Tracker

For the purpose of illustration, consider that this application is running on localhost:8080.

Technologies Used

Spring MVC, EasyRules, Morphia with MongoDB

###Part 1 : Infromation from Sensors Different sensors communicate with this application using RESTful web services. Each sensor sends weight information every 5 seconds by sending data to http://localhost:8080/weight using HTTP post request. The data can be as following:

{"timeStamp": "1502586399207", "value": "150"}

To view all the data between specific time-range use following HTTP Get request.

http://localhost:8080/weight?from=1502652953725&to=1502652953755
http://localhost:8080/weight?from=1502652953725
http://localhost:8080/weight?to=1502652953725

A sample output for HTTP Get request is shown below:

[
    {
        "id": { "timestamp": 1502652954, "machineIdentifier": 5833587, "processIdentifier": 12896, "counter": 6738920, "time": 1502652954000, "date": 1502652954000,"timeSecond": 1502652954 },
        "sesonrIP": "127.0.0.1",
        "timeStamp": 1502652953725,
        "value": 150
    }
]

###Part 2 : Notification based on Rules We want to notify user when the weight reported by a sensor falls below 10% or goes above 10%. To perform this, I have used EasyRules(http://www.easyrules.org).

This app will automatically identify the IP address of Sensor. If a sensor sends request for a first time then it will be considered as a base value.

Notify endpoint can be used to see all notifications or notifications within a range. You can use following HTTP GET requests:

http://localhost:8080/notify
http://localhost:8080/notify?from=1502651512023&to=1502651517035

How to use it

Clone it and use it. It has main method which will start server on it's own.

HTTP Get request can be modified to fetch sensor specific data.

weight_tracker's People

Watchers

 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.