Skip to content

Commit

Permalink
feat: updated create table database script for participant screening …
Browse files Browse the repository at this point in the history
…episode table and rescaffolded
  • Loading branch information
antoinerubeiz committed Nov 12, 2024
1 parent 58b2beb commit d7c9e89
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 85 deletions.
45 changes: 24 additions & 21 deletions scripts/database/create_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -76,25 +76,28 @@ IF NOT EXISTS
BEGIN
CREATE TABLE PARTICIPANT_SCREENING_EPISODE
(
ID BIGINT IDENTITY(1,1) PRIMARY KEY,
EPISODE_ID NVARCHAR (50) NOT NULL,
SCREENING_NAME VARCHAR(50) NULL,
NHS_NUMBER VARCHAR(50) NULL,
EPISODE_TYPE VARCHAR(50) NULL,
EPISODE_TYPE_DESCRIPTION VARCHAR(50) NULL,
EPISODE_OPEN_DATE VARCHAR(50) NULL,
APPOINTMENT_MADE_FLAG VARCHAR(10) NULL,
FIRST_OFFERED_APPOINTMENT_DATE VARCHAR(50) NULL,
ACTUAL_SCREENING_DATE VARCHAR(50) NULL,
EARLY_RECALL_DATE VARCHAR(50) NULL,
CALL_RECALL_STATUS_AUTHORISED_BY VARCHAR(50) NULL,
END_CODE VARCHAR(50) NULL,
END_CODE_DESCRIPTION VARCHAR(50) NULL,
END_CODE_LAST_UPDATED VARCHAR(50) NULL,
ORGANISATION_CODE VARCHAR(50) NULL,
ORGANISATION_NAME VARCHAR(50) NULL,
BATCH_ID VARCHAR(50) NULL,
RECORD_INSERT_DATETIME DATETIME NULL
);
EPISODE_ID BIGINT NOT NULL,
NHS_NUMBER BIGINT NOT NULL,
SCREENING_NAME VARCHAR(200) NULL,
EPISODE_TYPE VARCHAR(50) NULL,
EPISODE_TYPE_DESCRIPTION VARCHAR(300) NULL,
EPISODE_OPEN_DATE DATE NULL,
APPOINTMENT_MADE_FLAG SMALLINT NULL,
FIRST_OFFERED_APPOINTMENT_DATE DATE NULL,
ACTUAL_SCREENING_DATE DATE NULL,
EARLY_RECALL_DATE DATE NULL,
CALL_RECALL_STATUS_AUTHORISED_BY VARCHAR(200) NULL,
END_CODE VARCHAR(50) NULL,
END_CODE_DESCRIPTION VARCHAR(300) NULL,
END_CODE_LAST_UPDATED DATE NULL,
REASON_CLOSED_CODE VARCHAR(50) NULL,
REASON_CLOSED_CODE_DESCRIPTION VARCHAR(300) NULL,
FINAL_ACTION_CODE VARCHAR(50) NULL,
FINAL_ACTION_CODE_DESCRIPTION VARCHAR(300) NULL,
END_POINT VARCHAR(200) NULL,
ORGANISATION_CODE VARCHAR(50) NULL,
ORGANISATION_NAME VARCHAR(300) NULL,
BATCH_ID VARCHAR(100) NULL,
RECORD_INSERT_DATETIME DATETIME NULL
)
END

72 changes: 34 additions & 38 deletions src/Shared/Data/ServiceInsightsDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,86 +79,82 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)

