Skip to content

Service for ingesting the tracking Points into the Database (in the early stage also for the computing)

Notifications You must be signed in to change notification settings

BinaryRepublic/triangl-tracking-ingestion-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CircleCI

Triangl-Tracking-Ingestion-Service

Url: https://api.triangl.io/tracking-ingestion-service/

Full API Documentation: https://api.triangl.io/tracking-ingestion-service/swagger-ui.html

Place in the Infrastructure: https://github.com/codeuniversity/triangl-infrastructure

For faster development this service currently combines the Computation and the Ingestion Service that we want to have seperate in the later stage

Routes

  • Send one DataPoint POST /tracking
  • Send multiple DataPoints POST /tracking/multiple
  • Get Routers lastSeen Timestamp GET /routers/lastSeen
  • Read the buffer GET /read

What does it do

This Service is an Endpoint for the Routers to send their DataPoints to. These DataPoints currently look the like the following:

{
    var routerId: "TheRouterId",

    var deviceId: "TrackedDeviceId",

    timestampString: "2018-10-15 09:00:00",   //GMT+00:00

    var signalStrength: -255
}

The service then:

  • calculates the location of the TrackedDevice,
  • hashes the Mac Address
  • inserts it into the Google Datastore
  • notifies the Pipeline over Google Pub/Sub about the new Tracking Point in the Datastore.

The Pipeline can then apply the changes to the Serving SQL Database.

ComputeLocation function

The location calculation function works in the following way:

It starts in a second kotlin coroutine and then checks every 5 seconds if there are some locations to compute.

The computation currently works based on the RSSI (Received Signal Strength Indication). The location of the TrackedDevice is currently the location of the nearest router that tracked him. Lateration is currently still work in Progress.

Tools used

Environment Variables

The following Environment variables are need for this service:

GOOGLE_APPLICATION_CREDENTIALS:{pathToGoogleKeyFile.json}
mac.salt:{your-salt-for-hashing}
mac.pepper:{your-pepper-for-hashing}

Be aware that salt and pepper can't change once some DatabaseEntries are created with it.

Moreover, you can set the pubsub.topicId env variable via the console to override the standard value pubsub.topicId=test.

Run

  • With Gradle

    GOOGLE_APPLICATION_CREDENTIALS=/path/to/google/key/file.json mac.salt:{your-salt-for-hashing} mac.pepper:{your-pepper-for-hashing} ./gradlew bootRun

About

Service for ingesting the tracking Points into the Database (in the early stage also for the computing)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages