## 3 System Architecture, Software Services and Deployment
### Data Engineering on the Fog Layer
#### 3.3.3 Application-Specific Processing  
Not all end-user-facing services have common data processing tasks that are being executed at the backend. Each and every one of those tasks is specified through Java Specification Requests JSR-000335 lambda expressions ([[https://jcp.org/aboutJava/communityprocess/final/jsr335/index.html](https://jcp.org/aboutJava/communityprocess/final/jsr335/index.html)]([https://jcp.org/aboutJava/communityprocess/final/jsr335/index.html](https://jcp.org/aboutJava/communityprocess/final/jsr335/index.html))), with the specifications being pushed into the EPL-B and analysed based on two factors: (i) the sensor data that are processed and (ii) the time frame in which the data stream process must have been finalized. In addition, as part of the services delivered to end-users, the association of factors such as pressure and consumption together with the various environmental conditions must be evaluated in order to assess the efficiency, as well as the accuracy of the water distribution monitoring framework. Modelling the relationship between all types of variables can be achieved by applying linear regression methods, which in general are considered to be highly effective for the specific task.  
For meeting the functional requirements of smart water metering services regarding data interpretation and analytics, customized lambda expressions for data processing and manipulation are implemented. These lambda expressions are divided into three main categories as follows:  
**Expressions that involve linear regression**: Certain high-level services employ linear regression for generating effective models to identify existing relationships between scalar-dependent and explanatory variables. The majority of currently implemented models are based on simple linear regressions; however, there are cases in which multivariate linear regressions are also utilized. Such a use case may be the prediction of water consumption within a confined area of the city or the estimation of the pressure of a specific block of buildings for the foreseeable future.  
**Expressions that employ clustering and classification of data**: Across the different user-facing functionalities implemented, datasets need to become as homogeneous as possible by using unsupervised learning techniques. The proposed framework addresses the specific necessity through the highly popular k-means clustering method of vector quantization and the KNN data classification method. For getting a better overview of more specific examples for this category of expressions, one could consider the fully automated characterization of the water consumption for each individual house across all buildings or water consumption classification of each building during each day/time-slot.  
**Fast Fourier transform expressions**: The last group of transformation expression is directly linked to the Fast Fourier Transform (FFT) algorithms toward computing the sequence's Discrete Fourier Transform (DFT). Through Fourier analysis, it is possible to convert a signal originally in the time/space domain to accurate frequency domain representation and vice versa. Through FFT, it is possible to compute such transformations rapidly by generating the corresponding DFT matrix as a product of sparse factors. Such expressions can be used for analysing the water consumption of the building in order to track whether specific household equipment was in use within given day/time-slots. An additional example has to do with the quantification of events that lead to low water pressures.