Git Product home page Git Product logo

ridesafe-backend's Introduction

Build Status

RideSafe

RideSafe is an open source project which detects bikers' falls. This is possible thanks to intelligent algorithms and data collection.

Our smartphones have accelerometers to measure acceleration and gyroscope forces of individuals, these data can be used to analyse the behaviour: when walking, running, biking and even falling ! The self learning algorithms are able to improve the detection of a fall by analysing such data.

Go to:

RideSafe Backend

The RideSafe backend is in charge of receiving data from clients. It is Spring Boot + Kotlin based application backed by Cassandra database

How it works

This is a simple service that only receipts Acceleration data and store it into its database.

Examples

curl -X POST --data '{"timestamp": 1234567890, "acc_x": 0.323149, "acc_y": -2.5231, "acc_z": 9.28387237, "gyr_x": 917, "gyr_y": -46, "gyr_z": -148}' -H "Device-Id: your_device_uuid" -H "Content-type: application/json" http://localhost:8093/api/v1/acceleration
curl -X POST --data '[{"timestamp": 1234567890, "acc_x": 0.323149, "acc_y": -2.5231, "acc_z": 9.28387237, "gyr_x": 917, "gyr_y": -46, "gyr_z": -148}, ...]' -H "Device-Id: your_device_uuid" -H "Content-type: application/json" http://localhost:8093/api/v1/accelerations

Basically, you need to generate an unique device id (mandatory) and put it as request header to store data correctly into database.

... -H "Device-Id: your_device_uuid" ...

To make data storing valuable, sender can categorize it's activity to make predictive model more accurate.

curl -X POST --data '{"start_timestamp": 1234567890, "end_timestamp": "2334567890", "activity_type": "MOTORBIKING", "bike_type": "ROADSTER", "road_type": "CITY", "road_condition": "GOOD"}' -H "Device-Id: your_device_uuid" -H "Content-type: application/json" http://localhost:8093/api/v1/acceleration/form
  • start_timestamp <-> end_timestamp is the range date in milli seconds of your activity.
  • activity_type has to be chosen between the followings: MOTORBIKING, MOTORBIKE_FALLING, MOTORBIKE_PUSHING, WALKING, JOGGING, SITTING, STANDING, SLEEPING, USING_PHONE
  • bike_type can be null or: ROADSTER, TRAIL, SPORT, TOURING, SPORT_TOURING, CUSTOM, COLLECTOR
  • road_type can be null or: PRIVATE_ROAD, TRACK, CITY, ROAD_ONE_LANE, ROAD_MULTIPLE_LANE, FREEWAY, TRACK_RACE
  • road_condition can be null or: GOOD, FAIR, BAD, VERY_BAD

Running locally

Note: If you aim to use your own RideSafe backend, keep in mind that our data are open as well. You are better to use our provided Android connector and pushing data to [our open backend](#Open backend).

Prerequisites:

Cassandra schema

CREATE KEYSPACE ridesafe WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };

use ridesafe;

CREATE COLUMNFAMILY data (
device_id text,
user_id bigint,
"timestamp" bigint,
acc_x decimal,
acc_y decimal,
acc_z decimal,
gyr_x decimal,
gyr_y decimal,
gyr_z decimal,
activity_type text,
bike_type text,
road_type text,
road_condition text,
PRIMARY KEY ((device_id, user_id), "timestamp")
);

CREATE INDEX data_activity_type_idx ON data (activity_type);
CREATE INDEX data_bike_type_idx ON data (bike_type);
CREATE INDEX data_road_type_idx ON data (road_type);
CREATE INDEX data_road_condition_idx ON data (road_condition);

Build app

# Clone this repository
cd ridesafe-backend

# Build app
chmod +x gradlew
./gradlew build

# Run app
java -jar build/libs/rs-backend-0.1.jar

# it's now live on http://localhost:8093

You can configure application

cd ridesafe-backend/src/main/resources
vi application.yml

# then you have to rebuild the app

Our open backend

Instead of locally install the backend, you can target our backend server which is available at the following web address:

https://api.ridesafe.io

Contribute

There are many ways to contribute to RideSafe.

  • You are developer: You have an idea to make RideSafe better ? You want to clean the code ?.. Just send us a Pull Request :)
  • You are data scientist: Take a look at our activity recognition algorithms and tell us what do you think and how to improve them.
  • You are motorcycling professional: More we can test, more accurate are algorithms and fall detection. Contact us to see how you can contribute !

Demo

RideSafe is used into our Nousmotards app.

Who are we ?

RideSafe has been launched by Nousmotards. It is a service platform for bikers, created by 4 engineers and bikers:

We are creating a set of services tailored exclusively to the world of motorcycling! Nousmotards app is available on Mobile (Android, iOS) and on your browser.

Partners

We are looking for worldwide partners specialised in motorbike and/or technology.

More

The "Activity Recognition" project is based on the work of Ludwine Probst, which detects one type of activity from the accelerometer integrated in smartphones and a self-learning algorithm called machine learning.

The data and algorithms are available under the Apache license, this means that the changes and improvements made will be communicated to the community. Commercial use is unrestricted.

Contact

Contact us at [email protected] or [email protected]

Follow us: Twitter Facebook

ridesafe-backend's People

Contributors

evoxmusic avatar deimosfr avatar nivdul avatar

Stargazers

Cyril Beslay avatar Maxime de Chalendar avatar  avatar Kasper Kondzielski avatar Kenny Cason avatar OranginaRouge avatar Sébastien Deleuze avatar Gaëtan avatar  avatar

Watchers

Mehdi Lefebvre avatar James Cloos avatar  avatar Alexis DINQUER avatar  avatar Gaëtan avatar  avatar OranginaRouge avatar Benoît Leforestier avatar Rémi Demol avatar

Forkers

nivdul el-cocow

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.