Product Location (PLAI)
Optional
Needed if your app scans products or looks up product locations.
Introduction
Product Location AI (PLAI) provides retailers with store maps that include automatic product location updates. Leveraging AI, barcode scans and hardware-free indoor positioning, PLAI seamlessly creates and maintains products' locations, offering a practical way to use realograms.
- Oriient's software-only indoor positioning works transparently as an SDK in the background of the scanning app, keeping track of the device's precise in-store location.
- Each barcode scan is captured together with an accurate location tag from Oriient.
- PLAI uses an AI engine to automatically learn product locations based on where they were scanned, removing outliers and concluding the most probable placement(s).
- Use the SDK API to get a product's or a product category's location based on previously collected scans.
- Optional. A full PLAI
.csvreport is generated on a daily basis, providing the most up-to-date product location information based on the scans collected.
A "scan" is any action in the app of marking or checking off a product, taking place when the user is expected to be near the shelf.
Application Flow
Once the user is in the store, calibration is finished, and the user is positioned, product scan data can be sent to the SDK. Based on previously sent scans, it is possible to receive a product's or a product category's location.
The basic flow for implementing this feature:
1. Send a product scan
Use IPSPositioning.sendEventTag():
tag: the product ID (a unified identifier used to identify the product, such as an EAN or similar);metadata: optional information about the product; the product's categories can be provided via this parameter as JSON:lx_category: category name at levelx;lx_category_id: category ID at levelx;x: ranges from 1 to 6;
type:IPSEventTagType.PRODUCT_SCAN, identifying a "product scan" event.
val metadata = ProductMetadata(
ProductCategory(
l1Category = "Food",
l1CategoryId = "food_id",
l2Category = "Pantry",
l2CategoryId = "pantry_id",
l3Category = "Soups",
l3CategoryId = "soups_id",
l4Category = "Broths & Stocks",
l4CategoryId = "broths_and_stocks_id",
l5Category = "Meat Broths & Stocks",
l5CategoryId = "meat_broths_and_stocks_id",
l6Category = "Beef Broths & Stocks",
l6CategoryId = "beef_broths_and_stocks_id",
)
)
val metadataJson = Gson().toJson(metadata)
// This code should be called for each barcode scan
IPSPositioning.sendEventTag(
"[Product ID]",
metadataJson,
IPSEventTagType.PRODUCT_SCAN,
object : IPSCompletionListener {
override fun onCompleted() {
// The event is registered, the SDK will take care of saving it
}
override fun onError(error: IPSError) {
// The SDK has failed to register the event
// Can happen if Login is not done or Positioning is not active
// Never retry after a failure
}
}
)
// Metadata model definition
data class ProductCategory(
@SerializedName("l1_category") val l1Category: String? = null,
@SerializedName("l1_category_id") val l1CategoryId: String? = null,
@SerializedName("l2_category") val l2Category: String? = null,
@SerializedName("l2_category_id") val l2CategoryId: String? = null,
@SerializedName("l3_category") val l3Category: String? = null,
@SerializedName("l3_category_id") val l3CategoryId: String? = null,
@SerializedName("l4_category") val l4Category: String? = null,
@SerializedName("l4_category_id") val l4CategoryId: String? = null,
@SerializedName("l5_category") val l5Category: String? = null,
@SerializedName("l5_category_id") val l5CategoryId: String? = null,
@SerializedName("l6_category") val l6Category: String? = null,
@SerializedName("l6_category_id") val l6CategoryId: String? = null
)
data class ProductMetadata(
@SerializedName("product_category") val productCategory: ProductCategory
)
Sending a tag may fail if there is no stable Internet connection or no active positioning session. Never retry after a failure.
One-Time (High-Confidence) Scanning
Instead of waiting for multiple PRODUCT_SCAN events to be aggregated by the daily PLAI process, a single scan can be saved as the product's location immediately. Use IPSPositioning.sendHighConfidenceEventTag():
IPSPositioning.sendHighConfidenceEventTag(
"[Product ID]",
null, // use the SDK's latest position
object : IPSCompletionListener {
override fun onCompleted() {
// The location is saved right away and is available immediately (see step 2)
}
override fun onError(error: IPSError) {
// error.code == IPSErrorCodes.INVALID_STATE if the position isn't locked or accurate enough
}
}
)
Pass null as the position to tag the product at the user's current location. In that case the SDK uses its latest position, which must be recent. To tag a location captured earlier (for example, the moment the barcode was scanned), pass an IPSHighConfidencePosition with the coordinates, floor, accuracy, lock state and time of that position instead:
val scanPosition = IPSHighConfidencePosition(
x = x,
y = y,
z = z,
buildingId = buildingId,
floorId = floorId,
floorOrder = floorOrder,
accuracy = accuracy,
isLocked = isLocked,
timeDeterminedMilli = timeDeterminedMilli
)
IPSPositioning.sendHighConfidenceEventTag("[Product ID]", scanPosition, completionListener)
Unlike sendEventTag(), this call takes no metadata. It requires a logged-in user, an active building and an Internet connection, and the position must be locked and high-accuracy — if a requirement isn't met, the call fails (usually with an IPSErrorCodes.INVALID_STATE error) instead of being saved. Unlike a regular PRODUCT_SCAN, a high-confidence scan doesn't go through the daily PLAI aggregation — the product's location is updated right away and is available immediately via step 2.
Since SDK 9.10.0, sendHighConfidenceEventTag() replaces sendEventTag() with IPSEventTagType.HIGH_CONFIDENCE_PRODUCT_SCAN, which has been removed.
2. Get the product or product category location
The possible results of this step vary and depend on the number of products or category locations known to the SDK. For example, there could be a single product plus three known categories: l1_category spanning three rows of shelves, l2_category a row of shelves, and l3_category part of a row.
Product and category locations are provided per building. For multi-floor buildings, the location should be filtered based on floorId.
In most cases, use the combined API call that provides both product and/or product category locations (section a). In some specific cases, you may need to retrieve only the category location (section b) or only the product location (section c).
a) Get a product and/or its categories' location
Use IPSContent.getProductAndCategoriesLocation() with the product ID and the list of its category IDs — these should be the same IDs used to fill the tag (for the product) and metadata (for categories) parameters of sendEventTag():
productId: the identifier of the product to get the location for;buildingId: the identifier of the building the product location is provided for;categories: the list of categories for the product in search.
fun onSearchProductAndCategory(productId: String, categories: List<String>) {
IPSContent.getProductAndCategoriesLocation(buildingManager.currentBuilding.value!!.id,
productId, categories,
object: IPSProductAndCategoriesLocationListener {
override fun onSuccess(result: IPSProductAndCategoriesLocationSearchResult?) {
if (result == null) return
if (result.productLocationSearchResult != null) {
// A product was found on the current floor
} else {
// Only categories were found
}
}
override fun onError(p0: IPSError) {
}
})
}
If a product or its categories' locations are found, IPSProductAndCategoriesLocationSearchResult is returned; otherwise null is returned:
buildingId: the identifier of the building the product location is provided for;productLocationSearchResult: if the product's location is found, IPSProductLocationSearchResult is returned; otherwisenull:buildingId,floorId,productId;primaryLocation: the location identified with the most confidence (IPSProductLocation) —x,y,regionIds,regionNames;allLocations: all available product locations associated with the result.
categoryLocationSearchResults: if the categories' locations are found, a list of IPSCategoryLocationSearchResult is returned, sorted from the smallest to the largest in terms of map area occupied; otherwise an empty list:buildingId,categoryId;primaryLocation: the category location identified with the most confidence (IPSCategoryLocation) —floorId,categoryName,bottomLeft,topRight;allLocations: all possible locations for this category.
recommendedNavigationDestination: the recommended navigation destination — the product's location if the product was found, otherwise the location of the smallest matched category.
For a single-floor building, use primaryLocation on either result to identify the product or category location. For a multi-floor building, use allLocations and filter it by floorId to match the visible floor in the building.
b) Get a category's location
Use IPSContent.getCategoryLocation() with the category ID — should be the same ID used to fill the metadata parameter of sendEventTag():
categoryId: the identifier of the category to get the location for.
IPSContent.getCategoryLocation(building.id, categoryId,
object: IPSCategoryLocationListener {
override fun onSuccess(result: IPSCategoryLocationSearchResult?) {
}
override fun onError(error: IPSError) {
}
}
)
If the category's location is found, IPSCategoryLocationSearchResult is returned as described above; otherwise null is returned.
c) Get a product's location
Use IPSContent.getProductLocation() with the product ID — should be the same ID used to fill the tag parameter of sendEventTag():
productId: the identifier of the product to get the location for;buildingId: the identifier of the building the product location is provided for.
fun onSearchProduct(buildingId: String, productId: String) {
IPSContent.getProductLocation(buildingId, productId,
object : IPSProductLocationResultListener {
override fun onError(error: IPSError) {
}
override fun onSuccess(info: IPSProductLocationSearchResult?) {
if (info == null) return
val location = info.primaryLocation
if (location.floorId == currentFloorId) {
// Place the product on the map at (location.x, location.y)
}
}
})
}
If the product's location is found, IPSProductLocationSearchResult is returned as described above; otherwise null is returned.