private bool HaveExistingSosPointsChanged( TimeSeriesDataCorrectedServiceRequest dataRequest, DateTimeOffset?lastSensorTime, TimeSeriesChangeEvent detectedChange, TimeSeriesDescription timeSeriesDescription) { if (detectedChange.HasAttributeChange ?? false) { return(true); } if (!detectedChange.FirstPointChanged.HasValue || !lastSensorTime.HasValue) { return(false); } if (lastSensorTime < detectedChange.FirstPointChanged) { return(false); } var timeSeriesIdentifier = timeSeriesDescription.Identifier; var sosPoints = new Queue <TimeSeriesPoint>(Sos.GetObservations(timeSeriesDescription, AddMilliseconds(detectedChange.FirstPointChanged.Value, -1), AddMilliseconds(lastSensorTime.Value, 1))); var aqtsPoints = new Queue <TimeSeriesPoint>(Aquarius.Publish.Get(dataRequest).Points); var sosCount = sosPoints.Count; var aqtsCount = aqtsPoints.Count; Log.Info($"Fetched {sosCount} SOS points and {aqtsCount} AQUARIUS points for '{timeSeriesIdentifier}' from {dataRequest.QueryFrom:O} ..."); while (sosPoints.Any() || aqtsPoints.Any()) { var sosPoint = sosPoints.FirstOrDefault(); var aqtsPoint = aqtsPoints.FirstOrDefault(); if (aqtsPoint == null) { Log.Warn($"'{timeSeriesIdentifier}': AQUARIUS now has fewer points than SOS@{sosPoint?.Timestamp.DateTimeOffset:O}"); return(true); } if (sosPoint == null) { break; } var aqtsValue = (dataRequest.ApplyRounding ?? false) ? double.Parse(aqtsPoint.Value.Display) : aqtsPoint.Value.Numeric; var sosValue = sosPoint.Value.Numeric; if (sosPoint.Timestamp.DateTimeOffset != aqtsPoint.Timestamp.DateTimeOffset) { Log.Warn($"'{timeSeriesIdentifier}': Different timestamps: AQUARIUS={aqtsValue}@{aqtsPoint.Timestamp.DateTimeOffset:O} vs SOS={sosValue}@{sosPoint.Timestamp.DateTimeOffset:O}"); return(true); } if (!DoubleHelper.AreSame(aqtsValue, sosValue)) { Log.Warn($"'{timeSeriesIdentifier}': Different values @ {aqtsPoint.Timestamp.DateTimeOffset:O}: AQUARIUS={aqtsValue} vs SOS={sosValue}"); return(true); } sosPoints.Dequeue(); aqtsPoints.Dequeue(); } Log.Info($"'{timeSeriesDescription.Identifier}': All {sosCount} SOS points match between SOS and AQUARIUS."); dataRequest.QueryFrom = lastSensorTime.Value.AddTicks(1); return(false); }