Skip to content

Commit 2903c9e

Browse files
authored
Skip inserting data when creating empty schemas - EHR-related tables (#254)
1 parent 506bebf commit 2903c9e

17 files changed

+58
-12
lines changed

LDK/resources/schemas/dbscripts/postgresql/ldk-0.01-0.02.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ CREATE TABLE ldk.integers (
1919
CONSTRAINT PK_integers PRIMARY KEY (value)
2020
);
2121

22+
-- @SkipOnEmptySchemasBegin
2223
INSERT INTO ldk.integers (value) VALUES (0);
2324
INSERT INTO ldk.integers (value) VALUES (1);
2425
INSERT INTO ldk.integers (value) VALUES (2);
@@ -120,4 +121,4 @@ INSERT INTO ldk.integers (value) VALUES (97);
120121
INSERT INTO ldk.integers (value) VALUES (98);
121122
INSERT INTO ldk.integers (value) VALUES (99);
122123
INSERT INTO ldk.integers (value) VALUES (100);
123-
124+
-- @SkipOnEmptySchemasEnd

LDK/resources/schemas/dbscripts/postgresql/ldk-12.32-12.33.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
-- @SkipOnEmptySchemasBegin
12
INSERT INTO ldk.integers (value) VALUES (101);
23
INSERT INTO ldk.integers (value) VALUES (102);
34
INSERT INTO ldk.integers (value) VALUES (103);
@@ -898,3 +899,4 @@ INSERT INTO ldk.integers (value) VALUES (997);
898899
INSERT INTO ldk.integers (value) VALUES (998);
899900
INSERT INTO ldk.integers (value) VALUES (999);
900901
INSERT INTO ldk.integers (value) VALUES (1000);
902+
-- @SkipOnEmptySchemasEnd

LDK/resources/schemas/dbscripts/postgresql/ldk-12.35-12.36.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ CREATE TABLE ldk.daysOfWeek (
55
CONSTRAINT PK_daysOfWeek PRIMARY KEY (idx)
66
);
77

8+
-- @SkipOnEmptySchemasBegin
89
INSERT INTO ldk.daysOfWeek (idx, name) VALUES (1, 'Sunday');
910
INSERT INTO ldk.daysOfWeek (idx, name) VALUES (2, 'Monday');
1011
INSERT INTO ldk.daysOfWeek (idx, name) VALUES (3, 'Tuesday');
1112
INSERT INTO ldk.daysOfWeek (idx, name) VALUES (4, 'Wednesday');
1213
INSERT INTO ldk.daysOfWeek (idx, name) VALUES (5, 'Thursday');
1314
INSERT INTO ldk.daysOfWeek (idx, name) VALUES (6, 'Friday');
14-
INSERT INTO ldk.daysOfWeek (idx, name) VALUES (7, 'Saturday');
15+
INSERT INTO ldk.daysOfWeek (idx, name) VALUES (7, 'Saturday');
16+
-- @SkipOnEmptySchemasEnd

LDK/resources/schemas/dbscripts/postgresql/ldk-12.36-12.37.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CREATE TABLE ldk.months (
66
CONSTRAINT PK_months PRIMARY KEY (rowid)
77
);
88

9+
-- @SkipOnEmptySchemasBegin
910
INSERT into ldk.months (monthName, monthNum) VALUES ('January', 1);
1011
INSERT into ldk.months (monthName, monthNum) VALUES ('February', 2);
1112
INSERT into ldk.months (monthName, monthNum) VALUES ('March', 3);
@@ -18,3 +19,4 @@ INSERT into ldk.months (monthName, monthNum) VALUES ('September', 9);
1819
INSERT into ldk.months (monthName, monthNum) VALUES ('October', 10);
1920
INSERT into ldk.months (monthName, monthNum) VALUES ('November', 11);
2021
INSERT into ldk.months (monthName, monthNum) VALUES ('December', 12);
22+
-- @SkipOnEmptySchemasEnd

laboratory/resources/schemas/dbscripts/postgresql/laboratory-0.00-11.10.sql

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,13 @@ WITH (OIDS=FALSE);
216216
-- ----------------------------
217217
-- Records of laboratory.dna_mol_type
218218
-- ----------------------------
219+
-- @SkipOnEmptySchemasBegin
219220
INSERT INTO laboratory.dna_mol_type VALUES ('mRNA');
220221
INSERT INTO laboratory.dna_mol_type VALUES ('vRNA');
221222
INSERT INTO laboratory.dna_mol_type VALUES ('gDNA');
222223
INSERT INTO laboratory.dna_mol_type VALUES ('Plasmid');
223224
INSERT INTO laboratory.dna_mol_type VALUES ('RNA');
225+
-- @SkipOnEmptySchemasEnd
224226

225227
-- ----------------------------
226228
-- Table structure for laboratory.sample_type
@@ -236,6 +238,7 @@ WITH (OIDS=FALSE);
236238
-- ----------------------------
237239
-- Records of sample_type
238240
-- ----------------------------
241+
-- @SkipOnEmptySchemasBegin
239242
INSERT INTO laboratory.sample_type VALUES ('Nasal swab');
240243
INSERT INTO laboratory.sample_type VALUES ('PBMC');
241244
INSERT INTO laboratory.sample_type VALUES ('Plasma');
@@ -245,6 +248,7 @@ INSERT INTO laboratory.sample_type VALUES ('Total RNA');
245248
INSERT INTO laboratory.sample_type VALUES ('mRNA');
246249
INSERT INTO laboratory.sample_type VALUES ('vRNA');
247250
INSERT INTO laboratory.sample_type VALUES ('RNA');
251+
-- @SkipOnEmptySchemasEnd
248252

249253
-- ----------------------------
250254
-- Table structure for laboratory.sample_additive
@@ -256,10 +260,12 @@ CREATE TABLE laboratory.sample_additive
256260
CONSTRAINT PK_sample_additive PRIMARY KEY (additive)
257261
) WITH (OIDS=FALSE);
258262

