Skip to main content
The Justina AI System provides automated, objective analysis of surgical simulations using a sophisticated 5-step machine learning pipeline. It evaluates surgical performance based on physical metrics, benchmarking against ideal patterns, and risk assessment.

Purpose

The AI system serves multiple critical functions:

Performance Evaluation

Objective scoring based on dexterity metrics, precision, and safety

Real-Time Feedback

Immediate, actionable recommendations for surgical improvement

Risk Detection

Identification of critical events like hemorrhages and tumor touches

Training Analytics

Long-term performance tracking and skill progression analysis

Architecture

The AI system is built as a Python microservice that integrates with the backend via REST API and WebSocket channels.

5-Step Analysis Pipeline

The analysis pipeline processes surgical trajectory data through five sequential steps:
1

Data Ingestion & Cleaning

Converts raw movement data into a structured pandas DataFrame, calculates relative timestamps, and prepares data for analysis.
  • Extracts x, y, z coordinates from each movement
  • Sorts by timestamp for chronological order
  • Calculates time deltas (dt) between movements
  • Converts timestamps to relative seconds
2

Dexterity Metrics Calculation

Computes physics-based metrics that quantify surgical skill and hand coordination.
  • Velocity (v = distance/time): Movement speed
  • Acceleration (a = dv/dt): Rate of speed change
  • Jerk (j = da/dt): Smoothness indicator
  • Economy of Movement: Ratio of total path length to direct distance
  • Duration: Total procedure time
3

Benchmarking Against Ideal

Compares actual trajectory to an ideal straight-line path between start and end points.
  • Calculates perpendicular distance from each point to ideal line
  • Averages deviation across all movements
  • Converts to precision percentage (100% = perfect)
4

Risk Analysis

Identifies critical events and spatial patterns that indicate surgical risks.
  • Tumor Touches: Contact with cancerous tissue
  • Hemorrhages: Vascular damage events
  • Critical Quadrants: Spatial zones where errors occurred
5

Feedback Generation

Synthesizes all metrics into a final score (0-100) with detailed, actionable feedback.
  • Numeric score with performance tier
  • Critical alerts (hemorrhages, touches)
  • Dexterity metrics summary
  • Personalized recommendations

Key Components

Analysis Pipeline

Core 5-step algorithm implemented in Python

AI Client

JustinaAIClient class for backend integration

WebSocket Integration

Real-time notifications when new surgeries complete

Technologies

The AI system leverages modern Python data science libraries:
  • pandas: Data manipulation and time-series analysis
  • numpy: Numerical computations and linear algebra
  • requests: HTTP client for REST API calls
  • websocket-client: Real-time backend communication
  • flask: Optional REST API server

Performance Tiers

The AI system classifies surgical performance into four tiers:
Exceptional performance with minimal errors, optimal economy of movement, and no critical events.
Good performance with minor inefficiencies, few errors, and safe technique.
Adequate performance but with notable areas for improvement in precision or safety.
Needs significant improvement due to multiple errors, poor economy, or critical safety events.

Integration Workflow

The typical AI workflow follows these steps:
from client import JustinaAIClient
from analysis_pipeline import run_pipeline

# 1. Initialize and authenticate
client = JustinaAIClient()
client.login()

# 2. Fetch trajectory data
trajectory = client.get_trajectory(surgery_id)

# 3. Run analysis pipeline
score, feedback = run_pipeline(trajectory)

# 4. Submit results to backend
client.send_analysis(surgery_id, score, feedback)
The AI system operates asynchronously from the simulation, allowing surgeons to continue training while analysis runs in the background.

Next Steps

Explore the Pipeline

Deep dive into each analysis step with code examples

Setup Your Environment

Install dependencies and configure the AI service

Build docs developers (and LLMs) love