feature: Medication Tracking & Vital Sign Correlation
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
public class MedicationCorrelationOptions
|
||||
{
|
||||
public const string SectionName = "MedicationCorrelation";
|
||||
|
||||
/// <summary>Lookback window for medication-vital correlation (minutes).</summary>
|
||||
public int CorrelationWindowMinutes { get; set; } = 90;
|
||||
|
||||
/// <summary>
|
||||
/// Drug name (lowercase) → observation codes that may be affected.
|
||||
/// Keys are normalized to lowercase for case-insensitive lookup.
|
||||
/// </summary>
|
||||
public Dictionary<string, string[]> DrugVitalMappings { get; set; } = new()
|
||||
{
|
||||
// Beta-blockers
|
||||
["metoprolol"] = new[] { "SYSTOLIC_BP", "HEART_RATE", "DIASTOLIC_BP" },
|
||||
["labetalol"] = new[] { "SYSTOLIC_BP", "HEART_RATE", "DIASTOLIC_BP" },
|
||||
["atenolol"] = new[] { "SYSTOLIC_BP", "HEART_RATE", "DIASTOLIC_BP" },
|
||||
["propranolol"] = new[] { "SYSTOLIC_BP", "HEART_RATE", "DIASTOLIC_BP" },
|
||||
["esmolol"] = new[] { "SYSTOLIC_BP", "HEART_RATE", "DIASTOLIC_BP" },
|
||||
["carvedilol"] = new[] { "SYSTOLIC_BP", "HEART_RATE", "DIASTOLIC_BP" },
|
||||
|
||||
// Vasopressors / inotropes
|
||||
["norepinephrine"] = new[] { "SYSTOLIC_BP", "DIASTOLIC_BP", "HEART_RATE" },
|
||||
["epinephrine"] = new[] { "SYSTOLIC_BP", "DIASTOLIC_BP", "HEART_RATE", "GLUCOSE_MG_DL" },
|
||||
["vasopressin"] = new[] { "SYSTOLIC_BP", "DIASTOLIC_BP" },
|
||||
["dopamine"] = new[] { "SYSTOLIC_BP", "DIASTOLIC_BP", "HEART_RATE" },
|
||||
["dobutamine"] = new[] { "SYSTOLIC_BP", "HEART_RATE" },
|
||||
["phenylephrine"] = new[] { "SYSTOLIC_BP", "DIASTOLIC_BP", "HEART_RATE" },
|
||||
|
||||
// Calcium channel blockers
|
||||
["diltiazem"] = new[] { "HEART_RATE", "SYSTOLIC_BP", "DIASTOLIC_BP" },
|
||||
["verapamil"] = new[] { "HEART_RATE", "SYSTOLIC_BP", "DIASTOLIC_BP" },
|
||||
["amlodipine"] = new[] { "SYSTOLIC_BP", "DIASTOLIC_BP" },
|
||||
["nicardipine"] = new[] { "SYSTOLIC_BP", "DIASTOLIC_BP", "HEART_RATE" },
|
||||
|
||||
// Antihypertensives
|
||||
["nitroglycerin"] = new[] { "SYSTOLIC_BP", "DIASTOLIC_BP", "HEART_RATE" },
|
||||
["nitroprusside"] = new[] { "SYSTOLIC_BP", "DIASTOLIC_BP", "HEART_RATE" },
|
||||
["hydralazine"] = new[] { "SYSTOLIC_BP", "DIASTOLIC_BP", "HEART_RATE" },
|
||||
|
||||
// Opioids
|
||||
["morphine"] = new[] { "RESP_RATE", "SPO2", "SYSTOLIC_BP", "HEART_RATE" },
|
||||
["fentanyl"] = new[] { "RESP_RATE", "SPO2", "HEART_RATE" },
|
||||
["hydromorphone"] = new[] { "RESP_RATE", "SPO2", "SYSTOLIC_BP" },
|
||||
["remifentanil"] = new[] { "RESP_RATE", "SPO2", "HEART_RATE" },
|
||||
|
||||
// Sedatives / anaesthetics
|
||||
["propofol"] = new[] { "RESP_RATE", "SPO2", "SYSTOLIC_BP", "HEART_RATE" },
|
||||
["midazolam"] = new[] { "RESP_RATE", "SPO2" },
|
||||
["lorazepam"] = new[] { "RESP_RATE", "SPO2" },
|
||||
["ketamine"] = new[] { "HEART_RATE", "SYSTOLIC_BP", "RESP_RATE" },
|
||||
|
||||
// Antiarrhythmics
|
||||
["amiodarone"] = new[] { "HEART_RATE", "SYSTOLIC_BP" },
|
||||
["adenosine"] = new[] { "HEART_RATE" },
|
||||
["digoxin"] = new[] { "HEART_RATE" },
|
||||
["atropine"] = new[] { "HEART_RATE" },
|
||||
|
||||
// Anticoagulants
|
||||
["heparin"] = new[] { "HEART_RATE" },
|
||||
|
||||
// Antipyretics
|
||||
["acetaminophen"] = new[] { "TEMP_C" },
|
||||
["ibuprofen"] = new[] { "TEMP_C" },
|
||||
|
||||
// Glucose management
|
||||
["insulin"] = new[] { "GLUCOSE_MG_DL" },
|
||||
["dextrose"] = new[] { "GLUCOSE_MG_DL" },
|
||||
["glucagon"] = new[] { "GLUCOSE_MG_DL" },
|
||||
|
||||
// Corticosteroids
|
||||
["dexamethasone"] = new[] { "GLUCOSE_MG_DL", "TEMP_C" },
|
||||
["methylprednisolone"] = new[] { "GLUCOSE_MG_DL", "TEMP_C" },
|
||||
["hydrocortisone"] = new[] { "GLUCOSE_MG_DL", "TEMP_C" },
|
||||
["prednisone"] = new[] { "GLUCOSE_MG_DL", "TEMP_C" },
|
||||
|
||||
// Diuretics
|
||||
["furosemide"] = new[] { "SYSTOLIC_BP", "DIASTOLIC_BP" },
|
||||
|
||||
// Bronchodilators
|
||||
["albuterol"] = new[] { "HEART_RATE", "SPO2" }
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Medication administration recording and lookup.
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Produces("application/json")]
|
||||
public class MedicationsController : ControllerBase
|
||||
{
|
||||
private readonly IMedicationService _medications;
|
||||
|
||||
public MedicationsController(IMedicationService medications) => _medications = medications;
|
||||
|
||||
/// <summary>
|
||||
/// Records a medication administration for an encounter.
|
||||
/// </summary>
|
||||
/// <param name="encounterId">Encounter id.</param>
|
||||
/// <param name="req">Medication administration details.</param>
|
||||
/// <returns>The created medication administration record.</returns>
|
||||
[HttpPost("api/v1/encounters/{encounterId:guid}/medications")]
|
||||
[ProducesResponseType(typeof(ApiResponse<MedicationAdministration>), StatusCodes.Status201Created)]
|
||||
[ProducesResponseType(typeof(ApiResponse<object>), StatusCodes.Status404NotFound)]
|
||||
[ProducesResponseType(typeof(ApiResponse<object>), StatusCodes.Status409Conflict)]
|
||||
public async Task<IActionResult> Create(Guid encounterId, [FromBody] CreateMedicationAdministrationRequest req)
|
||||
{
|
||||
var med = await _medications.CreateAsync(encounterId, req);
|
||||
return StatusCode(201, ApiResponse<MedicationAdministration>.Created(med));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lists medication administrations for an encounter with optional time filter.
|
||||
/// </summary>
|
||||
/// <param name="encounterId">Encounter id.</param>
|
||||
/// <param name="since">Optional ISO 8601 cutoff — only returns administrations at or after this time.</param>
|
||||
/// <param name="page">Page number (1-based).</param>
|
||||
/// <param name="pageSize">Results per page.</param>
|
||||
/// <returns>A paginated list of medication administrations.</returns>
|
||||
[HttpGet("api/v1/encounters/{encounterId:guid}/medications")]
|
||||
[ProducesResponseType(typeof(ApiResponse<object>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> ListByEncounter(
|
||||
Guid encounterId,
|
||||
[FromQuery] DateTimeOffset? since,
|
||||
[FromQuery] int page = 1,
|
||||
[FromQuery] int pageSize = 20)
|
||||
{
|
||||
var result = await _medications.ListByEncounterAsync(encounterId, since, page, pageSize);
|
||||
return Ok(ApiResponse<object>.Ok(new
|
||||
{
|
||||
items = result.Items,
|
||||
page = result.Page,
|
||||
pageSize = result.PageSize,
|
||||
totalCount = result.TotalCount,
|
||||
totalPages = result.TotalPages
|
||||
}));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single medication administration by id.
|
||||
/// </summary>
|
||||
/// <param name="id">Medication administration id.</param>
|
||||
/// <returns>The medication administration record.</returns>
|
||||
[HttpGet("api/v1/medications/{id:guid}")]
|
||||
[ProducesResponseType(typeof(ApiResponse<MedicationAdministration>), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(ApiResponse<object>), StatusCodes.Status404NotFound)]
|
||||
public async Task<IActionResult> Get(Guid id)
|
||||
{
|
||||
var med = await _medications.GetByIdAsync(id);
|
||||
return Ok(ApiResponse<MedicationAdministration>.Ok(med));
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ public class AppDbContext : DbContext
|
||||
public DbSet<News2Score> News2Scores => Set<News2Score>();
|
||||
public DbSet<SepsisBundle> SepsisBundles => Set<SepsisBundle>();
|
||||
public DbSet<SepsisBundleElement> SepsisBundleElements => Set<SepsisBundleElement>();
|
||||
public DbSet<MedicationAdministration> MedicationAdministrations => Set<MedicationAdministration>();
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
public class MedicationAdministrationConfiguration : IEntityTypeConfiguration<MedicationAdministration>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<MedicationAdministration> builder)
|
||||
{
|
||||
builder.ToTable("medication_administrations");
|
||||
builder.HasKey(m => m.Id);
|
||||
builder.Property(m => m.Id).HasColumnName("id").HasDefaultValueSql("gen_random_uuid()");
|
||||
builder.Property(m => m.EncounterId).HasColumnName("encounter_id").IsRequired();
|
||||
builder.Property(m => m.DrugName).HasColumnName("drug_name").HasMaxLength(200).IsRequired();
|
||||
builder.Property(m => m.Dose).HasColumnName("dose").HasPrecision(10, 4).IsRequired();
|
||||
builder.Property(m => m.DoseUnit).HasColumnName("dose_unit").HasMaxLength(20).IsRequired();
|
||||
builder.Property(m => m.Route).HasColumnName("route").HasMaxLength(50).IsRequired();
|
||||
builder.Property(m => m.AdministeredAt).HasColumnName("administered_at").IsRequired();
|
||||
builder.Property(m => m.AdministeredBy).HasColumnName("administered_by").HasMaxLength(100).IsRequired();
|
||||
|
||||
builder.HasOne(m => m.Encounter)
|
||||
.WithMany()
|
||||
.HasForeignKey(m => m.EncounterId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
builder.HasIndex(m => new { m.EncounterId, m.AdministeredAt });
|
||||
builder.HasIndex(m => new { m.EncounterId, m.DrugName });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
public class MedicationAdministration
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid EncounterId { get; set; }
|
||||
public string DrugName { get; set; } = null!;
|
||||
public decimal Dose { get; set; }
|
||||
public string DoseUnit { get; set; } = null!;
|
||||
public string Route { get; set; } = null!;
|
||||
public DateTimeOffset AdministeredAt { get; set; }
|
||||
public string AdministeredBy { get; set; } = null!;
|
||||
|
||||
public Encounter Encounter { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
public class MedicationCorrelationHelper
|
||||
{
|
||||
private readonly IMedicationService _medicationService;
|
||||
private readonly MedicationCorrelationOptions _options;
|
||||
|
||||
public MedicationCorrelationHelper(
|
||||
IMedicationService medicationService,
|
||||
IOptions<MedicationCorrelationOptions> options)
|
||||
{
|
||||
_medicationService = medicationService;
|
||||
_options = options.Value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Appends medication context to alert details if a correlated administration
|
||||
/// exists within the lookback window. Returns the original details if none found.
|
||||
/// </summary>
|
||||
public async Task<string> TryAnnotateDetailsAsync(
|
||||
Guid encounterId,
|
||||
string observationCode,
|
||||
string details,
|
||||
CancellationToken ct = default)
|
||||
{
|
||||
var recent = await _medicationService.GetRecentForEncounterAsync(
|
||||
encounterId, observationCode, _options.CorrelationWindowMinutes);
|
||||
|
||||
if (recent.Count == 0)
|
||||
return details;
|
||||
|
||||
// Use the most recent correlated administration
|
||||
var med = recent[0];
|
||||
var minutesAgo = (int)(DateTimeOffset.UtcNow - med.AdministeredAt).TotalMinutes;
|
||||
|
||||
return $"{details} — note: {med.DrugName} {med.Dose}{med.DoseUnit} " +
|
||||
$"({med.Route}) administered {minutesAgo} min ago";
|
||||
}
|
||||
}
|
||||
Generated
+932
@@ -0,0 +1,932 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace VigilCareClinicalAPI.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDbContext))]
|
||||
[Migration("20260619021003_AddMedicationAdministrationsTable")]
|
||||
partial class AddMedicationAdministrationsTable
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "8.0.4")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("AlertThreshold", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id")
|
||||
.HasDefaultValueSql("gen_random_uuid()");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at")
|
||||
.HasDefaultValueSql("NOW()");
|
||||
|
||||
b.Property<decimal?>("CriticalHigh")
|
||||
.HasColumnType("decimal(10,3)")
|
||||
.HasColumnName("critical_high");
|
||||
|
||||
b.Property<decimal?>("CriticalLow")
|
||||
.HasColumnType("decimal(10,3)")
|
||||
.HasColumnName("critical_low");
|
||||
|
||||
b.Property<string>("DisplayName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)")
|
||||
.HasColumnName("display_name");
|
||||
|
||||
b.Property<string>("ObservationCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)")
|
||||
.HasColumnName("observation_code");
|
||||
|
||||
b.Property<int?>("SuppressionWindowMinutes")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("suppression_window_minutes");
|
||||
|
||||
b.Property<string>("Unit")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)")
|
||||
.HasColumnName("unit");
|
||||
|
||||
b.Property<decimal?>("WarningHigh")
|
||||
.HasColumnType("decimal(10,3)")
|
||||
.HasColumnName("warning_high");
|
||||
|
||||
b.Property<decimal?>("WarningLow")
|
||||
.HasColumnType("decimal(10,3)")
|
||||
.HasColumnName("warning_low");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ObservationCode")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("alert_thresholds", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ClinicalAlert", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id")
|
||||
.HasDefaultValueSql("gen_random_uuid()");
|
||||
|
||||
b.Property<DateTimeOffset?>("AcknowledgedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("acknowledged_at");
|
||||
|
||||
b.Property<string>("AcknowledgedBy")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)")
|
||||
.HasColumnName("acknowledged_by");
|
||||
|
||||
b.Property<string>("AlertType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)")
|
||||
.HasColumnName("alert_type");
|
||||
|
||||
b.Property<string>("Details")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("details");
|
||||
|
||||
b.Property<Guid>("EncounterId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("encounter_id");
|
||||
|
||||
b.Property<Guid?>("ObservationId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("observation_id");
|
||||
|
||||
b.Property<Guid>("PatientId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("patient_id");
|
||||
|
||||
b.Property<DateTimeOffset?>("ResolvedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("resolved_at");
|
||||
|
||||
b.Property<string>("Severity")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)")
|
||||
.HasColumnName("severity");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)")
|
||||
.HasColumnName("status")
|
||||
.HasDefaultValueSql("'OPEN'");
|
||||
|
||||
b.Property<DateTimeOffset>("TriggeredAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("triggered_at")
|
||||
.HasDefaultValueSql("NOW()");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("EncounterId", "TriggeredAt");
|
||||
|
||||
b.HasIndex("PatientId", "TriggeredAt");
|
||||
|
||||
b.HasIndex("Severity", "TriggeredAt")
|
||||
.HasFilter("status = 'OPEN'");
|
||||
|
||||
b.ToTable("clinical_alerts", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("chk_clinical_alerts_alert_type", "alert_type IN ('SEPSIS_WARNING', 'CRITICAL_HEART_RATE', 'CRITICAL_TEMP_C', 'CRITICAL_POTASSIUM_MEQ_L', 'CRITICAL_SPO2', 'CRITICAL_RESP_RATE', 'CRITICAL_WBC_K_UL')");
|
||||
|
||||
t.HasCheckConstraint("chk_clinical_alerts_severity", "severity IN ('WARNING', 'CRITICAL')");
|
||||
|
||||
t.HasCheckConstraint("chk_clinical_alerts_status", "status IN ('OPEN', 'ACKNOWLEDGED', 'RESOLVED', 'ESCALATED')");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Encounter", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id")
|
||||
.HasDefaultValueSql("gen_random_uuid()");
|
||||
|
||||
b.Property<string>("AdmissionReason")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("character varying(500)")
|
||||
.HasColumnName("admission_reason");
|
||||
|
||||
b.Property<DateTimeOffset>("AdmittedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("admitted_at")
|
||||
.HasDefaultValueSql("NOW()");
|
||||
|
||||
b.Property<string>("AttendingPhysician")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)")
|
||||
.HasColumnName("attending_physician");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at")
|
||||
.HasDefaultValueSql("NOW()");
|
||||
|
||||
b.Property<string>("Department")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("department");
|
||||
|
||||
b.Property<string>("DischargeDiagnosis")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("character varying(500)")
|
||||
.HasColumnName("discharge_diagnosis");
|
||||
|
||||
b.Property<DateTimeOffset?>("DischargedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("discharged_at");
|
||||
|
||||
b.Property<string>("EncounterType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)")
|
||||
.HasColumnName("encounter_type");
|
||||
|
||||
b.Property<Guid>("PatientId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("patient_id");
|
||||
|
||||
b.Property<string>("RoomBed")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)")
|
||||
.HasColumnName("room_bed");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)")
|
||||
.HasColumnName("status")
|
||||
.HasDefaultValueSql("'SCHEDULED'");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PatientId", "AdmittedAt");
|
||||
|
||||
b.HasIndex("Status", "AdmittedAt")
|
||||
.HasFilter("status = 'ACTIVE'");
|
||||
|
||||
b.ToTable("encounters", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("chk_encounters_department", "department IN ('ICU', 'GENERAL_MEDICINE', 'EMERGENCY', 'CARDIOLOGY', 'SURGERY', 'PEDIATRICS')");
|
||||
|
||||
t.HasCheckConstraint("chk_encounters_encounter_type", "encounter_type IN ('INPATIENT', 'OUTPATIENT', 'EMERGENCY')");
|
||||
|
||||
t.HasCheckConstraint("chk_encounters_status", "status IN ('SCHEDULED', 'ACTIVE', 'DISCHARGED', 'CANCELLED')");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MedicationAdministration", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id")
|
||||
.HasDefaultValueSql("gen_random_uuid()");
|
||||
|
||||
b.Property<DateTimeOffset>("AdministeredAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("administered_at");
|
||||
|
||||
b.Property<string>("AdministeredBy")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("administered_by");
|
||||
|
||||
b.Property<decimal>("Dose")
|
||||
.HasPrecision(10, 4)
|
||||
.HasColumnType("numeric(10,4)")
|
||||
.HasColumnName("dose");
|
||||
|
||||
b.Property<string>("DoseUnit")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)")
|
||||
.HasColumnName("dose_unit");
|
||||
|
||||
b.Property<string>("DrugName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)")
|
||||
.HasColumnName("drug_name");
|
||||
|
||||
b.Property<Guid>("EncounterId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("encounter_id");
|
||||
|
||||
b.Property<string>("Route")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)")
|
||||
.HasColumnName("route");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("EncounterId", "AdministeredAt");
|
||||
|
||||
b.HasIndex("EncounterId", "DrugName");
|
||||
|
||||
b.ToTable("medication_administrations", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("News2Score", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id")
|
||||
.HasDefaultValueSql("gen_random_uuid()");
|
||||
|
||||
b.Property<DateTimeOffset>("CalculatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("calculated_at");
|
||||
|
||||
b.Property<int>("ConsciousnessScore")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("consciousness_score");
|
||||
|
||||
b.Property<Guid>("EncounterId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("encounter_id");
|
||||
|
||||
b.Property<bool>("HasSingleParamThree")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("has_single_param_three");
|
||||
|
||||
b.Property<int>("HeartRateScore")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("heart_rate_score");
|
||||
|
||||
b.Property<Guid>("PatientId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("patient_id");
|
||||
|
||||
b.Property<int>("RespRateScore")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("resp_rate_score");
|
||||
|
||||
b.Property<string>("RiskLevel")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)")
|
||||
.HasColumnName("risk_level");
|
||||
|
||||
b.Property<int>("Spo2Score")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("spo2_score");
|
||||
|
||||
b.Property<int>("SupplementalO2Score")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("supplemental_o2_score");
|
||||
|
||||
b.Property<int>("SystolicBpScore")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("systolic_bp_score");
|
||||
|
||||
b.Property<int>("TemperatureScore")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("temperature_score");
|
||||
|
||||
b.Property<int>("TotalScore")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("total_score");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("EncounterId", "CalculatedAt");
|
||||
|
||||
b.HasIndex("PatientId", "CalculatedAt");
|
||||
|
||||
b.ToTable("news2_scores", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("chk_news2_scores_risk_level", "risk_level IN ('LOW', 'LOW_MEDIUM', 'MEDIUM', 'HIGH')");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Observation", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id")
|
||||
.HasDefaultValueSql("gen_random_uuid()");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at")
|
||||
.HasDefaultValueSql("NOW()");
|
||||
|
||||
b.Property<Guid>("EncounterId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("encounter_id");
|
||||
|
||||
b.Property<string>("IdempotencyKey")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("idempotency_key");
|
||||
|
||||
b.Property<string>("ObservationCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)")
|
||||
.HasColumnName("observation_code");
|
||||
|
||||
b.Property<DateTimeOffset>("RecordedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("recorded_at");
|
||||
|
||||
b.Property<string>("Source")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)")
|
||||
.HasColumnName("source")
|
||||
.HasDefaultValueSql("'MANUAL'");
|
||||
|
||||
b.Property<string>("Unit")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)")
|
||||
.HasColumnName("unit");
|
||||
|
||||
b.Property<decimal>("Value")
|
||||
.HasColumnType("decimal(10,3)")
|
||||
.HasColumnName("value");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IdempotencyKey")
|
||||
.IsUnique()
|
||||
.HasFilter("idempotency_key IS NOT NULL");
|
||||
|
||||
b.HasIndex("EncounterId", "ObservationCode", "RecordedAt");
|
||||
|
||||
b.ToTable("observations", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("chk_observations_source", "source IN ('MANUAL', 'DEVICE', 'LAB')");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Order", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id")
|
||||
.HasDefaultValueSql("gen_random_uuid()");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("description");
|
||||
|
||||
b.Property<Guid>("EncounterId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("encounter_id");
|
||||
|
||||
b.Property<string>("OrderType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)")
|
||||
.HasColumnName("order_type");
|
||||
|
||||
b.Property<DateTimeOffset>("OrderedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("ordered_at")
|
||||
.HasDefaultValueSql("NOW()");
|
||||
|
||||
b.Property<string>("OrderedBy")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)")
|
||||
.HasColumnName("ordered_by");
|
||||
|
||||
b.Property<string>("ResultSummary")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("result_summary");
|
||||
|
||||
b.Property<DateTimeOffset?>("ResultedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("resulted_at");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)")
|
||||
.HasColumnName("status")
|
||||
.HasDefaultValueSql("'PENDING'");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("EncounterId", "OrderedAt");
|
||||
|
||||
b.HasIndex("Status", "OrderedAt")
|
||||
.HasFilter("status IN ('PENDING', 'IN_PROGRESS')");
|
||||
|
||||
b.ToTable("orders", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("chk_orders_order_type", "order_type IN ('LAB', 'IMAGING', 'MEDICATION', 'PROCEDURE')");
|
||||
|
||||
t.HasCheckConstraint("chk_orders_status", "status IN ('PENDING', 'IN_PROGRESS', 'RESULTED', 'CANCELLED')");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("OutboxEvent", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id")
|
||||
.HasDefaultValueSql("gen_random_uuid()");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at")
|
||||
.HasDefaultValueSql("NOW()");
|
||||
|
||||
b.Property<string>("PartitionKey")
|
||||
.HasMaxLength(36)
|
||||
.HasColumnType("character varying(36)")
|
||||
.HasColumnName("partition_key");
|
||||
|
||||
b.Property<string>("Payload")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("payload");
|
||||
|
||||
b.Property<DateTimeOffset?>("ProcessedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("processed_at");
|
||||
|
||||
b.Property<string>("Topic")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)")
|
||||
.HasColumnName("topic");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreatedAt")
|
||||
.HasFilter("processed_at IS NULL");
|
||||
|
||||
b.ToTable("outbox_events", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Patient", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id")
|
||||
.HasDefaultValueSql("gen_random_uuid()");
|
||||
|
||||
b.Property<string>("Allergies")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("allergies");
|
||||
|
||||
b.Property<string>("BloodType")
|
||||
.HasMaxLength(5)
|
||||
.HasColumnType("character varying(5)")
|
||||
.HasColumnName("blood_type");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at")
|
||||
.HasDefaultValueSql("NOW()");
|
||||
|
||||
b.Property<DateOnly>("DateOfBirth")
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("date_of_birth");
|
||||
|
||||
b.Property<string>("EmergencyContactName")
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)")
|
||||
.HasColumnName("emergency_contact_name");
|
||||
|
||||
b.Property<string>("EmergencyContactPhone")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)")
|
||||
.HasColumnName("emergency_contact_phone");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("first_name");
|
||||
|
||||
b.Property<string>("Gender")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("character varying(10)")
|
||||
.HasColumnName("gender");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("last_name");
|
||||
|
||||
b.Property<string>("Mrn")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)")
|
||||
.HasColumnName("mrn");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)")
|
||||
.HasDefaultValue("active")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Mrn")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("patients", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReconciliationAlert", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id")
|
||||
.HasDefaultValueSql("gen_random_uuid()");
|
||||
|
||||
b.Property<string>("CheckType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)")
|
||||
.HasColumnName("check_type");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at")
|
||||
.HasDefaultValueSql("NOW()");
|
||||
|
||||
b.Property<string>("Details")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("details");
|
||||
|
||||
b.Property<Guid?>("EncounterId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("encounter_id");
|
||||
|
||||
b.Property<Guid?>("PatientId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("patient_id");
|
||||
|
||||
b.Property<DateTimeOffset?>("ResolvedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("resolved_at");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("EncounterId");
|
||||
|
||||
b.HasIndex("PatientId");
|
||||
|
||||
b.HasIndex("CheckType", "EncounterId")
|
||||
.HasFilter("resolved_at IS NULL");
|
||||
|
||||
b.ToTable("reconciliation_alerts", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("chk_reconciliation_alerts_check_type", "check_type IN ('UNACKNOWLEDGED_CRITICAL_ALERT', 'PENDING_ORDER_NO_RESULT', 'ACTIVE_INPATIENT_NO_OBSERVATION')");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SepsisBundle", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id")
|
||||
.HasDefaultValueSql("gen_random_uuid()");
|
||||
|
||||
b.Property<DateTimeOffset?>("CompletedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("completed_at");
|
||||
|
||||
b.Property<string>("ComplianceStatus")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)")
|
||||
.HasColumnName("compliance_status")
|
||||
.HasDefaultValueSql("'IN_PROGRESS'");
|
||||
|
||||
b.Property<DateTimeOffset>("DeadlineAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("deadline_at");
|
||||
|
||||
b.Property<Guid>("EncounterId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("encounter_id");
|
||||
|
||||
b.Property<DateTimeOffset>("RecognizedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("recognized_at");
|
||||
|
||||
b.Property<Guid>("TriggeringAlertId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("triggering_alert_id");
|
||||
|
||||
b.Property<string>("TriggeringAlertType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)")
|
||||
.HasColumnName("triggering_alert_type");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ComplianceStatus");
|
||||
|
||||
b.HasIndex("TriggeringAlertId");
|
||||
|
||||
b.HasIndex("EncounterId", "RecognizedAt");
|
||||
|
||||
b.ToTable("sepsis_bundles", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("chk_sepsis_bundles_compliance_status", "compliance_status IN ('IN_PROGRESS', 'COMPLIANT', 'NON_COMPLIANT')");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SepsisBundleElement", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id")
|
||||
.HasDefaultValueSql("gen_random_uuid()");
|
||||
|
||||
b.Property<Guid>("BundleId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("bundle_id");
|
||||
|
||||
b.Property<DateTimeOffset?>("CompletedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("completed_at");
|
||||
|
||||
b.Property<string>("ElementType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("character varying(40)")
|
||||
.HasColumnName("element_type");
|
||||
|
||||
b.Property<Guid?>("OrderId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("order_id");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)")
|
||||
.HasColumnName("status")
|
||||
.HasDefaultValueSql("'PENDING'");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrderId");
|
||||
|
||||
b.HasIndex("BundleId", "ElementType")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("sepsis_bundle_elements", null, t =>
|
||||
{
|
||||
t.HasCheckConstraint("chk_sepsis_bundle_elements_element_type", "element_type IN ('BLOOD_CULTURES', 'SERUM_LACTATE', 'BROAD_SPECTRUM_ANTIBIOTICS', 'IV_FLUID_RESUSCITATION')");
|
||||
|
||||
t.HasCheckConstraint("chk_sepsis_bundle_elements_status", "status IN ('PENDING', 'COMPLETED')");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ClinicalAlert", b =>
|
||||
{
|
||||
b.HasOne("Encounter", "Encounter")
|
||||
.WithMany("Alerts")
|
||||
.HasForeignKey("EncounterId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Encounter");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Encounter", b =>
|
||||
{
|
||||
b.HasOne("Patient", "Patient")
|
||||
.WithMany("Encounters")
|
||||
.HasForeignKey("PatientId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Patient");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MedicationAdministration", b =>
|
||||
{
|
||||
b.HasOne("Encounter", "Encounter")
|
||||
.WithMany()
|
||||
.HasForeignKey("EncounterId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Encounter");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("News2Score", b =>
|
||||
{
|
||||
b.HasOne("Encounter", "Encounter")
|
||||
.WithMany()
|
||||
.HasForeignKey("EncounterId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Encounter");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Observation", b =>
|
||||
{
|
||||
b.HasOne("Encounter", "Encounter")
|
||||
.WithMany("Observations")
|
||||
.HasForeignKey("EncounterId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Encounter");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Order", b =>
|
||||
{
|
||||
b.HasOne("Encounter", "Encounter")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("EncounterId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Encounter");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReconciliationAlert", b =>
|
||||
{
|
||||
b.HasOne("Encounter", "Encounter")
|
||||
.WithMany()
|
||||
.HasForeignKey("EncounterId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("Patient", "Patient")
|
||||
.WithMany()
|
||||
.HasForeignKey("PatientId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("Encounter");
|
||||
|
||||
b.Navigation("Patient");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SepsisBundle", b =>
|
||||
{
|
||||
b.HasOne("Encounter", "Encounter")
|
||||
.WithMany()
|
||||
.HasForeignKey("EncounterId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ClinicalAlert", "TriggeringAlert")
|
||||
.WithMany()
|
||||
.HasForeignKey("TriggeringAlertId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Encounter");
|
||||
|
||||
b.Navigation("TriggeringAlert");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SepsisBundleElement", b =>
|
||||
{
|
||||
b.HasOne("SepsisBundle", "Bundle")
|
||||
.WithMany("Elements")
|
||||
.HasForeignKey("BundleId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Order", "Order")
|
||||
.WithMany()
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("Bundle");
|
||||
|
||||
b.Navigation("Order");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Encounter", b =>
|
||||
{
|
||||
b.Navigation("Alerts");
|
||||
|
||||
b.Navigation("Observations");
|
||||
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Patient", b =>
|
||||
{
|
||||
b.Navigation("Encounters");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SepsisBundle", b =>
|
||||
{
|
||||
b.Navigation("Elements");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace VigilCareClinicalAPI.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddMedicationAdministrationsTable : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "medication_administrations",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false, defaultValueSql: "gen_random_uuid()"),
|
||||
encounter_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
drug_name = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: false),
|
||||
dose = table.Column<decimal>(type: "numeric(10,4)", precision: 10, scale: 4, nullable: false),
|
||||
dose_unit = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
|
||||
route = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
||||
administered_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
administered_by = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_medication_administrations", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "FK_medication_administrations_encounters_encounter_id",
|
||||
column: x => x.encounter_id,
|
||||
principalTable: "encounters",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_medication_administrations_encounter_id_administered_at",
|
||||
table: "medication_administrations",
|
||||
columns: new[] { "encounter_id", "administered_at" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_medication_administrations_encounter_id_drug_name",
|
||||
table: "medication_administrations",
|
||||
columns: new[] { "encounter_id", "drug_name" });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "medication_administrations");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -250,6 +250,60 @@ namespace VigilCareClinicalAPI.Migrations
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MedicationAdministration", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id")
|
||||
.HasDefaultValueSql("gen_random_uuid()");
|
||||
|
||||
b.Property<DateTimeOffset>("AdministeredAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("administered_at");
|
||||
|
||||
b.Property<string>("AdministeredBy")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("character varying(100)")
|
||||
.HasColumnName("administered_by");
|
||||
|
||||
b.Property<decimal>("Dose")
|
||||
.HasPrecision(10, 4)
|
||||
.HasColumnType("numeric(10,4)")
|
||||
.HasColumnName("dose");
|
||||
|
||||
b.Property<string>("DoseUnit")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("character varying(20)")
|
||||
.HasColumnName("dose_unit");
|
||||
|
||||
b.Property<string>("DrugName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)")
|
||||
.HasColumnName("drug_name");
|
||||
|
||||
b.Property<Guid>("EncounterId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("encounter_id");
|
||||
|
||||
b.Property<string>("Route")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)")
|
||||
.HasColumnName("route");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("EncounterId", "AdministeredAt");
|
||||
|
||||
b.HasIndex("EncounterId", "DrugName");
|
||||
|
||||
b.ToTable("medication_administrations", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("News2Score", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@@ -753,6 +807,17 @@ namespace VigilCareClinicalAPI.Migrations
|
||||
b.Navigation("Patient");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MedicationAdministration", b =>
|
||||
{
|
||||
b.HasOne("Encounter", "Encounter")
|
||||
.WithMany()
|
||||
.HasForeignKey("EncounterId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Encounter");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("News2Score", b =>
|
||||
{
|
||||
b.HasOne("Encounter", "Encounter")
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
public record CreateMedicationAdministrationRequest(
|
||||
string DrugName,
|
||||
decimal Dose,
|
||||
string DoseUnit,
|
||||
string Route,
|
||||
DateTimeOffset? AdministeredAt, // null = now
|
||||
string AdministeredBy);
|
||||
@@ -172,6 +172,18 @@ public class News2Detector
|
||||
var triggeredAt = DateTimeOffset.UtcNow;
|
||||
var details = BuildDetails(totalScore, riskLevel, paramScores);
|
||||
|
||||
var correlation = scope.ServiceProvider.GetRequiredService<MedicationCorrelationHelper>();
|
||||
var annotatedParts = new List<string>();
|
||||
foreach (var code in News2Calculator.ParameterCodes)
|
||||
{
|
||||
var part = await correlation.TryAnnotateDetailsAsync(
|
||||
encounterId, code, "", ct);
|
||||
if (part.StartsWith(" — note:"))
|
||||
annotatedParts.Add(part.TrimStart(' ', '—').Trim());
|
||||
}
|
||||
if (annotatedParts.Count > 0)
|
||||
details += " — " + string.Join("; ", annotatedParts.Distinct());
|
||||
|
||||
var affected = await db.Database.ExecuteSqlInterpolatedAsync($"""
|
||||
INSERT INTO clinical_alerts
|
||||
(id, encounter_id, patient_id, alert_type, severity, details, status, triggered_at)
|
||||
|
||||
@@ -71,6 +71,9 @@ try
|
||||
builder.Services.Configure<SuppressionOptions>(
|
||||
builder.Configuration.GetSection(SuppressionOptions.SectionName));
|
||||
|
||||
builder.Services.Configure<MedicationCorrelationOptions>(
|
||||
builder.Configuration.GetSection(MedicationCorrelationOptions.SectionName));
|
||||
|
||||
builder.Services.AddScoped<IPatientService, PatientService>();
|
||||
builder.Services.AddScoped<IEncounterService, EncounterService>();
|
||||
builder.Services.AddScoped<IAlertThresholdService, AlertThresholdService>();
|
||||
@@ -92,7 +95,9 @@ try
|
||||
builder.Services.AddScoped<News2Detector>();
|
||||
builder.Services.AddScoped<TrendDetector>();
|
||||
builder.Services.AddSingleton<IAlertSuppressionService, AlertSuppressionService>();
|
||||
|
||||
builder.Services.AddScoped<IMedicationService, MedicationService>();
|
||||
builder.Services.AddScoped<MedicationCorrelationHelper>();
|
||||
|
||||
builder.Services.AddHostedService<ThresholdCacheLoader>();
|
||||
builder.Services.AddHostedService<KafkaTopicProvisioner>();
|
||||
builder.Services.AddHostedService<OutboxRelayService>();
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
public interface IMedicationService
|
||||
{
|
||||
Task<MedicationAdministration> CreateAsync(
|
||||
Guid encounterId, CreateMedicationAdministrationRequest req);
|
||||
Task<PagedResult<MedicationAdministration>> ListByEncounterAsync(
|
||||
Guid encounterId, DateTimeOffset? since, int page, int pageSize);
|
||||
Task<MedicationAdministration> GetByIdAsync(Guid id);
|
||||
Task<IReadOnlyList<MedicationAdministration>> GetRecentForEncounterAsync(
|
||||
Guid encounterId, string observationCode, int windowMinutes);
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
public class MedicationService : IMedicationService
|
||||
{
|
||||
private readonly AppDbContext _db;
|
||||
private readonly MedicationCorrelationOptions _correlationOptions;
|
||||
|
||||
public MedicationService(
|
||||
AppDbContext db,
|
||||
IOptions<MedicationCorrelationOptions> correlationOptions)
|
||||
{
|
||||
_db = db;
|
||||
_correlationOptions = correlationOptions.Value;
|
||||
}
|
||||
|
||||
public async Task<MedicationAdministration> CreateAsync(
|
||||
Guid encounterId, CreateMedicationAdministrationRequest req)
|
||||
{
|
||||
var encounter = await _db.Encounters.FindAsync(encounterId);
|
||||
if (encounter is null)
|
||||
throw new NotFoundException("Encounter not found.", "ENCOUNTER_NOT_FOUND");
|
||||
|
||||
if (encounter.Status != EncounterStatus.Active)
|
||||
throw new ConflictException(
|
||||
"Cannot record medications for a non-active encounter.",
|
||||
"ENCOUNTER_NOT_ACTIVE");
|
||||
|
||||
var med = new MedicationAdministration
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
EncounterId = encounterId,
|
||||
DrugName = req.DrugName.Trim(),
|
||||
Dose = req.Dose,
|
||||
DoseUnit = req.DoseUnit.Trim(),
|
||||
Route = req.Route.Trim(),
|
||||
AdministeredAt = req.AdministeredAt ?? DateTimeOffset.UtcNow,
|
||||
AdministeredBy = req.AdministeredBy.Trim()
|
||||
};
|
||||
|
||||
_db.MedicationAdministrations.Add(med);
|
||||
await _db.SaveChangesAsync();
|
||||
return med;
|
||||
}
|
||||
|
||||
public async Task<MedicationAdministration> GetByIdAsync(Guid id)
|
||||
{
|
||||
var med = await _db.MedicationAdministrations
|
||||
.AsNoTracking()
|
||||
.Include(m => m.Encounter)
|
||||
.FirstOrDefaultAsync(m => m.Id == id);
|
||||
|
||||
if (med is null)
|
||||
throw new NotFoundException("Medication administration not found.", "MEDICATION_NOT_FOUND");
|
||||
|
||||
return med;
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyList<MedicationAdministration>> GetRecentForEncounterAsync(
|
||||
Guid encounterId, string observationCode, int windowMinutes)
|
||||
{
|
||||
var cutoff = DateTimeOffset.UtcNow.AddMinutes(-windowMinutes);
|
||||
var mappings = _correlationOptions.DrugVitalMappings;
|
||||
|
||||
// Find drugs that affect this observation code
|
||||
var relevantDrugs = mappings
|
||||
.Where(kv => kv.Value.Contains(observationCode, StringComparer.OrdinalIgnoreCase))
|
||||
.Select(kv => kv.Key)
|
||||
.ToHashSet(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
if (relevantDrugs.Count == 0)
|
||||
return Array.Empty<MedicationAdministration>();
|
||||
|
||||
return await _db.MedicationAdministrations
|
||||
.AsNoTracking()
|
||||
.Where(m => m.EncounterId == encounterId
|
||||
&& m.AdministeredAt >= cutoff
|
||||
&& relevantDrugs.Contains(m.DrugName.ToLower()))
|
||||
.OrderByDescending(m => m.AdministeredAt)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<PagedResult<MedicationAdministration>> ListByEncounterAsync(
|
||||
Guid encounterId, DateTimeOffset? since, int page, int pageSize)
|
||||
{
|
||||
var query = _db.MedicationAdministrations
|
||||
.AsNoTracking()
|
||||
.Where(m => m.EncounterId == encounterId);
|
||||
|
||||
if (since.HasValue)
|
||||
query = query.Where(m => m.AdministeredAt >= since.Value);
|
||||
|
||||
var total = await query.CountAsync();
|
||||
var items = await query
|
||||
.OrderByDescending(m => m.AdministeredAt)
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToListAsync();
|
||||
|
||||
return new PagedResult<MedicationAdministration>(items, page, pageSize, total);
|
||||
}
|
||||
}
|
||||
@@ -6,12 +6,12 @@ public static class PlausibilityValidator
|
||||
private static readonly Dictionary<string, (decimal Min, decimal Max)> _ranges = new()
|
||||
{
|
||||
["HEART_RATE"] = (1, 300),
|
||||
["TEMP_C"] = (20, 50),
|
||||
["POTASSIUM_MEQ_L"] = (0.1m, 15),
|
||||
["TEMP_C"] = (15, 50),
|
||||
["POTASSIUM_MEQ_L"] = (0.1m, 12),
|
||||
["SPO2"] = (50, 100),
|
||||
["RESP_RATE"] = (1, 80),
|
||||
["WBC_K_UL"] = (0.1m, 500),
|
||||
["GLUCOSE_MG_DL"] = (10, 1500),
|
||||
["GLUCOSE_MG_DL"] = (10, 1000),
|
||||
["SYSTOLIC_BP"] = (40, 300),
|
||||
["DIASTOLIC_BP"] = (20, 200),
|
||||
["LACTATE_MMOL_L"] = (0.1m, 30),
|
||||
|
||||
@@ -90,6 +90,10 @@ public class WarningEvaluator
|
||||
var triggeredAt = DateTimeOffset.UtcNow;
|
||||
var details = BuildWarningDetails(observationCode, value, threshold);
|
||||
|
||||
var correlation = scope.ServiceProvider.GetRequiredService<MedicationCorrelationHelper>();
|
||||
details = await correlation.TryAnnotateDetailsAsync(
|
||||
encounterId, observationCode, details, ct);
|
||||
|
||||
var affected = await db.Database.ExecuteSqlInterpolatedAsync($"""
|
||||
INSERT INTO clinical_alerts
|
||||
(id, encounter_id, patient_id, observation_id, alert_type, severity, details, status, triggered_at)
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
using FluentValidation;
|
||||
|
||||
public class CreateMedicationAdministrationRequestValidator
|
||||
: AbstractValidator<CreateMedicationAdministrationRequest>
|
||||
{
|
||||
public CreateMedicationAdministrationRequestValidator()
|
||||
{
|
||||
RuleFor(x => x.DrugName).NotEmpty().MaximumLength(200);
|
||||
RuleFor(x => x.Dose).GreaterThan(0);
|
||||
RuleFor(x => x.DoseUnit).NotEmpty().MaximumLength(20);
|
||||
RuleFor(x => x.Route).NotEmpty().MaximumLength(50);
|
||||
RuleFor(x => x.AdministeredBy).NotEmpty().MaximumLength(100);
|
||||
RuleFor(x => x.AdministeredAt)
|
||||
.LessThanOrEqualTo(DateTimeOffset.UtcNow.AddMinutes(5))
|
||||
.When(x => x.AdministeredAt.HasValue)
|
||||
.WithMessage("AdministeredAt cannot be in the future.");
|
||||
}
|
||||
}
|
||||
@@ -93,5 +93,65 @@
|
||||
},
|
||||
"AlertSuppression": {
|
||||
"DefaultWindowMinutes": 30
|
||||
},
|
||||
"MedicationCorrelation": {
|
||||
"CorrelationWindowMinutes": 90,
|
||||
"DrugVitalMappings": {
|
||||
"metoprolol": ["SYSTOLIC_BP", "HEART_RATE", "DIASTOLIC_BP"],
|
||||
"labetalol": ["SYSTOLIC_BP", "HEART_RATE", "DIASTOLIC_BP"],
|
||||
"atenolol": ["SYSTOLIC_BP", "HEART_RATE", "DIASTOLIC_BP"],
|
||||
"propranolol": ["SYSTOLIC_BP", "HEART_RATE", "DIASTOLIC_BP"],
|
||||
"esmolol": ["SYSTOLIC_BP", "HEART_RATE", "DIASTOLIC_BP"],
|
||||
"carvedilol": ["SYSTOLIC_BP", "HEART_RATE", "DIASTOLIC_BP"],
|
||||
|
||||
"norepinephrine": ["SYSTOLIC_BP", "DIASTOLIC_BP", "HEART_RATE"],
|
||||
"epinephrine": ["SYSTOLIC_BP", "DIASTOLIC_BP", "HEART_RATE", "GLUCOSE_MG_DL"],
|
||||
"vasopressin": ["SYSTOLIC_BP", "DIASTOLIC_BP"],
|
||||
"dopamine": ["SYSTOLIC_BP", "DIASTOLIC_BP", "HEART_RATE"],
|
||||
"dobutamine": ["SYSTOLIC_BP", "HEART_RATE"],
|
||||
"phenylephrine": ["SYSTOLIC_BP", "DIASTOLIC_BP", "HEART_RATE"],
|
||||
|
||||
"diltiazem": ["HEART_RATE", "SYSTOLIC_BP", "DIASTOLIC_BP"],
|
||||
"verapamil": ["HEART_RATE", "SYSTOLIC_BP", "DIASTOLIC_BP"],
|
||||
"amlodipine": ["SYSTOLIC_BP", "DIASTOLIC_BP"],
|
||||
"nicardipine": ["SYSTOLIC_BP", "DIASTOLIC_BP", "HEART_RATE"],
|
||||
|
||||
"nitroglycerin": ["SYSTOLIC_BP", "DIASTOLIC_BP", "HEART_RATE"],
|
||||
"nitroprusside": ["SYSTOLIC_BP", "DIASTOLIC_BP", "HEART_RATE"],
|
||||
"hydralazine": ["SYSTOLIC_BP", "DIASTOLIC_BP", "HEART_RATE"],
|
||||
|
||||
"morphine": ["RESP_RATE", "SPO2", "SYSTOLIC_BP", "HEART_RATE"],
|
||||
"fentanyl": ["RESP_RATE", "SPO2", "HEART_RATE"],
|
||||
"hydromorphone": ["RESP_RATE", "SPO2", "SYSTOLIC_BP"],
|
||||
"remifentanil": ["RESP_RATE", "SPO2", "HEART_RATE"],
|
||||
|
||||
"propofol": ["RESP_RATE", "SPO2", "SYSTOLIC_BP", "HEART_RATE"],
|
||||
"midazolam": ["RESP_RATE", "SPO2"],
|
||||
"lorazepam": ["RESP_RATE", "SPO2"],
|
||||
"ketamine": ["HEART_RATE", "SYSTOLIC_BP", "RESP_RATE"],
|
||||
|
||||
"amiodarone": ["HEART_RATE", "SYSTOLIC_BP"],
|
||||
"adenosine": ["HEART_RATE"],
|
||||
"digoxin": ["HEART_RATE"],
|
||||
"atropine": ["HEART_RATE"],
|
||||
|
||||
"heparin": ["HEART_RATE"],
|
||||
|
||||
"acetaminophen": ["TEMP_C"],
|
||||
"ibuprofen": ["TEMP_C"],
|
||||
|
||||
"insulin": ["GLUCOSE_MG_DL"],
|
||||
"dextrose": ["GLUCOSE_MG_DL"],
|
||||
"glucagon": ["GLUCOSE_MG_DL"],
|
||||
|
||||
"dexamethasone": ["GLUCOSE_MG_DL", "TEMP_C"],
|
||||
"methylprednisolone": ["GLUCOSE_MG_DL", "TEMP_C"],
|
||||
"hydrocortisone": ["GLUCOSE_MG_DL", "TEMP_C"],
|
||||
"prednisone": ["GLUCOSE_MG_DL", "TEMP_C"],
|
||||
|
||||
"furosemide": ["SYSTOLIC_BP", "DIASTOLIC_BP"],
|
||||
|
||||
"albuterol": ["HEART_RATE", "SPO2"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user