From 30bf00085eacb91655f189300d056816aa47d3e7 Mon Sep 17 00:00:00 2001 From: Andrew Cooke <45248509+cookeac@users.noreply.github.com> Date: Thu, 13 Apr 2023 11:40:08 +1200 Subject: [PATCH 1/7] Inventory transaction resources Defines a generalised icarInventoryTransactionResource and its specific versions, icarFeedTransactionResource and icarMedicineTransactionResource. Resolves #369 --- .../icarFeedTransactionCollection.json | 21 + .../icarInventoryTransactionCollection.json | 21 + .../icarMedicineTransactionCollection.json | 21 + enums/icarInventoryTransactionKindType.json | 11 + enums/icarProductFamilyType.json | 16 + resources/icarFeedTransactionResource.json | 19 + .../icarInventoryTransactionResource.json | 19 + .../icarMedicineTransactionResource.json | 19 + types/icarFeedReferenceType.json | 20 + types/icarInventoryTransactionType.json | 53 +++ types/icarMedicineReferenceType.json | 7 +- types/icarProductIdentifierType.json | 9 + types/icarProductReferenceType.json | 44 ++ url-schemes/exampleUrlScheme.json | 194 +++++++- url-schemes/managementURLScheme.json | 444 ++++++++++++++++++ well-known/icarProductIdentifierType.md | 4 + 16 files changed, 916 insertions(+), 6 deletions(-) create mode 100644 collections/icarFeedTransactionCollection.json create mode 100644 collections/icarInventoryTransactionCollection.json create mode 100644 collections/icarMedicineTransactionCollection.json create mode 100644 enums/icarInventoryTransactionKindType.json create mode 100644 enums/icarProductFamilyType.json create mode 100644 resources/icarFeedTransactionResource.json create mode 100644 resources/icarInventoryTransactionResource.json create mode 100644 resources/icarMedicineTransactionResource.json create mode 100644 types/icarFeedReferenceType.json create mode 100644 types/icarInventoryTransactionType.json create mode 100644 types/icarProductIdentifierType.json create mode 100644 types/icarProductReferenceType.json create mode 100644 well-known/icarProductIdentifierType.md diff --git a/collections/icarFeedTransactionCollection.json b/collections/icarFeedTransactionCollection.json new file mode 100644 index 0000000..caa4703 --- /dev/null +++ b/collections/icarFeedTransactionCollection.json @@ -0,0 +1,21 @@ +{ + "description": "Represents a collection of feed inventory transactions. Based on icarResourceCollection to provide paging etc.", + + "allOf": [{ + "$ref": "../collections/icarResourceCollection.json" + }, + { + "type": "object", + + "properties": { + "member": { + "type": "array", + "items": { + "$ref": "../resources/icarFeedTransactionResource.json" + }, + "description": "As per JSON-LD Hydra syntax, member provides the array of objects, in this case inventory transactions." + } + } + } + ] +} \ No newline at end of file diff --git a/collections/icarInventoryTransactionCollection.json b/collections/icarInventoryTransactionCollection.json new file mode 100644 index 0000000..d80ef06 --- /dev/null +++ b/collections/icarInventoryTransactionCollection.json @@ -0,0 +1,21 @@ +{ + "description": "Represents a collection of inventory transactions. Based on icarResourceCollection to provide paging etc.", + + "allOf": [{ + "$ref": "../collections/icarResourceCollection.json" + }, + { + "type": "object", + + "properties": { + "member": { + "type": "array", + "items": { + "$ref": "../resources/icarInventoryTransactionResource.json" + }, + "description": "As per JSON-LD Hydra syntax, member provides the array of objects, in this case inventory transactions." + } + } + } + ] +} \ No newline at end of file diff --git a/collections/icarMedicineTransactionCollection.json b/collections/icarMedicineTransactionCollection.json new file mode 100644 index 0000000..2977aa5 --- /dev/null +++ b/collections/icarMedicineTransactionCollection.json @@ -0,0 +1,21 @@ +{ + "description": "Represents a collection of medicine inventory transactions. Based on icarResourceCollection to provide paging etc.", + + "allOf": [{ + "$ref": "../collections/icarResourceCollection.json" + }, + { + "type": "object", + + "properties": { + "member": { + "type": "array", + "items": { + "$ref": "../resources/icarMedicineTransactionResource.json" + }, + "description": "As per JSON-LD Hydra syntax, member provides the array of objects, in this case inventory transactions." + } + } + } + ] +} \ No newline at end of file diff --git a/enums/icarInventoryTransactionKindType.json b/enums/icarInventoryTransactionKindType.json new file mode 100644 index 0000000..fd94266 --- /dev/null +++ b/enums/icarInventoryTransactionKindType.json @@ -0,0 +1,11 @@ +{ + "description": "Defines the kinds of inventory transaction, which can represent items received, disposed of (including sale or destruction), used, counted in a stocktake or calculated on hand.", + "type": "string", + "enum": [ + "Receipt", + "Disposal", + "OnHand", + "StockTake", + "Use" + ] +} \ No newline at end of file diff --git a/enums/icarProductFamilyType.json b/enums/icarProductFamilyType.json new file mode 100644 index 0000000..894bba6 --- /dev/null +++ b/enums/icarProductFamilyType.json @@ -0,0 +1,16 @@ +{ + "description": "Defines the families of products", + "type": "string", + "enum": [ + "Animal Feeds", + "Animal Reproductive Products", + "Veterinary Supplies", + "Seed and Plant Material", + "Fertilisers and Nutrients", + "Pest Control Products", + "Other Animal Products", + "Milking Supplies", + "Fencing Supplies", + "Water System Supplies" + ] +} \ No newline at end of file diff --git a/resources/icarFeedTransactionResource.json b/resources/icarFeedTransactionResource.json new file mode 100644 index 0000000..2f3098b --- /dev/null +++ b/resources/icarFeedTransactionResource.json @@ -0,0 +1,19 @@ +{ + "description": "An inventory transaction resource for a feed product.", + "type": "object", + "$id": "types/icarFeedTransactionResource", + "allOf": [ + { + "$ref": "../types/icarInventoryTransactionType.json" + } + ], + "required": [ + "product" + ], + "properties": { + "product": { + "$ref": "../types/icarFeedReferenceType.json", + "description": "The feed product in this transaction." + } + } +} \ No newline at end of file diff --git a/resources/icarInventoryTransactionResource.json b/resources/icarInventoryTransactionResource.json new file mode 100644 index 0000000..26b8856 --- /dev/null +++ b/resources/icarInventoryTransactionResource.json @@ -0,0 +1,19 @@ +{ + "description": "Generic inventory transaction resource. Some product families have specific transaction resources (e.g. medicines, feeds).", + "type": "object", + "$id": "types/icarInventoryTransactionResource", + "allOf": [ + { + "$ref": "../types/icarInventoryTransactionType.json" + } + ], + "required": [ + "product" + ], + "properties": { + "product": { + "$ref": "../types/icarProductReferenceType.json", + "description": "The product in this inventory transaction." + } + } +} \ No newline at end of file diff --git a/resources/icarMedicineTransactionResource.json b/resources/icarMedicineTransactionResource.json new file mode 100644 index 0000000..babdc70 --- /dev/null +++ b/resources/icarMedicineTransactionResource.json @@ -0,0 +1,19 @@ +{ + "description": "An inventory transaction resource for a medicine product.", + "type": "object", + "$id": "types/icarMedicineTransactionResource", + "allOf": [ + { + "$ref": "../types/icarInventoryTransactionType.json" + } + ], + "required": [ + "product" + ], + "properties": { + "product": { + "$ref": "../types/icarMedicineReferenceType.json", + "description": "The medicine product in this transaction." + } + } +} \ No newline at end of file diff --git a/types/icarFeedReferenceType.json b/types/icarFeedReferenceType.json new file mode 100644 index 0000000..041b9ec --- /dev/null +++ b/types/icarFeedReferenceType.json @@ -0,0 +1,20 @@ +{ + "description": "Feed Reference defines a feed product.", + "type": "object", + "$id": "types/icarFeedReferenceType", + "allOf": [ + { + "$ref": "../types/icarProductReferenceType.json" + } + ], + "properties": { + "category": { + "$ref": "https://raw.githubusercontent.com/Pure-Farming/ICAR/ADE-1/enums/icarFeedCategoryType.json", + "description": "Defines the category of the feed product." + }, + "type": { + "$ref": "https://raw.githubusercontent.com/Pure-Farming/ICAR/ADE-1/types/icarFeedIdentifierType.json", + "description": "The scheme + id identifying the type of feed." + } + } +} \ No newline at end of file diff --git a/types/icarInventoryTransactionType.json b/types/icarInventoryTransactionType.json new file mode 100644 index 0000000..148725b --- /dev/null +++ b/types/icarInventoryTransactionType.json @@ -0,0 +1,53 @@ +{ + "description": "Inventory Transaction defines a transaction on a product inventory where the transaction may be a receipt, disposal, on hand, stocktake, use", + "type": "object", + "$id": "types/icarInventoryTransactionType", + "allOf": [ + { + "$ref": "../resources/icarEventCoreResource.json" + } + ], + "required": [ + "transactionKind", + "quantity", + "units" + ], + "properties": { + "transactionKind": { + "$ref": "../enums/icarInventoryTransactionKindType.json", + "description": "Identifies the transaction kind." + }, + "quantity": { + "type": "number", + "description": "The overall volume, weight or count of the product in the transaction in the units defined." + }, + "units": { + "description": "The units of the quantity specified. Where applicable it is recommended that uncefact mass and volume units are used.", + "type": "string" + }, + "supplierName": { + "type": "string", + "description": "The supplier of the product in this transaction. This is particularly relevant if the transaction is a receipt." + }, + "expiryDate": { + "$ref": "../types/icarDateTimeType.json", + "description": "The expiry date of the product supplied in the transaction." + }, + "totalCost": { + "type": "number", + "description": "Total cost applied to this transaction" + }, + "currency": { + "type": "string", + "description": "The currency of the cost expressed using the ISO 4217 3-character code (such as AUD, GBP, USD, EUR)." + }, + "packSize": { + "type": "number", + "description": "The volume or weight of the product in a pack in the units defined. Especially relevant for Vet Medicines." + }, + "numberOfPacks": { + "type": "number", + "description": "The number of packs of the product in the transaction. Especially relevant for Vet Medicines. Could be a decimal number for a part-pack." + } + } +} \ No newline at end of file diff --git a/types/icarMedicineReferenceType.json b/types/icarMedicineReferenceType.json index a08b42e..b14851b 100644 --- a/types/icarMedicineReferenceType.json +++ b/types/icarMedicineReferenceType.json @@ -2,15 +2,12 @@ "description": "Provides basic details about a medicine and links to a medicine resource (if available).", "allOf": [ { - "$ref": "icarResourceReferenceType.json" + "$ref": "../types/icarProductReferenceType.json" }, { "type": "object", "properties": { - "name": { - "type": "string", - "description": "Name of the medicine or remedy given for this treatment" - }, + "approved": { "type": "string", "description": "An indicator whether the medicine or remedy is an approved medicine" diff --git a/types/icarProductIdentifierType.json b/types/icarProductIdentifierType.json new file mode 100644 index 0000000..dc7f4c9 --- /dev/null +++ b/types/icarProductIdentifierType.json @@ -0,0 +1,9 @@ +{ + "description": "Provides a scheme + identifier mechanism for product types.", + + "allOf": [ + { + "$ref": "../types/icarIdentifierType.json" + } + ] +} \ No newline at end of file diff --git a/types/icarProductReferenceType.json b/types/icarProductReferenceType.json new file mode 100644 index 0000000..c503b0b --- /dev/null +++ b/types/icarProductReferenceType.json @@ -0,0 +1,44 @@ +{ + "description": "Product Reference refers to a specific product. It is based on the generalised resource reference type.", + "type": "object", + + "allOf": [ + { + "$ref": "../types/icarResourceReferenceType.json" + }, + { + "type": "object", + + "required": [ + "identifier", + "family" + ], + + "properties": { + "identifiers": { + "type": "array", + "description": "An array of product identifiers. This allows a product to have multiple identifiers for manufacturers, distributors, official registrations, etc.", + "items": { + "$ref": "../types/icarProductIdentifierType.json" + } + }, + "family": { + "$ref": "../enums/icarProductFamilyType.json", + "description": "The product family to which this product belongs." + }, + "name": { + "type": "string", + "description": "The name of the product." + }, + "gtin": { + "type": "string", + "description": "GS1 global trade item number." + }, + "unspc": { + "type": "string", + "description": "UN service and product code (the code, not the accompanying description)." + } + } + } + ] +} \ No newline at end of file diff --git a/url-schemes/exampleUrlScheme.json b/url-schemes/exampleUrlScheme.json index 45e743c..0f86a8c 100644 --- a/url-schemes/exampleUrlScheme.json +++ b/url-schemes/exampleUrlScheme.json @@ -2212,6 +2212,162 @@ } } } + }, + "/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.3-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.3-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.3-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" + } + } + } } }, "components": { @@ -2377,6 +2533,15 @@ }, "icarCarcassObservationsEventCollection" : { "$ref": "../collections/icarCarcassObservationsEventCollection.json" + }, + "icarInventoryTransactionCollection": { + "$ref": "../collections/icarInventoryTransactionCollection.json" + }, + "icarFeedTransactionCollection": { + "$ref": "../collections/icarFeedTransactionCollection.json" + }, + "icarMedicineTransactionCollection": { + "$ref": "../collections/icarMedicineTransactionCollection.json" } }, "parameters": { @@ -2448,7 +2613,16 @@ "$ref": "../enums/icarStatisticsPurposeType.json" } }, - "report-start-date-time": { + "family": { + "name": "family", + "in": "query", + "description": "The family of products.", + "required": false, + "schema": { + "$ref": "../enums/icarProductFamilyType.json" + } + }, + "report-start-date-time": { "name": "report-start-date-time", "in": "query", "description": "The start of the date-time range for the data to get in the request based on the event date time.", @@ -2501,6 +2675,24 @@ "schema": { "type": "string" } + }, + "identifier-scheme": { + "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" + } } }, "responses": { diff --git a/url-schemes/managementURLScheme.json b/url-schemes/managementURLScheme.json index dd6fc99..ff9fd65 100644 --- a/url-schemes/managementURLScheme.json +++ b/url-schemes/managementURLScheme.json @@ -484,6 +484,162 @@ } } }, + "/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.3-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.3-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.3-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" + } + } + } + }, "/batches/locations/{location-scheme}/{location-id}/animal-sets": { "post": { "operationId": "post-batch-animal-sets", @@ -783,6 +939,231 @@ } } } + }, + "/batches/locations/{location-scheme}/{location-id}/inventory-transactions": { + "post": { + "operationId": "post-batch-inventory-transactions", + "summary": "Add an array of inventory transactions.", + "description": "# Purpose \nAllows a client to add a collection of inventory transactions.\n", + "tags": [ + "ADE-1.3-management" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + } + ], + "requestBody": { + "required": true, + "description": "The collection of inventory transactions 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/icarInventoryTransactionArray" + } + } + } + }, + "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" + } + } + } + } + } + } + }, + "/batches/locations/{location-scheme}/{location-id}/feed-transactions": { + "post": { + "operationId": "post-batch-feed-transactions", + "summary": "Add an array of feed inventory transactions.", + "description": "# Purpose \nAllows a client to add a collection of feed inventory transactions.\n", + "tags": [ + "ADE-1.3-management" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + } + ], + "requestBody": { + "required": true, + "description": "The collection of feed inventory transactions 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/icarFeedTransactionArray" + } + } + } + }, + "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" + } + } + } + } + } + } + }, + "/batches/locations/{location-scheme}/{location-id}/medicine-transactions": { + "post": { + "operationId": "post-batch-medicine-transactions", + "summary": "Add an array of medicine inventory transactions.", + "description": "# Purpose \nAllows a client to add a collection of medicine inventory transactions.\n", + "tags": [ + "ADE-1.3-management" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + } + ], + "requestBody": { + "required": true, + "description": "The collection of medicine inventory transactions 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/icarMedicineTransactionArray" + } + } + } + }, + "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": { @@ -843,6 +1224,42 @@ "items": { "$ref": "#/components/schemas/icarDeviceResource" } + }, + "icarInventoryTransactionResource": { + "$ref": "../resources/icarInventoryTransactionResource.json" + }, + "icarInventoryTransactionCollection": { + "$ref": "../collections/icarInventoryTransactionCollection.json" + }, + "icarInventoryTransactionArray": { + "type": "array", + "items": { + "$ref": "#/components/schemas/icarInventoryTransactionResource" + } + }, + "icarFeedTransactionResource": { + "$ref": "../resources/icarFeedTransactionResource.json" + }, + "icarFeedTransactionCollection": { + "$ref": "../collections/icarFeedTransactionCollection.json" + }, + "icarFeedTransactionArray": { + "type": "array", + "items": { + "$ref": "#/components/schemas/icarFeedTransactionResource" + } + }, + "icarMedicineTransactionResource": { + "$ref": "../resources/icarMedicineTransactionResource.json" + }, + "icarMedicineTransactionCollection": { + "$ref": "../collections/icarMedicineTransactionCollection.json" + }, + "icarMedicineTransactionArray": { + "type": "array", + "items": { + "$ref": "#/components/schemas/icarMedicineTransactionResource" + } } }, "parameters": { @@ -908,6 +1325,33 @@ "schema": { "$ref": "../enums/icarStatisticsPurposeType.json" } + }, + "family": { + "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" + } + }, + "identifier-id": { + "name": "identifier-id", + "in": "query", + "description": "The unique identifier within a scheme.", + "required": false, + "schema": { + "type": "string" + } } }, "responses": { diff --git a/well-known/icarProductIdentifierType.md b/well-known/icarProductIdentifierType.md new file mode 100644 index 0000000..fffe3e9 --- /dev/null +++ b/well-known/icarProductIdentifierType.md @@ -0,0 +1,4 @@ +# Well-known Product Schemes + +| Short URI | Resolvable URI | Organisation | Description | +| --- | --- | --- | --- | From 4301073f69540b897ebbd4f9c2db3ba39bbe2d8c Mon Sep 17 00:00:00 2001 From: Andrew Cooke <45248509+cookeac@users.noreply.github.com> Date: Thu, 13 Apr 2023 11:49:22 +1200 Subject: [PATCH 2/7] Fix linting errors --- resources/icarFeedTransactionResource.json | 27 +++++++++++-------- .../icarMedicineTransactionResource.json | 26 ++++++++++-------- 2 files changed, 31 insertions(+), 22 deletions(-) diff --git a/resources/icarFeedTransactionResource.json b/resources/icarFeedTransactionResource.json index 2f3098b..ac416fc 100644 --- a/resources/icarFeedTransactionResource.json +++ b/resources/icarFeedTransactionResource.json @@ -1,19 +1,24 @@ { "description": "An inventory transaction resource for a feed product.", "type": "object", - "$id": "types/icarFeedTransactionResource", + "allOf": [ { "$ref": "../types/icarInventoryTransactionType.json" + }, + { + "type": "object", + + "required": [ + "product" + ], + + "properties": { + "product": { + "$ref": "../types/icarFeedReferenceType.json", + "description": "The feed product in this transaction." + } + } } - ], - "required": [ - "product" - ], - "properties": { - "product": { - "$ref": "../types/icarFeedReferenceType.json", - "description": "The feed product in this transaction." - } - } + ] } \ No newline at end of file diff --git a/resources/icarMedicineTransactionResource.json b/resources/icarMedicineTransactionResource.json index babdc70..ad117cc 100644 --- a/resources/icarMedicineTransactionResource.json +++ b/resources/icarMedicineTransactionResource.json @@ -1,19 +1,23 @@ { "description": "An inventory transaction resource for a medicine product.", - "type": "object", - "$id": "types/icarMedicineTransactionResource", + "allOf": [ { "$ref": "../types/icarInventoryTransactionType.json" + }, + { + "type": "object", + + "required": [ + "product" + ], + + "properties": { + "product": { + "$ref": "../types/icarMedicineReferenceType.json", + "description": "The medicine product in this transaction." + } + } } ], - "required": [ - "product" - ], - "properties": { - "product": { - "$ref": "../types/icarMedicineReferenceType.json", - "description": "The medicine product in this transaction." - } - } } \ No newline at end of file From 9cae01a827dcd8e3fc385fb09eff037459d49966 Mon Sep 17 00:00:00 2001 From: Andrew Cooke <45248509+cookeac@users.noreply.github.com> Date: Thu, 13 Apr 2023 15:04:10 +1200 Subject: [PATCH 3/7] Fix linting errors Remove $id terms --- .../icarInventoryTransactionResource.json | 27 +++--- types/icarFeedReferenceType.json | 26 ++--- types/icarInventoryTransactionType.json | 95 ++++++++++--------- 3 files changed, 79 insertions(+), 69 deletions(-) diff --git a/resources/icarInventoryTransactionResource.json b/resources/icarInventoryTransactionResource.json index 26b8856..60af4f5 100644 --- a/resources/icarInventoryTransactionResource.json +++ b/resources/icarInventoryTransactionResource.json @@ -1,19 +1,22 @@ { "description": "Generic inventory transaction resource. Some product families have specific transaction resources (e.g. medicines, feeds).", - "type": "object", - "$id": "types/icarInventoryTransactionResource", + "allOf": [ { "$ref": "../types/icarInventoryTransactionType.json" + }, + { + "type": "object", + + "required": [ + "product" + ], + "properties": { + "product": { + "$ref": "../types/icarProductReferenceType.json", + "description": "The product in this inventory transaction." + } + } } - ], - "required": [ - "product" - ], - "properties": { - "product": { - "$ref": "../types/icarProductReferenceType.json", - "description": "The product in this inventory transaction." - } - } + ] } \ No newline at end of file diff --git a/types/icarFeedReferenceType.json b/types/icarFeedReferenceType.json index 041b9ec..c6c83d0 100644 --- a/types/icarFeedReferenceType.json +++ b/types/icarFeedReferenceType.json @@ -1,20 +1,22 @@ { "description": "Feed Reference defines a feed product.", - "type": "object", - "$id": "types/icarFeedReferenceType", + "allOf": [ { "$ref": "../types/icarProductReferenceType.json" - } - ], - "properties": { - "category": { - "$ref": "https://raw.githubusercontent.com/Pure-Farming/ICAR/ADE-1/enums/icarFeedCategoryType.json", - "description": "Defines the category of the feed product." }, - "type": { - "$ref": "https://raw.githubusercontent.com/Pure-Farming/ICAR/ADE-1/types/icarFeedIdentifierType.json", - "description": "The scheme + id identifying the type of feed." + { + "type": "object", + "properties": { + "category": { + "$ref": "https://raw.githubusercontent.com/Pure-Farming/ICAR/ADE-1/enums/icarFeedCategoryType.json", + "description": "Defines the category of the feed product." + }, + "type": { + "$ref": "https://raw.githubusercontent.com/Pure-Farming/ICAR/ADE-1/types/icarFeedIdentifierType.json", + "description": "The scheme + id identifying the type of feed." + } + } } - } + ] } \ No newline at end of file diff --git a/types/icarInventoryTransactionType.json b/types/icarInventoryTransactionType.json index 148725b..63a25f1 100644 --- a/types/icarInventoryTransactionType.json +++ b/types/icarInventoryTransactionType.json @@ -1,53 +1,58 @@ { "description": "Inventory Transaction defines a transaction on a product inventory where the transaction may be a receipt, disposal, on hand, stocktake, use", - "type": "object", - "$id": "types/icarInventoryTransactionType", + "allOf": [ { "$ref": "../resources/icarEventCoreResource.json" } - ], - "required": [ - "transactionKind", - "quantity", - "units" - ], - "properties": { - "transactionKind": { - "$ref": "../enums/icarInventoryTransactionKindType.json", - "description": "Identifies the transaction kind." - }, - "quantity": { - "type": "number", - "description": "The overall volume, weight or count of the product in the transaction in the units defined." - }, - "units": { - "description": "The units of the quantity specified. Where applicable it is recommended that uncefact mass and volume units are used.", - "type": "string" - }, - "supplierName": { - "type": "string", - "description": "The supplier of the product in this transaction. This is particularly relevant if the transaction is a receipt." - }, - "expiryDate": { - "$ref": "../types/icarDateTimeType.json", - "description": "The expiry date of the product supplied in the transaction." - }, - "totalCost": { - "type": "number", - "description": "Total cost applied to this transaction" - }, - "currency": { - "type": "string", - "description": "The currency of the cost expressed using the ISO 4217 3-character code (such as AUD, GBP, USD, EUR)." - }, - "packSize": { - "type": "number", - "description": "The volume or weight of the product in a pack in the units defined. Especially relevant for Vet Medicines." - }, - "numberOfPacks": { - "type": "number", - "description": "The number of packs of the product in the transaction. Especially relevant for Vet Medicines. Could be a decimal number for a part-pack." + , + { + "type": "object", + + "required": [ + "transactionKind", + "quantity", + "units" + ], + + "properties": { + "transactionKind": { + "$ref": "../enums/icarInventoryTransactionKindType.json", + "description": "Identifies the transaction kind." + }, + "quantity": { + "type": "number", + "description": "The overall volume, weight or count of the product in the transaction in the units defined." + }, + "units": { + "description": "The units of the quantity specified. Where applicable it is recommended that uncefact mass and volume units are used.", + "type": "string" + }, + "supplierName": { + "type": "string", + "description": "The supplier of the product in this transaction. This is particularly relevant if the transaction is a receipt." + }, + "expiryDate": { + "$ref": "../types/icarDateTimeType.json", + "description": "The expiry date of the product supplied in the transaction." + }, + "totalCost": { + "type": "number", + "description": "Total cost applied to this transaction" + }, + "currency": { + "type": "string", + "description": "The currency of the cost expressed using the ISO 4217 3-character code (such as AUD, GBP, USD, EUR)." + }, + "packSize": { + "type": "number", + "description": "The volume or weight of the product in a pack in the units defined. Especially relevant for Vet Medicines." + }, + "numberOfPacks": { + "type": "number", + "description": "The number of packs of the product in the transaction. Especially relevant for Vet Medicines. Could be a decimal number for a part-pack." + } + } } - } + ] } \ No newline at end of file From 2e06b6ac2343b74e87fa6d7cc8874fead8adf31f Mon Sep 17 00:00:00 2001 From: Andrew Cooke <45248509+cookeac@users.noreply.github.com> Date: Thu, 13 Apr 2023 15:08:21 +1200 Subject: [PATCH 4/7] Fix linting error Removed extraneous comma --- resources/icarMedicineTransactionResource.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/icarMedicineTransactionResource.json b/resources/icarMedicineTransactionResource.json index ad117cc..a620fee 100644 --- a/resources/icarMedicineTransactionResource.json +++ b/resources/icarMedicineTransactionResource.json @@ -11,7 +11,7 @@ "required": [ "product" ], - + "properties": { "product": { "$ref": "../types/icarMedicineReferenceType.json", @@ -19,5 +19,5 @@ } } } - ], + ] } \ No newline at end of file From 957b370164bf805b4649081fa35736e485acd7fc Mon Sep 17 00:00:00 2001 From: Andrew Cooke <45248509+cookeac@users.noreply.github.com> Date: Thu, 22 Jun 2023 17:27:00 +0100 Subject: [PATCH 5/7] Correct paths --- types/icarFeedReferenceType.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/icarFeedReferenceType.json b/types/icarFeedReferenceType.json index c6c83d0..3386511 100644 --- a/types/icarFeedReferenceType.json +++ b/types/icarFeedReferenceType.json @@ -13,7 +13,7 @@ "description": "Defines the category of the feed product." }, "type": { - "$ref": "https://raw.githubusercontent.com/Pure-Farming/ICAR/ADE-1/types/icarFeedIdentifierType.json", + "$ref": "../types/icarFeedIdentifierType.json", "description": "The scheme + id identifying the type of feed." } } From e2339deb63fb48b31f7f7a2a84ae2133499e2393 Mon Sep 17 00:00:00 2001 From: Andrew Cooke <45248509+cookeac@users.noreply.github.com> Date: Thu, 22 Jun 2023 17:28:11 +0100 Subject: [PATCH 6/7] Correct path in types/icarFeedReferenceType.json --- types/icarFeedReferenceType.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/icarFeedReferenceType.json b/types/icarFeedReferenceType.json index 3386511..ba4e22d 100644 --- a/types/icarFeedReferenceType.json +++ b/types/icarFeedReferenceType.json @@ -9,7 +9,7 @@ "type": "object", "properties": { "category": { - "$ref": "https://raw.githubusercontent.com/Pure-Farming/ICAR/ADE-1/enums/icarFeedCategoryType.json", + "$ref": "../enums/icarFeedCategoryType.json", "description": "Defines the category of the feed product." }, "type": { From 13fd8c2f8a18f884943e5f88bb3aa0eb6411a50c Mon Sep 17 00:00:00 2001 From: cookeac Date: Mon, 10 Jul 2023 17:29:56 +1200 Subject: [PATCH 7/7] Add inventory transactions to URL schemes Inventory transactions are already in the example URL scheme. Adding the medicines ones to the health scheme, and the feed ones to the feed scheme. --- url-schemes/feedURLscheme.json | 245 ++++++++++++++++++++++++++++++- url-schemes/healthURLScheme.json | 224 +++++++++++++++++++++++++++- 2 files changed, 466 insertions(+), 3 deletions(-) diff --git a/url-schemes/feedURLscheme.json b/url-schemes/feedURLscheme.json index adf5fae..cf7fe39 100644 --- a/url-schemes/feedURLscheme.json +++ b/url-schemes/feedURLscheme.json @@ -597,6 +597,123 @@ } } }, + "/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.3-feed" + ], + "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" + } + } + }, + "post": { + "operationId": "post-single-feed-inventory-transaction", + "summary": "Add a single new feed inventory transaction.", + "description": "# Purpose\nAllows a client to add a single feed inventory transaction.\n", + "tags": [ + "ADE-1.3-feed" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + } + ], + "requestBody": { + "required": true, + "description": "The feed inventory transaction 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/icarFeedTransactionResource" + } + } + } + }, + "responses": { + "200": { + "description": "Successful. The response contains a copy of the event, as modifed by the server.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarFeedTransactionResource" + } + } + } + }, + "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" + } + } + } + }, "/batches/locations/{location-scheme}/{location-id}/feeds": { "post": { "operationId": "post-batch-feeds", @@ -971,6 +1088,81 @@ } } } + }, + "/batches/locations/{location-scheme}/{location-id}/feed-inventory-transactions": { + "post": { + "operationId": "post-batch-feed-inventory-transactions", + "summary": "Add an array of feed inventory transactions.", + "description": "# Purpose \nAllows a client to add a collection of feed inventory transactions.\n", + "tags": [ + "ADE-1.3-feed" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + } + ], + "requestBody": { + "required": true, + "description": "The collection of feed inventory transactions 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/icarFeedTransactionArray" + } + } + } + }, + "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": { @@ -1043,7 +1235,19 @@ }, "icarFeedReportCollection": { "$ref": "../collections/icarFeedReportCollection.json" - } + }, + "icarFeedTransactionResource": { + "$ref": "../resources/icarFeedTransactionResource.json" + }, + "icarFeedTransactionCollection": { + "$ref": "../collections/icarFeedTransactionCollection.json" + }, + "icarFeedTransactionArray": { + "type": "array", + "items": { + "$ref": "#/components/schemas/icarFeedTransactionResource" + } + } }, "parameters": { "location-scheme": { @@ -1099,7 +1303,44 @@ "type": "string", "format": "date-time" } - } + }, + "date-from": { + "name": "date-to", + "in": "query", + "description": "The end of the date range for the period for which data is needed, the date inclusive.", + "schema": { + "type": "string", + "format": "date" + } + }, + "date-to": { + "name": "date-from", + "in": "query", + "description": "The start of the date range for the period for which data is needed, the date inclusive.", + "schema": { + "type": "string", + "format": "date" + } + }, + "identifier-scheme": { + "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" + } + } + }, "responses": { "default": { diff --git a/url-schemes/healthURLScheme.json b/url-schemes/healthURLScheme.json index ba7c4a8..c5814a1 100644 --- a/url-schemes/healthURLScheme.json +++ b/url-schemes/healthURLScheme.json @@ -475,6 +475,105 @@ } } }, + "/locations/{location-scheme}/{location-id}/medicine-transaction": { + "get": { + "operationId": "get-medicine-inventory-transaction", + "summary": "Get medicine inventory transactions.", + "description": "# Purpose\nProvides the medicine inventory transactions for a location\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 medicine inventory transactions for the given location.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarMedicineTransactionCollection" + } + } + } + }, + "default": { + "$ref": "#/components/responses/default" + } + } + }, + "post": { + "operationId": "post-single-medicine-inventory-transaction", + "summary": "Add a single new medicine inventory transaction.", + "description": "# Purpose \nAllows a client to add a single medicine inventory transaction.\n", + "tags": [ + "ADE-1.3-health" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + } + ], + "requestBody": { + "required": true, + "description": "The medicine transaction 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/icarMedicineTransactionResource" + } + } + } + }, + "responses": { + "200": { + "description": "Successful. The response contains a copy of the resource, as modifed by the server.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/icarHealthStatusObservedEvent" + } + } + } + }, + "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", @@ -849,6 +948,81 @@ } } } + }, + "/batches/locations/{location-scheme}/{location-id}/medicine-inventory-transactions": { + "post": { + "operationId": "post-batch-medicine-inventory-transactions", + "summary": "Add an array of medicine inventory transactions.", + "description": "# Purpose \nAllows a client to add a collection of medicine inventory transactions.\n", + "tags": [ + "ADE-1.3-health" + ], + "parameters": [ + { + "$ref": "#/components/parameters/location-scheme" + }, + { + "$ref": "#/components/parameters/location-id" + } + ], + "requestBody": { + "required": true, + "description": "The collection of medicine inventory transactions 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/icarMedicineTransactionArray" + } + } + } + }, + "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": { @@ -918,7 +1092,19 @@ "items": { "$ref": "../resources/icarHealthStatusObservedEventResource.json" } - } + }, + "icarMedicineTransactionResource": { + "$ref": "../resources/icarMedicineTransactionResource.json" + }, + "icarMedicineTransactionCollection": { + "$ref": "../collections/icarMedicineTransactionCollection.json" + }, + "icarMedicineTransactionArray": { + "type": "array", + "items": { + "$ref": "#/components/schemas/icarMedicineTransactionResource" + } + } }, "parameters": { "location-scheme": { @@ -956,6 +1142,42 @@ "type": "string", "format": "date-time" } + }, + "date-from": { + "name": "date-to", + "in": "query", + "description": "The end of the date range for the period for which data is needed, the date inclusive.", + "schema": { + "type": "string", + "format": "date" + } + }, + "date-to": { + "name": "date-from", + "in": "query", + "description": "The start of the date range for the period for which data is needed, the date inclusive.", + "schema": { + "type": "string", + "format": "date" + } + }, + "identifier-scheme": { + "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" + } } }, "responses": {