From f466929c9edc0fee94da43c760103732d9696a0c Mon Sep 17 00:00:00 2001 From: David Randolph Phillips Date: Wed, 20 Jul 2022 14:42:04 -0400 Subject: [PATCH] =?UTF-8?q?[BI-1146]=20change=20=E2=80=98Exp=20Trt=20Facto?= =?UTF-8?q?r=20Name=E2=80=99=20to=20=E2=80=98Treatment=20Factors=E2=80=99?= =?UTF-8?q?=20-=20failed=20QA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ExperimentObservation.java | 9 ++++--- ...ate_experiment_template_system_mapping.sql | 27 +++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 src/main/resources/db/migration/V1.0.2__update_experiment_template_system_mapping.sql diff --git a/src/main/java/org/breedinginsight/brapps/importer/model/imports/experimentObservation/ExperimentObservation.java b/src/main/java/org/breedinginsight/brapps/importer/model/imports/experimentObservation/ExperimentObservation.java index 7a2a27b2b..f7cd41151 100644 --- a/src/main/java/org/breedinginsight/brapps/importer/model/imports/experimentObservation/ExperimentObservation.java +++ b/src/main/java/org/breedinginsight/brapps/importer/model/imports/experimentObservation/ExperimentObservation.java @@ -99,7 +99,7 @@ public class ExperimentObservation implements BrAPIImport { private String column; @ImportFieldType(type= ImportFieldTypeEnum.TEXT) - @ImportFieldMetadata(id="treatmentFactors", name="Exp Treatment Factor Name", description = "treatement factors in an experiment with applied variables, like fertilizer or water regimens.") + @ImportFieldMetadata(id="treatmentFactors", name="Treatment Factors", description = "Treatment factors in an experiment with applied variables, like fertilizer or water regimens.") private String treatmentFactors; @ImportFieldType(type= ImportFieldTypeEnum.TEXT) @@ -148,7 +148,10 @@ public BrAPIStudy constructBrAPIStudy(Program program, Supplier next study.setStudyType(getExpType()); study.setLocationName(getEnvLocation()); study.setTrialName(getExpTitle()); - study.setSeasons( List.of( getEnvYear()==null ? "" : getEnvYear() ) ); + + List seasonsList= new ArrayList<>(); + seasonsList.add(getEnvYear()); + study.setSeasons(seasonsList); /* TODO: Not used BrAPIStudyExperimentalDesign design = new BrAPIStudyExperimentalDesign(); @@ -224,4 +227,4 @@ public BrAPIObservationUnit constructBrAPIObservationUnit(Program program, Suppl return observationUnit; } -} \ No newline at end of file +} diff --git a/src/main/resources/db/migration/V1.0.2__update_experiment_template_system_mapping.sql b/src/main/resources/db/migration/V1.0.2__update_experiment_template_system_mapping.sql new file mode 100644 index 000000000..9c3492ca4 --- /dev/null +++ b/src/main/resources/db/migration/V1.0.2__update_experiment_template_system_mapping.sql @@ -0,0 +1,27 @@ +/* + * 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 +-- change file/mapping column ‘Exp Trt Factor Name’ to ‘Treatment Factors’ + 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": "ce5f61f2-f1de-45a4-8baf-e2471a5d863d", "value": {"fileFieldName": "Treatment Factors"}, "objectId": "treatmentFactors"}, {"id": "c5b8276f-e777-4385-a80f-5199abe63aac", "objectId": "ObsUnitID"}]', + file = '[{"Env": "New Study", "Row": 4, "Column": 5, "Env Year": 2012, "Exp Type": "phenotyping", "Exp Unit": "plot", "Exp Title": "New Trial", "ObsUnitID": "", "Exp Block #": 2, "Exp Unit ID": 3, "Env Location": "New Location", "Germplasm GID": 1, "Germplasm Name": "Test", "Exp Description": "A new trial", "Exp Replicate #": 0, "Treatment Factors": "Jam application", "Test (T) or Check (C )": true}]' + where import_type_id = 'ExperimentImport'; +END $$; \ No newline at end of file