File size: 1,225 Bytes
408b7e6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from abc import ABC, abstractmethod
from typing import Optional
from pydantic import BaseModel

class ScannerContext(BaseModel):
    adult_id: str      # The Gmail SSO ID of the parent/teacher
    child_name: str    # For multi-child identification
    child_class: str   # Critical for school-based reporting
    level: str         # beginner/intermediate/advanced
    locale: str        # AU_VIC / IN_NEP
    video_path: str
    hw_path: Optional[str] = None
    target_text: str   # Reading Prompt
    writing_target: str # Writing Prompt (For Levenshtein comparison)
    parent_email: str
    report_password: Optional[str] = None

    """Shared metadata for all clinical engines [cite: 2026-02-21, 2026-02-27]"""
    session_id: str
    locale: str
    has_paper: bool = False

class BaseScanner(ABC):
    """The universal blueprint for every diagnostic scanner."""
    
    @abstractmethod
    async def analyze(self, video, paper_scan, context: ScannerContext):
        """Perform biometric extraction and return raw metrics."""
        pass

    @abstractmethod
    def synthesize_risk(self, metrics: dict) -> float:
        """Apply clinical weights (e.g., Logarithmic Dampening) to generate a score."""
        pass