diff --git a/docs/docs/api/methods/10-aggregateGroupByDuration.md b/docs/docs/api/methods/10-aggregateGroupByDuration.md new file mode 100644 index 0000000..266eed8 --- /dev/null +++ b/docs/docs/api/methods/10-aggregateGroupByDuration.md @@ -0,0 +1,38 @@ +--- +title: aggregateGroupByDuration +--- + +# `aggregateGroupByDuration` + +Reads aggregated group result by Duration according to requested read criteria. `timeRangeSlicer` needs to be specified for the Duration type (`MILLIS' | 'SECONDS' | 'MINUTES' | 'HOURS' | 'DAYS`) and length. Some record types do not support aggregation. + +# Method + +```ts +aggregateGroupByDuration( + request: AggregateGroupByDurationRequest +): Promise[]> +``` + +# Example + +```ts +import { aggregateGroupByDuration } from 'react-native-health-connect'; + +const aggregateSampleData = () => { + aggregateGroupByDuration({ + recordType: 'Steps', + timeRangeFilter: { + operator: 'between', + startTime: '2024-10-04T15:00:00Z', + endTime: '2024-10-12T14:57:39.714Z', + }, + timeRangeSlicer: { + duration: 'DAYS', + length: 2, + }, + }).then((result) => { + console.log('Aggregated Group by Duration: ', { result }); // Aggregated record: {"result": [{"endTime": "2024-10-06T15:00:00Z", "startTime": "2024-10-04T15:00:00Z", "zoneOffset": "+09:00", "result": {"dataOrigins": [], "COUNT_TOTAL": 3000}}, {"endTime": "2024-10-08T15:00:00Z", "startTime": "2024-10-06T15:00:00Z", "zoneOffset": "+09:00", "result": {"dataOrigins": [], "COUNT_TOTAL": 7000}}, {"endTime": "2024-10-10T15:00:00Z", "startTime": "2024-10-08T15:00:00Z", "zoneOffset": "+09:00", "result": {"dataOrigins": [], "COUNT_TOTAL": 11000}}, {"endTime": "2024-10-12T14:57:39.714Z", "startTime": "2024-10-10T15:00:00Z", "zoneOffset": "+09:00", "result": {"dataOrigins": [], "COUNT_TOTAL": 7000}}]} + }); +}; +``` diff --git a/docs/docs/api/methods/11-aggregateGroupByPeriod.md b/docs/docs/api/methods/11-aggregateGroupByPeriod.md new file mode 100644 index 0000000..3e2ffcf --- /dev/null +++ b/docs/docs/api/methods/11-aggregateGroupByPeriod.md @@ -0,0 +1,38 @@ +--- +title: aggregateGroupByPeriod +--- + +# `aggregateGroupByPeriod` + +Reads aggregated group result by Period according to requested read criteria. `timeRangeSlicer` needs to be specified for the Period type (`'DAYS' | 'WEEKS' | 'MONTHS' | 'YEARS'`) and length. `Period` is date-based amount of time as opposed to `Duration`, which is a fixed length of time. Some record types do not support aggregation. + +# Method + +```ts +aggregateGroupByPeriod( + request: AggregateGroupByPeriodRequest +): Promise[]> +``` + +# Example + +```ts +import { aggregateGroupByPeriod } from 'react-native-health-connect'; + +const aggregateSampleData = () => { + aggregateGroupByPeriod({ + recordType: 'Steps', + timeRangeFilter: { + operator: 'between', + startTime: '2024-09-03T15:00', + endTime: '2024-09-11T10:50:12.182', + }, + timeRangeSlicer: { + period: 'DAYS', + length: 1, + }, + }).then((result) => { + console.log('Aggregated Group by Period: ', { result }); // Aggregated record: {"result": [{"endTime": "2024-09-04T15:00", "startTime": "2024-09-03T15:00", "result": {"dataOrigins": [], "COUNT_TOTAL": 1000}}, {"endTime": "2024-09-05T15:00", "startTime": "2024-09-04T15:00", "result": {"dataOrigins": [], "COUNT_TOTAL": 2000}}, {"endTime": "2024-09-06T15:00", "startTime": "2024-09-05T15:00", "result": {"dataOrigins": [], "COUNT_TOTAL": 3000}}, {"endTime": "2024-09-07T15:00", "startTime": "2024-09-06T15:00", "result": {"dataOrigins": [], "COUNT_TOTAL": 4000}}, {"endTime": "2024-09-08T15:00", "startTime": "2024-09-07T15:00", "result": {"dataOrigins": [], "COUNT_TOTAL": 5000}}, {"endTime": "2024-09-09T15:00", "startTime": "2024-09-08T15:00", "result": {"dataOrigins": [], "COUNT_TOTAL": 6000}}, {"endTime": "2024-09-10T15:00", "startTime": "2024-09-09T15:00", "result": {"dataOrigins": [], "COUNT_TOTAL": 7000}}, {"endTime": "2024-09-11T10:50:12.182", "startTime": "2024-09-10T15:00", "result": {"dataOrigins": [], "COUNT_TOTAL": 0}}]} + }); +}; +``` diff --git a/docs/docs/api/methods/10-deleteRecordsByTimeRange.md b/docs/docs/api/methods/12-deleteRecordsByTimeRange.md similarity index 100% rename from docs/docs/api/methods/10-deleteRecordsByTimeRange.md rename to docs/docs/api/methods/12-deleteRecordsByTimeRange.md diff --git a/docs/docs/api/methods/11-deleteRecordsByUuids.md b/docs/docs/api/methods/13-deleteRecordsByUuids.md similarity index 100% rename from docs/docs/api/methods/11-deleteRecordsByUuids.md rename to docs/docs/api/methods/13-deleteRecordsByUuids.md diff --git a/docs/docs/api/methods/12-openHealthConnectSettings.md b/docs/docs/api/methods/14-openHealthConnectSettings.md similarity index 100% rename from docs/docs/api/methods/12-openHealthConnectSettings.md rename to docs/docs/api/methods/14-openHealthConnectSettings.md diff --git a/docs/docs/api/methods/13-openHealthConnectDataManagement.md b/docs/docs/api/methods/15-openHealthConnectDataManagement.md similarity index 100% rename from docs/docs/api/methods/13-openHealthConnectDataManagement.md rename to docs/docs/api/methods/15-openHealthConnectDataManagement.md