From 7bd093f3bf0d0fefec40d7ec51d4aced7841fb5c Mon Sep 17 00:00:00 2001 From: cookeac Date: Thu, 20 May 2021 17:28:01 +1200 Subject: [PATCH 01/12] Create healthURLScheme.json URL scheme for ADE-1.x-health with POST and batch POST methods. --- url-schemes/healthURLScheme.json | 611 +++++++++++++++++++++++++++++++ 1 file changed, 611 insertions(+) create mode 100644 url-schemes/healthURLScheme.json diff --git a/url-schemes/healthURLScheme.json b/url-schemes/healthURLScheme.json new file mode 100644 index 0000000..73b4126 --- /dev/null +++ b/url-schemes/healthURLScheme.json @@ -0,0 +1,611 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "Health Diagnosis and Treatment API Specifications", + "description": "Specifications for messages that support livestock health and disease diagnosis and treatments.", + "version": "1.2", + "contact": { + "name": "Animal Data Exchange Working Group", + "url": "https://www.icar.org/index.php/technical-bodies/working-groups/animal-data-exchange-wg/", + "email": "icar@icar.org" + } + }, + "servers": [ + { + "url": "https://icar-ade.standard.com" + } + ], + "tags": [ + { + "name": "ADE-1.2-health", + "description": "Health messages approved by the working group" + } + ], + "paths": { + "/locations/{location-scheme}/{location-id}/diagnoses": { + "get": { + "operationId": "get-Diagnoses", + "summary": "Get the diagnoses for a certain location", + "description": "# Purpose\nProvides the animal health diagnoses for a location\n", + "tags": [ + "ADE-1.2-health" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + }, + { + "$ref": "#/components/parameters/meta-modified-from" + }, + { + "$ref": "#/components/parameters/meta-modified-to" + } + ], + "responses": { + "200": { + "description": "Successful. The response contains the diagnoses for the given location.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarDiagnosisEventCollection" + } + } + } + }, + "default": { + "$ref": "#/components/responses/default" + } + } + }, + "post": { + "operationId": "post-single-Diagnosis", + "summary": "Add a single new diagnosis event", + "description": "# Purpose \nAllows a client to add a single animal health diagnosis event.\n", + "tags": [ + "ADE-1.2-health" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + } + ], + "requestBody": { + "required": true, + "description": "The health diagnosis event 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.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarDiagnosisEvent" + } + } + } + }, + "responses": { + "200": { + "description": "Successful. The response contains a copy of the event, as modifed by the server.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarDiagnosisEvent" + } + } + } + }, + "201": { + "description": "Created. The Location header contains the URI to the new resource.", + "headers": { + "Location": { + "schema": { + "type": "string", + "format": "uri" + }, + "description": "Contains the URI to the new resource." + } + } + }, + "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": { + "$ref": "#/components/responses/default" + } + } + } + }, + "/locations/{location-scheme}/{location-id}/treatments": { + "get": { + "operationId": "get-Treatments", + "summary": "Get the treatments for a certain location", + "description": "# Purpose\nProvides the animal health treatments for a location\n", + "tags": [ + "ADE-1.2-health" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + }, + { + "$ref": "#/components/parameters/meta-modified-from" + }, + { + "$ref": "#/components/parameters/meta-modified-to" + } + ], + "responses": { + "200": { + "description": "Successful. The response contains the treatments for the given location.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarTreatmentEventCollection" + } + } + } + }, + "default": { + "$ref": "#/components/responses/default" + } + } + }, + "post": { + "operationId": "post-single-Treatment", + "summary": "Add a single new health treatment event", + "description": "# Purpose \nAllows a client to add a single animal health treatment event.\n", + "tags": [ + "ADE-1.2-health" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + } + ], + "requestBody": { + "required": true, + "description": "The health treatment event 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.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarTreatmentEvent" + } + } + } + }, + "responses": { + "200": { + "description": "Successful. The response contains a copy of the event, as modifed by the server.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarTreatmentEvent" + } + } + } + }, + "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" + } + } + } + }, + "/locations/{location-scheme}/{location-id}/treatment-programs": { + "get": { + "operationId": "get-Treatment-Programs", + "summary": "Get the treatment programs for a certain location", + "description": "# Purpose\nProvides the animal health treatment programs for a location\n", + "tags": [ + "ADE-1.2-health" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + }, + { + "$ref": "#/components/parameters/meta-modified-from" + }, + { + "$ref": "#/components/parameters/meta-modified-to" + } + ], + "responses": { + "200": { + "description": "Successful. The response contains the treatment progams for the given location.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarTreatmentProgramEventCollection" + } + } + } + }, + "default": { + "$ref": "#/components/responses/default" + } + } + }, + "post": { + "operationId": "post-single-Treatment-Program", + "summary": "Add a single new health treatment programme.", + "description": "# Purpose \nAllows a client to add a single animal health treatment programme.\n", + "tags": [ + "ADE-1.2-health" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + } + ], + "requestBody": { + "required": true, + "description": "The health treatment programme 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/icarTreatmentProgramEvent" + } + } + } + }, + "responses": { + "200": { + "description": "Successful. The response contains a copy of the event, as modifed by the server.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarTreatmentProgramEvent" + } + } + } + }, + "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/{location-scheme}/{location-id}/diagnoses": { + "post": { + "operationId": "post-batch-Diagnosis", + "summary": "Add a single new diagnosis event", + "description": "# Purpose \nAllows a client to add a collection of animal health diagnosis events.\n", + "tags": [ + "ADE-1.2-health" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + } + ], + "requestBody": { + "required": true, + "description": "The collection of health diagnosis 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.\nAlthough a collection is used, servers SHALL IGNORE any pagination-related attributes.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarDiagnosisEventCollection" + } + } + } + }, + "responses": { + "200": { + "description": "Successful. The response contains a copy of the collection, as modifed by the server.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarDiagnosisEventCollection" + } + } + } + }, + "201": { + "description": "Created. The Location header contains the URI to the collection, as modified by the server.", + "headers": { + "Location": { + "schema": { + "type": "string", + "format": "uri" + }, + "description": "Contains the URI to the new resource." + } + } + }, + "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": { + "$ref": "#/components/responses/default" + } + } + } + }, + "/batches/{location-scheme}/{location-id}/treatments": { + "post": { + "operationId": "post-batch-Treatments", + "summary": "Add a collection of health treatment events", + "description": "# Purpose \nAllows a client to add a collection of animal health treatment events.\n", + "tags": [ + "ADE-1.2-health" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + } + ], + "requestBody": { + "required": true, + "description": "The collection of health treatment 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.\nAlthough a collection is used, servers SHALL IGNORE any pagination-related attributes.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarTreatmentEventCollection" + } + } + } + }, + "responses": { + "200": { + "description": "Successful. The response contains a copy of the collection, as modifed by the server.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarDiagnosisEventCollection" + } + } + } + }, + "201": { + "description": "Created. The Location header contains the URI to the collection, as modified by the server.", + "headers": { + "Location": { + "schema": { + "type": "string", + "format": "uri" + }, + "description": "Contains the URI to a collection of new resources." + } + } + }, + "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": { + "$ref": "#/components/responses/default" + } + } + } + }, + "/batches/{location-scheme}/{location-id}/treatment-programs": { + "post": { + "operationId": "post-batch-Treatment-Program", + "summary": "Add a collection of animal health treatment program events.", + "description": "# Purpose \nAllows a client to add a collection of animal health treatment program events.\n", + "tags": [ + "ADE-1.2-health" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + } + ], + "requestBody": { + "required": true, + "description": "The collection of health treatment program 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.\nAlthough a collection is used, servers SHALL IGNORE any pagination-related attributes.\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarTreatmentProgramEventCollection" + } + } + } + }, + "responses": { + "200": { + "description": "Successful. The response contains a copy of the collection, as modifed by the server.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarTreatmentProgramEventCollection" + } + } + } + }, + "201": { + "description": "Created. The Location header contains the URI to the collection, as modified by the server.", + "headers": { + "Location": { + "schema": { + "type": "string", + "format": "uri" + }, + "description": "Contains the URI to a collection of new resources." + } + } + }, + "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": { + "$ref": "#/components/responses/default" + } + } + } + } + }, + "components": { + "schemas": { + "error": { + "$ref": "../resources/exampleErrorResource.json" + }, + "icarDiagnosisEvent": { + "$ref": "../resources/icarDiagnosisEventResource.json" + }, + "icarDiagnosisEventCollection": { + "$ref": "../collections/icarDiagnosisEventCollection.json" + }, + "icarTreatmentEvent": { + "$ref": "../resources/icarTreatmentEventResource.json" + }, + "icarTreatmentEventCollection": { + "$ref": "../collections/icarTreatmentEventCollection.json" + }, + "icarTreatmentProgramEvent": { + "$ref": "../resources/icarTreatmentProgramEventResource.json" + }, + "icarTreatmentProgramEventCollection": { + "$ref": "../collections/icarTreatmentProgramEventCollection.json" + } + }, + "parameters": { + "location-scheme": { + "name": "location-scheme", + "in": "path", + "description": "The scheme id for the location identifier.", + "required": true, + "schema": { + "type": "string" + } + }, + "location-id": { + "name": "location-id", + "in": "path", + "description": "The unique identifier for the location.", + "required": true, + "schema": { + "type": "string" + } + }, + "meta-modified-from": { + "name": "meta-modified-from", + "in": "query", + "description": "The start of the date-time range for the data to get in the request.", + "schema": { + "type": "string", + "format": "date-time" + } + }, + "meta-modified-to": { + "name": "meta-modified-to", + "in": "query", + "description": "The end of the date-time range for the data to get in the request.", + "schema": { + "type": "string", + "format": "date-time" + } + }, + "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" + } + } + }, + "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": { + "type": "object", + "properties": { + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/error" + } + } + }, + "description": "A default response containing only a list of errors" + } + } + } + } + } + } +} \ No newline at end of file From 325e9b6281616726b3b0ce6143d49df1ed053528 Mon Sep 17 00:00:00 2001 From: Andrew Cooke <45248509+cookeac@users.noreply.github.com> Date: Thu, 1 Jul 2021 18:06:11 +1200 Subject: [PATCH 02/12] Update resource for RFC7801 compliance and Ids --- resources/exampleErrorResource.json | 32 ++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/resources/exampleErrorResource.json b/resources/exampleErrorResource.json index ae5b07f..b1a4a7f 100644 --- a/resources/exampleErrorResource.json +++ b/resources/exampleErrorResource.json @@ -1,22 +1,19 @@ { - "description": "A human-readable error message describing what went wrong.", + "description": "An extention to a RFC7807 compliant problem response for JSON APIs", "type": "object", "properties": { - "id": { + "type": { "type": "string", - "description": "A unique identifier for this particular occurrence of the problem" + "format": "uri", + "description": "Machine readable URI that uniquely defines the problem." }, "status": { "type": "integer", - "description": "The HTTP status code applicable to this problem, expressed as a string value", + "description": "The HTTP status code applicable to this problem", "format": "int32" }, - "code": { - "type": "string", - "description": "An application-specific error code, expressed as a string value." - }, "title": { "type": "string", "description": "A short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization." @@ -25,10 +22,25 @@ "type": "string", "description": "A human-readable explanation specific to this occurrence of the problem. Like title, this field’s value can be localized." }, - "meta": { + "instance": { + "type": "string", + "description": "A URI reference or internal JSON document reference to the specific data resource that caused the problem." + }, + "instanceIdentification": { "type": "object", "properties": { - + "source": { + "type": "string", + "description": "Identifies the source of the resource as contained in the resource metadata." + }, + "sourceId": { + "type": "string", + "description": "Identifies the resource using its source identifier as contained in the resource metadata." + }, + "hostId": { + "type": "string", + "description": "If specified, identifies the resource with a unique Id (UUID) in the host system." + } } } } From a04075368a95a7a2514be77b770df03a7704a47f Mon Sep 17 00:00:00 2001 From: Andrew Cooke <45248509+cookeac@users.noreply.github.com> Date: Thu, 1 Jul 2021 19:53:02 +1200 Subject: [PATCH 03/12] Added ErrorResource, BatchResult, removed collections --- resources/exampleErrorResource.json | 32 +++-------- resources/icarBatchResult.json | 30 ++++++++++ resources/icarErrorResource.json | 31 ++++++++++ url-schemes/healthURLScheme.json | 89 ++++++++++++++++++++++------- 4 files changed, 136 insertions(+), 46 deletions(-) create mode 100644 resources/icarBatchResult.json create mode 100644 resources/icarErrorResource.json diff --git a/resources/exampleErrorResource.json b/resources/exampleErrorResource.json index b1a4a7f..3045cde 100644 --- a/resources/exampleErrorResource.json +++ b/resources/exampleErrorResource.json @@ -1,18 +1,18 @@ { - "description": "An extention to a RFC7807 compliant problem response for JSON APIs", + "description": "An extension to an (almost) RFC7807 compliant problem response for JSON APIs.", "type": "object", "properties": { - "type": { + "id": { "type": "string", - "format": "uri", - "description": "Machine readable URI that uniquely defines the problem." + "description": "Machine readable URI that uniquely defines the problem (this field should really be called 'type')." }, "status": { "type": "integer", - "description": "The HTTP status code applicable to this problem", - "format": "int32" + "description": "The HTTP status code applicable to this problem.", + "format": "int32", + "nullable": true }, "title": { "type": "string", @@ -24,24 +24,8 @@ }, "instance": { "type": "string", - "description": "A URI reference or internal JSON document reference to the specific data resource that caused the problem." - }, - "instanceIdentification": { - "type": "object", - "properties": { - "source": { - "type": "string", - "description": "Identifies the source of the resource as contained in the resource metadata." - }, - "sourceId": { - "type": "string", - "description": "Identifies the resource using its source identifier as contained in the resource metadata." - }, - "hostId": { - "type": "string", - "description": "If specified, identifies the resource with a unique Id (UUID) in the host system." - } - } + "description": "A URI reference or internal JSON document reference to the specific data item that caused the problem.", + "nullable": true } } } \ No newline at end of file diff --git a/resources/icarBatchResult.json b/resources/icarBatchResult.json new file mode 100644 index 0000000..a064c83 --- /dev/null +++ b/resources/icarBatchResult.json @@ -0,0 +1,30 @@ +{ + "description": "Returned by a batch POST event to return identity (meta), errors, and warnings for a resource.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique identifier created in the system for this event. SHOULD be a UUID." + }, + "meta": { + "$ref": "../types/icarMetaDataType.json", + "description": "Metadata for the posted resource. Allows specification of the source, source Id to synchronise data." + }, + "errors": { + "type": "array", + "description": "An arry of errors for this resource.", + "nullable": true, + "items": { + "$ref": "../resources/icarErrorResource.json" + } + }, + "warnings": { + "type": "array", + "description": "An arry of warnings for this resource.", + "nullable": true, + "items": { + "$ref": "../resources/icarErrorResource.json" + } + } + } +} \ No newline at end of file diff --git a/resources/icarErrorResource.json b/resources/icarErrorResource.json new file mode 100644 index 0000000..aab32e3 --- /dev/null +++ b/resources/icarErrorResource.json @@ -0,0 +1,31 @@ +{ + "description": "An RFC7807 compliant problem response for JSON APIs.", + + "type": "object", + + "properties": { + "type": { + "type": "string", + "description": "Machine readable URI or code that defines the type of error or warning." + }, + "status": { + "type": "integer", + "description": "The HTTP status code applicable to this problem.", + "format": "int32", + "nullable": true + }, + "title": { + "type": "string", + "description": "A short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization." + }, + "detail": { + "type": "string", + "description": "A human-readable explanation specific to this occurrence of the problem. Like title, this field’s value can be localized." + }, + "instance": { + "type": "string", + "description": "A URI reference or internal JSON document reference to the specific data item that caused the problem.", + "nullable": true + } + } +} \ No newline at end of file diff --git a/url-schemes/healthURLScheme.json b/url-schemes/healthURLScheme.json index 73b4126..586fa0b 100644 --- a/url-schemes/healthURLScheme.json +++ b/url-schemes/healthURLScheme.json @@ -319,35 +319,35 @@ ], "requestBody": { "required": true, - "description": "The collection of health diagnosis 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.\nAlthough a collection is used, servers SHALL IGNORE any pagination-related attributes.\n", + "description": "The collection of health diagnosis 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/icarDiagnosisEventCollection" + "$ref": "#/components/schemas/icarDiagnosisEventArray" } } } }, "responses": { "200": { - "description": "Successful. The response contains a copy of the collection, as modifed by the server.", + "description": "Successful. The response contains a set of batch results, which may include warnings.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/icarDiagnosisEventCollection" + "$ref": "#/components/schemas/batchResults" } } } }, "201": { - "description": "Created. The Location header contains the URI to the collection, as modified by the server.", + "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 new resource." + "description": "Contains the URI to the results." } } }, @@ -364,7 +364,14 @@ } }, "default": { - "$ref": "#/components/responses/default" + "description": "The response contains a set of batch results, which may include errors and warnings.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/batchResults" + } + } + } } } } @@ -387,35 +394,35 @@ ], "requestBody": { "required": true, - "description": "The collection of health treatment 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.\nAlthough a collection is used, servers SHALL IGNORE any pagination-related attributes.\n", + "description": "The collection of health treatment 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/icarTreatmentEventCollection" + "$ref": "#/components/schemas/icarTreatmentEventArray" } } } }, "responses": { "200": { - "description": "Successful. The response contains a copy of the collection, as modifed by the server.", + "description": "Successful. The response contains a set of batch results, which may include warnings.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/icarDiagnosisEventCollection" + "$ref": "#/components/schemas/batchResults" } } } }, "201": { - "description": "Created. The Location header contains the URI to the collection, as modified by the server.", + "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 a collection of new resources." + "description": "Contains the URI to the results." } } }, @@ -432,7 +439,14 @@ } }, "default": { - "$ref": "#/components/responses/default" + "description": "The response contains a set of batch results, which may include errors and warnings.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/batchResults" + } + } + } } } } @@ -455,35 +469,35 @@ ], "requestBody": { "required": true, - "description": "The collection of health treatment program 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.\nAlthough a collection is used, servers SHALL IGNORE any pagination-related attributes.\n", + "description": "The collection of health treatment program 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/icarTreatmentProgramEventCollection" + "$ref": "#/components/schemas/icarTreatmentProgramEventArray" } } } }, "responses": { "200": { - "description": "Successful. The response contains a copy of the collection, as modifed by the server.", + "description": "Successful. The response contains a set of batch results, which may include warnings.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/icarTreatmentProgramEventCollection" + "$ref": "#/components/schemas/batchResults" } } } }, "201": { - "description": "Created. The Location header contains the URI to the collection, as modified by the server.", + "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 a collection of new resources." + "description": "Contains the URI to the results." } } }, @@ -500,7 +514,14 @@ } }, "default": { - "$ref": "#/components/responses/default" + "description": "The response contains a set of batch results, which may include errors and warnings.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/batchResults" + } + } + } } } } @@ -508,8 +529,14 @@ }, "components": { "schemas": { + "batchResults": { + "type": "array", + "items": { + "$ref": "../resources/icarBatchResult.json" + } + }, "error": { - "$ref": "../resources/exampleErrorResource.json" + "$ref": "../resources/icarErrorResource.json" }, "icarDiagnosisEvent": { "$ref": "../resources/icarDiagnosisEventResource.json" @@ -517,17 +544,35 @@ "icarDiagnosisEventCollection": { "$ref": "../collections/icarDiagnosisEventCollection.json" }, + "icarDiagnosisEventArray": { + "type": "array", + "items": { + "$ref": "../resources/icarDiagnosisEventResource.json" + } + }, "icarTreatmentEvent": { "$ref": "../resources/icarTreatmentEventResource.json" }, "icarTreatmentEventCollection": { "$ref": "../collections/icarTreatmentEventCollection.json" }, + "icarTreatmentEventArray": { + "type": "array", + "items": { + "$ref": "../resources/icarTreatmentEventResource.json" + } + }, "icarTreatmentProgramEvent": { "$ref": "../resources/icarTreatmentProgramEventResource.json" }, "icarTreatmentProgramEventCollection": { "$ref": "../collections/icarTreatmentProgramEventCollection.json" + }, + "icarTreatmentProgramEventArray": { + "type": "array", + "items": { + "$ref": "../resources/icarTreatmentProgramEventResource.json" + } } }, "parameters": { From 72c5dfe31cb92225eda2052740243694931503f2 Mon Sep 17 00:00:00 2001 From: Andrew Cooke <45248509+cookeac@users.noreply.github.com> Date: Thu, 15 Jul 2021 18:09:56 +1200 Subject: [PATCH 04/12] Changes to death method and reason Adjustments to the enumerated values for death event reasons and methods (kinds). Resolves #224. --- enums/icarDeathMethodType.json | 9 ++++++--- enums/icarDeathReasonType.json | 9 ++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/enums/icarDeathMethodType.json b/enums/icarDeathMethodType.json index e11168c..1833b65 100644 --- a/enums/icarDeathMethodType.json +++ b/enums/icarDeathMethodType.json @@ -4,9 +4,12 @@ "type": "string", "enum": [ + "Perished", + "Slaughter", + "Culled", + "Theft", + "Lost", "Accident", - "Euthanised", - "Natural", - "Unknown" + "Other" ] } \ No newline at end of file diff --git a/enums/icarDeathReasonType.json b/enums/icarDeathReasonType.json index 070fbc6..bbb55d0 100644 --- a/enums/icarDeathReasonType.json +++ b/enums/icarDeathReasonType.json @@ -11,6 +11,13 @@ "Consumption", "Culled", "Other", - "Unknown" + "Unknown", + "Age", + "Mastitis", + "Production", + "LegOrClaw", + "MilkingAbility", + "NUtrition", + "Fertility" ] } \ No newline at end of file From 19730a1a39dc6299853cd98a9c8266a682b8aa27 Mon Sep 17 00:00:00 2001 From: Andrew Cooke <45248509+cookeac@users.noreply.github.com> Date: Thu, 15 Jul 2021 18:14:31 +1200 Subject: [PATCH 05/12] Add no. treatments and interval to courses Added numberOfTreatments and treatmentInterval to icarMedicineCourseSummaryType Resolves #219 --- types/icarMedicineCourseSummaryType.json | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/types/icarMedicineCourseSummaryType.json b/types/icarMedicineCourseSummaryType.json index 0d23a97..55d21e0 100644 --- a/types/icarMedicineCourseSummaryType.json +++ b/types/icarMedicineCourseSummaryType.json @@ -32,6 +32,17 @@ "$ref": "../types/icarMedicineDoseType.json", "description": "Total dose proposed or administered." }, + "numberOfTreatments": { + "type": "number", + "description": "The number of treatments included in the course.", + "nullable": true + }, + "treatmentInterval": { + "type": "number", + "format": "double", + "description": "The interval between treatments specified in HOURS.", + "nullable": true + }, "batches": { "type": "array", "items": { From 441b5d14389472b293f8943ceeeda2fe664cae98 Mon Sep 17 00:00:00 2001 From: Andrew Cooke <45248509+cookeac@users.noreply.github.com> Date: Thu, 15 Jul 2021 19:25:58 +1200 Subject: [PATCH 06/12] Added Unknown departure reason, additional milk characteristics * Added "Unknown" to Departure Reason. Resolves #206. * Added x/y/z positions to QuarterMilking, and TEMPERATURE to milk characteristics. Resolves #170. --- enums/icarDepartureReasonType.json | 3 ++- types/icarMilkCharacteristicsType.json | 2 +- types/icarQuarterMilkingType.json | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/enums/icarDepartureReasonType.json b/enums/icarDepartureReasonType.json index d0cf71b..0c67d9d 100644 --- a/enums/icarDepartureReasonType.json +++ b/enums/icarDepartureReasonType.json @@ -19,6 +19,7 @@ "MilkingAbility", "BadType", "Behaviour", - "Other" + "Other", + "Unknown" ] } \ No newline at end of file diff --git a/types/icarMilkCharacteristicsType.json b/types/icarMilkCharacteristicsType.json index c4ad72a..9eeb63f 100644 --- a/types/icarMilkCharacteristicsType.json +++ b/types/icarMilkCharacteristicsType.json @@ -11,7 +11,7 @@ "properties": { "characteristic": { "type": "string", - "description": "ICAR Milk Characteristics Codes and values - we have at this moment SCC, FAT, PROTEIN, LAC, UREA, BLOOD, ACETONE, BHB, LDH, PRO, AVGCOND, MAXCOND, AVGFLWR, MAXFLWR, WEIGHT.\nThe following units have to be applied:\n\n|SCC|Somatic cell count|x1000 cells/ml|NCL\n|FAT|Fat|%|VP\n|PROTEIN|Protein|%|VP\n|LAC|Lactose|%|VP\n|UREA|Urea|mg/l|M1\n|BLOOD|Blood|true/false|A99\n|ACETONE|Acetone|mmol/l|M33\n|BHB|Beta hydroxybutyrate|mmol/l|M33\n|LDH|Lactate dehydrogenase|IU/l|\n|PRO|Progesteron|mmol/l|M33\n|AVGCOND|Average conductivity value of the milk at 25 ° C|mS/cm|H61\n|MAXCOND|Maximum conductivity value of the milk at 25 ° C|mS/cm|H61\n|AVGFLWR|Average flow rate|Kg/min|F31\n|MAXFLWR|Max flow rate|Kg/min|F31\n|WEIGHT|Weight of animal|Kg|KGM\n|PAG|Pregnancy associated glycoprotein|mmol/l|M33" + "description": "ICAR Milk Characteristics Codes and values: SCC, FAT, PROTEIN, LAC, UREA, BLOOD, ACETONE, BHB, LDH, PRO, AVGCOND, MAXCOND, AVGFLWR, MAXFLWR, WEIGHT, TEMPERATURE.\nThe following units have to be applied:\n\n|SCC|Somatic cell count|x1000 cells/ml|NCL\n|FAT|Fat|%|VP\n|PROTEIN|Protein|%|VP\n|LAC|Lactose|%|VP\n|UREA|Urea|mg/l|M1\n|BLOOD|Blood|true/false|A99\n|ACETONE|Acetone|mmol/l|M33\n|BHB|Beta hydroxybutyrate|mmol/l|M33\n|LDH|Lactate dehydrogenase|IU/l|\n|PRO|Progesteron|mmol/l|M33\n|AVGCOND|Average conductivity value of the milk at 25 ° C|mS/cm|H61\n|MAXCOND|Maximum conductivity value of the milk at 25 ° C|mS/cm|H61\n|AVGFLWR|Average flow rate|Kg/min|F31\n|MAXFLWR|Max flow rate|Kg/min|F31\n|WEIGHT|Weight of animal|Kg|KGM\n|PAG|Pregnancy associated glycoprotein|mmol/l|M33" }, "value": { "type": "string", diff --git a/types/icarQuarterMilkingType.json b/types/icarQuarterMilkingType.json index cd9c3ff..072e743 100644 --- a/types/icarQuarterMilkingType.json +++ b/types/icarQuarterMilkingType.json @@ -14,6 +14,21 @@ "RR" ] }, + "xposition": { + "type": "number", + "nullable": true, + "description": "Optional milking robot X position. Vendors may choose not to provide this." + }, + "yposition": { + "type": "number", + "nullable": true, + "description": "Optional milking robot Y position. Vendors may choose not to provide this." + }, + "zposition": { + "type": "number", + "nullable": true, + "description": "Optional milking robot Z position. Vendors may choose not to provide this." + }, "quarterMilkingDuration": { "$ref": "../types/icarMilkDurationType.json" }, From 2bfe7125672534b88badd9ed80b67abd6ed6ccae Mon Sep 17 00:00:00 2001 From: Andrew Cooke <45248509+cookeac@users.noreply.github.com> Date: Thu, 15 Jul 2021 19:25:58 +1200 Subject: [PATCH 07/12] Added Unknown departure reason, additional milk characteristics * Added "Unknown" to Departure Reason. Resolves #206. * Added x/y/z positions to QuarterMilking, and TEMPERATURE to milk characteristics. Resolves #170. From 89604b20421b807799745d46a3716e2203115fa3 Mon Sep 17 00:00:00 2001 From: Andrew Cooke <45248509+cookeac@users.noreply.github.com> Date: Thu, 15 Jul 2021 18:09:56 +1200 Subject: [PATCH 08/12] Changes to death method and reason Adjustments to the enumerated values for death event reasons and methods (kinds). Resolves #224. From f1c1ac6b2c08b40dccf6acfe4d2b020c817fc98b Mon Sep 17 00:00:00 2001 From: Andrew Cooke <45248509+cookeac@users.noreply.github.com> Date: Mon, 26 Jul 2021 20:42:12 +1200 Subject: [PATCH 09/12] Revert "Added ErrorResource, BatchResult, removed collections" This reverts commit a04075368a95a7a2514be77b770df03a7704a47f. --- resources/exampleErrorResource.json | 32 ++++++++--- resources/icarBatchResult.json | 30 ---------- resources/icarErrorResource.json | 31 ---------- url-schemes/healthURLScheme.json | 89 +++++++---------------------- 4 files changed, 46 insertions(+), 136 deletions(-) delete mode 100644 resources/icarBatchResult.json delete mode 100644 resources/icarErrorResource.json diff --git a/resources/exampleErrorResource.json b/resources/exampleErrorResource.json index 3045cde..b1a4a7f 100644 --- a/resources/exampleErrorResource.json +++ b/resources/exampleErrorResource.json @@ -1,18 +1,18 @@ { - "description": "An extension to an (almost) RFC7807 compliant problem response for JSON APIs.", + "description": "An extention to a RFC7807 compliant problem response for JSON APIs", "type": "object", "properties": { - "id": { + "type": { "type": "string", - "description": "Machine readable URI that uniquely defines the problem (this field should really be called 'type')." + "format": "uri", + "description": "Machine readable URI that uniquely defines the problem." }, "status": { "type": "integer", - "description": "The HTTP status code applicable to this problem.", - "format": "int32", - "nullable": true + "description": "The HTTP status code applicable to this problem", + "format": "int32" }, "title": { "type": "string", @@ -24,8 +24,24 @@ }, "instance": { "type": "string", - "description": "A URI reference or internal JSON document reference to the specific data item that caused the problem.", - "nullable": true + "description": "A URI reference or internal JSON document reference to the specific data resource that caused the problem." + }, + "instanceIdentification": { + "type": "object", + "properties": { + "source": { + "type": "string", + "description": "Identifies the source of the resource as contained in the resource metadata." + }, + "sourceId": { + "type": "string", + "description": "Identifies the resource using its source identifier as contained in the resource metadata." + }, + "hostId": { + "type": "string", + "description": "If specified, identifies the resource with a unique Id (UUID) in the host system." + } + } } } } \ No newline at end of file diff --git a/resources/icarBatchResult.json b/resources/icarBatchResult.json deleted file mode 100644 index a064c83..0000000 --- a/resources/icarBatchResult.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "description": "Returned by a batch POST event to return identity (meta), errors, and warnings for a resource.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique identifier created in the system for this event. SHOULD be a UUID." - }, - "meta": { - "$ref": "../types/icarMetaDataType.json", - "description": "Metadata for the posted resource. Allows specification of the source, source Id to synchronise data." - }, - "errors": { - "type": "array", - "description": "An arry of errors for this resource.", - "nullable": true, - "items": { - "$ref": "../resources/icarErrorResource.json" - } - }, - "warnings": { - "type": "array", - "description": "An arry of warnings for this resource.", - "nullable": true, - "items": { - "$ref": "../resources/icarErrorResource.json" - } - } - } -} \ No newline at end of file diff --git a/resources/icarErrorResource.json b/resources/icarErrorResource.json deleted file mode 100644 index aab32e3..0000000 --- a/resources/icarErrorResource.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "description": "An RFC7807 compliant problem response for JSON APIs.", - - "type": "object", - - "properties": { - "type": { - "type": "string", - "description": "Machine readable URI or code that defines the type of error or warning." - }, - "status": { - "type": "integer", - "description": "The HTTP status code applicable to this problem.", - "format": "int32", - "nullable": true - }, - "title": { - "type": "string", - "description": "A short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization." - }, - "detail": { - "type": "string", - "description": "A human-readable explanation specific to this occurrence of the problem. Like title, this field’s value can be localized." - }, - "instance": { - "type": "string", - "description": "A URI reference or internal JSON document reference to the specific data item that caused the problem.", - "nullable": true - } - } -} \ No newline at end of file diff --git a/url-schemes/healthURLScheme.json b/url-schemes/healthURLScheme.json index 586fa0b..73b4126 100644 --- a/url-schemes/healthURLScheme.json +++ b/url-schemes/healthURLScheme.json @@ -319,35 +319,35 @@ ], "requestBody": { "required": true, - "description": "The collection of health diagnosis 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", + "description": "The collection of health diagnosis 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.\nAlthough a collection is used, servers SHALL IGNORE any pagination-related attributes.\n", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/icarDiagnosisEventArray" + "$ref": "#/components/schemas/icarDiagnosisEventCollection" } } } }, "responses": { "200": { - "description": "Successful. The response contains a set of batch results, which may include warnings.", + "description": "Successful. The response contains a copy of the collection, as modifed by the server.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/batchResults" + "$ref": "#/components/schemas/icarDiagnosisEventCollection" } } } }, "201": { - "description": "Created. The Location header contains URI to retrieve a set of batch results, which may include warnings.", + "description": "Created. The Location header contains the URI to the collection, as modified by the server.", "headers": { "Location": { "schema": { "type": "string", "format": "uri" }, - "description": "Contains the URI to the results." + "description": "Contains the URI to the new resource." } } }, @@ -364,14 +364,7 @@ } }, "default": { - "description": "The response contains a set of batch results, which may include errors and warnings.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/batchResults" - } - } - } + "$ref": "#/components/responses/default" } } } @@ -394,35 +387,35 @@ ], "requestBody": { "required": true, - "description": "The collection of health treatment 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", + "description": "The collection of health treatment 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.\nAlthough a collection is used, servers SHALL IGNORE any pagination-related attributes.\n", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/icarTreatmentEventArray" + "$ref": "#/components/schemas/icarTreatmentEventCollection" } } } }, "responses": { "200": { - "description": "Successful. The response contains a set of batch results, which may include warnings.", + "description": "Successful. The response contains a copy of the collection, as modifed by the server.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/batchResults" + "$ref": "#/components/schemas/icarDiagnosisEventCollection" } } } }, "201": { - "description": "Created. The Location header contains URI to retrieve a set of batch results, which may include warnings.", + "description": "Created. The Location header contains the URI to the collection, as modified by the server.", "headers": { "Location": { "schema": { "type": "string", "format": "uri" }, - "description": "Contains the URI to the results." + "description": "Contains the URI to a collection of new resources." } } }, @@ -439,14 +432,7 @@ } }, "default": { - "description": "The response contains a set of batch results, which may include errors and warnings.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/batchResults" - } - } - } + "$ref": "#/components/responses/default" } } } @@ -469,35 +455,35 @@ ], "requestBody": { "required": true, - "description": "The collection of health treatment program 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", + "description": "The collection of health treatment program 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.\nAlthough a collection is used, servers SHALL IGNORE any pagination-related attributes.\n", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/icarTreatmentProgramEventArray" + "$ref": "#/components/schemas/icarTreatmentProgramEventCollection" } } } }, "responses": { "200": { - "description": "Successful. The response contains a set of batch results, which may include warnings.", + "description": "Successful. The response contains a copy of the collection, as modifed by the server.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/batchResults" + "$ref": "#/components/schemas/icarTreatmentProgramEventCollection" } } } }, "201": { - "description": "Created. The Location header contains URI to retrieve a set of batch results, which may include warnings.", + "description": "Created. The Location header contains the URI to the collection, as modified by the server.", "headers": { "Location": { "schema": { "type": "string", "format": "uri" }, - "description": "Contains the URI to the results." + "description": "Contains the URI to a collection of new resources." } } }, @@ -514,14 +500,7 @@ } }, "default": { - "description": "The response contains a set of batch results, which may include errors and warnings.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/batchResults" - } - } - } + "$ref": "#/components/responses/default" } } } @@ -529,14 +508,8 @@ }, "components": { "schemas": { - "batchResults": { - "type": "array", - "items": { - "$ref": "../resources/icarBatchResult.json" - } - }, "error": { - "$ref": "../resources/icarErrorResource.json" + "$ref": "../resources/exampleErrorResource.json" }, "icarDiagnosisEvent": { "$ref": "../resources/icarDiagnosisEventResource.json" @@ -544,35 +517,17 @@ "icarDiagnosisEventCollection": { "$ref": "../collections/icarDiagnosisEventCollection.json" }, - "icarDiagnosisEventArray": { - "type": "array", - "items": { - "$ref": "../resources/icarDiagnosisEventResource.json" - } - }, "icarTreatmentEvent": { "$ref": "../resources/icarTreatmentEventResource.json" }, "icarTreatmentEventCollection": { "$ref": "../collections/icarTreatmentEventCollection.json" }, - "icarTreatmentEventArray": { - "type": "array", - "items": { - "$ref": "../resources/icarTreatmentEventResource.json" - } - }, "icarTreatmentProgramEvent": { "$ref": "../resources/icarTreatmentProgramEventResource.json" }, "icarTreatmentProgramEventCollection": { "$ref": "../collections/icarTreatmentProgramEventCollection.json" - }, - "icarTreatmentProgramEventArray": { - "type": "array", - "items": { - "$ref": "../resources/icarTreatmentProgramEventResource.json" - } } }, "parameters": { From 75576446fd2c6139b10c68efb22ee8262032909b Mon Sep 17 00:00:00 2001 From: Andrew Cooke <45248509+cookeac@users.noreply.github.com> Date: Mon, 26 Jul 2021 20:42:19 +1200 Subject: [PATCH 10/12] Revert "Update resource for RFC7801 compliance and Ids" This reverts commit 325e9b6281616726b3b0ce6143d49df1ed053528. --- resources/exampleErrorResource.json | 32 +++++++++-------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/resources/exampleErrorResource.json b/resources/exampleErrorResource.json index b1a4a7f..ae5b07f 100644 --- a/resources/exampleErrorResource.json +++ b/resources/exampleErrorResource.json @@ -1,19 +1,22 @@ { - "description": "An extention to a RFC7807 compliant problem response for JSON APIs", + "description": "A human-readable error message describing what went wrong.", "type": "object", "properties": { - "type": { + "id": { "type": "string", - "format": "uri", - "description": "Machine readable URI that uniquely defines the problem." + "description": "A unique identifier for this particular occurrence of the problem" }, "status": { "type": "integer", - "description": "The HTTP status code applicable to this problem", + "description": "The HTTP status code applicable to this problem, expressed as a string value", "format": "int32" }, + "code": { + "type": "string", + "description": "An application-specific error code, expressed as a string value." + }, "title": { "type": "string", "description": "A short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization." @@ -22,25 +25,10 @@ "type": "string", "description": "A human-readable explanation specific to this occurrence of the problem. Like title, this field’s value can be localized." }, - "instance": { - "type": "string", - "description": "A URI reference or internal JSON document reference to the specific data resource that caused the problem." - }, - "instanceIdentification": { + "meta": { "type": "object", "properties": { - "source": { - "type": "string", - "description": "Identifies the source of the resource as contained in the resource metadata." - }, - "sourceId": { - "type": "string", - "description": "Identifies the resource using its source identifier as contained in the resource metadata." - }, - "hostId": { - "type": "string", - "description": "If specified, identifies the resource with a unique Id (UUID) in the host system." - } + } } } From 3f0af0a220b3f01fae26ba7df2b447cec3e74420 Mon Sep 17 00:00:00 2001 From: Andrew Cooke <45248509+cookeac@users.noreply.github.com> Date: Mon, 26 Jul 2021 20:44:06 +1200 Subject: [PATCH 11/12] Revert "Create healthURLScheme.json" This reverts commit 7bd093f3bf0d0fefec40d7ec51d4aced7841fb5c. --- url-schemes/healthURLScheme.json | 611 ------------------------------- 1 file changed, 611 deletions(-) delete mode 100644 url-schemes/healthURLScheme.json diff --git a/url-schemes/healthURLScheme.json b/url-schemes/healthURLScheme.json deleted file mode 100644 index 73b4126..0000000 --- a/url-schemes/healthURLScheme.json +++ /dev/null @@ -1,611 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "Health Diagnosis and Treatment API Specifications", - "description": "Specifications for messages that support livestock health and disease diagnosis and treatments.", - "version": "1.2", - "contact": { - "name": "Animal Data Exchange Working Group", - "url": "https://www.icar.org/index.php/technical-bodies/working-groups/animal-data-exchange-wg/", - "email": "icar@icar.org" - } - }, - "servers": [ - { - "url": "https://icar-ade.standard.com" - } - ], - "tags": [ - { - "name": "ADE-1.2-health", - "description": "Health messages approved by the working group" - } - ], - "paths": { - "/locations/{location-scheme}/{location-id}/diagnoses": { - "get": { - "operationId": "get-Diagnoses", - "summary": "Get the diagnoses for a certain location", - "description": "# Purpose\nProvides the animal health diagnoses for a location\n", - "tags": [ - "ADE-1.2-health" - ], - "parameters": [ - { - "$ref": "#/components/parameters/location-scheme" - }, - { - "$ref": "#/components/parameters/location-id" - }, - { - "$ref": "#/components/parameters/meta-modified-from" - }, - { - "$ref": "#/components/parameters/meta-modified-to" - } - ], - "responses": { - "200": { - "description": "Successful. The response contains the diagnoses for the given location.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/icarDiagnosisEventCollection" - } - } - } - }, - "default": { - "$ref": "#/components/responses/default" - } - } - }, - "post": { - "operationId": "post-single-Diagnosis", - "summary": "Add a single new diagnosis event", - "description": "# Purpose \nAllows a client to add a single animal health diagnosis event.\n", - "tags": [ - "ADE-1.2-health" - ], - "parameters": [ - { - "$ref": "#/components/parameters/location-scheme" - }, - { - "$ref": "#/components/parameters/location-id" - } - ], - "requestBody": { - "required": true, - "description": "The health diagnosis event 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.\n", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/icarDiagnosisEvent" - } - } - } - }, - "responses": { - "200": { - "description": "Successful. The response contains a copy of the event, as modifed by the server.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/icarDiagnosisEvent" - } - } - } - }, - "201": { - "description": "Created. The Location header contains the URI to the new resource.", - "headers": { - "Location": { - "schema": { - "type": "string", - "format": "uri" - }, - "description": "Contains the URI to the new resource." - } - } - }, - "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": { - "$ref": "#/components/responses/default" - } - } - } - }, - "/locations/{location-scheme}/{location-id}/treatments": { - "get": { - "operationId": "get-Treatments", - "summary": "Get the treatments for a certain location", - "description": "# Purpose\nProvides the animal health treatments for a location\n", - "tags": [ - "ADE-1.2-health" - ], - "parameters": [ - { - "$ref": "#/components/parameters/location-scheme" - }, - { - "$ref": "#/components/parameters/location-id" - }, - { - "$ref": "#/components/parameters/meta-modified-from" - }, - { - "$ref": "#/components/parameters/meta-modified-to" - } - ], - "responses": { - "200": { - "description": "Successful. The response contains the treatments for the given location.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/icarTreatmentEventCollection" - } - } - } - }, - "default": { - "$ref": "#/components/responses/default" - } - } - }, - "post": { - "operationId": "post-single-Treatment", - "summary": "Add a single new health treatment event", - "description": "# Purpose \nAllows a client to add a single animal health treatment event.\n", - "tags": [ - "ADE-1.2-health" - ], - "parameters": [ - { - "$ref": "#/components/parameters/location-scheme" - }, - { - "$ref": "#/components/parameters/location-id" - } - ], - "requestBody": { - "required": true, - "description": "The health treatment event 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.\n", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/icarTreatmentEvent" - } - } - } - }, - "responses": { - "200": { - "description": "Successful. The response contains a copy of the event, as modifed by the server.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/icarTreatmentEvent" - } - } - } - }, - "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" - } - } - } - }, - "/locations/{location-scheme}/{location-id}/treatment-programs": { - "get": { - "operationId": "get-Treatment-Programs", - "summary": "Get the treatment programs for a certain location", - "description": "# Purpose\nProvides the animal health treatment programs for a location\n", - "tags": [ - "ADE-1.2-health" - ], - "parameters": [ - { - "$ref": "#/components/parameters/location-scheme" - }, - { - "$ref": "#/components/parameters/location-id" - }, - { - "$ref": "#/components/parameters/meta-modified-from" - }, - { - "$ref": "#/components/parameters/meta-modified-to" - } - ], - "responses": { - "200": { - "description": "Successful. The response contains the treatment progams for the given location.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/icarTreatmentProgramEventCollection" - } - } - } - }, - "default": { - "$ref": "#/components/responses/default" - } - } - }, - "post": { - "operationId": "post-single-Treatment-Program", - "summary": "Add a single new health treatment programme.", - "description": "# Purpose \nAllows a client to add a single animal health treatment programme.\n", - "tags": [ - "ADE-1.2-health" - ], - "parameters": [ - { - "$ref": "#/components/parameters/location-scheme" - }, - { - "$ref": "#/components/parameters/location-id" - } - ], - "requestBody": { - "required": true, - "description": "The health treatment programme 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/icarTreatmentProgramEvent" - } - } - } - }, - "responses": { - "200": { - "description": "Successful. The response contains a copy of the event, as modifed by the server.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/icarTreatmentProgramEvent" - } - } - } - }, - "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/{location-scheme}/{location-id}/diagnoses": { - "post": { - "operationId": "post-batch-Diagnosis", - "summary": "Add a single new diagnosis event", - "description": "# Purpose \nAllows a client to add a collection of animal health diagnosis events.\n", - "tags": [ - "ADE-1.2-health" - ], - "parameters": [ - { - "$ref": "#/components/parameters/location-scheme" - }, - { - "$ref": "#/components/parameters/location-id" - } - ], - "requestBody": { - "required": true, - "description": "The collection of health diagnosis 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.\nAlthough a collection is used, servers SHALL IGNORE any pagination-related attributes.\n", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/icarDiagnosisEventCollection" - } - } - } - }, - "responses": { - "200": { - "description": "Successful. The response contains a copy of the collection, as modifed by the server.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/icarDiagnosisEventCollection" - } - } - } - }, - "201": { - "description": "Created. The Location header contains the URI to the collection, as modified by the server.", - "headers": { - "Location": { - "schema": { - "type": "string", - "format": "uri" - }, - "description": "Contains the URI to the new resource." - } - } - }, - "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": { - "$ref": "#/components/responses/default" - } - } - } - }, - "/batches/{location-scheme}/{location-id}/treatments": { - "post": { - "operationId": "post-batch-Treatments", - "summary": "Add a collection of health treatment events", - "description": "# Purpose \nAllows a client to add a collection of animal health treatment events.\n", - "tags": [ - "ADE-1.2-health" - ], - "parameters": [ - { - "$ref": "#/components/parameters/location-scheme" - }, - { - "$ref": "#/components/parameters/location-id" - } - ], - "requestBody": { - "required": true, - "description": "The collection of health treatment 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.\nAlthough a collection is used, servers SHALL IGNORE any pagination-related attributes.\n", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/icarTreatmentEventCollection" - } - } - } - }, - "responses": { - "200": { - "description": "Successful. The response contains a copy of the collection, as modifed by the server.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/icarDiagnosisEventCollection" - } - } - } - }, - "201": { - "description": "Created. The Location header contains the URI to the collection, as modified by the server.", - "headers": { - "Location": { - "schema": { - "type": "string", - "format": "uri" - }, - "description": "Contains the URI to a collection of new resources." - } - } - }, - "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": { - "$ref": "#/components/responses/default" - } - } - } - }, - "/batches/{location-scheme}/{location-id}/treatment-programs": { - "post": { - "operationId": "post-batch-Treatment-Program", - "summary": "Add a collection of animal health treatment program events.", - "description": "# Purpose \nAllows a client to add a collection of animal health treatment program events.\n", - "tags": [ - "ADE-1.2-health" - ], - "parameters": [ - { - "$ref": "#/components/parameters/location-scheme" - }, - { - "$ref": "#/components/parameters/location-id" - } - ], - "requestBody": { - "required": true, - "description": "The collection of health treatment program 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.\nAlthough a collection is used, servers SHALL IGNORE any pagination-related attributes.\n", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/icarTreatmentProgramEventCollection" - } - } - } - }, - "responses": { - "200": { - "description": "Successful. The response contains a copy of the collection, as modifed by the server.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/icarTreatmentProgramEventCollection" - } - } - } - }, - "201": { - "description": "Created. The Location header contains the URI to the collection, as modified by the server.", - "headers": { - "Location": { - "schema": { - "type": "string", - "format": "uri" - }, - "description": "Contains the URI to a collection of new resources." - } - } - }, - "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": { - "$ref": "#/components/responses/default" - } - } - } - } - }, - "components": { - "schemas": { - "error": { - "$ref": "../resources/exampleErrorResource.json" - }, - "icarDiagnosisEvent": { - "$ref": "../resources/icarDiagnosisEventResource.json" - }, - "icarDiagnosisEventCollection": { - "$ref": "../collections/icarDiagnosisEventCollection.json" - }, - "icarTreatmentEvent": { - "$ref": "../resources/icarTreatmentEventResource.json" - }, - "icarTreatmentEventCollection": { - "$ref": "../collections/icarTreatmentEventCollection.json" - }, - "icarTreatmentProgramEvent": { - "$ref": "../resources/icarTreatmentProgramEventResource.json" - }, - "icarTreatmentProgramEventCollection": { - "$ref": "../collections/icarTreatmentProgramEventCollection.json" - } - }, - "parameters": { - "location-scheme": { - "name": "location-scheme", - "in": "path", - "description": "The scheme id for the location identifier.", - "required": true, - "schema": { - "type": "string" - } - }, - "location-id": { - "name": "location-id", - "in": "path", - "description": "The unique identifier for the location.", - "required": true, - "schema": { - "type": "string" - } - }, - "meta-modified-from": { - "name": "meta-modified-from", - "in": "query", - "description": "The start of the date-time range for the data to get in the request.", - "schema": { - "type": "string", - "format": "date-time" - } - }, - "meta-modified-to": { - "name": "meta-modified-to", - "in": "query", - "description": "The end of the date-time range for the data to get in the request.", - "schema": { - "type": "string", - "format": "date-time" - } - }, - "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" - } - } - }, - "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": { - "type": "object", - "properties": { - "errors": { - "type": "array", - "items": { - "$ref": "#/components/schemas/error" - } - } - }, - "description": "A default response containing only a list of errors" - } - } - } - } - } - } -} \ No newline at end of file From 4c0e10f93066d62ac7ed8d300372b20d6f208489 Mon Sep 17 00:00:00 2001 From: Andrew Cooke <45248509+cookeac@users.noreply.github.com> Date: Thu, 29 Jul 2021 18:27:02 +1200 Subject: [PATCH 12/12] Update icarDeathReasonType.json Correct typo --- enums/icarDeathReasonType.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enums/icarDeathReasonType.json b/enums/icarDeathReasonType.json index bbb55d0..5ddfc1b 100644 --- a/enums/icarDeathReasonType.json +++ b/enums/icarDeathReasonType.json @@ -17,7 +17,7 @@ "Production", "LegOrClaw", "MilkingAbility", - "NUtrition", + "Nutrition", "Fertility" ] } \ No newline at end of file