matrice-analytics 0.1.60__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/embedding_manager.py +8 -8
- matrice_analytics/post_processing/face_reg/face_recognition.py +886 -201
- matrice_analytics/post_processing/face_reg/face_recognition_client.py +68 -2
- 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 +149 -11
- matrice_analytics/post_processing/usecases/license_plate_monitoring.py +548 -40
- matrice_analytics/post_processing/usecases/people_counting.py +11 -11
- matrice_analytics/post_processing/usecases/vehicle_monitoring.py +34 -34
- matrice_analytics/post_processing/usecases/weapon_detection.py +98 -22
- 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.60.dist-info → matrice_analytics-0.1.89.dist-info}/METADATA +1 -1
- {matrice_analytics-0.1.60.dist-info → matrice_analytics-0.1.89.dist-info}/RECORD +21 -18
- {matrice_analytics-0.1.60.dist-info → matrice_analytics-0.1.89.dist-info}/WHEEL +0 -0
- {matrice_analytics-0.1.60.dist-info → matrice_analytics-0.1.89.dist-info}/licenses/LICENSE.txt +0 -0
- {matrice_analytics-0.1.60.dist-info → matrice_analytics-0.1.89.dist-info}/top_level.txt +0 -0
|
@@ -474,6 +474,42 @@ 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 update_deployment_action(self, deployment_id: str) -> Dict[str, Any]:
|
|
479
|
+
"""Update deployment action in backend
|
|
480
|
+
|
|
481
|
+
API: PUT /internal/v1/actions/update_facial_recognition_deployment/:server_id?app_deployment_id=:deployment_id
|
|
482
|
+
|
|
483
|
+
Args:
|
|
484
|
+
deployment_id: The deployment ID to update
|
|
485
|
+
|
|
486
|
+
Returns:
|
|
487
|
+
Dict containing response data
|
|
488
|
+
"""
|
|
489
|
+
if not deployment_id:
|
|
490
|
+
self.logger.warning("No deployment_id provided for update_deployment_action")
|
|
491
|
+
return {"success": False, "error": "deployment_id is required"}
|
|
492
|
+
|
|
493
|
+
self.logger.info(f"API REQUEST: Updating deployment action - deployment_id={deployment_id}")
|
|
494
|
+
|
|
495
|
+
# Use Matrice session for async RPC call to backend (not facial recognition server).
|
|
496
|
+
try:
|
|
497
|
+
response = await self.session.rpc.async_send_request(
|
|
498
|
+
method="PUT",
|
|
499
|
+
path=f"/v1/actions/update_facial_recognition_deployment/{self.server_id}?app_deployment_id={deployment_id}",
|
|
500
|
+
payload={},
|
|
501
|
+
base_url="https://prod.backend.app.matrice.ai"
|
|
502
|
+
)
|
|
503
|
+
|
|
504
|
+
if response.get('success', False):
|
|
505
|
+
self.logger.info(f"API RESPONSE: Deployment action updated successfully - deployment_id={deployment_id}")
|
|
506
|
+
else:
|
|
507
|
+
self.logger.warning(f"Failed to update deployment action for deployment_id={deployment_id}: {response.get('error', 'Unknown error')}")
|
|
508
|
+
|
|
509
|
+
return self._handle_response(response)
|
|
510
|
+
except Exception as e:
|
|
511
|
+
self.logger.error(f"API ERROR: Update deployment action request failed - deployment_id={deployment_id} - {e}", exc_info=True)
|
|
512
|
+
return {"success": False, "error": str(e)}
|
|
477
513
|
|
|
478
514
|
async def update_deployment(self, deployment_id: str) -> Dict[str, Any]:
|
|
479
515
|
"""Update deployment to notify facial recognition server
|
|
@@ -566,17 +602,47 @@ class FacialRecognitionClient:
|
|
|
566
602
|
payload={},
|
|
567
603
|
base_url=self.server_base_url
|
|
568
604
|
)
|
|
569
|
-
|
|
605
|
+
|
|
570
606
|
if response.get('success', False):
|
|
571
607
|
self.logger.info(f"API RESPONSE: Service is healthy")
|
|
572
608
|
else:
|
|
573
609
|
self.logger.warning(f"Health check failed: {response.get('error', 'Unknown error')}")
|
|
574
|
-
|
|
610
|
+
|
|
575
611
|
return self._handle_response(response)
|
|
576
612
|
except Exception as e:
|
|
577
613
|
self.logger.error(f"API ERROR: Health check request failed - {e}", exc_info=True)
|
|
578
614
|
return {"success": False, "error": str(e)}
|
|
579
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
|
+
|
|
580
646
|
def _handle_response(self, response: Dict[str, Any]) -> Dict[str, Any]:
|
|
581
647
|
"""Handle RPC response and errors"""
|
|
582
648
|
try:
|