modelBuilder.Entity<ParticipantScreeningEpisode>(entity =>
{
entity.HasKey(e => e.Id).HasName("PK__PARTICIP__3214EC27CC6C8464");
entity
.HasNoKey()
.ToTable("PARTICIPANT_SCREENING_EPISODE");
entity.ToTable("PARTICIPANT_SCREENING_EPISODE");
entity.Property(e => e.Id).HasColumnName("ID");
entity.Property(e => e.ActualScreeningDate)
.HasMaxLength(50)
.IsUnicode(false)
.HasColumnName("ACTUAL_SCREENING_DATE");
entity.Property(e => e.AppointmentMadeFlag)
.HasMaxLength(10)
.IsUnicode(false)
.HasColumnName("APPOINTMENT_MADE_FLAG");
entity.Property(e => e.ActualScreeningDate).HasColumnName("ACTUAL_SCREENING_DATE");
entity.Property(e => e.AppointmentMadeFlag).HasColumnName("APPOINTMENT_MADE_FLAG");
entity.Property(e => e.BatchId)
.HasMaxLength(50)
.HasMaxLength(100)
.IsUnicode(false)
.HasColumnName("BATCH_ID");
entity.Property(e => e.CallRecallStatusAuthorisedBy)
.HasMaxLength(50)
.HasMaxLength(200)
.IsUnicode(false)
.HasColumnName("CALL_RECALL_STATUS_AUTHORISED_BY");
entity.Property(e => e.EarlyRecallDate)
.HasMaxLength(50)
.IsUnicode(false)
.HasColumnName("EARLY_RECALL_DATE");
entity.Property(e => e.EarlyRecallDate).HasColumnName("EARLY_RECALL_DATE");
entity.Property(e => e.EndCode)
.HasMaxLength(50)
.IsUnicode(false)
.HasColumnName("END_CODE");
entity.Property(e => e.EndCodeDescription)
.HasMaxLength(50)
.HasMaxLength(300)
.IsUnicode(false)
.HasColumnName("END_CODE_DESCRIPTION");
entity.Property(e => e.EndCodeLastUpdated)
.HasMaxLength(50)
entity.Property(e => e.EndCodeLastUpdated).HasColumnName("END_CODE_LAST_UPDATED");
entity.Property(e => e.EndPoint)
.HasMaxLength(200)
.IsUnicode(false)
.HasColumnName("END_CODE_LAST_UPDATED");
entity.Property(e => e.EpisodeId)
.HasMaxLength(50)
.HasColumnName("EPISODE_ID");
entity.Property(e => e.EpisodeOpenDate)
.HasMaxLength(50)
.IsUnicode(false)
.HasColumnName("EPISODE_OPEN_DATE");
.HasColumnName("END_POINT");
entity.Property(e => e.EpisodeId).HasColumnName("EPISODE_ID");
entity.Property(e => e.EpisodeOpenDate).HasColumnName("EPISODE_OPEN_DATE");
entity.Property(e => e.EpisodeType)
.HasMaxLength(50)
.IsUnicode(false)
.HasColumnName("EPISODE_TYPE");
entity.Property(e => e.EpisodeTypeDescription)
.HasMaxLength(50)
.HasMaxLength(300)
.IsUnicode(false)
.HasColumnName("EPISODE_TYPE_DESCRIPTION");
entity.Property(e => e.FirstOfferedAppointmentDate)
entity.Property(e => e.FinalActionCode)
.HasMaxLength(50)
.IsUnicode(false)
.HasColumnName("FIRST_OFFERED_APPOINTMENT_DATE");
entity.Property(e => e.NhsNumber)
.HasMaxLength(50)
.HasColumnName("FINAL_ACTION_CODE");
entity.Property(e => e.FinalActionCodeDescription)
.HasMaxLength(300)
.IsUnicode(false)
.HasColumnName("NHS_NUMBER");
.HasColumnName("FINAL_ACTION_CODE_DESCRIPTION");
entity.Property(e => e.FirstOfferedAppointmentDate).HasColumnName("FIRST_OFFERED_APPOINTMENT_DATE");
entity.Property(e => e.NhsNumber).HasColumnName("NHS_NUMBER");
entity.Property(e => e.OrganisationCode)
.HasMaxLength(50)
.IsUnicode(false)
.HasColumnName("ORGANISATION_CODE");
entity.Property(e => e.OrganisationName)
.HasMaxLength(50)
.HasMaxLength(300)
.IsUnicode(false)
.HasColumnName("ORGANISATION_NAME");
entity.Property(e => e.ReasonClosedCode)
.HasMaxLength(50)
.IsUnicode(false)
.HasColumnName("REASON_CLOSED_CODE");
entity.Property(e => e.ReasonClosedCodeDescription)
.HasMaxLength(300)
.IsUnicode(false)
.HasColumnName("REASON_CLOSED_CODE_DESCRIPTION");
entity.Property(e => e.RecordInsertDatetime)
.HasColumnType("datetime")
.HasColumnName("RECORD_INSERT_DATETIME");
entity.Property(e => e.ScreeningName)
.HasMaxLength(50)
.HasMaxLength(200)
.IsUnicode(false)
.HasColumnName("SCREENING_NAME");
});

