feature:
Full SOFA Score: Data Layer + Scoring Engine Glasgow Coma Scale: Data Layer + Scoring Engine
This commit is contained in:
@@ -12,8 +12,19 @@ public class ClinicalAlertConfiguration : IEntityTypeConfiguration<ClinicalAlert
|
||||
t.HasCheckConstraint("chk_clinical_alerts_status",
|
||||
"status IN ('OPEN', 'ACKNOWLEDGED', 'RESOLVED', 'ESCALATED')");
|
||||
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')");
|
||||
"alert_type IN (" +
|
||||
"'SEPSIS_WARNING', " +
|
||||
"'CRITICAL_HEART_RATE', 'CRITICAL_TEMP_C', 'CRITICAL_POTASSIUM_MEQ_L', " +
|
||||
"'CRITICAL_SPO2', 'CRITICAL_RESP_RATE', 'CRITICAL_WBC_K_UL', " +
|
||||
"'CRITICAL_SYSTOLIC_BP', 'CRITICAL_DIASTOLIC_BP', 'CRITICAL_LACTATE_MMOL_L', " +
|
||||
"'CRITICAL_AVPU', 'CRITICAL_GLUCOSE_MG_DL', " +
|
||||
"'WARNING_HEART_RATE', 'WARNING_TEMP_C', 'WARNING_POTASSIUM_MEQ_L', " +
|
||||
"'WARNING_SPO2', 'WARNING_RESP_RATE', 'WARNING_WBC_K_UL', " +
|
||||
"'WARNING_SYSTOLIC_BP', 'WARNING_DIASTOLIC_BP', 'WARNING_LACTATE_MMOL_L', " +
|
||||
"'WARNING_GLUCOSE_MG_DL', " +
|
||||
"'NEWS2_WARNING', 'NEWS2_EMERGENCY', " +
|
||||
"'RAPID_DETERIORATION', 'QSOFA_WARNING', " +
|
||||
"'GCS_CRITICAL', 'GCS_WARNING')");
|
||||
});
|
||||
builder.HasKey(a => a.Id);
|
||||
builder.Property(a => a.Id).HasColumnName("id").HasDefaultValueSql("gen_random_uuid()");
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
public class GcsScoreConfiguration : IEntityTypeConfiguration<GcsScore>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<GcsScore> builder)
|
||||
{
|
||||
builder.ToTable("gcs_scores", t =>
|
||||
{
|
||||
t.HasCheckConstraint("chk_gcs_scores_classification",
|
||||
"classification IN ('MILD', 'MODERATE', 'SEVERE')");
|
||||
});
|
||||
builder.HasKey(g => g.Id);
|
||||
builder.Property(g => g.Id).HasColumnName("id").HasDefaultValueSql("gen_random_uuid()");
|
||||
builder.Property(g => g.EncounterId).HasColumnName("encounter_id").IsRequired();
|
||||
builder.Property(g => g.PatientId).HasColumnName("patient_id").IsRequired();
|
||||
builder.Property(g => g.EyeScore).HasColumnName("eye_score").IsRequired();
|
||||
builder.Property(g => g.VerbalScore).HasColumnName("verbal_score").IsRequired();
|
||||
builder.Property(g => g.MotorScore).HasColumnName("motor_score").IsRequired();
|
||||
builder.Property(g => g.TotalScore).HasColumnName("total_score").IsRequired();
|
||||
builder.Property(g => g.Classification).HasColumnName("classification").HasMaxLength(16).IsRequired();
|
||||
builder.Property(g => g.CalculatedAt).HasColumnName("calculated_at").IsRequired();
|
||||
builder.Property(g => g.CreatedAt).HasColumnName("created_at").IsRequired();
|
||||
|
||||
builder.HasOne(g => g.Encounter)
|
||||
.WithMany()
|
||||
.HasForeignKey(g => g.EncounterId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
builder.HasIndex(g => new { g.EncounterId, g.CalculatedAt });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
public class SofaScoreConfiguration : IEntityTypeConfiguration<SofaScore>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<SofaScore> builder)
|
||||
{
|
||||
builder.ToTable("sofa_scores");
|
||||
builder.HasKey(s => s.Id);
|
||||
builder.Property(s => s.Id).HasColumnName("id").HasDefaultValueSql("gen_random_uuid()");
|
||||
builder.Property(s => s.EncounterId).HasColumnName("encounter_id").IsRequired();
|
||||
builder.Property(s => s.PatientId).HasColumnName("patient_id").IsRequired();
|
||||
builder.Property(s => s.TotalScore).HasColumnName("total_score").IsRequired();
|
||||
builder.Property(s => s.RespiratoryScore).HasColumnName("respiratory_score").IsRequired();
|
||||
builder.Property(s => s.CoagulationScore).HasColumnName("coagulation_score").IsRequired();
|
||||
builder.Property(s => s.LiverScore).HasColumnName("liver_score").IsRequired();
|
||||
builder.Property(s => s.CardiovascularScore).HasColumnName("cardiovascular_score").IsRequired();
|
||||
builder.Property(s => s.CnsScore).HasColumnName("cns_score").IsRequired();
|
||||
builder.Property(s => s.RenalScore).HasColumnName("renal_score").IsRequired();
|
||||
builder.Property(s => s.IsBaseline).HasColumnName("is_baseline").IsRequired();
|
||||
builder.Property(s => s.DeltaFromBaseline).HasColumnName("delta_from_baseline");
|
||||
builder.Property(s => s.StalenessFlags).HasColumnName("staleness_flags").HasColumnType("jsonb");
|
||||
builder.Property(s => s.CalculatedAt).HasColumnName("calculated_at").IsRequired();
|
||||
builder.Property(s => s.CreatedAt).HasColumnName("created_at").IsRequired();
|
||||
|
||||
builder.HasOne(s => s.Encounter)
|
||||
.WithMany()
|
||||
.HasForeignKey(s => s.EncounterId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
builder.HasIndex(s => new { s.EncounterId, s.CalculatedAt });
|
||||
builder.HasIndex(s => s.EncounterId)
|
||||
.HasFilter("is_baseline = true")
|
||||
.HasDatabaseName("idx_sofa_scores_baseline");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user