Conversation
03a5d4f to
f1221c2
Compare
| return brAPIDAOUtil.post(brAPIObservationList, upload, api::observationsPost, importDAO::update); | ||
| } | ||
|
|
||
| public BrAPIObservation updateBrAPIObservation(String dbId, BrAPIObservation observation, UUID programId) throws ApiException { |
There was a problem hiding this comment.
IntellaJ says: "Return value of the method is never used". Does this need a return value
There was a problem hiding this comment.
Thanks, I put a check in place that will compare the requested value and timestamp to the updated values returned from the brapi service, throwing an exception if they don't match.
There was a problem hiding this comment.
The following import statements are no longer needed;
import org.brapi.client.v2.model.exceptions.ApiException;
import org.breedinginsight.services.exceptions.DoesNotExistException;
import org.breedinginsight.services.exceptions.MissingRequiredInfoException;
import org.breedinginsight.services.exceptions.UnprocessableEntityException;
import org.breedinginsight.services.exceptions.ValidatorException;
There was a problem hiding this comment.
The following Import statements are no loner needed:
import org.brapi.client.v2.model.exceptions.ApiException;
import org.breedinginsight.brapps.importer.model.imports.germplasm.GermplasmImport;
import org.breedinginsight.services.exceptions.MissingRequiredInfoException;
import org.breedinginsight.services.exceptions.UnprocessableEntityException;
import org.breedinginsight.services.exceptions.ValidatorException;
There was a problem hiding this comment.
The following import statements are no longer used:
import org.brapi.client.v2.model.exceptions.ApiException;
import org.breedinginsight.services.exceptions.DoesNotExistException;
import org.breedinginsight.services.exceptions.MissingRequiredInfoException;
import org.breedinginsight.services.exceptions.UnprocessableEntityException;
import org.breedinginsight.services.exceptions.ValidatorException;
| public static String missingColumn = "Column name \"%s\" does not exist in file"; | ||
| public static String missingUserInput = "User input, \"%s\" is required"; | ||
| public static String wrongUserInputDataType = "User input, \"%s\" must be an %s"; | ||
|
|
There was a problem hiding this comment.
The above 5-fields are never used
| import java.util.function.Supplier; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| import static org.breedinginsight.brapps.importer.services.FileMappingUtil.EXPERIMENT_TEMPLATE_NAME; |
| "If you’re trying to add these units to the experiment, please create a new environment" + | ||
| " with all appropriate experiment units (NOTE: this will generate new Observation Unit Ids " + | ||
| "for each experiment unit)."; | ||
| private static final String MISSING_OBS_UNIT_ID_ERROR = "Experiment Units are missing Observation Unit Id.<br/><br/>" + |
There was a problem hiding this comment.
MISSING_OBS_UNIT_ID_ERROR is no longer used
There was a problem hiding this comment.
I'm going to keep this in for now since it will likely be used again in the near future once the functionality of specifying by OU id is restored.
| @@ -90,6 +104,9 @@ public class ExperimentProcessor implements Processor { | |||
| private static final String TIMESTAMP_REGEX = "^"+TIMESTAMP_PREFIX+"\\s*"; | |||
| private static final String COMMA_DELIMITER = ","; | |||
| private static final String BLANK_FIELD = "Required field is blank"; | |||
There was a problem hiding this comment.
'BLANK_FIELD' is never used
There was a problem hiding this comment.
import org.breedinginsight.services.exceptions.MissingRequiredInfoException no longer used
| import org.apache.commons.lang3.StringUtils; | ||
| import org.brapi.client.v2.model.exceptions.ApiException; | ||
| import org.brapi.v2.model.BrAPIExternalReference; | ||
| import org.brapi.v2.model.pheno.BrAPIObservationUnit; |
| int rowNum, | ||
| ExperimentObservation importRow, | ||
| List<Column<?>> phenotypeCols, | ||
| Map<String, Trait> colVarMap, |
There was a problem hiding this comment.
Why was this changed from CaseInsensitiveMap to Map?
There was a problem hiding this comment.
I don't think that was deliberate. I reverted it back to CaseInsensitiveMap.
| pendingObservation.getAdditionalInfo().add(BrAPIAdditionalInfoFields.CHANGELOG, new JsonArray()); | ||
| } | ||
|
|
||
| if (pendingObservation.getAdditionalInfo() != null && !pendingObservation.getAdditionalInfo().has(BrAPIAdditionalInfoFields.CHANGELOG)) { |
There was a problem hiding this comment.
Does this work with multiple edits? Will it add entries to the array or create a new one?
There was a problem hiding this comment.
It does work with multiple edits. The changelog field in additional info stores an array, and each edit to an observation will add a new entry to that array. I've added some comments in the code here to help clarify.
| existingObsByObsHash = fetchExistingObservations(referencedTraits, program); | ||
| if (existingObsByObsHash.containsKey(key)) { | ||
| if (StringUtils.isNotBlank(value) && | ||
| !existingObsByObsHash.get(key).getValue().equals(value)) { |
There was a problem hiding this comment.
Mutated is set based on the observation value changing. Not sure if timestamp should be included here or not as well?
There was a problem hiding this comment.
I made changes here and throughout to enable updating timestamps. So, now an observation PIO will have a MUTATED state if either or both value and timestamp differ from what is stored in the brapi service.
3a7867c to
d708409
Compare
d708409 to
4471a0a
Compare
Description
Story: BI-1830
The expected behavior of a user-supplied observation unit dbid superseding experiment, environment, and unit import values has apparently regressed. Fixing this regression will be handled in a separate card, and the parts of
ExperimentProcessorinvolved commented out with TODOs. For this feature, observations are updated by filling out the complete import row with the ObsUnitID value blank.overwriteandoverwriteReasonadded toExperimentObservationchangeLogentry is added to additionalInfo when committing updates to existing observationspostBrapiDatawas updated to both post new observations and put updates to existing observationsDependencies
bi-web
feature/BI-1265Testing
Checklist: