Service - Locations
Jump to navigation
Jump to search
Overview
Manages Location Graph
Repository
https://bitbucket.org/izara-core-locations/izara-core-locations-locations/src/master/
ObjectSchemas
LocationType
{
"objectType": "locationType",
"canDelete": true,
"belongTo": {
"serviceTag": "UserAccount",
"objectType": "user"
},
"storageResources": {
"graph": {
"storageType": "graph",
"graphServerTag": "GraphHandler"
}
},
"addOnDataStructure": [
{
"type": "translation"
}
],
"fieldNames": {
"locationTypeId": {
"type": "string",
"randomOnCreate": true,
"requiredOnCreate": false,
"optionalOnCreate": false,
"canUpdate": false,
"validation": {
"pattern": "^[a-zA-Z0-9_-]+$"
},
"storageResourceTags": [
"graph"
]
}
},
"compositeKeyDeliminator": "_",
"identifiers": [
{
"type": "identifier",
"fieldName": "locationTypeId"
}
],
"generatedBy": "userGenerated"
}
LocationNode
{
"objectType": "locationNode",
"canDelete": true,
"belongTo": {
"serviceTag": "UserAccount",
"objectType": "user"
},
"storageResources": {
"graph": {
"storageType": "graph",
"graphServerTag": "GraphHandler"
}
},
"addOnDataStructure": [
{
"type": "translation"
}
],
"fieldNames": {
"locationNodeId": {
"type": "string",
"randomOnCreate": true,
"requiredOnCreate": false,
"optionalOnCreate": false,
"canUpdate": false,
"validation": {
"pattern": "^[a-zA-Z0-9_-]+$"
},
"storageResourceTags": [
"graph"
]
}
},
"compositeKeyDeliminator": "_",
"identifiers": [
{
"type": "identifier",
"fieldName": "locationNodeId"
}
],
"generatedBy": "userGenerated"
}
LocationLink
{
"objectType": "locationNode",
"canDelete": true,
"belongTo": {
"serviceTag": "UserAccount",
"objectType": "user"
},
"storageResources": {
"graph": {
"storageType": "graph",
"graphServerTag": "GraphHandler"
}
},
"addOnDataStructure": [
{
"type": "translation"
}
],
"fieldNames": {
"locationNodeId": {
"type": "string",
"randomOnCreate": true,
"requiredOnCreate": false,
"optionalOnCreate": false,
"canUpdate": false,
"validation": {
"pattern": "^[a-zA-Z0-9_-]+$"
},
"storageResourceTags": [
"graph"
]
}
},
"compositeKeyDeliminator": "_",
"identifiers": [
{
"type": "identifier",
"fieldName": "locationNodeId"
}
],
"generatedBy": "userGenerated"
}
RelationshipSchemas
hasLocationLink
{
"relationshipServiceTag": "Locations",
"fieldNames": {
"originTimeStamp": {
"type": "number",
"requiredOnCreate": false,
"canUpdate": true,
"validation": {
},
"optionalOnCreate": false
},
},
"storageResources": {
"graph": {
"storageType": "graph",
"graphServerTag": "GraphHandler"
}
},
"links": [
{
"storageResourceTags": [
"graph"
],
"from": {
"objType": {
"serviceTag": "Locations",
"objectType": "locationNode"
},
"linkType": "one",
"handler": true,
"requiredOnCreate": false
},
"to": {
"objType": {
"serviceTag": "Locations",
"objectType": "locationLink"
},
"requiredOnCreate": true,
"linkType": "many",
"handler": true
},
"canDelete": false
}
],
"canMove": false
}
isLocationNode
{
"relationshipServiceTag": "Locations",
"fieldNames": {
"originTimeStamp": {
"type": "number",
"requiredOnCreate": false,
"canUpdate": true,
"validation": {
},
"optionalOnCreate": false
},
},
"storageResources": {
"graph": {
"storageType": "graph",
"graphServerTag": "GraphHandler"
}
},
"links": [
{
"storageResourceTags": [
"graph"
],
"from": {
"objType": {
"serviceTag": "Locations",
"objectType": "locationLink"
},
"requiredOnCreate": true,
"linkType": "many",
"handler": true
},
"to": {
"objType": {
"serviceTag": "Locations",
"objectType": "locationNode"
},
"linkType": "one",
"handler": true,
"requiredOnCreate": false
},
"canDelete": false
}
],
"canMove": false
}
isLocationType
{
"relationshipServiceTag": "Locations",
"fieldNames": {
"originTimeStamp": {
"type": "number",
"requiredOnCreate": false,
"canUpdate": true,
"validation": {
},
"optionalOnCreate": false
},
},
"storageResources": {
"graph": {
"storageType": "graph",
"graphServerTag": "GraphHandler"
}
},
"links": [
{
"storageResourceTags": [
"graph"
],
"from": {
"objType": {
"serviceTag": "Locations",
"objectType": "locationNode"
},
"requiredOnCreate": true,
"linkType": "many",
"handler": true
},
"to": {
"objType": {
"serviceTag": "Locations",
"objectType": "locationType"
},
"linkType": "one",
"handler": true,
"requiredOnCreate": false
},
"canDelete": false
}
],
"canMove": false
}
Translations
locationNode
- given name of the location, eg: Bangkok
locationType
- description of the type of label, eg: Country
- see note about about adding a second translation textTag for presentation text, because locationType translation is used to create locationTypeId, so if want to split Post Codes for different countries into their own locationTypes will need to have unique text (eg: "Post Code (USA)", but might want to present with same text (eg: "Post Code")
Using locationNodeIds to search for sell offers
- Sellers set where they ship to, setting more inclusive ship to locationNodeIds is best (if it matches their actual service) because will be included in all searches for lower level locationNodeIds
- Buyers set where they are so can see sell offers that ship there, best to be as low level/specific as possible because will search sell offers for all matching parents
- Buyers can use their address which will find all parent locationNodeIds for all locationNodeIds in their address, or buyers can choose specific locationNodeId/s, eg a country when not signed in, this would return less results as will only return sell offers that specify they can ship anywhere in that country
Possible optimization when finding matching parents
- eg: when given a set of locationNodeIds from a buyer's address, we find all parent locationNodeIds and use this list to filter ship to locationNodeIds to find sell offers that ship to this buyer. This can result in a large number of queries
- this will be mitigated a lot by our cached complex filter and search results, but is still a lot of processing
- in all cases, all nodes set in an address would be searched for, these optimizations are for finding additional parents for checking
- we could reduce the filtering work by reducing the number of parent locationNodeIds
- one way is to only accept parent links that meet a certain weight, eg reach a limit of how many times they have been used as a parent in user addresses. Problem with this is lower level links will have less links, and just because a link is used little does not make it invalid
- another way is to curate the types of parent links to search for, eg only accept certain chains of links, such as city > post code > state, any parent nodes that do not match this chain are ignored. Would probably need to know the country beforehand to set the accepted chains. Additional processing to handle this might outweigh the gains
- another is to have curated parents, user entry (eg by a low level admin role) sets which are real links worth checking
- new plan: set only one locationNodeId as used by an address to calculate the chain of parent locationNodeIds, default is the lowest level node, but allow per address to choose which node