Skip to content

Commit 87b58ec

Browse files
committed
Add test data, update README
1 parent 04cb7c6 commit 87b58ec

File tree

3 files changed

+43
-4
lines changed

3 files changed

+43
-4
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ dist/
2121
.project
2222
.settings
2323
.tern-port
24-
ui/
24+
ui/
25+
logs/

EcdSensorData.avro

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"namespace": "ecd-sensor-data",
3+
"name": "HealthSensorInputTopic",
4+
"type": "record",
5+
"fields": [
6+
7+
8+
{"name": "eventid", "type": {
9+
"type": "long",
10+
"arg.properties": {
11+
"iteration": { "start": 1}
12+
}
13+
}},
14+
15+
16+
{
17+
"name": "heartbeat",
18+
"type":
19+
{
20+
"type": "string",
21+
"arg.properties": {
22+
"regex": "([2-7]\\.[0-9][1-9]\\#){209}[2-7]\\.[0-9][1-9]"
23+
}
24+
}
25+
}
26+
27+
28+
]
29+
}

README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ Send a sample message (returns a prediction of 1.2104138026620321):
7171
Create derived stream in KSQL:
7272

7373
CREATE STREAM AnomalyDetection WITH (VALUE_FORMAT='AVRO') AS \
74-
SELECT TIMESTAMPTOSTRING(ROWTIME, 'yyyy-MM-dd HH:mm:ss') AS EVENT_TS, \
75-
eventid, \
74+
SELECT eventid, sensorinput, \
7675
CAST (anomaly(sensorinput) AS DOUBLE) as Anomaly \
7776
FROM healthsensor;
7877

@@ -125,7 +124,8 @@ Generates all readings with same/close timestamp though. To spread out over time
125124

126125
Run continually:
127126

128-
cat ecg_discord_test.msgs | pv -q -L 1000| kafkacat -b localhost:9021 -P -t HealthSensorInputTopic
127+
cd test-data
128+
./stream_loop_of_test_data_into_kafka.sh
129129

130130
### Generating random test data
131131

@@ -135,6 +135,15 @@ Run continually:
135135

136136
This uses the ksql-datagen tool (part of KSQL project) to generate test data. Whilst it provides random data, it's not very realistic to real-world data since it is truly random, rather than following a particular realistic pattern.
137137

138+
### Change anomaly threshold
139+
140+
TERMINATE CSAS_ANOMALYDETECTIONBREACH;
141+
DROP STREAM ANOMALYDETECTIONBREACH;
142+
CREATE STREAM AnomalyDetectionBreach AS \
143+
SELECT * FROM AnomalyDetectionAvro2 \
144+
WHERE Anomaly >2;
145+
146+
138147
## Stream to Elasticsearch
139148

140149
Create a Kafka Connect sink to stream all scored events to Elasticsearch:

0 commit comments

Comments
 (0)