feature: Optional OCR-Assisted Draft Pre-Fill

This commit is contained in:
voltsrage
2026-06-28 01:28:54 +08:00
parent 5039dbb979
commit c160c5f912
42 changed files with 3592 additions and 33 deletions
@@ -0,0 +1,12 @@
public class OcrResult
{
public Guid Id { get; set; }
public Guid BatchId { get; set; }
public string Provider { get; set; } = null!; // "azure" or "tesseract"
public string FieldConfidencesJson { get; set; } = null!; // serialized Dictionary<string, double>
public string? RawText { get; set; }
public int DurationMs { get; set; }
public DateTimeOffset ProcessedAt { get; set; }
public DigitizationBatch Batch { get; set; } = null!;
}
@@ -22,7 +22,10 @@ public enum DigitizationEventType
DocumentAccessed,
Cancelled,
DraftFieldUpdated,
DraftObservationDeleted
DraftObservationDeleted,
OcrStarted,
OcrCompleted,
OcrFailed
}
public static class DigitizationEventTypeExtensions
@@ -52,6 +55,9 @@ public static class DigitizationEventTypeExtensions
DigitizationEventType.Cancelled => "cancelled",
DigitizationEventType.DraftFieldUpdated => "draft_field_updated",
DigitizationEventType.DraftObservationDeleted => "draft_observation_deleted",
DigitizationEventType.OcrStarted => "ocr_started",
DigitizationEventType.OcrCompleted => "ocr_completed",
DigitizationEventType.OcrFailed => "ocr_failed",
_ => throw new ArgumentOutOfRangeException(nameof(t))
};
@@ -80,6 +86,9 @@ public static class DigitizationEventTypeExtensions
"cancelled" => DigitizationEventType.Cancelled,
"draft_field_updated" => DigitizationEventType.DraftFieldUpdated,
"draft_observation_deleted" => DigitizationEventType.DraftObservationDeleted,
"ocr_started" => DigitizationEventType.OcrStarted,
"ocr_completed" => DigitizationEventType.OcrCompleted,
"ocr_failed" => DigitizationEventType.OcrFailed,
_ => throw new ArgumentOutOfRangeException(nameof(v), $"Unknown digitization event type: '{v}'")
};
}