Skip to content

Integrate New Apps with Radar Platform

Yatharth Ranjan edited this page Nov 20, 2017 · 24 revisions

Integrate New Apps with Radar Platform

The Radar platform is a healthcare pipeline to obtain clinical and health data from various active and passive sources like questionnaires, wearable devices, phone sensors, etc. The platform is open source and is based on top of apache kafka ADD URL and is built as such to accommodate easy integration of future devices and applications to the platform. The main components of the system that will be required for integration of new devices are-

  1. Management Portal ADD URL - This is the central management service of the Radar Platform. It offers services like authorization of different components, Creating and storing info of Subjects, Sources, Studies( or Projects),etc, Creating relationship between different components (like registering a source to a subject), etc.
  2. Rest Proxy ADD URL - Since the platform is based on Apache Kafka ADD URL, we can either send data directly into kafka via a producer or use a rest proxy. This is for sending data into kafka topics through a RESTful interface. This a confluent provided product so we can post data using http requests.
  3. Schema Registry ADD URL - The data we send into the platform from our app or device will be converted to AVRO ADD URL format before going into kafka topics. For converting our data to avro, Rest proxy needs to know the schema (or format) of the data we are sending. These schemas are stored in the schema registry so that we don't have to send them with each request as this increases the latency.

Step 1: Get the Access Token from the Management Portal

The access token from Management Portal(MP) is required for authorization across the platform. Without this token, you can neither register your device nor send data into the platform. There are 2 ways in which access token can be obtained from the MP. They are discussed in the following sub-sections

1. Get Token by scanning the QR code

This method involves obtaining two tokens. This method is appropriate for applications that need to register themselves to a subject and send data for that subject. Note that this method will only give you access rights for that particular subject. If you need additional rights, then the other method may be more appropriate for your use-case. You can use any available library for scanning the QR code. A QR code is available on the Project's page in which the subject is enrolled in. When you select pair app option on the subject on the management portal, you will be presented with a menu where you can generate a QR code for your app type. ADD IMAGE OF MP QR CODE PAGE This QR code contains a refresh token. This refresh token can be used used to query the Management Portal for an access token using the client id and secret as authorization header. The QR code has information as shown in the sample below -

2. Get Token by using client credentials

Step 2: Register your device or App as a source to a Subject

Step 3: Get the schema version for the Topic

1. Get versions of the schema

2. Get the id of the latest version of the schema

Step 4: Post data to the Platform

1. Add the access token to the request header

2. Create request body

3. Post the record to kafka

Step 5: Additional enhancements

Get the latest schema periodically

Refresh the token before it expires

Use OAuth client libraries if Java and client credentials grant type