function aggregateMinChunks(rawMinChunks) {
                        let processedMinChunks 
                        processedMinChunks = processSync(rawMinChunks)

                        return processedMinChunks

                        /**
                         * This function processes raw data chunks using a specified aggregation method
                         * and returns the processed chunks.
                         * @param rawMinChunks - an array of raw data chunks that need to be processed
                         * @returns an array of processed chunks after aggregating the raw data using
                         * either the "Avg" method or a fallback method of simple average if an unknown
                         * aggregation method is defined in the dataset definition config.
                         */
                        function processSync(rawMinChunks) {
                            let rawChunks = rawMinChunks
                            let processedChunks = []
                            let processedChunk

                            //TODO: move this switch within aggregation methods so that aggregation type can be chosen by property again
                            for (let i = 0; i < rawChunks.length; i++) {

                                /* Reporting we are doing well */
                                logAndHeartBeat(new Date(rawChunks[i][0]), ' Aggregating data ', rawChunks, i)

                                switch (datasetDef.config.aggregationMethod) {
                                    case "Avg":
                                        SA.logger.info("Aggrergating data using simple average")
                                        processedChunk = TS.projects.dataMining.functionLibraries.aggregationMethods.average(recordDef.properties, rawMinChunks[i])
                                        processedChunks.push(processedChunk)
                                        break
                                    default: 
                                        SA.logger.warn("Unknown aggregation method defined in dataset defintion config, falling back to simple average")
                                        processedChunk = TS.projects.dataMining.functionLibraries.aggregationMethods.average(recordDef.properties, rawMinChunks)
                                        processedChunks.push(processedChunk)
                                        break
                                }
                            }

                            return processedChunks
                        }

                        /* TODO: Implement asyc processing
                        function processAsyc (rawMinChunks) {
                        
                            const { fork } = require('child_process')
                       
                            processChunksInParallel(rawChunks)
                                .then(result => {
                                console.log("this is our finsihed chunks", result)
                                return result
                            })

                            function processChunksInParallel(rawChunks) {
                            console.log("in processChunksInParallel", rawChunks)

                            return new Promise((resolve, reject) => {
                              let aggregatedChunks = [];
                              let completedCount = 0;
                              let pathToWorker = global.env.PATH_TO_PROJECTS + "/Data-Mining/TS/Bot-Modules/Sensor-Bot/Database-Sensor/aggregationMethods.js" 
                          
                              for (let i = 0; i < rawChunks.length; i++) {
                                const worker = fork(pathToWorker);
                          
                                worker.on('message', (result) => {
                                  aggregatedChunks[i] = result;
                                  completedCount++;
                          
                                  if (completedCount === rawChunks.length) {
                                    resolve(aggregatedChunks);
                                  }
                                });
                          
                                worker.on('error', (error) => {
                                  reject(error);
                                });
                          
                                worker.send(rawChunks[i], aggregationType);
                              }
                            });
                            }
                        }*/
                    }
The function aggregates data using a specified method and returns the processed
chunks.
@param rawMinChunks - an array of raw data chunks to be aggregated.
@returns The function `aggregateMinChunks` returns the processed and aggregated
chunks of data based on the aggregation method specified in the dataset
definition config. The processing can be done synchronously or asynchronously
using child processes.