feature: Live Capture (Track B)

This commit is contained in:
voltsrage
2026-06-27 04:23:51 +08:00
parent 01000a2489
commit 88e70b3dbe
30 changed files with 4547 additions and 23 deletions
@@ -0,0 +1,11 @@
/// <summary>
/// Internal result type for critical alert evaluation. Not exposed in API responses;
/// mapped to LiveCaptureCriticalAlert in the response builder.
/// </summary>
internal record CriticalAlertResult(
Guid Id,
string Severity,
string Message,
decimal ThresholdValue,
string ThresholdBound
);
@@ -0,0 +1,11 @@
/// <summary>
/// A critical alert that was generated synchronously during live capture promotion.
/// Returned inline so the clinician sees the alert before the HTTP response completes.
/// </summary>
public record LiveCaptureCriticalAlert(
Guid AlertId,
string Severity,
string Message,
decimal ThresholdValue,
string ThresholdBound
);
@@ -0,0 +1,10 @@
/// <summary>
/// A single observation entered at bedside by a credentialed clinician.
/// </summary>
public record LiveCaptureObservationRequest(
string ObservationCode,
decimal Value,
string Unit,
DateTimeOffset RecordedAt,
string? Note
);
@@ -0,0 +1,13 @@
/// <summary>
/// Response for a single promoted observation, including any synchronous
/// critical alert generated during promotion.
/// </summary>
public record LiveCaptureObservationResponse(
Guid DraftObservationId,
Guid LiveObservationId,
string ObservationCode,
decimal Value,
string Unit,
DateTimeOffset RecordedAt,
LiveCaptureCriticalAlert? CriticalAlert
);
@@ -0,0 +1,12 @@
/// <summary>
/// Full response for a live capture operation. Contains the batch ID,
/// the VigilCareClinical encounter ID, all promoted observations with
/// their live IDs, and any critical alerts generated synchronously.
/// </summary>
public record LiveCaptureResponse(
Guid BatchId,
Guid EncounterId,
IReadOnlyList<LiveCaptureObservationResponse> Observations,
int CriticalAlertCount,
DateTimeOffset PromotedAt
);
@@ -0,0 +1,13 @@
/// <summary>
/// Opens a new encounter and records initial vitals in a single request.
/// Used for outpatient workflows where the encounter does not yet exist.
/// </summary>
public record OpenEncounterWithVitalsRequest(
Guid PatientId,
string Department,
string? RoomBed,
string AdmissionReason,
List<LiveCaptureObservationRequest> Observations,
bool ClinicianAttestation,
string PasswordConfirm
);
@@ -0,0 +1,9 @@
/// <summary>
/// Records one or more observations against an existing VigilCareClinical encounter.
/// Requires clinician attestation and password re-confirmation.
/// </summary>
public record RecordObservationsRequest(
List<LiveCaptureObservationRequest> Observations,
bool ClinicianAttestation,
string PasswordConfirm
);
@@ -0,0 +1,6 @@
public record ThresholdCacheEntry(
string ObservationCode,
decimal? CriticalLow,
decimal? WarningLow,
decimal? WarningHigh,
decimal? CriticalHigh);