263+
-- @SkipOnEmptySchemasBegin
259264
INSERT INTO laboratory.sample_additive (Additive) VALUES
260265
('EDTA'),
261266
('Heparin'),
262267
('RNA Later'),
263268
('Sodium citrate');
264269

265-
INSERT INTO laboratory.sample_type VALUES ('Cell Line');
270+
INSERT INTO laboratory.sample_type VALUES ('Cell Line');
271+
-- @SkipOnEmptySchemasEnd

laboratory/resources/schemas/dbscripts/postgresql/laboratory-11.10-11.20.sql

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ ALTER TABLE laboratory.inventory
2626

2727
/* laboratory-11.13-11.14.sql */
2828

29+
-- @SkipOnEmptySchemasBegin
2930
INSERT INTO laboratory.sample_type VALUES
3031
('BLCL'),
3132
('DNA'),
3233
('Whole Blood')
3334
;
35+
-- @SkipOnEmptySchemasEnd
3436

3537
ALTER TABLE laboratory.inventory
3638
add column cell_number float
@@ -124,6 +126,7 @@ CREATE TABLE laboratory.report_types
124126
CONSTRAINT pk_report_types PRIMARY KEY (type )
125127
);
126128

129+
-- @SkipOnEmptySchemasBegin
127130
INSERT INTO laboratory.report_types
128131
(type) VALUES
129132
('query'),
@@ -132,7 +135,7 @@ INSERT INTO laboratory.report_types
132135
('webpart'),
133136
('details')
134137
;
135-
138+
-- @SkipOnEmptySchemasEnd
136139

137140
-- ----------------------------
138141
-- Table structure for laboratory.subjects
@@ -181,6 +184,7 @@ WITH (OIDS=FALSE)
181184
-- ----------------------------
182185
-- Records of laboratory.species
183186
-- ----------------------------
187+
-- @SkipOnEmptySchemasBegin
184188
INSERT INTO laboratory.species
185189
(common_name, scientific_name, mhc_prefix)
186190
VALUES
@@ -197,7 +201,7 @@ VALUES
197201
('Mouse', 'Mus musculus', null),
198202
('Rat', 'Rattus norvegicus', null)
199203
;
200-
204+
-- @SkipOnEmptySchemasEnd
201205

