feature:
Full SOFA Score: Data Layer + Scoring Engine Glasgow Coma Scale: Data Layer + Scoring Engine
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace VigilCareClinicalAPI.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddSofaScores : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "sofa_scores",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false, defaultValueSql: "gen_random_uuid()"),
|
||||
encounter_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
patient_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
total_score = table.Column<int>(type: "integer", nullable: false),
|
||||
respiratory_score = table.Column<int>(type: "integer", nullable: false),
|
||||
coagulation_score = table.Column<int>(type: "integer", nullable: false),
|
||||
liver_score = table.Column<int>(type: "integer", nullable: false),
|
||||
cardiovascular_score = table.Column<int>(type: "integer", nullable: false),
|
||||
cns_score = table.Column<int>(type: "integer", nullable: false),
|
||||
renal_score = table.Column<int>(type: "integer", nullable: false),
|
||||
is_baseline = table.Column<bool>(type: "boolean", nullable: false),
|
||||
delta_from_baseline = table.Column<int>(type: "integer", nullable: true),
|
||||
staleness_flags = table.Column<string>(type: "jsonb", nullable: true),
|
||||
calculated_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
created_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_sofa_scores", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "FK_sofa_scores_encounters_encounter_id",
|
||||
column: x => x.encounter_id,
|
||||
principalTable: "encounters",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "idx_sofa_scores_baseline",
|
||||
table: "sofa_scores",
|
||||
column: "encounter_id",
|
||||
filter: "is_baseline = true");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_sofa_scores_encounter_id_calculated_at",
|
||||
table: "sofa_scores",
|
||||
columns: new[] { "encounter_id", "calculated_at" });
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "sofa_scores");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user