Skip to content

Commit

Permalink
Merge pull request #385 from cookeac/Develop
Browse files Browse the repository at this point in the history
Inventory transaction resources. Resolves #369
  • Loading branch information
cookeac authored Jul 10, 2023
2 parents a5d66e4 + 13fd8c2 commit a1dfb63
Show file tree
Hide file tree
Showing 18 changed files with 1,401 additions and 9 deletions.
21 changes: 21 additions & 0 deletions collections/icarFeedTransactionCollection.json
Original file line number Diff line number Diff line change
@@ -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."
}
}
}
]
}
21 changes: 21 additions & 0 deletions collections/icarInventoryTransactionCollection.json
Original file line number Diff line number Diff line change
@@ -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."
}
}
}
]
}
21 changes: 21 additions & 0 deletions collections/icarMedicineTransactionCollection.json
Original file line number Diff line number Diff line change
@@ -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."
}
}
}
]
}
11 changes: 11 additions & 0 deletions enums/icarInventoryTransactionKindType.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
16 changes: 16 additions & 0 deletions enums/icarProductFamilyType.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
24 changes: 24 additions & 0 deletions resources/icarFeedTransactionResource.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"description": "An inventory transaction resource for a feed product.",
"type": "object",

"allOf": [
{
"$ref": "../types/icarInventoryTransactionType.json"
},
{
"type": "object",

"required": [
"product"
],

"properties": {
"product": {
"$ref": "../types/icarFeedReferenceType.json",
"description": "The feed product in this transaction."
}
}
}
]
}
22 changes: 22 additions & 0 deletions resources/icarInventoryTransactionResource.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"description": "Generic inventory transaction resource. Some product families have specific transaction resources (e.g. medicines, feeds).",

"allOf": [
{
"$ref": "../types/icarInventoryTransactionType.json"
},
{
"type": "object",

"required": [
"product"
],
"properties": {
"product": {
"$ref": "../types/icarProductReferenceType.json",
"description": "The product in this inventory transaction."
}
}
}
]
}
23 changes: 23 additions & 0 deletions resources/icarMedicineTransactionResource.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"description": "An inventory transaction resource for a medicine product.",

"allOf": [
{
"$ref": "../types/icarInventoryTransactionType.json"
},
{
"type": "object",

"required": [
"product"
],

"properties": {
"product": {
"$ref": "../types/icarMedicineReferenceType.json",
"description": "The medicine product in this transaction."
}
}
}
]
}
22 changes: 22 additions & 0 deletions types/icarFeedReferenceType.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"description": "Feed Reference defines a feed product.",

"allOf": [
{
"$ref": "../types/icarProductReferenceType.json"
},
{
"type": "object",
"properties": {
"category": {
"$ref": "../enums/icarFeedCategoryType.json",
"description": "Defines the category of the feed product."
},
"type": {
"$ref": "../types/icarFeedIdentifierType.json",
"description": "The scheme + id identifying the type of feed."
}
}
}
]
}
58 changes: 58 additions & 0 deletions types/icarInventoryTransactionType.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"description": "Inventory Transaction defines a transaction on a product inventory where the transaction may be a receipt, disposal, on hand, stocktake, use",

"allOf": [
{
"$ref": "../resources/icarEventCoreResource.json"
}
,
{
"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."
}
}
}
]
}
7 changes: 2 additions & 5 deletions types/icarMedicineReferenceType.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 9 additions & 0 deletions types/icarProductIdentifierType.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"description": "Provides a scheme + identifier mechanism for product types.",

"allOf": [
{
"$ref": "../types/icarIdentifierType.json"
}
]
}
44 changes: 44 additions & 0 deletions types/icarProductReferenceType.json
Original file line number Diff line number Diff line change
@@ -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)."
}
}
}
]
}
Loading

0 comments on commit a1dfb63

Please sign in to comment.