get_trend_data_es
Analyze trends and patterns in Apple Health data over time using Elasticsearch date histogram aggregation. Specify a record type, time interval, and optional date range to retrieve average, min, max, and count statistics for each period.
Instructions
Get trend data for a specific health record type over time using Elasticsearch date histogram aggregation.
Parameters:
- record_type: The type of health record to analyze (e.g., "HKQuantityTypeIdentifierStepCount")
- interval: Time interval for aggregation.
- date_from, date_to: Optional ISO8601 date strings for filtering date range
Returns:
- record_type: The analyzed record type
- interval: The time interval used
- trend_data: List of time buckets with statistics for each period:
- date: The time period (ISO string)
- avg_value: Average value for the period
- min_value: Minimum value for the period
- max_value: Maximum value for the period
- count: Number of records in the period
Notes for LLMs:
- Use this to analyze trends, patterns, and seasonal variations in health data
- The function automatically handles date filtering if date_from/date_to are provided
- IMPORTANT - interval must be one of: "day", "week", "month", or "year". Do not use other values.
- Do not guess, auto-fill, or assume any missing data.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
date_from | No | ||
date_to | No | ||
interval | No | month | |
record_type | Yes |