Skip to content

Commit 36e8ae2

Browse files
authored
Merge pull request #83 from RADAR-base/release-0.4.0
Release 0.4.0
2 parents b5191c6 + dc87395 commit 36e8ae2

File tree

74 files changed

+1262
-2067
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1262
-2067
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ services:
77
- docker
88

99
env:
10-
DOCKER_COMPOSE_VERSION: 1.16.1
10+
DOCKER_COMPOSE_VERSION: 1.21.2
1111

1212
cache:
1313
directories:

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ RUN ./gradlew distTar && \
3232
tar xf build/distributions/*.tar && \
3333
rm build/distributions/*.tar
3434

35-
FROM confluentinc/cp-base:4.1.0
35+
FROM confluentinc/cp-base:5.0.0
3636

3737
MAINTAINER Nivethika M <nivethika@thehyve.nl> , Joris Borgdorff <joris@thehyve.nl> , Yatharth Ranjan <yatharth.ranjan@kcl.ac.uk>
3838

README.md

Lines changed: 71 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ RADAR-Backend provides an abstract layer to monitor and analyze streams of weara
1212
The following are the prerequisites to run RADAR-Backend on your machine:
1313

1414
- Java 8
15-
- [Confluent Platform 3.3.1](http://docs.confluent.io/3.3.1/installation.html) ( Running instances of Zookeeper, Kafka-broker(s), Schema-Registry and Kafka-REST-Proxy services ).
15+
- [Confluent Platform 5.0.0](http://docs.confluent.io/5.0.0/installation.html) ( Running instances of Zookeeper, Kafka-broker(s), Schema-Registry and Kafka-REST-Proxy services ).
1616
- SMTP server to send notifications from the monitors.
1717

1818
## Installation
@@ -49,24 +49,7 @@ The RADAR command-line has three subcommands: `stream`, `monitor` and `mock`. Th
4949
### RADAR-Backend streams
5050

5151
1. In `radar.yml`, Specify in which `mode` you want to run the application. There are two alternatives: `standalone` and `high_performance`. The `standalone` starts one thread for each streams without checking the priority, whereas the `high_performance` starts as many thread as the related priority value
52-
2. If `auto.create.topics.enable` is `false` in your Kafka `server.properties`, before starting you must create the topics manually. Create the following topics for Empatica E4 Streams
53-
- android_empatica_e4_acceleration
54-
- android_empatica_e4_acceleration_output
55-
- android_empatica_e4_battery_level
56-
- android_empatica_e4_battery_level_output
57-
- android_empatica_e4_blood_volume_pulse
58-
- android_empatica_e4_blood_volume_pulse_output
59-
- android_empatica_e4_electrodermal_activity
60-
- android_empatica_e4_electrodermal_activity_output
61-
- android_empatica_e4_heartrate_output
62-
- android_empatica_e4_inter_beat_interval
63-
- android_empatica_e4_inter_beat_interval_output
64-
- android_empatica_e4_sensor_status
65-
- android_empatica_e4_sensor_status_output
66-
- android_empatica_e4_temperature
67-
- android_empatica_e4_temperature_output
68-
- android_phone_usage_event
69-
- android_phone_usage_event_output
52+
2. If `auto.create.topics.enable` is `false` in your Kafka `server.properties`, before starting you must create the topics manually. The stream server will print what topics to create.
7053
3. Run `radar-backend` with configured `radar.yml` and `stream` argument
7154

7255
```shell
@@ -86,8 +69,13 @@ To get email notifications for Empatica E4 battery status, an email server witho
8669
# level of battery you want to monitor
8770
level: CRITICAL
8871
# list of email addresses to be notified
89-
email_address:
90-
- notify-me@example.com
72+
notify:
73+
- project_id: s1
74+
email_address:
75+
- test@thehyve.nl
76+
- project_id: s2
77+
email_address:
78+
- radar@thehyve.nl
9179
# host name of your email server
9280
email_host: localhost
9381
# port of email server
@@ -104,11 +92,16 @@ To get email notifications for Empatica E4 battery status, an email server witho
10492
disconnect_monitor:
10593
# timeout in milliseconds -> 5 minutes
10694
timeout: 300000
107-
email_address:
108-
- notify-me@example.com
10995
email_host: localhost
110-
email_port: 25
111-
email_user: noreply@example.com
96+
email_port: 25
97+
email_user: no-reply@example.com
98+
notify:
99+
- project_id: s1
100+
email_address:
101+
- test@thehyve.nl
102+
- project_id: s2
103+
email_address:
104+
- radar@thehyve.nl
112105
# temperature readings are sent very regularly, but
113106
# not too often.
114107
topics:
@@ -118,35 +111,36 @@ To get email notifications for Empatica E4 battery status, an email server witho
118111
3. For Source Statistics monitors, configure what source topics to monitor to output some basic output statistics (like last time seen)
119112

120113
```yaml
121-
statistics_monitors:
122-
# Human readable monitor name
123-
- name: Empatica E4
124-
# topics to aggregate. This can take any number of topics that may
125-
# lead to slightly different statistics
126-
topics:
127-
- android_empatica_e4_blood_volume_pulse_1min
128-
# Topic to write results to. This should follow the convention
129-
# source_statistics_[provider]_[model] with produer and model as
130-
# defined in RADAR-Schemas
131-
output_topic: source_statistics_empatica_e4
132-
# Maximum batch size to aggregate before sending results.
133-
# Defaults to 1000.
134-
max_batch_size: 500
135-
# Flush timeout in milliseconds. If the batch size is not larger than
136-
# max_batch_size for this amount of time, the current batch is
137-
# forcefully flushed to the output topic.
138-
# Defaults to 60000 = 1 minute.
139-
flush_timeout: 15000
140-
- name: Biovotion VSM1
141-
topics:
142-
- android_biovotion_vsm1_acceleration_1min
143-
output_topic: source_statistics_biovotion_vsm1
144-
- name: RADAR pRMT
145-
topics:
146-
- android_phone_acceleration_1min
147-
- android_phone_bluetooth_devices
148-
- android_phone_sms
149-
output_topic: source_statistics_radar_prmt
114+
stream:
115+
statistics_monitors:
116+
# Human readable monitor name
117+
- name: Empatica E4
118+
# topics to aggregate. This can take any number of topics that may
119+
# lead to slightly different statistics
120+
topics:
121+
- android_empatica_e4_blood_volume_pulse_1min
122+
# Topic to write results to. This should follow the convention
123+
# source_statistics_[provider]_[model] with produer and model as
124+
# defined in RADAR-Schemas
125+
output_topic: source_statistics_empatica_e4
126+
# Maximum batch size to aggregate before sending results.
127+
# Defaults to 1000.
128+
max_batch_size: 500
129+
# Flush timeout in milliseconds. If the batch size is not larger than
130+
# max_batch_size for this amount of time, the current batch is
131+
# forcefully flushed to the output topic.
132+
# Defaults to 60000 = 1 minute.
133+
flush_timeout: 15000
134+
- name: Biovotion VSM1
135+
topics:
136+
- android_biovotion_vsm1_acceleration_1min
137+
output_topic: source_statistics_biovotion_vsm1
138+
- name: RADAR pRMT
139+
topics:
140+
- android_phone_acceleration_1min
141+
- android_phone_bluetooth_devices
142+
- android_phone_sms
143+
output_topic: source_statistics_radar_prmt
150144
```
151145

152146
3. Run `radar-backend` with configured `radar.yml` and `monitor` argument
@@ -223,32 +217,30 @@ There are currently two APIs in RADAR-Backend: one for streaming data (RADAR-Str
223217

224218
RADAR-Stream is a layer on top of Kafka streams. Topics are processed by streams in two phases. First, a group of sensor streams aggregates data of sensors into predefined time windows (e.g., 10 seconds). Next, internal topics aggregate and transforms data that has already been processed by an earlier stream.
225219

226-
KafkaStreams currently communicates using master-slave model. The [MasterAggregator][1] defines the stream-master, while [AggregatorWorker][2] represents the stream-slave. The master-stream creates, starts and stops a list of stream-slaves registered with the corresponding master.
227-
While the classical Kafka Consumer requires two implementations to support standalone and group executions, the AggregatorWorker provides both behaviors with one implementation.
220+
KafkaStreams currently communicates using master-slave model. The [StreamMaster][1] defines the stream-master, while [StreamWorker][2] represents the stream-slave. The master-stream creates, starts and stops a list of stream-slaves registered with the corresponding master. While the classical Kafka Consumer requires two implementations to support standalone and group executions, the StreamWorker provides both behaviors with one implementation.
228221

229222
To extend the RADAR-Stream API, follow these steps (see the `org.radarcns.passive.empatica` package as an example):
230223

231-
- Create a stream group by overriding [GeneralStreamGroup][8]. Use its `createSensorStream` and `createStream` methods to create the stream definitions.
232-
- For each topic, create a [AggregatorWorker][2].
233-
- Define the [MasterAggregator][1]
224+
- For each topic, create a [StreamWorker][2] or more conveniently extend [SensorStreamWorker][6].
225+
- Add the stream topic to the `stream: streams: [{class: MyClass}]` configuration
226+
234227

235228
#### Empatica E4
236229

237-
Currently, RADAR-Backend provides implementation to stream, monitor, store Empatica E4 topics data produced by RADAR-AndroidApplication.
238-
[E4Worker][11] is the [MasterAggregator][1]. The stream group [E4Streams][14] defines the following sensor topics:
230+
Currently, RADAR-Backend provides implementation to stream, monitor, store Empatica E4 topics data produced by RADAR-AndroidApplication. It defines the following streams:
239231

240-
- [E4Acceleration][15]: it aggregates data coming from accelerometer
241-
- [E4BatteryLevel][16]: it aggregates battery level information
242-
- [E4BloodVolumePulse][17]: it aggregates blood volume pulse data
243-
- [E4ElectroDermalActivity][18]: it aggregates electrodermal activity informations
244-
- [E4InterBeatInterval][20]: it aggregates inter-beat-interval data
245-
- [E4Temperature][21]: it aggregates data coming form temperature sensor
232+
- [E4Acceleration][15] aggregates data coming from accelerometer
233+
- [E4BatteryLevel][16] aggregates battery level information
234+
- [E4BloodVolumePulse][17] aggregates blood volume pulse data
235+
- [E4ElectroDermalActivity][18] aggregates electrodermal activity informations
236+
- [E4InterBeatInterval][20] aggregates inter-beat-interval data
237+
- [E4Temperature][21] aggregates data coming form temperature sensor
246238

247239
And one internal topic:
248240

249241
- [E4HeartRate][19]: starting from the inter-beat-interval, this aggregator computes the heart rate
250242

251-
[DeviceTimestampExtractor][10] implements a [TimestampExtractor](http://docs.confluent.io/3.1.2/streams/javadocs/index.html) such that: given in input a generic Apache Avro object, it extracts a field named `timeReceived`. [DeviceTimestampExtractor][10] works with the entire set of sensor schemas currently available.
243+
[DeviceTimestampExtractor][10] implements a [TimestampExtractor](http://docs.confluent.io/5.0.0/streams/javadocs/index.html) such that: given in input a generic Apache Avro object, it extracts a field named `timeReceived`. [DeviceTimestampExtractor][10] works with the entire set of sensor schemas currently available.
252244

253245
#### Android Phone
254246

@@ -269,19 +261,17 @@ Monitors can be used to evaluate the status of a single stream, for example whet
269261
```
270262
- the default log path is the jar folder
271263

272-
[1]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/stream/aggregator/MasterAggregator.java
273-
[2]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/stream/aggregator/AggregatorWorker.java
264+
[1]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/stream/StreamMaster.java
265+
[2]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/stream/StreamWorker.java
274266
[3]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/monitor/AbstractKafkaMonitor.java
275267
[4]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/monitor/KafkaMonitorFactory.java
276268
[5]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/monitor/DisconnectMonitor.java
277-
[8]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/topic/GeneralStreamGroup.java
278-
[10]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/stream/aggregator/DeviceTimestampExtractor.java
279-
[11]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/empatica/E4Worker.java
280-
[14]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/empatica/topic/E4Streams.java
281-
[15]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/empatica/streams/E4Acceleration.java
282-
[16]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/empatica/streams/E4BatteryLevel.java
283-
[17]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/empatica/streams/E4BloodVolumePulse.java
284-
[18]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/empatica/streams/E4ElectroDermalActivity.java
285-
[19]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/empatica/streams/E4HeartRate.java
286-
[20]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/empatica/streams/E4InterBeatInterval.java
287-
[21]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/empatica/streams/E4Temperature.java
269+
[6]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/stream/SensorStreamWorker.java
270+
[10]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/stream/DeviceTimestampExtractor.java
271+
[15]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/stream/empatica/E4Acceleration.java
272+
[16]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/stream/empatica/E4BatteryLevel.java
273+
[17]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/stream/empatica/E4BloodVolumePulse.java
274+
[18]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/stream/empatica/E4ElectroDermalActivity.java
275+
[19]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/stream/empatica/E4HeartRate.java
276+
[20]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/stream/empatica/E4InterBeatInterval.java
277+
[21]: https://github.com/RADAR-base/RADAR-Backend/blob/master/src/main/java/org/radarcns/stream/empatica/E4Temperature.java

build.gradle

Lines changed: 30 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ plugins {
22
// Apply the java plugin to add support for Java
33
id 'java'
44
id 'application'
5-
id 'com.jfrog.bintray' version '1.7.3' apply false
5+
id 'com.jfrog.bintray' version '1.8.1' apply false
66

77
}
88

@@ -11,49 +11,50 @@ plugins {
1111
//---------------------------------------------------------------------------//
1212

1313
group = 'org.radarcns'
14-
version = '0.3.0'
15-
16-
ext.description = 'Kafka backend for processing device data.'
14+
version = '0.4.0'
1715

1816
mainClassName = 'org.radarcns.RadarBackend'
1917
applicationDefaultJvmArgs = ["-Dlog4j.configuration=log4j.properties"]
2018

21-
ext.githubRepoName = 'RADAR-CNS/RADAR-Backend'
2219

2320
targetCompatibility = '1.8'
2421
sourceCompatibility = '1.8'
2522

26-
ext.boundaryVersion = '1.0.6'
27-
ext.codacyVersion = '1.0.10'
28-
ext.confluentVersion = '4.1.0'
29-
ext.hamcrestVersion = '1.3'
30-
ext.kafkaVersion = '1.1.0'
31-
ext.jacksonVersion='2.8.5'
32-
ext.javaMailVersion = '1.5.6'
33-
ext.junitVersion = '4.12'
34-
ext.mathVersion = '3.0'
35-
ext.findbugVersion = '3.0.1'
36-
ext.commonsCliVersion = '1.2'
37-
ext.mockitoVersion = '2.2.29'
38-
ext.radarCommonsVersion = '0.8.2'
39-
ext.radarSchemasVersion = '0.3.2'
40-
ext.subethamailVersion = '3.1.7'
41-
ext.jsoupVersion = '1.10.2'
42-
ext.slf4jVersion = '1.7.25'
43-
ext.log4jVersion = '1.2.17'
44-
ext.avroVersion = '1.8.2'
45-
46-
ext.githubUrl = 'https://github.com/' + githubRepoName + '.git'
47-
ext.issueUrl = 'https://github.com/' + githubRepoName + '/issues'
48-
ext.website = 'http://radar-cns.org'
23+
ext {
24+
moduleDescription = 'Kafka backend for processing device data.'
25+
githubRepoName = 'RADAR-Base/RADAR-Backend'
26+
27+
28+
githubUrl = 'https://github.com/' + githubRepoName + '.git'
29+
issueUrl = 'https://github.com/' + githubRepoName + '/issues'
30+
website = 'http://radar-base.org'
31+
32+
codacyVersion = '4.0.2'
33+
confluentVersion = '5.0.0'
34+
hamcrestVersion = '1.3'
35+
kafkaVersion = '2.0.0-cp1'
36+
jacksonVersion = '2.9.6'
37+
javaMailVersion = '1.6.1'
38+
junitVersion = '4.12'
39+
findbugVersion = '3.0.2'
40+
commonsCliVersion = '1.4'
41+
mockitoVersion = '2.19.1'
42+
radarCommonsVersion = '0.10.0'
43+
radarSchemasVersion = '0.4.0'
44+
subethamailVersion = '3.1.7'
45+
jsoupVersion = '1.11.3'
46+
slf4jVersion = '1.7.25'
47+
log4jVersion = '1.2.17'
48+
avroVersion = '1.8.2'
49+
}
4950

5051
//---------------------------------------------------------------------------//
5152
// Sources and classpath configurations //
5253
//---------------------------------------------------------------------------//
5354

5455
// In this section you declare where to find the dependencies of your project
5556
repositories {
56-
jcenter()
57+
mavenCentral()
5758
// Non-jcenter radar releases
5859
maven { url 'http://dl.bintray.com/radar-cns/org.radarcns' }
5960
// Kafka/confluent releases
@@ -100,12 +101,6 @@ dependencies {
100101
runtimeOnly group: 'org.slf4j', name: 'slf4j-log4j12', version: slf4jVersion
101102
}
102103

103-
run {
104-
if ( project.hasProperty("appArgs") ) {
105-
args Eval.me(appArgs)
106-
}
107-
}
108-
109104
if (!hasProperty('profile')) {
110105
ext.profile = 'dev'
111106
}

config/pmd/ruleset.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
<exclude name="PositionLiteralsFirstInComparisons"/>
5858
<exclude name="ConfusingTernary"/>
5959
<exclude name="UseVarargs"/>
60+
<exclude name="OptimizableToArrayCall"/>
6061
</rule>
6162

6263
<rule ref="rulesets/java/codesize.xml">

gradle/codacy.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ jacocoTestReport {
2828
task sendCoverageToCodacy(type: JavaExec, dependsOn: jacocoTestReport) {
2929
main = 'com.codacy.CodacyCoverageReporter'
3030
classpath = configurations.codacy
31-
args = ['-l', 'Java', '-r', "${buildDir}/reports/jacoco/test/jacocoTestReport.xml"]
31+
args = ['report', '-l', 'Java', '-r', "${buildDir}/reports/jacoco/test/jacocoTestReport.xml"]
3232
}

0 commit comments

Comments
 (0)