From b762637877ddb53e9126e575840611bdbe595d41 Mon Sep 17 00:00:00 2001 From: labkey-jeckels Date: Thu, 28 Oct 2021 18:15:07 -0700 Subject: [PATCH 1/3] Fix ONPRC test query validation errors by adding missing column and enabling module. Add dependency on SampleManagement Remove some center-specific code from AbstractEHRTest Misc code cleanup --- .../test/tests/ehr/AbstractEHRTest.java | 78 +++---------------- .../labkey/test/tests/ehr/EHRSetupHelper.java | 60 -------------- .../AbstractGenericONPRC_EHRTest.java | 65 +++++++++++++++- 3 files changed, 74 insertions(+), 129 deletions(-) delete mode 100644 ehr/test/src/org/labkey/test/tests/ehr/EHRSetupHelper.java diff --git a/ehr/test/src/org/labkey/test/tests/ehr/AbstractEHRTest.java b/ehr/test/src/org/labkey/test/tests/ehr/AbstractEHRTest.java index 60643e30a..61f4ce3e4 100644 --- a/ehr/test/src/org/labkey/test/tests/ehr/AbstractEHRTest.java +++ b/ehr/test/src/org/labkey/test/tests/ehr/AbstractEHRTest.java @@ -142,7 +142,6 @@ abstract public class AbstractEHRTest extends BaseWebDriverTest implements Advan protected List _saveRowsTimes; protected abstract String getModuleDirectory(); - private EHRSetupHelper _setupHelper = new EHRSetupHelper(this, getProjectName(), FOLDER_NAME, getModulePath(), getContainerPath()); protected EHRBillingHelper _billingHelper = new EHRBillingHelper(this, getProjectName(), FOLDER_NAME, getModulePath(), getContainerPath(),BILLING_FOLDER); //xpath fragment @@ -221,7 +220,7 @@ protected void createTestSubjects() throws Exception { String[] fields; Object[][] data; - PostCommand insertCommand; + PostCommand insertCommand; //insert into demographics log("Creating test subjects"); @@ -376,22 +375,26 @@ protected void createProjectAndFolders(String type) _containerHelper.createSubfolder(getProjectName(), getProjectName(), FOLDER_NAME, type, null); } + /** Hook for center-specific setup that needs to happen after the containers are created but before the study is imported */ + protected void doExtraPreStudyImportSetup() + { + + } + + @LogMethod protected void initProject() throws Exception { initProject("EHR"); } - @LogMethod protected void initProject(String type) throws Exception { createProjectAndFolders(type); setFormatStrings(); setEHRModuleProperties(); createUsersandPermissions();//note: we create the users prior to study import, b/c that user is used by TableCustomizers - if(type.equals("TNPRC EHR")) - _setupHelper.loadEHRTableDefinitions(); - if(type.equals("ONPRC EHR")) - onprcSetupBeforeStudyUpload(); //this needs to happen before import study() below so that 'Validation Queries' step doesn't fail since the queries depend on setup in this method. + + doExtraPreStudyImportSetup(); populateInitialData(); defineQCStates(); @@ -406,67 +409,6 @@ protected void initProject(String type) throws Exception primeCaches(); } - private void onprcSetupBeforeStudyUpload() - { - //create onprc_billing_public linked schema - beginAt(getProjectName()); - SchemaHelper schemaHelper = new SchemaHelper(this); - schemaHelper.createLinkedSchema(this.getProjectName(), null, "onprc_billing_public", "/" + this.getContainerPath(), "onprc_billing_public", null, null, null); - - //create Labfee_NoChargeProjects - beginAt(getProjectName()); - - ListHelper.ListColumn projectCol= new ListHelper.ListColumn("project", ListHelper.ListColumnType.Integer); - ListHelper.ListColumn startDateCol= new ListHelper.ListColumn("startDate", ListHelper.ListColumnType.DateAndTime); - ListHelper.ListColumn dateDisabledCol= new ListHelper.ListColumn("dateDisabled", ListHelper.ListColumnType.DateAndTime); - ListHelper.ListColumn createdDbCol= new ListHelper.ListColumn("Createdb", ListHelper.ListColumnType.Integer); - ListHelper.ListColumn notesCol= new ListHelper.ListColumn("Notes", ListHelper.ListColumnType.String); - _listHelper.createList(getProjectName(), "Labfee_NoChargeProjects", ListHelper.ListColumnType.Integer, "key", projectCol, startDateCol, dateDisabledCol, createdDbCol, notesCol); - - _listHelper.createList(getProjectName(), "GeneticValue", ListHelper.ListColumnType.String, "Id", - new ListHelper.ListColumn("meanKinship", ListHelper.ListColumnType.Decimal), - new ListHelper.ListColumn("zscore", ListHelper.ListColumnType.Decimal), - new ListHelper.ListColumn("genomeUniqueness", ListHelper.ListColumnType.Decimal), - new ListHelper.ListColumn("totalOffspring", ListHelper.ListColumnType.Integer), - new ListHelper.ListColumn("livingOffspring", ListHelper.ListColumnType.Integer), - new ListHelper.ListColumn("assignments", ListHelper.ListColumnType.Integer), - new ListHelper.ListColumn("condition", ListHelper.ListColumnType.String), - new ListHelper.ListColumn("import", ListHelper.ListColumnType.String), - new ListHelper.ListColumn("value", ListHelper.ListColumnType.String), - new ListHelper.ListColumn("rank", ListHelper.ListColumnType.Integer) - ); - - _listHelper.createList(getProjectName(), "Special_Aliases", ListHelper.ListColumnType.AutoInteger, "Key", - new ListHelper.ListColumn("Category", ListHelper.ListColumnType.String), - new ListHelper.ListColumn("Alias", ListHelper.ListColumnType.String)); - - // Fake up an external schema connection for "dbo" via a list and a linked schema - _listHelper.createList(getProjectName(), "Rpt_ChargesProjection", ListHelper.ListColumnType.AutoInteger, "RowId", - new ListHelper.ListColumn("ChargeId", ListHelper.ListColumnType.Integer), - new ListHelper.ListColumn("UnitCost", ListHelper.ListColumnType.Decimal), - new ListHelper.ListColumn("year1", ListHelper.ListColumnType.Decimal), - new ListHelper.ListColumn("year2", ListHelper.ListColumnType.Decimal), - new ListHelper.ListColumn("year3", ListHelper.ListColumnType.Decimal), - new ListHelper.ListColumn("year4", ListHelper.ListColumnType.Decimal), - new ListHelper.ListColumn("year5", ListHelper.ListColumnType.Decimal), - new ListHelper.ListColumn("year6", ListHelper.ListColumnType.Decimal), - new ListHelper.ListColumn("year7", ListHelper.ListColumnType.Decimal), - new ListHelper.ListColumn("year8", ListHelper.ListColumnType.Decimal), - new ListHelper.ListColumn("Aprate1", ListHelper.ListColumnType.Decimal), - new ListHelper.ListColumn("Aprate2", ListHelper.ListColumnType.Decimal), - new ListHelper.ListColumn("Aprate3", ListHelper.ListColumnType.Decimal), - new ListHelper.ListColumn("Aprate4", ListHelper.ListColumnType.Decimal), - new ListHelper.ListColumn("Aprate5", ListHelper.ListColumnType.Decimal), - new ListHelper.ListColumn("Aprate6", ListHelper.ListColumnType.Decimal), - new ListHelper.ListColumn("Aprate7", ListHelper.ListColumnType.Decimal), - new ListHelper.ListColumn("Aprate8", ListHelper.ListColumnType.Decimal), - new ListHelper.ListColumn("Aprate9", ListHelper.ListColumnType.Decimal), - new ListHelper.ListColumn("PostedDate", ListHelper.ListColumnType.DateAndTime) - ); - schemaHelper.createLinkedSchema(this.getProjectName(), null, "dbo", "/" + this.getContainerPath(), null, "lists", null, null); - - } - @LogMethod(quiet = true) protected void populate(@LoggedParam String tableLabel) { diff --git a/ehr/test/src/org/labkey/test/tests/ehr/EHRSetupHelper.java b/ehr/test/src/org/labkey/test/tests/ehr/EHRSetupHelper.java deleted file mode 100644 index 4becf11dc..000000000 --- a/ehr/test/src/org/labkey/test/tests/ehr/EHRSetupHelper.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2018-2019 LabKey Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.labkey.test.tests.ehr; - -import org.labkey.test.BaseWebDriverTest; -import org.labkey.test.Locator; - -public class EHRSetupHelper -{ - private BaseWebDriverTest _test; - private String _projectName; - private String _folderName; - private String _modulePath; - private String _containerPath; - - public EHRSetupHelper(BaseWebDriverTest test, String projectName, String folderName, String modulePath, String containerPath) - { - this(test, projectName); - _folderName = folderName; - _modulePath = modulePath; - _containerPath = containerPath; - } - - public EHRSetupHelper(BaseWebDriverTest test, String projectName) - { - _test = test; - _projectName = projectName; - } - - public void loadEHRTableDefinitions() - { - _test.goToProjectHome(); - if (_folderName != null && _projectName == "TNPRC") - _test.clickFolder(_folderName); - else - _test.clickFolder(_projectName); - - _test.beginAt(_test.getCurrentContainerPath() + "/tnprc_ehr-ehrSettings.view?"); - _test.clickButton("Load EHR table definitions", 0); - _test.waitForElement(Locator.tagWithClass("span", "x4-window-header-text").withText("Success")); - _test.assertExt4MsgBox("EHR tables updated successfully.", "OK"); - - _test.clickButton("Load EHR_Lookup table definitions", 0); - _test.waitForElement(Locator.tagWithClass("span", "x4-window-header-text").withText("Success")); - _test.assertExt4MsgBox("EHR_Lookups tables updated successfully.", "OK"); - } -} diff --git a/ehr/test/src/org/labkey/test/tests/onprc_ehr/AbstractGenericONPRC_EHRTest.java b/ehr/test/src/org/labkey/test/tests/onprc_ehr/AbstractGenericONPRC_EHRTest.java index fc5d7fb98..06a678f6e 100644 --- a/ehr/test/src/org/labkey/test/tests/onprc_ehr/AbstractGenericONPRC_EHRTest.java +++ b/ehr/test/src/org/labkey/test/tests/onprc_ehr/AbstractGenericONPRC_EHRTest.java @@ -31,13 +31,14 @@ import org.labkey.test.WebTestHelper; import org.labkey.test.tests.ehr.AbstractGenericEHRTest; import org.labkey.test.util.Ext4Helper; +import org.labkey.test.util.ListHelper; import org.labkey.test.util.LogMethod; import org.labkey.test.util.PasswordUtil; +import org.labkey.test.util.SchemaHelper; import org.labkey.test.util.SqlserverOnlyTest; import org.labkey.test.util.ehr.EHRClientAPIHelper; import org.labkey.test.util.ext4cmp.Ext4CmpRef; import org.labkey.test.util.ext4cmp.Ext4FieldRef; -import org.openqa.selenium.WebElement; import java.io.File; import java.text.SimpleDateFormat; @@ -114,6 +115,68 @@ protected void importStudy() importStudyFromPath(1); } + @Override + protected void doExtraPreStudyImportSetup() + { + //create onprc_billing_public linked schema + beginAt(getProjectName()); + _containerHelper.enableModule(getContainerPath(), "GeneticsCore"); + SchemaHelper schemaHelper = new SchemaHelper(this); + schemaHelper.createLinkedSchema(this.getProjectName(), null, "onprc_billing_public", "/" + this.getContainerPath(), "onprc_billing_public", null, null, null); + + //create Labfee_NoChargeProjects + beginAt(getProjectName()); + + ListHelper.ListColumn projectCol= new ListHelper.ListColumn("project", ListHelper.ListColumnType.Integer); + ListHelper.ListColumn startDateCol= new ListHelper.ListColumn("startDate", ListHelper.ListColumnType.DateAndTime); + ListHelper.ListColumn dateDisabledCol= new ListHelper.ListColumn("dateDisabled", ListHelper.ListColumnType.DateAndTime); + ListHelper.ListColumn createdDbCol= new ListHelper.ListColumn("Createdb", ListHelper.ListColumnType.Integer); + ListHelper.ListColumn notesCol= new ListHelper.ListColumn("Notes", ListHelper.ListColumnType.String); + _listHelper.createList(getProjectName(), "Labfee_NoChargeProjects", ListHelper.ListColumnType.Integer, "key", projectCol, startDateCol, dateDisabledCol, createdDbCol, notesCol); + + _listHelper.createList(getProjectName(), "GeneticValue", ListHelper.ListColumnType.String, "Id", + new ListHelper.ListColumn("meanKinship", ListHelper.ListColumnType.Decimal), + new ListHelper.ListColumn("zscore", ListHelper.ListColumnType.Decimal), + new ListHelper.ListColumn("genomeUniqueness", ListHelper.ListColumnType.Decimal), + new ListHelper.ListColumn("totalOffspring", ListHelper.ListColumnType.Integer), + new ListHelper.ListColumn("livingOffspring", ListHelper.ListColumnType.Integer), + new ListHelper.ListColumn("assignments", ListHelper.ListColumnType.Integer), + new ListHelper.ListColumn("condition", ListHelper.ListColumnType.String), + new ListHelper.ListColumn("import", ListHelper.ListColumnType.String), + new ListHelper.ListColumn("value", ListHelper.ListColumnType.String), + new ListHelper.ListColumn("rank", ListHelper.ListColumnType.Integer) + ); + + _listHelper.createList(getProjectName(), "Special_Aliases", ListHelper.ListColumnType.AutoInteger, "Key", + new ListHelper.ListColumn("Category", ListHelper.ListColumnType.String), + new ListHelper.ListColumn("Alias", ListHelper.ListColumnType.String)); + + // Fake up an external schema connection for "dbo" via a list and a linked schema + _listHelper.createList(getProjectName(), "Rpt_ChargesProjection", ListHelper.ListColumnType.AutoInteger, "RowId", + new ListHelper.ListColumn("ChargeId", ListHelper.ListColumnType.Integer), + new ListHelper.ListColumn("UnitCost", ListHelper.ListColumnType.Decimal), + new ListHelper.ListColumn("year1", ListHelper.ListColumnType.Decimal), + new ListHelper.ListColumn("year2", ListHelper.ListColumnType.Decimal), + new ListHelper.ListColumn("year3", ListHelper.ListColumnType.Decimal), + new ListHelper.ListColumn("year4", ListHelper.ListColumnType.Decimal), + new ListHelper.ListColumn("year5", ListHelper.ListColumnType.Decimal), + new ListHelper.ListColumn("year6", ListHelper.ListColumnType.Decimal), + new ListHelper.ListColumn("year7", ListHelper.ListColumnType.Decimal), + new ListHelper.ListColumn("year8", ListHelper.ListColumnType.Decimal), + new ListHelper.ListColumn("Aprate1", ListHelper.ListColumnType.Decimal), + new ListHelper.ListColumn("Aprate2", ListHelper.ListColumnType.Decimal), + new ListHelper.ListColumn("Aprate3", ListHelper.ListColumnType.Decimal), + new ListHelper.ListColumn("Aprate4", ListHelper.ListColumnType.Decimal), + new ListHelper.ListColumn("Aprate5", ListHelper.ListColumnType.Decimal), + new ListHelper.ListColumn("Aprate6", ListHelper.ListColumnType.Decimal), + new ListHelper.ListColumn("Aprate7", ListHelper.ListColumnType.Decimal), + new ListHelper.ListColumn("Aprate8", ListHelper.ListColumnType.Decimal), + new ListHelper.ListColumn("Aprate9", ListHelper.ListColumnType.Decimal), + new ListHelper.ListColumn("PostedDate", ListHelper.ListColumnType.DateAndTime) + ); + schemaHelper.createLinkedSchema(this.getProjectName(), null, "dbo", "/" + this.getContainerPath(), null, "lists", null, null); + } + @Override @LogMethod protected void initProject() throws Exception From 81326b03c6e9d5541f6b87a1c90b9d9d7b1795dd Mon Sep 17 00:00:00 2001 From: labkey-jeckels Date: Fri, 29 Oct 2021 15:55:18 -0700 Subject: [PATCH 2/3] Alternate approach for mocking up ONPRC environment for geneticscore --- .../onprc_ehr/AbstractGenericONPRC_EHRTest.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ehr/test/src/org/labkey/test/tests/onprc_ehr/AbstractGenericONPRC_EHRTest.java b/ehr/test/src/org/labkey/test/tests/onprc_ehr/AbstractGenericONPRC_EHRTest.java index 06a678f6e..789672c23 100644 --- a/ehr/test/src/org/labkey/test/tests/onprc_ehr/AbstractGenericONPRC_EHRTest.java +++ b/ehr/test/src/org/labkey/test/tests/onprc_ehr/AbstractGenericONPRC_EHRTest.java @@ -120,7 +120,6 @@ protected void doExtraPreStudyImportSetup() { //create onprc_billing_public linked schema beginAt(getProjectName()); - _containerHelper.enableModule(getContainerPath(), "GeneticsCore"); SchemaHelper schemaHelper = new SchemaHelper(this); schemaHelper.createLinkedSchema(this.getProjectName(), null, "onprc_billing_public", "/" + this.getContainerPath(), "onprc_billing_public", null, null, null); @@ -174,7 +173,19 @@ protected void doExtraPreStudyImportSetup() new ListHelper.ListColumn("Aprate9", ListHelper.ListColumnType.Decimal), new ListHelper.ListColumn("PostedDate", ListHelper.ListColumnType.DateAndTime) ); - schemaHelper.createLinkedSchema(this.getProjectName(), null, "dbo", "/" + this.getContainerPath(), null, "lists", null, null); + + // Mock up a table in the geneticscore schema instead of needing to mock up all of the geneticscore dependencies too + _listHelper.createList(getProjectName(), "mhc_data", ListHelper.ListColumnType.AutoInteger, "RowId", + new ListHelper.ListColumn("subjectId", ListHelper.ListColumnType.String), + new ListHelper.ListColumn("datatype", ListHelper.ListColumnType.String), + new ListHelper.ListColumn("marker", ListHelper.ListColumnType.String), + new ListHelper.ListColumn("result", ListHelper.ListColumnType.String), + new ListHelper.ListColumn("score", ListHelper.ListColumnType.Decimal), + new ListHelper.ListColumn("assaytype", ListHelper.ListColumnType.String), + new ListHelper.ListColumn("totalTests", ListHelper.ListColumnType.Integer)); + + schemaHelper.createLinkedSchema(this.getProjectName(), null, "dbo", "/" + this.getContainerPath(), null, "lists", null, null); + schemaHelper.createLinkedSchema(this.getProjectName(), null, "geneticscore", "/" + this.getContainerPath(), null, "lists", null, null); } @Override From 0adb6e3bdd1935044a073278e4376c1d0e8ec594 Mon Sep 17 00:00:00 2001 From: labkey-jeckels Date: Sat, 30 Oct 2021 14:46:22 -0700 Subject: [PATCH 3/3] Delete problematic RandData_MHCData.sql as it references tables and queries that don't exist --- .../test/tests/onprc_ehr/AbstractGenericONPRC_EHRTest.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ehr/test/src/org/labkey/test/tests/onprc_ehr/AbstractGenericONPRC_EHRTest.java b/ehr/test/src/org/labkey/test/tests/onprc_ehr/AbstractGenericONPRC_EHRTest.java index 789672c23..108568b99 100644 --- a/ehr/test/src/org/labkey/test/tests/onprc_ehr/AbstractGenericONPRC_EHRTest.java +++ b/ehr/test/src/org/labkey/test/tests/onprc_ehr/AbstractGenericONPRC_EHRTest.java @@ -25,7 +25,6 @@ import org.labkey.remoteapi.query.SaveRowsResponse; import org.labkey.remoteapi.query.SelectRowsCommand; import org.labkey.remoteapi.query.SelectRowsResponse; -import org.labkey.test.Locator; import org.labkey.test.ModulePropertyValue; import org.labkey.test.TestFileUtils; import org.labkey.test.WebTestHelper; @@ -184,8 +183,7 @@ protected void doExtraPreStudyImportSetup() new ListHelper.ListColumn("assaytype", ListHelper.ListColumnType.String), new ListHelper.ListColumn("totalTests", ListHelper.ListColumnType.Integer)); - schemaHelper.createLinkedSchema(this.getProjectName(), null, "dbo", "/" + this.getContainerPath(), null, "lists", null, null); - schemaHelper.createLinkedSchema(this.getProjectName(), null, "geneticscore", "/" + this.getContainerPath(), null, "lists", null, null); + schemaHelper.createLinkedSchema(this.getProjectName(), "dbo", "/" + this.getContainerPath(), null, "lists", null, null); } @Override