Service - Addresses: Difference between revisions

From Izara Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 35: Line 35:
rootlocationNodeId: "xx",
rootlocationNodeId: "xx",
addressTemplateTag: "xx", // user defined string
addressTemplateTag: "xx", // user defined string
elements: [ // use Dynamo List as want to preserve order of elements
templateElements: [ // use Dynamo List as want to preserve order of elements
"customText",
"customText",
"newLine",
"newLine",
Line 53: Line 53:
* partition key: rootlocationNodeId
* partition key: rootlocationNodeId
* sort key: addressTemplateTag
* sort key: addressTemplateTag
* integer elements point to locationType nodes
* templateElements point to locationType nodes


= Graph database =  
= Graph database =  
Line 63: Line 63:
<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{  
{  
nodeLabel: "{AddressesSharedLib.ADDRESSNODE_GRAPH_NODE_LABEL}", // "addressNode"
nodeLabel: "{AddressesSharedLib.ADDRESS_GRAPH_NODE_LABEL}", // "address"
schema: {
schema: {
immutable: true,
immutable: true,
Line 72: Line 72:
identifier: true, // create unique id from request details including uniqueMessageId
identifier: true, // create unique id from request details including uniqueMessageId
},
},
addressTag: {
addressTag: {}, // free text name given by user
immutable: true,
addressText: {), // full text of the address, ready to be used by service
},
rootlocationNodeId: {}, // optional, if created from addressTemplate
addressText: {
addressTemplateTag: {}, // optional, if created from addressTemplate
immutable: true, // full text of the address
templateElements: {}, // optional, if not created from addressTemplate, is the structure submitted for the address, same format as addressTemplate templateElements
},
addressElements: {}, // the values used in each configurable templateElement
addressTemplateTag: {
languageId: {}, will determine the translation used by each locationTypeId
immutable: true, // optional, if created from addressTemplate
},
template: {
immutable: true, // is the structure submitted for the address, same format as addressTemplateTag.elements (but might be custom made/no addressTemplateTag used)
},
languageId: {
immutable: true, // will determine the translation used by each locationTypeId
},
},
},
}
}
Line 96: Line 88:
<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
relationshipType: "{AddressesSharedLib.addressNodeHasRelType()}", // "has_addressNode"
relationshipType: "{AddressesSharedLib.HasAddressRelType()}", // "has_address"
schema: {
schema: {
elementCanBeRemoved: true,
elementCanBeRemoved: true,
Line 109: Line 101:
<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
relationshipType: "{AddressesSharedLib.addressNodeDisabledRelType()}", // "disabled_addressNode"
relationshipType: "{AddressesSharedLib.DisabledAddressRelType()}", // "disabled_address"
schema: {
schema: {
elementCanBeRemoved: true,
elementCanBeRemoved: true,
Line 122: Line 114:
<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
relationshipType: "{AddressesSharedLib.addressNodeDefaultRelType()}", // "default_addressNode"
relationshipType: "{AddressesSharedLib.defaultAddressRelType()}", // "default_address"
schema: {
schema: {
elementCanBeRemoved: true,
elementCanBeRemoved: true,
Line 136: Line 128:
<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
relationshipType: "{AddressesSharedLib.addressNodeLocationNodeHasRelType()}", // "has_addressNodeLocationNode"
relationshipType: "{AddressesSharedLib.addressHasLocationNodeRelType()}", // "addressHas_LocationNode"
schema: {
schema: {
elementCanBeRemoved: false,
elementCanBeRemoved: false,
Line 156: Line 148:
= Working documents =
= Working documents =


[[:Category:Working_documents - Media Link|Media Link]]
[[:Category:Working_documents - Addresses|Addresses]]


[[Category:Backend services| Media Link]]
[[Category:Backend services| Addresses]]

Latest revision as of 12:21, 9 February 2022

Overview

Addresses linking to LocationIds, including optional address templates.

Repository

https://bitbucket.org/izara-core-locations/izara-core-addresses-addresses/src/master/

DynamoDB tables

Standard Config Table Per Service

Configuration tags

{
	configKey: "LocationsGraphServiceName"
	configTag: "LocationsGraphServiceName"
	configValue: "xxx" // eg: "Locations"
}
{
	configKey: "TranslationGraphServiceName"
	configTag: "TranslationGraphServiceName"
	configValue: "xxx" // eg: "TranslationGraph"
}

AddressTemplates

{
	rootlocationNodeId: "xx",
	addressTemplateTag: "xx", // user defined string
	templateElements: [ // use Dynamo List as want to preserve order of elements
		"customText",
		"newLine",
		"customText",
		"newLine",
		23,
		"newLine",
		6988,
		"space",
		"6465",
		"newLine",
		"rootlocationNodeId",
	]
}
  • partition key: rootlocationNodeId
  • sort key: addressTemplateTag
  • templateElements point to locationType nodes

Graph database

Service - Locations Graph

Nodes

{ 
	nodeLabel: "{AddressesSharedLib.ADDRESS_GRAPH_NODE_LABEL}", // "address"
	schema: {
		immutable: true,
		restrictProperties: true,
		restrictRelationships: true,
		properties: {
			addressId: {
				identifier: true, // create unique id from request details including uniqueMessageId
			},
			addressTag: {}, // free text name given by user
			addressText: {), // full text of the address, ready to be used by service
			rootlocationNodeId: {}, // optional, if created from addressTemplate
			addressTemplateTag: {}, // optional, if created from addressTemplate
			templateElements: {}, // optional, if not created from addressTemplate, is the structure submitted for the address, same format as addressTemplate templateElements
			addressElements: {}, // the values used in each configurable templateElement
			languageId: {}, will determine the translation used by each locationTypeId
		},
	}
}

Relationships

{
	relationshipType: "{AddressesSharedLib.HasAddressRelType()}", // "has_address"
	schema: {
		elementCanBeRemoved: true,
		allPropertiesImmutable: true,
		restrictProperties: true,
		properties: {
			originTimestamp: //timestamp the request to create/change this relationship was sent
		},
	}
}
{
	relationshipType: "{AddressesSharedLib.DisabledAddressRelType()}", // "disabled_address"
	schema: {
		elementCanBeRemoved: true,
		allPropertiesImmutable: true,
		restrictProperties: true,
		properties: {
			originTimestamp: //timestamp the request to create/change this relationship was sent
		},
	}
}
{
	relationshipType: "{AddressesSharedLib.defaultAddressRelType()}", // "default_address"
	schema: {
		elementCanBeRemoved: true,
		allPropertiesImmutable: true,
		restrictProperties: true,
		properties: {
			originTimestamp: //timestamp the request to create/change this relationship was sent
		},
	}
}
{
	relationshipType: "{AddressesSharedLib.addressHasLocationNodeRelType()}", // "addressHas_LocationNode"
	schema: {
		elementCanBeRemoved: false,
		allPropertiesImmutable: true,
		restrictProperties: true,
		properties: {
			originTimestamp: //timestamp the request to create/change this relationship was sent
			order: 1 // the order within the template/addressText where this locationNode is
		},
	}
}

Notes

  • storing the addressText directly into the address node means the address text is fixed and will not be adjusted by for example translation changes in locationNodes
  • addressText is already translated and stores it's languageId, so no confusion when viewing an address what parts are what language (eg customText elements are fixed text but locationNodeIds could change if their translated text is calculated on the fly)

Working documents

Addresses