modelBuilder.Entity<ParticipantScreeningProfile>(entity =>
{
entity.HasKey(e => e.Id).HasName("PK__PARTICIP__3214EC27431877C7");
entity.HasKey(e => e.Id).HasName("PK__PARTICIP__3214EC27FE32C9C6");
entity.ToTable("PARTICIPANT_SCREENING_PROFILE");
Expand Down
60 changes: 34 additions & 26 deletions src/Shared/Model/ParticipantScreeningEpisode.cs
Original file line number Diff line number Diff line change
@@ -1,45 +1,53 @@
using System;
using System.Collections.Generic;
using System;
using System.Collections.Generic;

namespace NHS.ServiceInsights.Model;

public partial class ParticipantScreeningEpisode
{
public long Id { get; set; }
namespace NHS.ServiceInsights.Model;

public string EpisodeId { get; set; } = null!;
public partial class ParticipantScreeningEpisode
{
public long EpisodeId { get; set; }

public string? ScreeningName { get; set; }
public long NhsNumber { get; set; }

public string? NhsNumber { get; set; }
public string? ScreeningName { get; set; }

public string? EpisodeType { get; set; }
public string? EpisodeType { get; set; }

public string? EpisodeTypeDescription { get; set; }
public string? EpisodeTypeDescription { get; set; }

public string? EpisodeOpenDate { get; set; }
public DateOnly? EpisodeOpenDate { get; set; }

public string? AppointmentMadeFlag { get; set; }
public short? AppointmentMadeFlag { get; set; }

public string? FirstOfferedAppointmentDate { get; set; }
public DateOnly? FirstOfferedAppointmentDate { get; set; }

public string? ActualScreeningDate { get; set; }
public DateOnly? ActualScreeningDate { get; set; }

public string? EarlyRecallDate { get; set; }
public DateOnly? EarlyRecallDate { get; set; }

public string? CallRecallStatusAuthorisedBy { get; set; }
public string? CallRecallStatusAuthorisedBy { get; set; }

public string? EndCode { get; set; }
public string? EndCode { get; set; }

public string? EndCodeDescription { get; set; }
public string? EndCodeDescription { get; set; }

public string? EndCodeLastUpdated { get; set; }
public DateOnly? EndCodeLastUpdated { get; set; }

public string? OrganisationCode { get; set; }
public string? ReasonClosedCode { get; set; }

public string? OrganisationName { get; set; }
public string? ReasonClosedCodeDescription { get; set; }

public string? BatchId { get; set; }
public string? FinalActionCode { get; set; }

public DateTime? RecordInsertDatetime { get; set; }
}
public string? FinalActionCodeDescription { get; set; }

public string? EndPoint { get; set; }

public string? OrganisationCode { get; set; }

public string? OrganisationName { get; set; }

public string? BatchId { get; set; }

public DateTime? RecordInsertDatetime { get; set; }
}

0 comments on commit d7c9e89

Please sign in to comment.