feature: Corrections and Supersession
This commit is contained in:
@@ -19,11 +19,16 @@ public record BatchDetailResponse(
|
||||
Guid? PromotionEncounterId,
|
||||
Guid? SupersedesBatchId,
|
||||
bool ClinicianAttestation,
|
||||
bool IsCorrection,
|
||||
SupersessionInfo? Supersession,
|
||||
DateTimeOffset CreatedAt,
|
||||
DateTimeOffset UpdatedAt
|
||||
)
|
||||
{
|
||||
public static BatchDetailResponse FromEntity(DigitizationBatch batch, string? documentUrl = null) =>
|
||||
public static BatchDetailResponse FromEntity(
|
||||
DigitizationBatch batch,
|
||||
string? documentUrl = null,
|
||||
SupersessionInfo? supersession = null) =>
|
||||
new(
|
||||
batch.Id,
|
||||
batch.Status.ToDbString(),
|
||||
@@ -41,7 +46,19 @@ public record BatchDetailResponse(
|
||||
batch.PromotionEncounterId,
|
||||
batch.SupersedesBatchId,
|
||||
batch.ClinicianAttestation,
|
||||
batch.SupersedesBatchId.HasValue,
|
||||
supersession,
|
||||
batch.CreatedAt,
|
||||
batch.UpdatedAt
|
||||
);
|
||||
|
||||
public static SupersessionInfo ToSupersessionInfo(
|
||||
DigitizationBatch supersededBatch,
|
||||
int originalObservationCount) =>
|
||||
new(
|
||||
supersededBatch.Id,
|
||||
supersededBatch.Status.ToDbString(),
|
||||
supersededBatch.PromotedAt ?? supersededBatch.UpdatedAt,
|
||||
originalObservationCount
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,24 +1,19 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
/// <summary>
|
||||
/// Multipart form for batch creation. Combines the uploaded scan with batch metadata
|
||||
/// so Swagger documents a single <c>multipart/form-data</c> request.
|
||||
/// </summary>
|
||||
public class CreateBatchForm
|
||||
{
|
||||
/// <summary>PDF, JPEG, or PNG scan (max 25 MB).</summary>
|
||||
[Required]
|
||||
public IFormFile File { get; set; } = null!;
|
||||
|
||||
/// <summary>Batch type literal, e.g. PATIENT_REGISTRATION or ENCOUNTER_SUMMARY.</summary>
|
||||
[Required]
|
||||
public string BatchType { get; set; } = null!;
|
||||
|
||||
/// <summary>BACKFILL (default) or LIVE_CAPTURE.</summary>
|
||||
public string? Track { get; set; }
|
||||
|
||||
/// <summary>Optional patient link used for duplicate-document detection.</summary>
|
||||
public Guid? PatientId { get; set; }
|
||||
|
||||
public CreateBatchRequest ToMetadata() => new(BatchType, Track, PatientId);
|
||||
}
|
||||
public Guid? SupersedesBatchId { get; set; }
|
||||
|
||||
public CreateBatchRequest ToMetadata() =>
|
||||
new(BatchType, Track, PatientId, SupersedesBatchId);
|
||||
}
|
||||
@@ -4,5 +4,6 @@
|
||||
public record CreateBatchRequest(
|
||||
string BatchType,
|
||||
string? Track,
|
||||
Guid? PatientId
|
||||
Guid? PatientId,
|
||||
Guid? SupersedesBatchId
|
||||
);
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
public record CreateBatchResult(
|
||||
DigitizationBatch Batch,
|
||||
SupersessionInfo? Supersession
|
||||
);
|
||||
@@ -0,0 +1,7 @@
|
||||
public record DigitizationEventSummary(
|
||||
string EventType,
|
||||
DateTimeOffset OccurredAt,
|
||||
Guid ActorUserId,
|
||||
string ActorName,
|
||||
string? MetadataJson
|
||||
);
|
||||
@@ -0,0 +1,23 @@
|
||||
public record DigitizationHistoryEntry(
|
||||
Guid BatchId,
|
||||
string Status,
|
||||
string BatchType,
|
||||
string Track,
|
||||
Guid? SupersedesBatchId,
|
||||
bool IsCorrection,
|
||||
bool HasBeenSuperseded,
|
||||
Guid? SupersededByBatchId,
|
||||
int DraftObservationCount,
|
||||
int LiveObservationCount,
|
||||
int SupersededObservationCount,
|
||||
DateTimeOffset CreatedAt,
|
||||
DateTimeOffset? PromotedAt,
|
||||
Guid? PromotionEncounterId,
|
||||
Guid? EnteredByUserId,
|
||||
string? EnteredByUserName,
|
||||
Guid? VerifiedByUserId,
|
||||
string? VerifiedByUserName,
|
||||
Guid? ApprovedByUserId,
|
||||
string? ApprovedByUserName,
|
||||
IReadOnlyList<DigitizationEventSummary> AuditTrail
|
||||
);
|
||||
@@ -0,0 +1,8 @@
|
||||
public record PatientDigitizationHistoryResponse(
|
||||
Guid PatientId,
|
||||
int TotalBatches,
|
||||
int PromotedBatches,
|
||||
int SupersededBatches,
|
||||
int PendingBatches,
|
||||
IReadOnlyList<DigitizationHistoryEntry> Entries
|
||||
);
|
||||
@@ -0,0 +1,6 @@
|
||||
public record SupersessionInfo(
|
||||
Guid OriginalBatchId,
|
||||
string OriginalBatchStatus,
|
||||
DateTimeOffset OriginalPromotedAt,
|
||||
int OriginalObservationCount
|
||||
);
|
||||
@@ -0,0 +1,7 @@
|
||||
public record PromotionResult(
|
||||
Guid BatchId,
|
||||
Guid EncounterId,
|
||||
int ObservationsPromoted,
|
||||
bool IsCorrection,
|
||||
SupersessionResult? Supersession
|
||||
);
|
||||
@@ -0,0 +1,6 @@
|
||||
public record SupersessionResult(
|
||||
Guid OriginalBatchId,
|
||||
int ObservationsSuperseded,
|
||||
int ObservationsReplaced,
|
||||
DateTimeOffset SupersededAt
|
||||
);
|
||||
Reference in New Issue
Block a user