Service - Transform Units: Difference between revisions

From Izara Wiki
Jump to navigation Jump to search
(Created page with "= Overview = Transformations are used to convert a number of input Units into sets of output Units. = Repository = https://bitbucket.org/izara-supply-units/izara-supply-units-transform-units = DynamoDB tables = == Standard Config Table Per Service == === Configuration tags === <syntaxhighlight lang="JavaScript"> { configTag: "SupplyGraphServiceName" configKey: "SupplyGraphServiceName" configValue: xxx // eg: "SupplyGraph" } </syntaxhighlight> == TransformC...")
 
No edit summary
Line 28: Line 28:
inputUnitTypes: {
inputUnitTypes: {
{unitTypeId}: {
{unitTypeId}: {
stageId: "xx", // optional stage that Units get updated to
quantityProperty: "xx", // optional, name of property that is used as quantity to spread across output Units, if none set then quantity is 1
quantityProperty: "xx", // optional, name of property that is used as quantity to spread across output Units, if none set then quantity is 1
stageId: "xx", // optional stage that Units get updated to
splitIntegerOnly: false, // default false, if true splits can only be integers, will not process transformation if split per outputUnit is not integer
}, //
}, //
},
},

Revision as of 11:54, 6 August 2023

Overview

Transformations are used to convert a number of input Units into sets of output Units.

Repository

https://bitbucket.org/izara-supply-units/izara-supply-units-transform-units

DynamoDB tables

Standard Config Table Per Service

Configuration tags

{
	configTag: "SupplyGraphServiceName"
	configKey: "SupplyGraphServiceName"
	configValue: xxx // eg: "SupplyGraph"
}

TransformConfig

{
	transformConfigId
	inputUnitTypes: {
		{unitTypeId}: {
			stageId: "xx", // optional stage that Units get updated to
			quantityProperty: "xx", // optional, name of property that is used as quantity to spread across output Units, if none set then quantity is 1
			splitIntegerOnly: false, // default false, if true splits can only be integers, will not process transformation if split per outputUnit is not integer
		}, //
	},
	outputUnitTypes: {
		{unitTypeId}: {
			stageId: "xx", // required initial stage Units are set to
			calculatedProperties: { // calculates a property added to the outputUnits
				{propertyName}: {
					calculationType: "multiplyQuantityValue", // can add other types later
					multipleByProperty: "xxx", // property of each input Unit that gets multiplied with the quantity of that Unit used for each outputUnit
				}, //..
			}
		}, //
	},
}
  • partition key: transformConfigId
  • sort key: (none)

UsersTransformConfigs

{
	userId: "xx" // user who owns the transformConfig
	transformConfigId: "xx",
}
  • partition key: userId
  • sort key: transformConfigId

Transform request

  • Input Units might have multiple Unit records of the same UnitType, and each record has it's quantityProperty which might be >1
  • All quantityProperty will be used completely in one transformation, no partial quantities handled
  • Do not differentiate which inputUnits are used on which outputUnits, if want to do that need to split into multiple transformations
  • When we calculate calculatedProperties we sum all inputUnits calculations together to work out a value per quantity, then apply the ratio set for each outputUnit to calculate each outputUnits property
  • outputUnits are split by itemType, but each itemType is split by sets so different calculatedProperties can be done (eg calcualting cost for sizes of different clothing)
  • each itemType sets the quantity (number of Units) that are created
  • each itemType set defaults to even ratio usage of inputUnit total quantity
  • each itemType set can set to override default ratio with a set value (total or per Unit) for each input ItemType, as long as all input quantities are used in full (either by having >0 sets use remaining ratio, or override accurately to use all quantity)

Working documents

Transform Units