Time Series Analysis - Dataflow
Tags: apachekafka, apachenifi, apacheflink
Published: 2020-05-11 16:03:57

---
title: Time Series Analysis - Dataflow
published: true
date: 2020-05-08 21:31:00 UTC
tags: apache kafka,apache nifi,apache-flink,apache-kafka
canonical_url: 
---

  

  

  

[![](https://1.bp.blogspot.com/-fDL7-RYS2KE/XrXEpQT2U1I/AAAAAAAAaDA/jUKSNttDcwIZ59KxuOAkrx9b1_fcDTqnQCK4BGAsYHg/w640-h362/4UpTeam.png)](https://1.bp.blogspot.com/-fDL7-RYS2KE/XrXEpQT2U1I/AAAAAAAAaDA/jUKSNttDcwIZ59KxuOAkrx9b1_fcDTqnQCK4BGAsYHg/4UpTeam.png)

  

  

In a first, we joined together for the forces of NYC, New Jersey and Philly to power this meetup.   A huge thanks to John Kuchmek, Amol Thacker and Paul Vidal for promoting and cross running a sweet meetup.   John was an amazing meetup lead and made sure we kept moving.  A giant thanks to Cloudera marketing for helping with logistics and some awesome giveaways!   Hopefully next year's we can do a Cinco De Mayo Taco Feast!  Bill Brooks and Robert Hryniewicz were great help!   And thanks for Cloudera for providing CDP Public Cloud on AWS and CDP-DC on OpenStack for demos, development and general data fun.   And thanks for the initial meetup suggestion and speaker to Bethann Noble and her awesome machine learning people.

  

  

[https://www.meetup.com/futureofdata-newyork/](https://www.meetup.com/futureofdata-newyork/) - [https://www.meetup.com/futureofdata-princeton/](https://www.meetup.com/futureofdata-princeton/) - [https://www.meetup.com/futureofdata-philadelphia/](https://www.meetup.com/futureofdata-philadelphia/)

[https://www.meetup.com/pro/futureofdata/](https://www.meetup.com/pro/futureofdata/)

  

[![Philly - NJ - NYC](https://1.bp.blogspot.com/-4g17LAGX9l0/XrW55PYNZhI/AAAAAAAAaAc/OMrXdKlEKLAaW2fb_QfDJUCMpWAuD8mhgCK4BGAsYHg/w400-h265/philly-to-nyc.jpg)](https://1.bp.blogspot.com/-4g17LAGX9l0/XrW55PYNZhI/AAAAAAAAaAc/OMrXdKlEKLAaW2fb_QfDJUCMpWAuD8mhgCK4BGAsYHg/philly-to-nyc.jpg)

  

  

To quote, John Kuchmek:

  

The Internet of Things (IoT) is growing in popularity but it isn’t new. Connected devices have existed in manufacturing and utilities with Supervisory Control and Data Acquisition (SCADA) systems. Time series data has been looked at for sometime in these industries as well as the stock market. Time series analysis can bring valuable insight to businesses and individuals with smart homes. There are many parts and components to be able to collect data at the edge, store in a central location for initial analysis, model build, train and eventually deploy. Time series forecasting is one of the more challenging problems to solve in data science. Important factors in time series analysis and forecasting are seasonality, stationary nature of data and autocorrelation of target variables. We show you a platform, built on open source technology, that has this potential. Sensor data will be collected at the edge, off a Raspberry Pi, using Cloudera’s Edge Flow Manager (powered by MiNiFi). The data will then be pushed to a cluster containing Cloudera Flow Manager (powered by NiFi) so it can be manipulated, routed, and then be stored in Kudu on Cloudera’s Data Platform. Initial inspection can be done in Hue using Impala. The time series data will be analyzed with potential forecasting using an ARIMA model in CML (Cloudera Machine Learning). Time series analysis and forecasting can be applied to but not limited to stock market analysis, forecasting electricity loads, inventory studies, weather conditions, census analysis and sales forecasting.

  

  

The main portion of our meetup was an amazing talk by Data Scientist - Victor Dibia.

  

# Analyzing Time Series Data with an ARIMA model

  

His talk comes right after mine and is about an hour of in-depth Data Science with many hard questions answered.   Also a cool [demo](https://anomagram.fastforwardlabs.com/#/).   Thanks again Victor.

  

We also had some really great attendees who asked some tough question.  My favorite question was by a Flink expert who joined from the West Coast who asked for a FLaNK sticker.

  

[![](https://1.bp.blogspot.com/-9Fpu4cM_5cs/XrW4xyB9k0I/AAAAAAAAaAM/6XBD6lXm9ugJTTDJ1L0Hqd47Fkpt6GZrQCK4BGAsYHg/s320/flankstacksticker.png)](https://flankstack.dev/)

  

  

**Time Series Analysis - Dataflow**

  

For my small part I did a demo of ingesting data from MiNiFi to NiFi to CML and Kafka.   Flink reads from two Kafka topics, joins them and inserts into a third Kafka topic.   We call the ML model for classification as part of our ingest flow.   This is an example of my FLaNK Stack.

  

MiNiFi sends the data it reads from sensors and a camera and sends them to a local NiFi gateway.   That NiFi gateway sends a stream to my CDP hosted CFM NiFi cluster for processing.  This cluster splits the data based on which set of sensors (energy or scada) and then publishes to Kafka topics and populates Kudu tables with an UPSERT.

  

[![](https://1.bp.blogspot.com/-skT-UpOCbdA/XrXH7T6R_XI/AAAAAAAAaIg/ZXEiOuiNyB4Iw09uRzxaJb4l1x6PLczLwCK4BGAsYHg/w640-h406/minififlow.png)](https://1.bp.blogspot.com/-skT-UpOCbdA/XrXH7T6R_XI/AAAAAAAAaIg/ZXEiOuiNyB4Iw09uRzxaJb4l1x6PLczLwCK4BGAsYHg/minififlow.png)

  

[![](https://1.bp.blogspot.com/-SP4J_2OLIWc/XrXH6OjKe8I/AAAAAAAAaIY/Q-jEanNvRpMjt2VNDMsHHYCshsNP_FCwgCK4BGAsYHg/w640-h322/sensorsLocal.png)](https://1.bp.blogspot.com/-SP4J_2OLIWc/XrXH6OjKe8I/AAAAAAAAaIY/Q-jEanNvRpMjt2VNDMsHHYCshsNP_FCwgCK4BGAsYHg/sensorsLocal.png)

  

[![](https://1.bp.blogspot.com/-uN6SpFkM9T8/XrXH1VOOSPI/AAAAAAAAaHw/W79DaDF-FLg9kVZGt_J0Kp9vnneRuV7mwCK4BGAsYHg/w640-h404/NiFiFlowTwoTopicsTwoTables.png)](https://1.bp.blogspot.com/-uN6SpFkM9T8/XrXH1VOOSPI/AAAAAAAAaHw/W79DaDF-FLg9kVZGt_J0Kp9vnneRuV7mwCK4BGAsYHg/NiFiFlowTwoTopicsTwoTables.png)

  

We have great options for monitoring, querying and analyzing our data with the tools from CDP and CDP-DC.   These include Cloudera DAS, Apache Hue, Cloudera SMM for Kafka, Flink SQL console, Flink Dashboard, CML Notebooks, Jupyter Notebooks from CML and Apache Zeppelin.

  

[![](https://1.bp.blogspot.com/-gmcEkUcpBM4/XrXH0Mlvi3I/AAAAAAAAaHk/tvDir_4RqrI-mxPMyov7plPa9ASAtG6SACK4BGAsYHg/w640-h358/huejoinkudutables.png)](https://1.bp.blogspot.com/-gmcEkUcpBM4/XrXH0Mlvi3I/AAAAAAAAaHk/tvDir_4RqrI-mxPMyov7plPa9ASAtG6SACK4BGAsYHg/huejoinkudutables.png)
  

[![](https://1.bp.blogspot.com/--W7TFgT2Klw/XrXH0gxK3jI/AAAAAAAAaHo/HRW67-uhZSwWxJduqv5-YqKXTh88GM1twCK4BGAsYHg/w640-h318/kafkaToFlink.png)](https://1.bp.blogspot.com/--W7TFgT2Klw/XrXH0gxK3jI/AAAAAAAAaHo/HRW67-uhZSwWxJduqv5-YqKXTh88GM1twCK4BGAsYHg/kafkaToFlink.png)
  

[![](https://1.bp.blogspot.com/-2R2s69BhtiY/XrXH1D0L8mI/AAAAAAAAaHs/5oNVMcj3NQ4mafIfePrfYntJWJzteUkPwCK4BGAsYHg/w640-h246/flinksqlresults.png)](https://1.bp.blogspot.com/-2R2s69BhtiY/XrXH1D0L8mI/AAAAAAAAaHs/5oNVMcj3NQ4mafIfePrfYntJWJzteUkPwCK4BGAsYHg/flinksqlresults.png)
  

  

  

[![](https://1.bp.blogspot.com/-wqcAw5EjFhg/XrXH1-S9c_I/AAAAAAAAaH0/h_4accMsJkYBFDIefJdLnCHu5nyxoYwegCK4BGAsYHg/w640-h508/flinksqlClient.png)](https://1.bp.blogspot.com/-wqcAw5EjFhg/XrXH1-S9c_I/AAAAAAAAaH0/h_4accMsJkYBFDIefJdLnCHu5nyxoYwegCK4BGAsYHg/flinksqlClient.png)
  

[![](https://1.bp.blogspot.com/-L-3yMcA9Ck8/XrXH2Z0Z1lI/AAAAAAAAaH4/ScJYHp9kj9ItgxT0e1ShuSCB_xuJkizYQCK4BGAsYHg/w640-h166/showtables.png)](https://1.bp.blogspot.com/-L-3yMcA9Ck8/XrXH2Z0Z1lI/AAAAAAAAaH4/ScJYHp9kj9ItgxT0e1ShuSCB_xuJkizYQCK4BGAsYHg/showtables.png)
  

[![](https://1.bp.blogspot.com/-JtjliTqeDu0/XrXH2nnIurI/AAAAAAAAaH8/uTcmj31zunohKJBPzMbey4AbvFa-dPTyQCK4BGAsYHg/w640-h144/insertjobrunning.png)](https://1.bp.blogspot.com/-JtjliTqeDu0/XrXH2nnIurI/AAAAAAAAaH8/uTcmj31zunohKJBPzMbey4AbvFa-dPTyQCK4BGAsYHg/insertjobrunning.png)
  

[![](https://1.bp.blogspot.com/-kyDfZXAR2I4/XrXH3EYBNqI/AAAAAAAAaIA/j-1DsqGXl8M5GrtPwCLq8inUP_Y9_i4hQCK4BGAsYHg/w640-h358/flinksqlquerysensors.png)](https://1.bp.blogspot.com/-kyDfZXAR2I4/XrXH3EYBNqI/AAAAAAAAaIA/j-1DsqGXl8M5GrtPwCLq8inUP_Y9_i4hQCK4BGAsYHg/flinksqlquerysensors.png)
  

[![](https://1.bp.blogspot.com/-u3-5Aw9aiUA/XrXH3pAZaaI/AAAAAAAAaIE/6NimvsK7AmwNZqKyvKNHv6eWypTeA90dwCK4BGAsYHg/w640-h286/smmevents.png)](https://1.bp.blogspot.com/-u3-5Aw9aiUA/XrXH3pAZaaI/AAAAAAAAaIE/6NimvsK7AmwNZqKyvKNHv6eWypTeA90dwCK4BGAsYHg/smmevents.png)
  

[![](https://1.bp.blogspot.com/-nDcSabsEkZc/XrXH4KB432I/AAAAAAAAaII/RMAE37iUoDAAEuWGl7ZLSvcykhuphR0rQCK4BGAsYHg/w640-h290/sensoreventssmm.png)](https://1.bp.blogspot.com/-nDcSabsEkZc/XrXH4KB432I/AAAAAAAAaII/RMAE37iUoDAAEuWGl7ZLSvcykhuphR0rQCK4BGAsYHg/sensoreventssmm.png)
  

[![](https://1.bp.blogspot.com/-VptvLgqbELs/XrXH4ZYG0yI/AAAAAAAAaIM/yI1u_3_9zxUCPmQ1owEhtPLRwHPLQV2LgCK4BGAsYHg/w640-h364/selectstarfromglobal.png)](https://1.bp.blogspot.com/-VptvLgqbELs/XrXH4ZYG0yI/AAAAAAAAaIM/yI1u_3_9zxUCPmQ1owEhtPLRwHPLQV2LgCK4BGAsYHg/selectstarfromglobal.png)
  

[![](https://1.bp.blogspot.com/-aXEkrQyj1ZE/XrXH5dulGqI/AAAAAAAAaIQ/-uYpbqmXzjEbgOD6oEs6iEZRWuNHlLvlgCK4BGAsYHg/w640-h376/flinkinsert.png)](https://1.bp.blogspot.com/-aXEkrQyj1ZE/XrXH5dulGqI/AAAAAAAAaIQ/-uYpbqmXzjEbgOD6oEs6iEZRWuNHlLvlgCK4BGAsYHg/flinkinsert.png)

  

  

As a separate way to investigate Kafka, I have created a Hive external table in beeline and connected that to a Kafka topic.  I can know query the current state of that topic.
  

[![](https://1.bp.blogspot.com/-Ho-JbxsXTq8/XrXH52KhB1I/AAAAAAAAaIU/p6vQ0T66LYk5fMbp1ee7TEAhpx4mskUrQCK4BGAsYHg/w640-h246/hiveOnKafka.png)](https://1.bp.blogspot.com/-Ho-JbxsXTq8/XrXH52KhB1I/AAAAAAAAaIU/p6vQ0T66LYk5fMbp1ee7TEAhpx4mskUrQCK4BGAsYHg/hiveOnKafka.png)
  

  

  

[![](https://1.bp.blogspot.com/-pPgXWpnDQFQ/XrXH68ik_NI/AAAAAAAAaIc/hsrID2WcCLA-eq44_QedA8LmcwA9VZ4eQCK4BGAsYHg/w640-h206/timeseriesmodel.png)](https://1.bp.blogspot.com/-pPgXWpnDQFQ/XrXH68ik_NI/AAAAAAAAaIc/hsrID2WcCLA-eq44_QedA8LmcwA9VZ4eQCK4BGAsYHg/timeseriesmodel.png)
  

  

  

**Video Walkthrough of FlinkSQL Application (and awesome Machine Learning Talk on Time Series)**

  

<iframe allowfullscreen="" height="266" src="https://www.youtube.com/embed/MTvGHAJpNL4" width="320" youtube-src-id="MTvGHAJpNL4"></iframe>

  

  

**Slides From Talk**

  

[https://www.slideshare.net/bunkertor/time-series-analysis-dataflow](https://www.slideshare.net/bunkertor/time-series-analysis-dataflow)

  

**Related Articles**

- [https://www.datainmotion.dev/2020/04/predicting-sensor-readings-with-time.html](https://dev.to/tspannhw/predicting-sensor-readings-with-time-series-machine-learning-3ngc)
- [https://www.datainmotion.dev/2020/05/flink-sql-preview.html](https://dev.to/tspannhw/flink-sql-preview-22l)
- [https://www.meetup.com/futureofdata-princeton/events/268830725/](https://www.meetup.com/futureofdata-princeton/events/268830725/)
- [https://www.datainmotion.dev/2020/04/sql-reporting-task-for-cloudera-flow.html](https://dev.to/tspannhw/sql-reporting-task-for-cloudera-flow-management-hdf-apache-nifi-260f)

  

**Demo Repositories**

- [https://github.com/tspannhw/meetup-sensors](https://github.com/tspannhw/meetup-sensors)
- [https://github.com/tspannhw/ExecuteClouderaML](https://github.com/tspannhw/ExecuteClouderaML)
- [https://github.com/tspannhw/EmergingTechnologyDay2020](https://github.com/tspannhw/EmergingTechnologyDay2020)
- [https://github.com/tspannhw/minifi-movidius-electric](https://github.com/tspannhw/minifi-movidius-electric)
- [https://github.com/tspannhw/minifi-enviroplus](https://github.com/tspannhw/minifi-enviroplus)
- [https://github.com/tspannhw/table-ddl](https://github.com/tspannhw/table-ddl)

  

**Up Next:   More Flink**

  

[https://www.meetup.com/futureofdata-princeton/events/269933905/](https://www.meetup.com/futureofdata-princeton/events/269933905/)