From cf2ce7190fa30c73bcb7231f674aae30bb648b69 Mon Sep 17 00:00:00 2001 From: cookeac Date: Thu, 5 Sep 2024 21:59:16 +1200 Subject: [PATCH 1/6] Add Observation Summary Resouce Initial commit to add icarObservationSummaryResource for animal activity and similar observations. Defines an icarObservationStatisticsType that extends icarStatisticsType, and an activity metrics list. Resolves #465 --- enums/icarDurationType.json | 14 +++++++ .../icarlObservationSummaryResource.json | 40 +++++++++++++++++++ types/icarObservationStatisticsType.json | 26 ++++++++++++ well-known/icarActivityMetrics.md | 15 +++++++ well-known/icarMetricTypeIdentifier.md | 1 + 5 files changed, 96 insertions(+) create mode 100644 enums/icarDurationType.json create mode 100644 resources/icarlObservationSummaryResource.json create mode 100644 types/icarObservationStatisticsType.json create mode 100644 well-known/icarActivityMetrics.md diff --git a/enums/icarDurationType.json b/enums/icarDurationType.json new file mode 100644 index 0000000..4968658 --- /dev/null +++ b/enums/icarDurationType.json @@ -0,0 +1,14 @@ +{ + "description": "ISO8601/RFC3339 durations used in various types of aggregations. D=Day, M=Month, W=Week, Y=Year, H=Hour, M=Min.", + + "type": "string", + + "enum": [ + "1D", + "1H", + "24H", + "1W", + "1M" + ] +} + diff --git a/resources/icarlObservationSummaryResource.json b/resources/icarlObservationSummaryResource.json new file mode 100644 index 0000000..24dd5f2 --- /dev/null +++ b/resources/icarlObservationSummaryResource.json @@ -0,0 +1,40 @@ +{ + "description": "This resource (not an event) is delivered on request to summarise observations for an animal over a time period.", + + "allOf": [ + { + "$ref": "../resources/icarResource.json" + }, + { + "type": "object", + + "required": ["animal"], + + "properties": { + "animal": { + "$ref": "../types/icarAnimalIdentifierType.json", + "description": "Unique animal scheme and identifier combination." + }, + "location": { + "$ref": "../types/icarLocationIdentifierType.json", + "description": "Location where the observations occurred." + }, + "dateFrom": { + "$ref": "../types/icarDateType.json", + "description": "The start of the period for which statistics were calculated." + }, + "dateTo": { + "$ref": "../types/icarDateType.json", + "description": "The end of the period for which statistics were calculated." + }, + "statistics": { + "description": "The array of statistics for this animal.", + "type": "array", + "items": { + "$ref": "../types/icarObservationStatisticsType.json" + } + } + } + } + ] + } \ No newline at end of file diff --git a/types/icarObservationStatisticsType.json b/types/icarObservationStatisticsType.json new file mode 100644 index 0000000..1c4c015 --- /dev/null +++ b/types/icarObservationStatisticsType.json @@ -0,0 +1,26 @@ +{ + "description": "Aggregated statistics for a animal behaviour or similar observation over a time period.", + + "allOf": [ + { + "type": "object", + + "required": ["startDateTime", "duration"], + + "properties": { + "startDateTime": { + "$ref": "../types/icarDateTimeType.json", + "description": "The start date and time of the aggregation period." + }, + "duration": { + "$ref": "../enums/icarDurationType.json", + "description": "The type of period duration (e.g. 1D, 24H, 1W)." + } + } + + }, + { + "$ref": "../types/icarStatisticsType.json" + } + ] + } \ No newline at end of file diff --git a/well-known/icarActivityMetrics.md b/well-known/icarActivityMetrics.md new file mode 100644 index 0000000..9e62568 --- /dev/null +++ b/well-known/icarActivityMetrics.md @@ -0,0 +1,15 @@ +# Predefined metrics that can be used for animal activity measurement + +| Metric name | Units | Description | +| --- | --- | --- | +| DrinkingTime | MIN | Time spent drinking, measured over a daily (1D) or 24hour (24H) period. | +| EatingTime | MIN | Time spent prehending, chewing, and swallowing feed, measured over a daily (1D) or 24hour (24H) period. | +| InactiveTime | MIN | Time when an animal is not actively moving, which can occur in either standing or lying positions. Measured over a daily (1D) or 24-hour (24H) period. | +| LyingTime | MIN | Time spent lying down, measured over a daily (1D) or 24-hour (24H) period. | +| RestingTime | MIN | Time spent resting (standing, lying, but not walking or eating), measured over a daily (1D) or 24hour (24H) period. | +| RuminationTime | MIN | Time spent ruminating (regurgiating and re-chewing food), measured over a daily (1D) or 24-hour (24H) period. | +| StandingTime | MIN | Time spent standing, measured over a daily (1D) or 24-hour (24H) period. | +| StepCount | STEP | Number of steps measured with a pedometer or activity device. STEP is not an ISO or UN/CEFACT unit. | +| WalkingTime | MIN | Time spent walking measured over a daily (1D) or 24-hour (24H) period. | + + diff --git a/well-known/icarMetricTypeIdentifier.md b/well-known/icarMetricTypeIdentifier.md index 8c08484..8ee83d3 100644 --- a/well-known/icarMetricTypeIdentifier.md +++ b/well-known/icarMetricTypeIdentifier.md @@ -4,3 +4,4 @@ | --- | --- | --- | --- | --- | | icar.org | | ICAR defined metrics - is there something available from ICAR | Milk weight | | | crv.nl | | CRV defined metrics - need to setup a webpage for this ... | Milk weight | | +| org.icar.activities | [icarActivityMetrics](icarActivityMetrics.md) | Activity observation metrics defined by the ICAR ADE group. | RuminationTime, StandingTime | Values as specified in the linked markdown. | From 68c19d6c673e9c743621502e62d7f985f7571d7a Mon Sep 17 00:00:00 2001 From: cookeac Date: Mon, 9 Sep 2024 20:37:12 +1200 Subject: [PATCH 2/6] Fix file name typo and clarify descriptions. --- ...mmaryResource.json => icarObservationSummaryResource.json} | 2 +- types/icarObservationStatisticsType.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename resources/{icarlObservationSummaryResource.json => icarObservationSummaryResource.json} (90%) diff --git a/resources/icarlObservationSummaryResource.json b/resources/icarObservationSummaryResource.json similarity index 90% rename from resources/icarlObservationSummaryResource.json rename to resources/icarObservationSummaryResource.json index 24dd5f2..1f72726 100644 --- a/resources/icarlObservationSummaryResource.json +++ b/resources/icarObservationSummaryResource.json @@ -28,7 +28,7 @@ "description": "The end of the period for which statistics were calculated." }, "statistics": { - "description": "The array of statistics for this animal.", + "description": "The summary statistics for this animal. Likely to be summarised on demand based on query parameters.", "type": "array", "items": { "$ref": "../types/icarObservationStatisticsType.json" diff --git a/types/icarObservationStatisticsType.json b/types/icarObservationStatisticsType.json index 1c4c015..81d121e 100644 --- a/types/icarObservationStatisticsType.json +++ b/types/icarObservationStatisticsType.json @@ -10,11 +10,11 @@ "properties": { "startDateTime": { "$ref": "../types/icarDateTimeType.json", - "description": "The start date and time of the aggregation period." + "description": "The start date/time of the aggregation period for this particular statistic." }, "duration": { "$ref": "../enums/icarDurationType.json", - "description": "The type of period duration (e.g. 1D, 24H, 1W)." + "description": "The type of period duration (e.g. 1D, 24H, 1W). A call may return statistics with different durations." } } From 87e098ea4918ae0f752e37e03184955926175f3f Mon Sep 17 00:00:00 2001 From: cookeac Date: Wed, 11 Sep 2024 13:31:44 +1200 Subject: [PATCH 3/6] Add isIncomplete as per comments on #465 --- types/icarObservationStatisticsType.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/icarObservationStatisticsType.json b/types/icarObservationStatisticsType.json index 81d121e..32e55eb 100644 --- a/types/icarObservationStatisticsType.json +++ b/types/icarObservationStatisticsType.json @@ -15,6 +15,10 @@ "duration": { "$ref": "../enums/icarDurationType.json", "description": "The type of period duration (e.g. 1D, 24H, 1W). A call may return statistics with different durations." + }, + "isIncomplete": { + "type": "boolean", + "description": "This flag is present with the value true, when there is insufficient or incomplete data in the duration." } } From b57cc0fc861f244ff0a5d6e9ac5d5762401fa3cb Mon Sep 17 00:00:00 2001 From: cookeac Date: Thu, 3 Oct 2024 21:00:43 +1300 Subject: [PATCH 4/6] Improvements to icarObservationSummaryResource 1. Extend icarAggregationType with "Range" and "Score". 2. Add icarObservationSummaryCollection. 3. Remove location, dateFrom, dateTo from icarObservationSummaryResource. 4. Rename icarActivityMetrics markdown to icarObservationSummaryMetrics 5. Define URL schemes in exampleURLScheme and managementURLScheme (GET only). --- .../icarObservationSummaryCollection.json | 21 + enums/icarAggregationType.json | 6 +- resources/icarObservationSummaryResource.json | 12 - types/icarObservationStatisticsType.json | 2 +- url-schemes/exampleUrlScheme.json | 92 +++- url-schemes/managementURLScheme.json | 499 +++++++++++------- well-known/icarActivityMetrics.md | 15 - well-known/icarMetricTypeIdentifier.md | 2 +- well-known/icarObservationSummaryMetrics.md | 18 + 9 files changed, 439 insertions(+), 228 deletions(-) create mode 100644 collections/icarObservationSummaryCollection.json delete mode 100644 well-known/icarActivityMetrics.md create mode 100644 well-known/icarObservationSummaryMetrics.md diff --git a/collections/icarObservationSummaryCollection.json b/collections/icarObservationSummaryCollection.json new file mode 100644 index 0000000..3fae907 --- /dev/null +++ b/collections/icarObservationSummaryCollection.json @@ -0,0 +1,21 @@ +{ + "description": "Represents a collection of animal sets. Based on icarResourceCollection to provide paging etc.", + + "allOf": [{ + "$ref": "../collections/icarResourceCollection.json" + }, + { + "type": "object", + + "properties": { + "member": { + "type": "array", + "items": { + "$ref": "../resources/icarObservationSummaryResource.json" + }, + "description": "As per JSON-LD Hydra syntax, member provides the array of objects, in this case observation summary statistics." + } + } + } + ] +} \ No newline at end of file diff --git a/enums/icarAggregationType.json b/enums/icarAggregationType.json index e223aa3..5b4d30f 100644 --- a/enums/icarAggregationType.json +++ b/enums/icarAggregationType.json @@ -1,5 +1,5 @@ { - "description": "The type of aggregation.", + "description": "The type of aggregation. In addition to obvious statistical terms, Range is the difference between min and max, and index is a computed index value.", "type": "string", @@ -9,7 +9,9 @@ "StDev", "Min", "Max", - "Count" + "Count", + "Range", + "Index" ] } diff --git a/resources/icarObservationSummaryResource.json b/resources/icarObservationSummaryResource.json index 1f72726..9f047e0 100644 --- a/resources/icarObservationSummaryResource.json +++ b/resources/icarObservationSummaryResource.json @@ -15,18 +15,6 @@ "$ref": "../types/icarAnimalIdentifierType.json", "description": "Unique animal scheme and identifier combination." }, - "location": { - "$ref": "../types/icarLocationIdentifierType.json", - "description": "Location where the observations occurred." - }, - "dateFrom": { - "$ref": "../types/icarDateType.json", - "description": "The start of the period for which statistics were calculated." - }, - "dateTo": { - "$ref": "../types/icarDateType.json", - "description": "The end of the period for which statistics were calculated." - }, "statistics": { "description": "The summary statistics for this animal. Likely to be summarised on demand based on query parameters.", "type": "array", diff --git a/types/icarObservationStatisticsType.json b/types/icarObservationStatisticsType.json index 32e55eb..e7aa4e0 100644 --- a/types/icarObservationStatisticsType.json +++ b/types/icarObservationStatisticsType.json @@ -24,7 +24,7 @@ }, { - "$ref": "../types/icarStatisticsType.json" + "$ref": "../types/icarStatisticsType.json" } ] } \ No newline at end of file diff --git a/url-schemes/exampleUrlScheme.json b/url-schemes/exampleUrlScheme.json index 4667c8a..52edb44 100644 --- a/url-schemes/exampleUrlScheme.json +++ b/url-schemes/exampleUrlScheme.json @@ -2631,7 +2631,67 @@ } } } - } + }, + "/locations/{location-scheme}/{location-id}/observation-summary-metrics": { + "get": { + "operationId": "get-animal-observation-summary-metrics", + "summary": "Get summary statistics for individual animal observations.", + "description": "# Purpose\nProvides the collection of animal observation summary statistics for animals at the specified location.\n", + "tags": [ + "ADE-1.4-management" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + }, + { + "$ref": "#/components/parameters/date-from" + }, + { + "$ref": "#/components/parameters/date-to" + }, + { + "$ref": "#/components/parameters/animal-scheme" + }, + { + "$ref": "#/components/parameters/animal-id" + }, + { + "$ref": "#/components/parameters/metric-scheme" + }, + { + "$ref": "#/components/parameters/metric-id" + }, + { + "$ref": "#/components/parameters/duration" + }, + { + "$ref": "#/components/parameters/meta-modified-from" + }, + { + "$ref": "#/components/parameters/meta-modified-to" + } + ], + "responses": { + "200": { + "description": "Successful. The response contains the animal observation summary resources for the given location.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarObservationSummaryCollection" + } + } + } + }, + "default": { + "$ref": "#/components/responses/default" + } + } + } + } }, "components": { "schemas": { @@ -2820,6 +2880,9 @@ }, "icarGroupPositionObservationEventCollection": { "$ref": "../collections/icarGroupPositionObservationEventCollection.json" + }, + "icarObservationSummaryCollection": { + "$ref": "../collections/icarObservationSummaryCollection.json" } }, "parameters": { @@ -2971,6 +3034,33 @@ "schema": { "type": "string" } + }, + "metric-scheme": { + "name": "metric-scheme", + "in": "query", + "description": "The scheme for a metric.", + "required": false, + "schema": { + "type": "string" + } + }, + "metric-id": { + "name": "metric-id", + "in": "query", + "description": "The unique metric within a scheme.", + "required": false, + "schema": { + "type": "string" + } + }, + "duration": { + "name": "duration", + "in": "query", + "description": "The duration for aggregations (e.g. 1D, 1H, 24H, 96H).", + "required": true, + "schema": { + "type": "string" + } } }, "responses": { diff --git a/url-schemes/managementURLScheme.json b/url-schemes/managementURLScheme.json index e5cd894..d44d4ad 100644 --- a/url-schemes/managementURLScheme.json +++ b/url-schemes/managementURLScheme.json @@ -465,7 +465,7 @@ }, { "$ref": "#/components/parameters/purpose" - } + } ], "responses": { "200": { @@ -485,160 +485,160 @@ } }, "/locations/{location-scheme}/{location-id}/inventory-transactions": { - "get": { - "operationId": "get-inventory-transactions", - "summary": "Get the inventory transactions that relate to a certain location", - "description": "# Purpose\nProvides the inventory transactions relating to a location\n", - "tags": [ - "ADE-1.4-management" - ], - "parameters": [ - { - "$ref": "#/components/parameters/location-scheme" - }, - { - "$ref": "#/components/parameters/location-id" - }, - { - "$ref": "#/components/parameters/date-from" - }, - { - "$ref": "#/components/parameters/date-to" - }, - { - "$ref": "#/components/parameters/family" - }, - { - "$ref": "#/components/parameters/identifier-scheme" - }, - { - "$ref": "#/components/parameters/identifier-id" - }, - { - "$ref": "#/components/parameters/meta-modified-from" - }, - { - "$ref": "#/components/parameters/meta-modified-to" - } - ], - "responses": { - "200": { - "description": "Successful. The response contains the inventory transactions for the given location.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/icarInventoryTransactionCollection" - } - } - } - }, - "default": { - "$ref": "#/components/responses/default" - } - } - } + "get": { + "operationId": "get-inventory-transactions", + "summary": "Get the inventory transactions that relate to a certain location", + "description": "# Purpose\nProvides the inventory transactions relating to a location\n", + "tags": [ + "ADE-1.4-management" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + }, + { + "$ref": "#/components/parameters/date-from" + }, + { + "$ref": "#/components/parameters/date-to" + }, + { + "$ref": "#/components/parameters/family" + }, + { + "$ref": "#/components/parameters/identifier-scheme" + }, + { + "$ref": "#/components/parameters/identifier-id" + }, + { + "$ref": "#/components/parameters/meta-modified-from" + }, + { + "$ref": "#/components/parameters/meta-modified-to" + } + ], + "responses": { + "200": { + "description": "Successful. The response contains the inventory transactions for the given location.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarInventoryTransactionCollection" + } + } + } + }, + "default": { + "$ref": "#/components/responses/default" + } + } + } }, "/locations/{location-scheme}/{location-id}/feed-inventory-transactions": { - "get": { - "operationId": "get-feed-inventory-transactions", - "summary": "Get the feed inventory transactions that relate to a certain location", - "description": "# Purpose\nProvides the feed inventory transactions relating to a location\n", - "tags": [ - "ADE-1.4-management" - ], - "parameters": [ - { - "$ref": "#/components/parameters/location-scheme" - }, - { - "$ref": "#/components/parameters/location-id" - }, - { - "$ref": "#/components/parameters/date-from" - }, - { - "$ref": "#/components/parameters/date-to" - }, - { - "$ref": "#/components/parameters/identifier-scheme" - }, - { - "$ref": "#/components/parameters/identifier-id" - }, - { - "$ref": "#/components/parameters/meta-modified-from" - }, - { - "$ref": "#/components/parameters/meta-modified-to" - } - ], - "responses": { - "200": { - "description": "Successful. The response contains the feed inventory transactions for the given location.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/icarFeedTransactionCollection" - } - } - } - }, - "default": { - "$ref": "#/components/responses/default" - } - } - } + "get": { + "operationId": "get-feed-inventory-transactions", + "summary": "Get the feed inventory transactions that relate to a certain location", + "description": "# Purpose\nProvides the feed inventory transactions relating to a location\n", + "tags": [ + "ADE-1.4-management" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + }, + { + "$ref": "#/components/parameters/date-from" + }, + { + "$ref": "#/components/parameters/date-to" + }, + { + "$ref": "#/components/parameters/identifier-scheme" + }, + { + "$ref": "#/components/parameters/identifier-id" + }, + { + "$ref": "#/components/parameters/meta-modified-from" + }, + { + "$ref": "#/components/parameters/meta-modified-to" + } + ], + "responses": { + "200": { + "description": "Successful. The response contains the feed inventory transactions for the given location.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarFeedTransactionCollection" + } + } + } + }, + "default": { + "$ref": "#/components/responses/default" + } + } + } }, "/locations/{location-scheme}/{location-id}/medicine-inventory-transactions": { - "get": { - "operationId": "get-medicine-inventory-transactions", - "summary": "Get the medicine inventory transactions that relate to a certain location", - "description": "# Purpose\nProvides the medicine inventory transactions relating to a location\n", - "tags": [ - "ADE-1.4-management" - ], - "parameters": [ - { - "$ref": "#/components/parameters/location-scheme" - }, - { - "$ref": "#/components/parameters/location-id" - }, - { - "$ref": "#/components/parameters/date-from" - }, - { - "$ref": "#/components/parameters/date-to" - }, - { - "$ref": "#/components/parameters/identifier-scheme" - }, - { - "$ref": "#/components/parameters/identifier-id" - }, - { - "$ref": "#/components/parameters/meta-modified-from" - }, - { - "$ref": "#/components/parameters/meta-modified-to" - } - ], - "responses": { - "200": { - "description": "Successful. The response contains the medicine inventory transactions for the given location.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/icarMedicineTransactionCollection" - } - } - } - }, - "default": { - "$ref": "#/components/responses/default" - } - } - } + "get": { + "operationId": "get-medicine-inventory-transactions", + "summary": "Get the medicine inventory transactions that relate to a certain location", + "description": "# Purpose\nProvides the medicine inventory transactions relating to a location\n", + "tags": [ + "ADE-1.4-management" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + }, + { + "$ref": "#/components/parameters/date-from" + }, + { + "$ref": "#/components/parameters/date-to" + }, + { + "$ref": "#/components/parameters/identifier-scheme" + }, + { + "$ref": "#/components/parameters/identifier-id" + }, + { + "$ref": "#/components/parameters/meta-modified-from" + }, + { + "$ref": "#/components/parameters/meta-modified-to" + } + ], + "responses": { + "200": { + "description": "Successful. The response contains the medicine inventory transactions for the given location.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarMedicineTransactionCollection" + } + } + } + }, + "default": { + "$ref": "#/components/responses/default" + } + } + } }, "/locations/{location-scheme}/{location-id}/position-observations": { "get": { @@ -656,16 +656,16 @@ "$ref": "#/components/parameters/location-id" }, { - "$ref": "#/components/parameters/date-from" + "$ref": "#/components/parameters/date-from" }, { "$ref": "#/components/parameters/date-to" }, { - "$ref": "#/components/parameters/identifier-scheme" + "$ref": "#/components/parameters/identifier-scheme" }, { - "$ref": "#/components/parameters/identifier-id" + "$ref": "#/components/parameters/identifier-id" }, { "$ref": "#/components/parameters/meta-modified-from" @@ -756,7 +756,7 @@ } } } - }, + }, "/locations/{location-scheme}/{location-id}/group-position-observations": { "get": { "operationId": "get-group-position-observations", @@ -773,16 +773,16 @@ "$ref": "#/components/parameters/location-id" }, { - "$ref": "#/components/parameters/date-from" + "$ref": "#/components/parameters/date-from" }, { "$ref": "#/components/parameters/date-to" }, { - "$ref": "#/components/parameters/identifier-scheme" + "$ref": "#/components/parameters/identifier-scheme" }, { - "$ref": "#/components/parameters/identifier-id" + "$ref": "#/components/parameters/identifier-id" }, { "$ref": "#/components/parameters/meta-modified-from" @@ -873,8 +873,67 @@ } } } - - }, + }, + "/locations/{location-scheme}/{location-id}/observation-summary-metrics": { + "get": { + "operationId": "get-animal-observation-summary-metrics", + "summary": "Get summary statistics for individual animal observations.", + "description": "# Purpose\nProvides the collection of animal observation summary statistics for animals at the specified location.\n", + "tags": [ + "ADE-1.4-management" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + }, + { + "$ref": "#/components/parameters/date-from" + }, + { + "$ref": "#/components/parameters/date-to" + }, + { + "$ref": "#/components/parameters/animal-scheme" + }, + { + "$ref": "#/components/parameters/animal-id" + }, + { + "$ref": "#/components/parameters/metric-scheme" + }, + { + "$ref": "#/components/parameters/metric-id" + }, + { + "$ref": "#/components/parameters/duration" + }, + { + "$ref": "#/components/parameters/meta-modified-from" + }, + { + "$ref": "#/components/parameters/meta-modified-to" + } + ], + "responses": { + "200": { + "description": "Successful. The response contains the animal observation summary resources for the given location.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarObservationSummaryCollection" + } + } + } + }, + "default": { + "$ref": "#/components/responses/default" + } + } + } + }, "/batches/locations/{location-scheme}/{location-id}/animal-sets": { "post": { "operationId": "post-batch-animal-sets", @@ -1614,7 +1673,7 @@ "$ref": "../resources/icarInventoryTransactionResource.json" }, "icarInventoryTransactionCollection": { - "$ref": "../collections/icarInventoryTransactionCollection.json" + "$ref": "../collections/icarInventoryTransactionCollection.json" }, "icarInventoryTransactionArray": { "type": "array", @@ -1626,7 +1685,7 @@ "$ref": "../resources/icarFeedTransactionResource.json" }, "icarFeedTransactionCollection": { - "$ref": "../collections/icarFeedTransactionCollection.json" + "$ref": "../collections/icarFeedTransactionCollection.json" }, "icarFeedTransactionArray": { "type": "array", @@ -1638,7 +1697,7 @@ "$ref": "../resources/icarMedicineTransactionResource.json" }, "icarMedicineTransactionCollection": { - "$ref": "../collections/icarMedicineTransactionCollection.json" + "$ref": "../collections/icarMedicineTransactionCollection.json" }, "icarMedicineTransactionArray": { "type": "array", @@ -1650,7 +1709,7 @@ "$ref": "../resources/icarGroupPositionObservationEventResource.json" }, "icarGroupPositionObservationEventCollection": { - "$ref": "../collections/icarGroupPositionObservationEventCollection.json" + "$ref": "../collections/icarGroupPositionObservationEventCollection.json" }, "icarGroupPositionObservationEventArray": { "type": "array", @@ -1662,13 +1721,16 @@ "$ref": "../resources/icarPositionObservationEventResource.json" }, "icarPositionObservationEventCollection": { - "$ref": "../collections/icarPositionObservationEventCollection.json" + "$ref": "../collections/icarPositionObservationEventCollection.json" }, "icarPositionObservationEventArray": { "type": "array", "items": { "$ref": "#/components/schemas/icarPositionObservationEventResource" } + }, + "icarObservationSummaryCollection": { + "$ref": "../collections/icarObservationSummaryCollection.json" } }, "parameters": { @@ -1732,48 +1794,93 @@ "description": "The purpose of the statistics.", "required": false, "schema": { - "$ref": "../enums/icarStatisticsPurposeType.json" + "$ref": "../enums/icarStatisticsPurposeType.json" } }, "family": { - "name": "family", - "in": "query", - "description": "The family of products.", - "required": false, - "schema": { - "$ref": "../enums/icarProductFamilyType.json" - } + "name": "family", + "in": "query", + "description": "The family of products.", + "required": false, + "schema": { + "$ref": "../enums/icarProductFamilyType.json" + } }, "identifier-scheme": { - "name": "identifier-scheme", - "in": "query", - "description": "The scheme for an identifier.", - "required": false, - "schema": { - "type": "string" - } + "name": "identifier-scheme", + "in": "query", + "description": "The scheme for an identifier.", + "required": false, + "schema": { + "type": "string" + } }, "identifier-id": { - "name": "identifier-id", - "in": "query", - "description": "The unique identifier within a scheme.", - "required": false, - "schema": { - "type": "string" - } + "name": "identifier-id", + "in": "query", + "description": "The unique identifier within a scheme.", + "required": false, + "schema": { + "type": "string" + } + }, + "animal-scheme": { + "name": "animal-scheme", + "in": "query", + "description": "The scheme id for the animal identifier.", + "required": false, + "schema": { + "type": "string" + } + }, + "animal-id": { + "name": "animal-id", + "in": "query", + "description": "The unique identifier for the animal.", + "required": false, + "schema": { + "type": "string" + } + }, + "metric-scheme": { + "name": "metric-scheme", + "in": "query", + "description": "The scheme for a metric.", + "required": false, + "schema": { + "type": "string" + } + }, + "metric-id": { + "name": "metric-id", + "in": "query", + "description": "The unique metric within a scheme.", + "required": false, + "schema": { + "type": "string" + } + }, + "duration": { + "name": "duration", + "in": "query", + "description": "The duration for aggregations (e.g. 1D, 1H, 24H, 96H).", + "required": true, + "schema": { + "type": "string" + } } }, "responses": { - "default": { - "description": "An error has occured while handling the request. Check the content of the message for the error details.", - "content": { - "application/json": { - "schema": { - "$ref": "../collections/icarErrorCollection.json" + "default": { + "description": "An error has occured while handling the request. Check the content of the message for the error details.", + "content": { + "application/json": { + "schema": { + "$ref": "../collections/icarErrorCollection.json" + } + } } - } } - } } } -} +} \ No newline at end of file diff --git a/well-known/icarActivityMetrics.md b/well-known/icarActivityMetrics.md deleted file mode 100644 index 9e62568..0000000 --- a/well-known/icarActivityMetrics.md +++ /dev/null @@ -1,15 +0,0 @@ -# Predefined metrics that can be used for animal activity measurement - -| Metric name | Units | Description | -| --- | --- | --- | -| DrinkingTime | MIN | Time spent drinking, measured over a daily (1D) or 24hour (24H) period. | -| EatingTime | MIN | Time spent prehending, chewing, and swallowing feed, measured over a daily (1D) or 24hour (24H) period. | -| InactiveTime | MIN | Time when an animal is not actively moving, which can occur in either standing or lying positions. Measured over a daily (1D) or 24-hour (24H) period. | -| LyingTime | MIN | Time spent lying down, measured over a daily (1D) or 24-hour (24H) period. | -| RestingTime | MIN | Time spent resting (standing, lying, but not walking or eating), measured over a daily (1D) or 24hour (24H) period. | -| RuminationTime | MIN | Time spent ruminating (regurgiating and re-chewing food), measured over a daily (1D) or 24-hour (24H) period. | -| StandingTime | MIN | Time spent standing, measured over a daily (1D) or 24-hour (24H) period. | -| StepCount | STEP | Number of steps measured with a pedometer or activity device. STEP is not an ISO or UN/CEFACT unit. | -| WalkingTime | MIN | Time spent walking measured over a daily (1D) or 24-hour (24H) period. | - - diff --git a/well-known/icarMetricTypeIdentifier.md b/well-known/icarMetricTypeIdentifier.md index 8ee83d3..1658f03 100644 --- a/well-known/icarMetricTypeIdentifier.md +++ b/well-known/icarMetricTypeIdentifier.md @@ -4,4 +4,4 @@ | --- | --- | --- | --- | --- | | icar.org | | ICAR defined metrics - is there something available from ICAR | Milk weight | | | crv.nl | | CRV defined metrics - need to setup a webpage for this ... | Milk weight | | -| org.icar.activities | [icarActivityMetrics](icarActivityMetrics.md) | Activity observation metrics defined by the ICAR ADE group. | RuminationTime, StandingTime | Values as specified in the linked markdown. | +| org.icar.activities | [icarObservationSummaryMetrics](icarObservationSummaryMetrics.md) | Observation summary metrics defined by the ICAR ADE group. | RuminationTime, StandingTime | Values as specified in the linked markdown. | diff --git a/well-known/icarObservationSummaryMetrics.md b/well-known/icarObservationSummaryMetrics.md new file mode 100644 index 0000000..887c4a7 --- /dev/null +++ b/well-known/icarObservationSummaryMetrics.md @@ -0,0 +1,18 @@ +# Predefined metrics that can be used for animal activity measurement +Add more metrics when required (check for duplicates first) and submit with a Pull Request. + +| Metric name | Units | Description | +| --- | --- | --- | +| DrinkingTime | MIN | Time spent drinking, measured over a time period. | +| EatingTime | MIN | Time spent prehending, chewing, and swallowing feed, measured over a time period. | +| InactiveTime | MIN | Time when an animal is not actively moving, which can occur in either standing or lying positions. Measured over a time period. | +| LyingTime | MIN | Time spent lying down, measured over a time period. | +| RestingTime | MIN | Time spent resting (standing, lying, but not walking or eating), measured over a time period. | +| RuminationTime | MIN | Time spent ruminating (regurgiating and re-chewing food), measured over a time period. | +| StandingTime | MIN | Time spent standing, measured over a time period. | +| StepCount | ACT | Number of steps measured with a pedometer or activity device. ACT is the UN/CEFACT unit for a count of an action. | +| WalkingTime | MIN | Time spent walking measured over a time period. | +| MilkingVisitCount | ACT | Number of milking visits observed in a time period. | +| RumenPHRange | - | Range or Amplitude difference between minimum and maximum pH over a period. | + + From 711500be1e2d767936ea1247f3f1acbb3f2e5698 Mon Sep 17 00:00:00 2001 From: cookeac Date: Thu, 3 Oct 2024 21:03:29 +1300 Subject: [PATCH 5/6] Add 96H to duration --- enums/icarDurationType.json | 1 + 1 file changed, 1 insertion(+) diff --git a/enums/icarDurationType.json b/enums/icarDurationType.json index 4968658..8e86fee 100644 --- a/enums/icarDurationType.json +++ b/enums/icarDurationType.json @@ -7,6 +7,7 @@ "1D", "1H", "24H", + "96H", "1W", "1M" ] From ef28b628b3a7a970cca6ea9058af6196d95ddc46 Mon Sep 17 00:00:00 2001 From: Andrew Cooke <45248509+cookeac@users.noreply.github.com> Date: Thu, 28 Nov 2024 07:37:14 +1300 Subject: [PATCH 6/6] Update collections/icarObservationSummaryCollection.json Incorporate suggestion correcting description --- collections/icarObservationSummaryCollection.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collections/icarObservationSummaryCollection.json b/collections/icarObservationSummaryCollection.json index 3fae907..a92e8f9 100644 --- a/collections/icarObservationSummaryCollection.json +++ b/collections/icarObservationSummaryCollection.json @@ -1,5 +1,5 @@ { - "description": "Represents a collection of animal sets. Based on icarResourceCollection to provide paging etc.", + "description": "Represents a collection of observation summary statistics. Based on icarResourceCollection to provide paging etc.", "allOf": [{ "$ref": "../collections/icarResourceCollection.json"