Skip to content

Commit

Permalink
Merge pull request #486 from cookeac/465-animal-observation-summary
Browse files Browse the repository at this point in the history
465 animal observation summary
  • Loading branch information
cookeac authored Nov 27, 2024
2 parents 20b97b3 + ef28b62 commit e55be23
Show file tree
Hide file tree
Showing 9 changed files with 511 additions and 199 deletions.
21 changes: 21 additions & 0 deletions collections/icarObservationSummaryCollection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"description": "Represents a collection of observation summary statistics. 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."
}
}
}
]
}
6 changes: 4 additions & 2 deletions enums/icarAggregationType.json
Original file line number Diff line number Diff line change
@@ -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",

Expand All @@ -9,7 +9,9 @@
"StDev",
"Min",
"Max",
"Count"
"Count",
"Range",
"Index"
]
}

15 changes: 15 additions & 0 deletions enums/icarDurationType.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"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",
"96H",
"1W",
"1M"
]
}

28 changes: 28 additions & 0 deletions resources/icarObservationSummaryResource.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"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."
},
"statistics": {
"description": "The summary statistics for this animal. Likely to be summarised on demand based on query parameters.",
"type": "array",
"items": {
"$ref": "../types/icarObservationStatisticsType.json"
}
}
}
}
]
}
30 changes: 30 additions & 0 deletions types/icarObservationStatisticsType.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"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/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). 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."
}
}

},
{
"$ref": "../types/icarStatisticsType.json"
}
]
}
92 changes: 91 additions & 1 deletion url-schemes/exampleUrlScheme.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -2820,6 +2880,9 @@
},
"icarGroupPositionObservationEventCollection": {
"$ref": "../collections/icarGroupPositionObservationEventCollection.json"
},
"icarObservationSummaryCollection": {
"$ref": "../collections/icarObservationSummaryCollection.json"
}
},
"parameters": {
Expand Down Expand Up @@ -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": {
Expand Down
Loading

0 comments on commit e55be23

Please sign in to comment.