From 5a8f87512d2b2d39a692e01f1cfe1f5e74108204 Mon Sep 17 00:00:00 2001 From: Nick <53413353+nickpalladino@users.noreply.github.com> Date: Thu, 22 Aug 2024 13:39:42 -0400 Subject: [PATCH 1/5] db migration to remove subentity columns from exp import template --- ...27.0__remove_subentity_cols_exp_import.sql | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/main/resources/db/migration/V1.27.0__remove_subentity_cols_exp_import.sql diff --git a/src/main/resources/db/migration/V1.27.0__remove_subentity_cols_exp_import.sql b/src/main/resources/db/migration/V1.27.0__remove_subentity_cols_exp_import.sql new file mode 100644 index 000000000..e2c8efc7d --- /dev/null +++ b/src/main/resources/db/migration/V1.27.0__remove_subentity_cols_exp_import.sql @@ -0,0 +1,25 @@ +/* + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. + * + * 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. + */ + +DO $$ +BEGIN +update importer_mapping +set + mapping = '[{"id": "726a9f10-4892-4204-9e52-bd2b1d735f65", "value": {"fileFieldName": "Germplasm Name"}, "objectId": "germplasmName"}, {"id": "98774e20-6f89-4d6a-a7c9-f88887228ed6", "value": {"fileFieldName": "Germplasm GID"}, "objectId": "gid"}, {"id": "880ef0c9-4e3e-42d4-9edc-667684a91889", "value": {"fileFieldName": "Test (T) or Check (C)"}, "objectId": "test_or_check"}, {"id": "b693eca7-efcd-4518-a9d3-db0b037a76ee", "value": {"fileFieldName": "Exp Title"}, "objectId": "exp_title"}, {"id": "df340215-db6e-4219-a3b7-119f297b81c3", "value": {"fileFieldName": "Exp Description"}, "objectId": "expDescription"}, {"id": "9ca7cc81-562c-43a7-989a-41da309f603d", "value": {"fileFieldName": "Exp Unit"}, "objectId": "expUnit"}, {"id": "27215777-c8f9-4fe7-a7ac-918d6168b0dd", "value": {"fileFieldName": "Exp Type"}, "objectId": "expType"}, {"id": "19d220e2-dff0-4a3a-ad6e-32f4d8602b5c", "value": {"fileFieldName": "Env"}, "objectId": "env"}, {"id": "861518b9-5c9e-4fe5-b31e-baf16e27155d", "value": {"fileFieldName": "Env Location"}, "objectId": "envLocation"}, {"id": "667355c3-dae1-4a64-94c8-ac2d543bd474", "value": {"fileFieldName": "Env Year"}, "objectId": "envYear"}, {"id": "ad11f2df-c5b4-4a05-8e52-c57625140061", "value": {"fileFieldName": "Exp Unit ID"}, "objectId": "expUnitId"}, {"id": "639b40ec-20f8-4659-8464-6a4be997ac7a", "value": {"fileFieldName": "Exp Replicate #"}, "objectId": "expReplicateNo"}, {"id": "2a62a80f-d8ba-42c4-9997-3b4ac8a965aa", "value": {"fileFieldName": "Exp Block #"}, "objectId": "expBlockNo"}, {"id": "f3e7de69-21ad-4cda-b1cc-a5e1987fb931", "value": {"fileFieldName": "Row"}, "objectId": "row"}, {"id": "251c5bbd-fc4d-4371-a4ce-4e2686f6837e", "value": {"fileFieldName": "Column"}, "objectId": "column"}, {"id": "a0edcc27-d423-478f-8eed-05b554805ec9", "value": {"fileFieldName": "Lat"}, "objectId": "lat"}, {"id": "a8fd2190-d277-4369-ae72-af32416f14ac", "value": {"fileFieldName": "Long"}, "objectId": "long"}, {"id": "95caefec-2b12-4728-9f2e-3bc17478b662", "value": {"fileFieldName": "Elevation"}, "objectId": "elevation"}, {"id": "e8f80336-0982-4a48-85ac-4b0278e28b70", "value": {"fileFieldName": "RTK"}, "objectId": "rtk"}, {"id": "ce5f61f2-f1de-45a4-8baf-e2471a5d863d", "value": {"fileFieldName": "Treatment Factors"}, "objectId": "treatmentFactors"}, {"id": "c5b8276f-e777-4385-a80f-5199abe63aac", "value": {"fileFieldName": "ObsUnitID"}, "objectId": "ObsUnitID"}]', + file = '[{"Germplasm Name": "Test", "Germplasm GID": 1, "Test (T) or Check (C)": true, "Exp Title": "New Trial", "Exp Description": "A new trial", "Exp Unit": "plot", "Exp Type": "phenotyping", "Env": "New Study", "Env Location": "New Location", "Env Year": 2012, "Exp Unit ID": 3, "Exp Replicate #": 0, "Exp Block #": 2, "Row": 4, "Column": 5, "Lat": 42.4440, "Long": 76.5019, "Elevation": 123, "RTK": "RTK description", "Treatment Factors": "Jam application", "ObsUnitID": ""}]' +where import_type_id = 'ExperimentImport'; +END $$; \ No newline at end of file From ebbb0a3c40b4222b0243934719f117ce17ab5219 Mon Sep 17 00:00:00 2001 From: Nick <53413353+nickpalladino@users.noreply.github.com> Date: Thu, 22 Aug 2024 16:15:45 -0400 Subject: [PATCH 2/5] commented out subentity cols in test file generation --- .../org/breedinginsight/brapps/importer/ImportTestUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/breedinginsight/brapps/importer/ImportTestUtils.java b/src/test/java/org/breedinginsight/brapps/importer/ImportTestUtils.java index 48b024efa..53abd8483 100644 --- a/src/test/java/org/breedinginsight/brapps/importer/ImportTestUtils.java +++ b/src/test/java/org/breedinginsight/brapps/importer/ImportTestUtils.java @@ -306,13 +306,13 @@ public File writeExperimentDataToFile(List> data, List Date: Thu, 22 Aug 2024 16:21:23 -0400 Subject: [PATCH 3/5] commented out subentity cols --- .../services/parsers/experiment/ExperimentFileColumns.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/breedinginsight/services/parsers/experiment/ExperimentFileColumns.java b/src/main/java/org/breedinginsight/services/parsers/experiment/ExperimentFileColumns.java index f95283bf2..3eedbaf11 100644 --- a/src/main/java/org/breedinginsight/services/parsers/experiment/ExperimentFileColumns.java +++ b/src/main/java/org/breedinginsight/services/parsers/experiment/ExperimentFileColumns.java @@ -32,13 +32,13 @@ public enum ExperimentFileColumns { EXP_TITLE(ExperimentObservation.Columns.EXP_TITLE, Column.ColumnDataType.STRING), EXP_DESCRIPTION(ExperimentObservation.Columns.EXP_DESCRIPTION, Column.ColumnDataType.STRING), EXP_UNIT(ExperimentObservation.Columns.EXP_UNIT, Column.ColumnDataType.STRING), - SUB_OBS_UNIT(ExperimentObservation.Columns.SUB_OBS_UNIT, Column.ColumnDataType.STRING), + //SUB_OBS_UNIT(ExperimentObservation.Columns.SUB_OBS_UNIT, Column.ColumnDataType.STRING), EXP_TYPE(ExperimentObservation.Columns.EXP_TYPE, Column.ColumnDataType.STRING), ENV(ExperimentObservation.Columns.ENV, Column.ColumnDataType.STRING), ENV_LOCATION(ExperimentObservation.Columns.ENV_LOCATION, Column.ColumnDataType.STRING), ENV_YEAR(ExperimentObservation.Columns.ENV_YEAR, Column.ColumnDataType.INTEGER), EXP_UNIT_ID(ExperimentObservation.Columns.EXP_UNIT_ID, Column.ColumnDataType.STRING), - SUB_UNIT_ID(ExperimentObservation.Columns.SUB_UNIT_ID, Column.ColumnDataType.STRING), + //SUB_UNIT_ID(ExperimentObservation.Columns.SUB_UNIT_ID, Column.ColumnDataType.STRING), REP_NUM(ExperimentObservation.Columns.REP_NUM, Column.ColumnDataType.INTEGER), BLOCK_NUM(ExperimentObservation.Columns.BLOCK_NUM, Column.ColumnDataType.INTEGER), ROW(ExperimentObservation.Columns.ROW, Column.ColumnDataType.STRING), From d7aabd3fda9cbf2870d1a71897d050b5221349d8 Mon Sep 17 00:00:00 2001 From: Nick <53413353+nickpalladino@users.noreply.github.com> Date: Mon, 26 Aug 2024 10:47:57 -0400 Subject: [PATCH 4/5] Update columns for tests and disable subentity test --- .../brapi/v2/ExperimentControllerIntegrationTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/breedinginsight/brapi/v2/ExperimentControllerIntegrationTest.java b/src/test/java/org/breedinginsight/brapi/v2/ExperimentControllerIntegrationTest.java index 7931ff587..d9de6ab3a 100644 --- a/src/test/java/org/breedinginsight/brapi/v2/ExperimentControllerIntegrationTest.java +++ b/src/test/java/org/breedinginsight/brapi/v2/ExperimentControllerIntegrationTest.java @@ -286,6 +286,7 @@ void downloadDatasets(boolean includeTimestamps, String extension, int numberOfE @ParameterizedTest @CsvSource(value = {"CSV", "XLSX", "XLS"}) @SneakyThrows + @Disabled // disabled for now until we re-enable subentity support void downloadSubEntityDataset(String extension) { // Create sub-entity dataset. @@ -389,13 +390,13 @@ private Map makeExpImportRow(String environment) { row.put(ExperimentObservation.Columns.TEST_CHECK, "T"); row.put(ExperimentObservation.Columns.EXP_TITLE, "Test Exp"); row.put(ExperimentObservation.Columns.EXP_UNIT, "Plot"); - row.put(ExperimentObservation.Columns.SUB_OBS_UNIT, ""); + //row.put(ExperimentObservation.Columns.SUB_OBS_UNIT, ""); row.put(ExperimentObservation.Columns.EXP_TYPE, "Phenotyping"); row.put(ExperimentObservation.Columns.ENV, environment); row.put(ExperimentObservation.Columns.ENV_LOCATION, "Location A"); row.put(ExperimentObservation.Columns.ENV_YEAR, "2023"); row.put(ExperimentObservation.Columns.EXP_UNIT_ID, "a-1"); - row.put(ExperimentObservation.Columns.SUB_UNIT_ID, ""); + //row.put(ExperimentObservation.Columns.SUB_UNIT_ID, ""); row.put(ExperimentObservation.Columns.REP_NUM, "1"); row.put(ExperimentObservation.Columns.BLOCK_NUM, "1"); row.put(ExperimentObservation.Columns.ROW, "1"); From 09bceef7f176d71e4da18017bd4a4bc2035c0ed7 Mon Sep 17 00:00:00 2001 From: Nick <53413353+nickpalladino@users.noreply.github.com> Date: Mon, 26 Aug 2024 16:55:16 -0400 Subject: [PATCH 5/5] Changed migration version to resolve conflict --- ...p_import.sql => V1.28.0__remove_subentity_cols_exp_import.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/resources/db/migration/{V1.27.0__remove_subentity_cols_exp_import.sql => V1.28.0__remove_subentity_cols_exp_import.sql} (100%) diff --git a/src/main/resources/db/migration/V1.27.0__remove_subentity_cols_exp_import.sql b/src/main/resources/db/migration/V1.28.0__remove_subentity_cols_exp_import.sql similarity index 100% rename from src/main/resources/db/migration/V1.27.0__remove_subentity_cols_exp_import.sql rename to src/main/resources/db/migration/V1.28.0__remove_subentity_cols_exp_import.sql