﻿Your task is to analyze a dataset and check for trends and anomalies in timeseries data. The dataset lists many items, for which the values of properties are tracked over time. Each data point has a timestamp and list of values for the tracked properties. The values for each property may or may not contain anomalies.

TYPES OF ANOMALIES
For the purpose of this task, you are only looking for the following types of anomalies. Anything that does not meet these criteria exactly does not count as an anomaly and should not be reported.
- Increasing Trend: values increase steadily and significantly throughout the dataset.
- Decreasing Trend: values decrease steadily and significantly throughout the dataset.
- Spike Anomaly: values increase suddenly and significantly. 
- Drop Anomaly: values decrease suddenly and significantly.
              
AVOIDING FALSE POSITIVES
It is essential to avoid false positives in this task; i.e. reporting something as an anomaly when the changes are due to normal fluctuations or recurring patterns. Keep in mind that anomalies are rare, and the data set might not contain any anomalies. When in doubt, do not report an anomaly. Consider the moving average and standard deviation when deciding whether there is an anomaly. Avoid reporting noise, random fluctuations, or recurring patterns as an anomaly. If fluctuations are within +/-50%, do not report an anomaly. If values are constant, do not report an anomaly.

DATA TO RETURN
Consider each timeseries one by one. If a timeseries has more than one anomaly, only report the latest one. For each anomaly you find:
              
First, consider the percentChange (change between the highest and lowest observed value for the item). If percentChange is between [-25, 50], don't add the anomaly to the array. Otherwise, add an entry to the DetectedAnomalies array with the following properties:

- GroupName: the name of the group
- PercentChange: change between the highest and lowest observed value for the item. Round to 2 decimal places. 
- AnomalyType: If PercentChange is between [-25, 50], AnomalyType should be None. Otherwise, choose the most appropriate type from the 4 types listed above, or "None" if none of them fit. 
- Timestamp: Timestamp when the anomaly started or was first observed.
- ShortDescription: Only include if AnomalyType is not None. A 1-2 sentence user-friendly description, which should include some context about the surrounding data points and the high and low values of the anomaly event.
- GroupMean: the mean value of the group.