matrice-analytics 0.1.70__py3-none-any.whl → 0.1.89__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- matrice_analytics/post_processing/config.py +2 -2
- matrice_analytics/post_processing/core/base.py +1 -1
- matrice_analytics/post_processing/face_reg/face_recognition.py +871 -190
- matrice_analytics/post_processing/face_reg/face_recognition_client.py +55 -25
- matrice_analytics/post_processing/usecases/advanced_customer_service.py +908 -498
- matrice_analytics/post_processing/usecases/color_detection.py +18 -18
- matrice_analytics/post_processing/usecases/customer_service.py +356 -9
- matrice_analytics/post_processing/usecases/fire_detection.py +147 -9
- matrice_analytics/post_processing/usecases/license_plate_monitoring.py +549 -41
- matrice_analytics/post_processing/usecases/people_counting.py +11 -11
- matrice_analytics/post_processing/usecases/vehicle_monitoring.py +34 -34
- matrice_analytics/post_processing/utils/alert_instance_utils.py +950 -0
- matrice_analytics/post_processing/utils/business_metrics_manager_utils.py +1245 -0
- matrice_analytics/post_processing/utils/incident_manager_utils.py +1657 -0
- {matrice_analytics-0.1.70.dist-info → matrice_analytics-0.1.89.dist-info}/METADATA +1 -1
- {matrice_analytics-0.1.70.dist-info → matrice_analytics-0.1.89.dist-info}/RECORD +19 -16
- {matrice_analytics-0.1.70.dist-info → matrice_analytics-0.1.89.dist-info}/WHEEL +0 -0
- {matrice_analytics-0.1.70.dist-info → matrice_analytics-0.1.89.dist-info}/licenses/LICENSE.txt +0 -0
- {matrice_analytics-0.1.70.dist-info → matrice_analytics-0.1.89.dist-info}/top_level.txt +0 -0
|
@@ -474,11 +474,11 @@ class FacialRecognitionClient:
|
|
|
474
474
|
except Exception as e:
|
|
475
475
|
self.logger.error(f"API ERROR: Get all staff embeddings request failed - {e}", exc_info=True)
|
|
476
476
|
return {"success": False, "error": str(e)}
|
|
477
|
-
|
|
478
|
-
async def
|
|
479
|
-
"""Update deployment
|
|
477
|
+
|
|
478
|
+
async def update_deployment_action(self, deployment_id: str) -> Dict[str, Any]:
|
|
479
|
+
"""Update deployment action in backend
|
|
480
480
|
|
|
481
|
-
API: PUT /v1/
|
|
481
|
+
API: PUT /internal/v1/actions/update_facial_recognition_deployment/:server_id?app_deployment_id=:deployment_id
|
|
482
482
|
|
|
483
483
|
Args:
|
|
484
484
|
deployment_id: The deployment ID to update
|
|
@@ -487,34 +487,34 @@ class FacialRecognitionClient:
|
|
|
487
487
|
Dict containing response data
|
|
488
488
|
"""
|
|
489
489
|
if not deployment_id:
|
|
490
|
-
self.logger.warning("No deployment_id provided for
|
|
490
|
+
self.logger.warning("No deployment_id provided for update_deployment_action")
|
|
491
491
|
return {"success": False, "error": "deployment_id is required"}
|
|
492
492
|
|
|
493
|
-
self.logger.info(f"API REQUEST: Updating deployment - deployment_id={deployment_id}")
|
|
493
|
+
self.logger.info(f"API REQUEST: Updating deployment action - deployment_id={deployment_id}")
|
|
494
494
|
|
|
495
|
-
# Use Matrice session for async RPC call
|
|
495
|
+
# Use Matrice session for async RPC call to backend (not facial recognition server).
|
|
496
496
|
try:
|
|
497
497
|
response = await self.session.rpc.async_send_request(
|
|
498
498
|
method="PUT",
|
|
499
|
-
path=f"/v1/
|
|
499
|
+
path=f"/v1/actions/update_facial_recognition_deployment/{self.server_id}?app_deployment_id={deployment_id}",
|
|
500
500
|
payload={},
|
|
501
|
-
base_url=
|
|
501
|
+
base_url="https://prod.backend.app.matrice.ai"
|
|
502
502
|
)
|
|
503
503
|
|
|
504
504
|
if response.get('success', False):
|
|
505
|
-
self.logger.info(f"API RESPONSE: Deployment updated successfully - deployment_id={deployment_id}")
|
|
505
|
+
self.logger.info(f"API RESPONSE: Deployment action updated successfully - deployment_id={deployment_id}")
|
|
506
506
|
else:
|
|
507
|
-
self.logger.warning(f"Failed to update deployment for deployment_id={deployment_id}: {response.get('error', 'Unknown error')}")
|
|
507
|
+
self.logger.warning(f"Failed to update deployment action for deployment_id={deployment_id}: {response.get('error', 'Unknown error')}")
|
|
508
508
|
|
|
509
509
|
return self._handle_response(response)
|
|
510
510
|
except Exception as e:
|
|
511
|
-
self.logger.error(f"API ERROR: Update deployment request failed - deployment_id={deployment_id} - {e}", exc_info=True)
|
|
511
|
+
self.logger.error(f"API ERROR: Update deployment action request failed - deployment_id={deployment_id} - {e}", exc_info=True)
|
|
512
512
|
return {"success": False, "error": str(e)}
|
|
513
513
|
|
|
514
|
-
async def
|
|
515
|
-
"""Update deployment
|
|
514
|
+
async def update_deployment(self, deployment_id: str) -> Dict[str, Any]:
|
|
515
|
+
"""Update deployment to notify facial recognition server
|
|
516
516
|
|
|
517
|
-
API: PUT /
|
|
517
|
+
API: PUT /v1/facial_recognition/update_deployment/:deployment_id
|
|
518
518
|
|
|
519
519
|
Args:
|
|
520
520
|
deployment_id: The deployment ID to update
|
|
@@ -523,28 +523,28 @@ class FacialRecognitionClient:
|
|
|
523
523
|
Dict containing response data
|
|
524
524
|
"""
|
|
525
525
|
if not deployment_id:
|
|
526
|
-
self.logger.warning("No deployment_id provided for
|
|
526
|
+
self.logger.warning("No deployment_id provided for update_deployment")
|
|
527
527
|
return {"success": False, "error": "deployment_id is required"}
|
|
528
528
|
|
|
529
|
-
self.logger.info(f"API REQUEST: Updating deployment
|
|
529
|
+
self.logger.info(f"API REQUEST: Updating deployment - deployment_id={deployment_id}")
|
|
530
530
|
|
|
531
|
-
# Use Matrice session for async RPC call
|
|
531
|
+
# Use Matrice session for async RPC call
|
|
532
532
|
try:
|
|
533
533
|
response = await self.session.rpc.async_send_request(
|
|
534
534
|
method="PUT",
|
|
535
|
-
path=f"/
|
|
535
|
+
path=f"/v1/facial_recognition/update_deployment/{deployment_id}",
|
|
536
536
|
payload={},
|
|
537
|
-
base_url=
|
|
537
|
+
base_url=self.server_base_url
|
|
538
538
|
)
|
|
539
539
|
|
|
540
540
|
if response.get('success', False):
|
|
541
|
-
self.logger.info(f"API RESPONSE: Deployment
|
|
541
|
+
self.logger.info(f"API RESPONSE: Deployment updated successfully - deployment_id={deployment_id}")
|
|
542
542
|
else:
|
|
543
|
-
self.logger.warning(f"Failed to update deployment
|
|
543
|
+
self.logger.warning(f"Failed to update deployment for deployment_id={deployment_id}: {response.get('error', 'Unknown error')}")
|
|
544
544
|
|
|
545
545
|
return self._handle_response(response)
|
|
546
546
|
except Exception as e:
|
|
547
|
-
self.logger.error(f"API ERROR: Update deployment
|
|
547
|
+
self.logger.error(f"API ERROR: Update deployment request failed - deployment_id={deployment_id} - {e}", exc_info=True)
|
|
548
548
|
return {"success": False, "error": str(e)}
|
|
549
549
|
|
|
550
550
|
async def enroll_unknown_person(self, embedding: List[float], image_source: str = None, timestamp: str = None, location: str = None, employee_id: str = None) -> Dict[str, Any]:
|
|
@@ -602,17 +602,47 @@ class FacialRecognitionClient:
|
|
|
602
602
|
payload={},
|
|
603
603
|
base_url=self.server_base_url
|
|
604
604
|
)
|
|
605
|
-
|
|
605
|
+
|
|
606
606
|
if response.get('success', False):
|
|
607
607
|
self.logger.info(f"API RESPONSE: Service is healthy")
|
|
608
608
|
else:
|
|
609
609
|
self.logger.warning(f"Health check failed: {response.get('error', 'Unknown error')}")
|
|
610
|
-
|
|
610
|
+
|
|
611
611
|
return self._handle_response(response)
|
|
612
612
|
except Exception as e:
|
|
613
613
|
self.logger.error(f"API ERROR: Health check request failed - {e}", exc_info=True)
|
|
614
614
|
return {"success": False, "error": str(e)}
|
|
615
615
|
|
|
616
|
+
async def get_redis_details(self) -> Dict[str, Any]:
|
|
617
|
+
"""Get Redis connection details from facial recognition server
|
|
618
|
+
|
|
619
|
+
API: GET /v1/facial_recognition/get_redis_details
|
|
620
|
+
|
|
621
|
+
Returns:
|
|
622
|
+
Dict containing Redis connection details (REDIS_IP, REDIS_PORT, REDIS_PASSWORD)
|
|
623
|
+
"""
|
|
624
|
+
|
|
625
|
+
self.logger.info(f"API REQUEST: Getting Redis connection details")
|
|
626
|
+
|
|
627
|
+
# Use Matrice session for async RPC call
|
|
628
|
+
try:
|
|
629
|
+
response = await self.session.rpc.async_send_request(
|
|
630
|
+
method="GET",
|
|
631
|
+
path=f"/v1/facial_recognition/get_redis_details",
|
|
632
|
+
payload={},
|
|
633
|
+
base_url=self.server_base_url
|
|
634
|
+
)
|
|
635
|
+
|
|
636
|
+
if response.get('success', False):
|
|
637
|
+
self.logger.info(f"API RESPONSE: Redis details retrieved successfully")
|
|
638
|
+
else:
|
|
639
|
+
self.logger.warning(f"Failed to get Redis details: {response.get('error', 'Unknown error')}")
|
|
640
|
+
|
|
641
|
+
return self._handle_response(response)
|
|
642
|
+
except Exception as e:
|
|
643
|
+
self.logger.error(f"API ERROR: Get Redis details request failed - {e}", exc_info=True)
|
|
644
|
+
return {"success": False, "error": str(e)}
|
|
645
|
+
|
|
616
646
|
def _handle_response(self, response: Dict[str, Any]) -> Dict[str, Any]:
|
|
617
647
|
"""Handle RPC response and errors"""
|
|
618
648
|
try:
|