diff --git a/collections/icarAttentionEventCollection.json b/collections/icarAttentionEventCollection.json new file mode 100644 index 0000000..4cfa2fb --- /dev/null +++ b/collections/icarAttentionEventCollection.json @@ -0,0 +1,21 @@ +{ + "description": "Represents a collection of attention events generated by devices. Based on icarResourceCollection to provide paging etc.", + + "allOf": [{ + "$ref": "icarResourceCollection.json" + }, + { + "type": "object", + + "properties": { + "member": { + "type": "array", + "items": { + "$ref": "../resources/icarAttentionEventResource.json" + }, + "description": "As per JSON-LD Hydra syntax, member provides the array of objects, in this case attention events." + } + } + } + ] +} diff --git a/enums/icarAttentionCategoryType.json b/enums/icarAttentionCategoryType.json new file mode 100644 index 0000000..73bae78 --- /dev/null +++ b/enums/icarAttentionCategoryType.json @@ -0,0 +1,12 @@ +{ + "description": "Defines a category of device messages that may allow filtering of alerts.", + + "type": "string", + + "enum": [ + "Behaviour", + "Environment", + "Health", + "Other" + ] + } \ No newline at end of file diff --git a/enums/icarAttentionCauseType.json b/enums/icarAttentionCauseType.json new file mode 100644 index 0000000..e165947 --- /dev/null +++ b/enums/icarAttentionCauseType.json @@ -0,0 +1,35 @@ +{ + "description": "Defines causes of alerts from devices.", + + "type": "string", + + "enum": [ + "Activity", + "AnimalTemperature", + "BodyCondition", + "EatingLess", + "EnvironmentTemperature", + "Disturbance", + "Health", + "HeartRate", + "Inactivity", + "Ketosis", + "Lameness", + "Location", + "LowerRumination", + "LyingTooLong", + "LyingTooShort", + "Mastitis", + "MobilityScore", + "NoMovement", + "Parturition", + "PostParturitionRisk", + "ProlongedParturition", + "RespirationRate", + "Standing", + "StandingUp", + "Walking", + "Other", + "Undefined" + ] + } \ No newline at end of file diff --git a/enums/icarAttentionPriorityType.json b/enums/icarAttentionPriorityType.json new file mode 100644 index 0000000..2db5c30 --- /dev/null +++ b/enums/icarAttentionPriorityType.json @@ -0,0 +1,12 @@ +{ + "description": "Defines the relative priority of alerts.", + + "type": "string", + + "enum": [ + "Informational", + "Normal", + "Urgent", + "Critical" + ] + } \ No newline at end of file diff --git a/enums/icarSetPurposeType.json b/enums/icarSetPurposeType.json index 27faf53..6b9e0fe 100644 --- a/enums/icarSetPurposeType.json +++ b/enums/icarSetPurposeType.json @@ -6,9 +6,12 @@ "enum": [ "Enclosure", "Feeding", + "Finishing", + "Growing", "Health", "Lactation", "Movement", + "Rearing", "Reproduction", "Session", "Other" diff --git a/resources/icarAttentionEventResource.json b/resources/icarAttentionEventResource.json new file mode 100644 index 0000000..958b8ee --- /dev/null +++ b/resources/icarAttentionEventResource.json @@ -0,0 +1,50 @@ +{ + "description": "Defines an alert for an animal that may require attention.", + + "allOf": [ + { + "$ref": "../resources/icarAnimalEventCoreResource.json" + }, + { + "type": "object", + + "required" : ["category", "causes"], + + "properties": { + "alertEndDateTime": { + "$ref": "../types/icarDateTimeType.json", + "nullable": true, + "description": "RFC3339 date time that represents the end time of an alert (start time is the eventDateTime) if it has ended." + }, + "category": { + "$ref": "../enums/icarAttentionCategoryType.json", + "description": "A category that allows filtering of alerts by subject." + }, + "causes": { + "type": "array", + "items": { + "$ref": "../enums/icarAttentionCauseType.json" + }, + "description": "The specific causes of the alert. This is an array and at least one cause must be specified." + }, + "priority": { + "$ref": "../enums/icarAttentionPriorityType.json", + "description": "The relative priority of the alert." + }, + "severity": { + "$ref": "../enums/icarDiagnosisSeverityType.json", + "description": "A structured set of severity values that align with those used in disease diagnosis." + }, + "deviceAttentionScore": { + "type": "number", + "description": "Provides a manufacturer- and device-specific score related to the alert." + }, + "device": { + "$ref": "../types/icarDeviceReferenceType.json", + "description": "Identifies the device that is raising the alert." + } + } + } + ] +} + \ No newline at end of file diff --git a/url-schemes/exampleUrlScheme.json b/url-schemes/exampleUrlScheme.json index 6e37583..3e7122d 100644 --- a/url-schemes/exampleUrlScheme.json +++ b/url-schemes/exampleUrlScheme.json @@ -2363,7 +2363,7 @@ "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.3-management" + "ADE-1.3-health" ], "parameters": [ { @@ -2407,6 +2407,57 @@ } } } + }, + "/locations/{location-scheme}/{location-id}/attention-events": { + "get": { + "operationId": "get-attention-events", + "summary": "Get attention events.", + "description": "# Purpose\nProvides the attention events for a location. These are individual animal events, typically generated by devices such as wearables and sensors.\n", + "tags": [ + "ADE-1.3-health" + ], + "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 attention event resources for the given location.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarAttentionEventCollection" + } + } + } + }, + "default": { + "$ref": "#/components/responses/default" + } + } + } } }, "components": { @@ -2584,6 +2635,9 @@ }, "icarMedicineTransactionCollection": { "$ref": "../collections/icarMedicineTransactionCollection.json" + }, + "icarAttentionEventCollection": { + "$ref": "../collections/icarAttentionEventCollection.json" } }, "parameters": { diff --git a/url-schemes/healthURLScheme.json b/url-schemes/healthURLScheme.json index c5814a1..5162ba3 100644 --- a/url-schemes/healthURLScheme.json +++ b/url-schemes/healthURLScheme.json @@ -557,7 +557,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/icarHealthStatusObservedEvent" + "$ref": "#/components/schemas/icarMedicineTransactionResource" } } } @@ -574,6 +574,105 @@ } } }, + "/locations/{location-scheme}/{location-id}/attention-events": { + "get": { + "operationId": "get-attention-events", + "summary": "Get attention events.", + "description": "# Purpose\nProvides the attention events for a location. These are individual animal events, typically generated by devices such as wearables and sensors.\n", + "tags": [ + "ADE-1.3-health" + ], + "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 attention event resources for the given location.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarAttentionEventCollection" + } + } + } + }, + "default": { + "$ref": "#/components/responses/default" + } + } + }, + "post": { + "operationId": "post-single-attention-event", + "summary": "Add a single new attention event.", + "description": "# Purpose \nAllows a client to add a single attention event (typically generated by a device, wearable, or sensor).\n", + "tags": [ + "ADE-1.3-health" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + } + ], + "requestBody": { + "required": true, + "description": "The attention event resource to create. \nA client MAY fill in the *ID* field with a client-generated UUID and the server MAY use this *ID*.\nIf the server does not use the client-specified *ID* field it shall issue its own *ID* for the resource.\nA client SHALL ensure that the *meta.source* and *meta.sourceId* fields are filled by the client.\nThis applies to all resource *ID* and *meta* objects in the *icarTreatmentProgramEvent*.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarAttentionEventResource" + } + } + } + }, + "responses": { + "200": { + "description": "Successful. The response contains a copy of the resource, as modifed by the server.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarAttentionEventResource" + } + } + } + }, + "201": { + "description": "Created. The Location header contains the URI to the new resource." + }, + "202": { + "description": "Accepted. The Location header contains a URI that the client can query for processing status." + }, + "default": { + "$ref": "#/components/responses/default" + } + } + } + }, "/batches/locations/{location-scheme}/{location-id}/diagnoses": { "post": { "operationId": "post-batch-Diagnosis", @@ -1023,6 +1122,81 @@ } } } + }, + "/batches/locations/{location-scheme}/{location-id}/attention-events": { + "post": { + "operationId": "post-batch-attention-events", + "summary": "Add an array of attention events.", + "description": "# Purpose \nAllows a client to add a collection of attention events for animals. These are typically generated by devices such as wearables and sensors.\n", + "tags": [ + "ADE-1.3-health" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + } + ], + "requestBody": { + "required": true, + "description": "The collection of attention events to create. \nA client MAY fill in resource *Id*s with a client-generated UUID and the server MAY use these *Id*s.\nIf the server does not use the client-specified *Id* field it shall issue its own *Id*s for the resources.\nA client SHALL ensure that the *meta.source* and *meta.sourceId* fields are filled by the client.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarAttentionEventArray" + } + } + } + }, + "responses": { + "200": { + "description": "Successful. The response contains a set of batch results, which may include warnings.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/batchResults" + } + } + } + }, + "201": { + "description": "Created. The Location header contains URI to retrieve a set of batch results, which may include warnings.", + "headers": { + "Location": { + "schema": { + "type": "string", + "format": "uri" + }, + "description": "Contains the URI to the results." + } + } + }, + "202": { + "description": "Accepted. The Location header contains a URI that the client can query for processing status.", + "headers": { + "Location": { + "schema": { + "type": "string", + "format": "uri" + }, + "description": "Contains a URI to query creation status." + } + } + }, + "default": { + "description": "The response contains a set of batch results, which may include errors and warnings.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/batchResults" + } + } + } + } + } + } } }, "components": { @@ -1104,7 +1278,19 @@ "items": { "$ref": "#/components/schemas/icarMedicineTransactionResource" } - } + }, + "icarAttentionEventResource": { + "$ref": "../resources/icarAttentionEventResource.json" + }, + "icarAttentionEventCollection": { + "$ref": "../collections/icarAttentionEventCollection.json" + }, + "icarAttentionEventArray": { + "type": "array", + "items": { + "$ref": "#/components/schemas/icarAttentionEventResource" + } + } }, "parameters": { "location-scheme": {