Files
operating-room-monitor-server/app/dependencies.py

74 lines
2.5 KiB
Python
Raw Normal View History

from loguru import logger
from app.config import settings
from app.repositories.surgery_results import SurgeryResultRepository
from app.repositories.voice_audits import VoiceAuditRepository
from app.services.consumable_classifier import ConsumableClassifierService
from app.services.baidu_speech import BaiduSpeechService
from app.services.minio_audio_storage import MinioAudioStorageService
from app.services.surgery_pipeline import SurgeryPipeline
from app.services.voice_resolution import VoiceConfirmationService
from app.services.tear_action import TearActionService
from app.services.video.hikvision_runtime import HikvisionRuntime
from app.services.video.session_manager import CameraSessionManager
consumable_classifier_service = ConsumableClassifierService()
tear_action_service = TearActionService()
hikvision_runtime = HikvisionRuntime.try_load(settings.hikvision_lib_dir)
if settings.hikvision_sdk_enabled and hikvision_runtime is None:
logger.warning(
"HIKVISION_SDK_ENABLED=true but no HCNetSDK library loaded "
"(check HIKVISION_LIB_DIR / mount /opt/hikvision/lib)"
)
surgery_result_repository = SurgeryResultRepository()
voice_audit_repository = VoiceAuditRepository()
baidu_speech_service = BaiduSpeechService()
minio_audio_storage_service = MinioAudioStorageService(settings)
camera_session_manager = CameraSessionManager(
settings=settings,
consumable_classifier=consumable_classifier_service,
tear_action=tear_action_service,
hikvision_runtime=hikvision_runtime,
result_repository=surgery_result_repository,
)
voice_confirmation_service = VoiceConfirmationService(
settings=settings,
sessions=camera_session_manager,
baidu=baidu_speech_service,
minio=minio_audio_storage_service,
audits=voice_audit_repository,
)
surgery_pipeline = SurgeryPipeline(
camera_session_manager,
result_repository=surgery_result_repository,
voice_confirmation=voice_confirmation_service,
)
def get_consumable_classifier_service() -> ConsumableClassifierService:
return consumable_classifier_service
def get_tear_action_service() -> TearActionService:
return tear_action_service
def get_surgery_pipeline() -> SurgeryPipeline:
return surgery_pipeline
def get_camera_session_manager() -> CameraSessionManager:
return camera_session_manager
def get_surgery_result_repository() -> SurgeryResultRepository:
return surgery_result_repository
def get_voice_confirmation_service() -> VoiceConfirmationService:
return voice_confirmation_service