Skip to content

Commit

Permalink
CNDIT-1729 Update liquibase and transformation
Browse files Browse the repository at this point in the history
  • Loading branch information
sveselev committed Sep 24, 2024
1 parent a292265 commit 219e2c5
Show file tree
Hide file tree
Showing 10 changed files with 799 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,10 @@ databaseChangeLog:
- sqlFile:
path: 020-sp_notification_event-002.sql
splitStatements: false
- changeSet:
id: 23
author: liquibase
changes:
- sqlFile:
path: 021_sp_observation_event-001.sql
splitStatements: false
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,10 @@ databaseChangeLog:
- sqlFile:
path: 015-sp_nrt_ldf_postprocessing-001.sql
splitStatements: false
- changeSet:
id: 37
author: liquibase
changes:
- sqlFile:
path: 017-create_nrt_observation-003.sql
splitStatements: false

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
IF EXISTS (SELECT 1 FROM sysobjects WHERE name = 'nrt_observation' and xtype = 'U')
BEGIN
IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'ctrl_cd_display_form' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD ctrl_cd_display_form varchar(20);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'obs_domain_cd_st_1' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD obs_domain_cd_st_1 varchar(20);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'processing_decision_cd' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD processing_decision_cd varchar(20);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'cd' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD cd varchar(50);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'shared_ind' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD shared_ind char(1);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'status_cd' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD status_cd char(1);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'cd_system_cd' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD cd_system_cd varchar(50);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'cd_system_desc_txt' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD cd_system_desc_txt varchar(1000);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'ctrl_cd_user_defined_1' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD ctrl_cd_user_defined_1 varchar(20);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'alt_cd' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD alt_cd varchar(50);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'alt_cd_desc_txt' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD alt_cd_desc_txt varchar(1000);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'alt_cd_system_cd' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD alt_cd_system_cd varchar(1000);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'alt_cd_system_desc_txt' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD alt_cd_system_desc_txt varchar(100);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'method_cd' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD method_cd varchar(2000);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'method_desc_txt' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD method_desc_txt varchar(2000);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'target_site_cd' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD target_site_cd varchar(20);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'target_site_desc_txt' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD target_site_desc_txt varchar(100);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'txt' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD txt varchar(1000);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'interpretation_cd' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD interpretation_cd varchar(20);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'interpretation_desc_txt' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD interpretation_desc_txt varchar(100);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'report_observation_id' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD report_observation_id bigint;
END;

IF EXISTS(SELECT 1 FROM sys.columns WHERE name = N'result_observation_id' AND DATA_TYPE = 'bigint' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ALTER COLUMN result_observation_id nvarchar(max);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'followup_observation_id' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD followup_observation_id nvarchar(max);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'report_refr_id' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD report_refr_id bigint;
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'report_sprt_id' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD report_sprt_id bigint;
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'morb_physician_id' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD morb_physician_id bigint;
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'morb_reporter_id' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD morb_reporter_id bigint;
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'transcriptionist_id' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD transcriptionist_id bigint;
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'transcriptionist_val' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD transcriptionist_val varchar(20);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'transcriptionist_first_nm' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD transcriptionist_first_nm varchar(50);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'transcriptionist_last_nm' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD transcriptionist_last_nm varchar(50);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'assistant_interpreter_id' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD assistant_interpreter_id bigint;
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'assistant_interpreter_val' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD assistant_interpreter_val varchar(20);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'assistant_interpreter_first_nm' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD assistant_interpreter_first_nm varchar(50);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'assistant_interpreter_last_nm' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD transcriptionist_last_nm varchar(50);
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'result_interpreter_id' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD result_interpreter_id bigint;
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'specimen_collector_id' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD specimen_collector_id bigint;
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'copy_to_provider_id' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD copy_to_provider_id bigint;
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'lab_test_technician_id' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD lab_test_technician_id bigint;
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'health_care_id' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD health_care_id bigint;
END;

IF NOT EXISTS(SELECT 1 FROM sys.columns WHERE name = N'morb_hosp_reporter_id' AND object_id = Object_ID(N'nrt_observation'))
BEGIN
ALTER TABLE nrt_observation
ADD morb_hosp_reporter_id bigint;
END;
END;
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ public class ObservationTransformed {
private Long authorOrganizationId;
private Long orderingOrganizationId;
private Long materialId;
private String resultObservationUid;
private String followUpObservationUid;
private String resultObservationId;
private String followUpObservationId;
private Long reportObservationId;
private Long reportSprtId;
private Long reportRefrId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,21 @@ public class ObservationReporting {
private Long reportObservationId;
private Long reportRefrId;
private Long reportSprtId;
private String resultObservationUid;
private String followupObservationUid;
private String resultObservationId;
private String followupObservationId;

private Long patientId;
private Long orderingPersonId;
private Long morbPhysicianId;
private Long morbReporterId;
private Long transcriptionistId;
private String transcriptionistVal;
private String transcriptionistName;
private String transcriptionistFirstNm;
private String transcriptionistLastNm;
private Long assistantInterpreterId;
private String assistantInterpreterVal;
private String assistantInterpreterName;
private String assistantInterpreterFirstNm;
private String assistantInterpreterLastNm;
private Long resultInterpreterId;
private Long specimenCollectorId;
private Long copyToProviderId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ protected void buildReportingModelForTransformedData(ObservationReporting report
reportingModel.setAuthorOrganizationId(observationTransformed.getAuthorOrganizationId());
reportingModel.setOrderingOrganizationId(observationTransformed.getOrderingOrganizationId());
reportingModel.setMaterialId(observationTransformed.getMaterialId());
reportingModel.setResultObservationUid(observationTransformed.getResultObservationUid());
reportingModel.setFollowupObservationUid(observationTransformed.getFollowUpObservationUid());
reportingModel.setResultObservationId(observationTransformed.getResultObservationId());
reportingModel.setFollowupObservationId(observationTransformed.getFollowUpObservationId());
reportingModel.setReportObservationId(Optional.ofNullable(observationTransformed.getReportObservationId())
.orElse(reportingModel.getObservationUid()));
reportingModel.setReportRefrId(observationTransformed.getReportRefrId());
reportingModel.setReportSprtId(observationTransformed.getReportSprtId());
}
}
Loading

0 comments on commit 219e2c5

Please sign in to comment.