202206
DROP TABLE IF EXISTS laboratory.geographic_origins;
203207
CREATE TABLE laboratory.geographic_origins (
@@ -226,6 +230,7 @@ CREATE TABLE laboratory.well_layout (
226230
CONSTRAINT PK_well_layout PRIMARY KEY (rowid)
227231
);
228232

233+
-- @SkipOnEmptySchemasBegin
229234
INSERT INTO laboratory.well_layout
230235
(Plate,Well_96,Well_96_Padded,Well_384,Well_384_Padded,AddressByRow_96,AddressByColumn_96,AddressByColumn_384,AddressByRow_384)
231236
VALUES
@@ -614,7 +619,7 @@ VALUES
614619
(4, 'H11', 'H11', 'P23', 'P23', 95, 88, 368, 383),
615620
(4, 'H12', 'H12', 'P24', 'P24', 96, 96, 384, 384)
616621
;
617-
622+
-- @SkipOnEmptySchemasEnd
618623

619624
-- ----------------------------
620625
-- Table structure for laboratory.genders
@@ -631,17 +636,22 @@ WITH (OIDS=FALSE)
631636

632637
;
633638

639+
-- @SkipOnEmptySchemasBegin
634640
INSERT INTO laboratory.genders
635641
(code, meaning, numericvalue)
636642
VALUES
637643
('m', 'Male', 1),
638644
('f', 'Female', 2),
639645
('u', 'Unknown', 0)
640646
;
647+
-- @SkipOnEmptySchemasEnd
641648

642649
drop table if exists laboratory.samples;
643650

651+
-- @SkipOnEmptySchemasBegin
644652
insert into laboratory.sample_type (type) values ('gDNA');
653+
-- @SkipOnEmptySchemasEnd
654+
645655
insert into laboratory.sample_source (source) values ('gDNA');
646656
insert into laboratory.sample_source (source) values ('DNA');
647657

laboratory/resources/schemas/dbscripts/postgresql/laboratory-11.20-11.30.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ alter table laboratory.samples
2121
add column subjectid varchar(200)
2222
;
2323

24-
24+
-- @SkipOnEmptySchemasBegin
2525
insert into laboratory.species
2626
(common_name,scientific_name)
2727
values
@@ -35,6 +35,7 @@ values
3535
insert into laboratory.dna_mol_type
3636
(mol_type) values ('Vector')
3737
;
38+
-- @SkipOnEmptySchemasEnd
3839

3940
DROP TABLE IF EXISTS laboratory.site_module_properties;
4041
CREATE TABLE laboratory.site_module_properties (

laboratory/resources/schemas/dbscripts/postgresql/laboratory-12.20-12.21.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ CREATE TABLE laboratory.qual_results
3434
CONSTRAINT PK_qual_results PRIMARY KEY (rowid)
3535
);
3636

37+
-- @SkipOnEmptySchemasBegin
3738
INSERT INTO laboratory.qual_results (meaning, description) VALUES ('POS', 'Positive');
3839
INSERT INTO laboratory.qual_results (meaning, description) VALUES ('NEG', 'Negative');
3940
INSERT INTO laboratory.qual_results (meaning, description) VALUES ('OUTLIER', 'Outlier');
4041
INSERT INTO laboratory.qual_results (meaning, description) VALUES ('ND', 'No Data');
42+
-- @SkipOnEmptySchemasEnd
4143

4244
CREATE TABLE laboratory.assay_requests
4345
(

laboratory/resources/schemas/dbscripts/postgresql/laboratory-12.22-12.23.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616
delete from laboratory.reference_peptides;
17+
-- @SkipOnEmptySchemasBegin
1718
INSERT INTO laboratory.reference_peptides (sequence, mhc_restriction) VALUES ('AAAQQRGPRK', null);
1819
INSERT INTO laboratory.reference_peptides (sequence, mhc_restriction) VALUES ('AADWDLQHPQ', null);
1920
INSERT INTO laboratory.reference_peptides (sequence, mhc_restriction) VALUES ('AADWDLQHPQPAPQQGQLRE', null);
@@ -5017,3 +5018,4 @@ INSERT INTO laboratory.reference_peptides (sequence, mhc_restriction) VALUES ('Y
50175018
INSERT INTO laboratory.reference_peptides (sequence, mhc_restriction) VALUES ('YYREGRDQLWKGPGE', null);
50185019
INSERT INTO laboratory.reference_peptides (sequence, mhc_restriction) VALUES ('YYSARRHRIL', null);
50195020
INSERT INTO laboratory.reference_peptides (sequence, mhc_restriction) VALUES ('YYSARRHRILDIYLE', null);
5021+
-- @SkipOnEmptySchemasEnd

laboratory/resources/schemas/dbscripts/postgresql/laboratory-12.24-12.25.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
17+
-- @SkipOnEmptySchemasBegin
1618
DELETE FROM laboratory.sample_type WHERE type = 'Serum';
1719
INSERT INTO laboratory.sample_type (type) VALUES ('Serum');
1820
DELETE FROM laboratory.sample_type WHERE type = 'Tissue';
1921
INSERT INTO laboratory.sample_type (type) VALUES ('Tissue');
2022
DELETE FROM laboratory.sample_type WHERE type = 'Supernatant';
2123
INSERT INTO laboratory.sample_type (type) VALUES ('Supernatant');
24+
-- @SkipOnEmptySchemasEnd
2225

2326
-- NOTE: SQLServer will not allow 2 FKs pointing to the same table with update cascade
2427
-- therefore rather than let 1 field update and the other not, we get rid of both

0 commit comments

Comments
 (0)