Harden API memory and CPU usage across Phases 19–22.
Bound list/PDF payloads, stream MinIO I/O with cancellation, paginate history and FHIR $everything, tighten OCR lifetimes/buffers, and add phase tracking docs.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using System.Text;
|
||||
using System.Threading.RateLimiting;
|
||||
using Azure;
|
||||
using Azure.AI.DocumentIntelligence;
|
||||
using FluentValidation;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||
@@ -62,9 +64,21 @@ try
|
||||
builder.Services.AddSingleton<ImagePreprocessor>();
|
||||
|
||||
if (ocrOptions.Provider == "azure")
|
||||
{
|
||||
builder.Services.AddSingleton(sp =>
|
||||
{
|
||||
var opts = sp.GetRequiredService<Microsoft.Extensions.Options.IOptions<OcrOptions>>()
|
||||
.Value.Azure;
|
||||
return new DocumentIntelligenceClient(
|
||||
new Uri(opts.Endpoint),
|
||||
new AzureKeyCredential(opts.ApiKey));
|
||||
});
|
||||
builder.Services.AddScoped<IOcrService, AzureDocumentOcrService>();
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.Services.AddScoped<IOcrService, TesseractOcrService>();
|
||||
}
|
||||
|
||||
builder.Services.AddScoped<OcrDraftPreFiller>();
|
||||
builder.Services.AddHostedService<OcrProcessingService>();
|
||||
|
||||
Reference in New Issue
Block a user