Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,19 @@ public void postBrapiData(Map<Integer, PendingImport> mappedBrAPIImport, Program

mutatedObservationByDbId.forEach((id, observation) -> {
try {
if (observation == null) {
throw new Exception("Null observation");
}
BrAPIObservation updatedObs = brAPIObservationDAO.updateBrAPIObservation(id, observation, program.getId());
if (!observation.getValue().equals(updatedObs.getValue()) || !observation.getObservationTimeStamp().isEqual(updatedObs.getObservationTimeStamp())) {

if (updatedObs == null) {
throw new Exception("Null updated observation");
}

if (!Objects.equals(observation.getValue(), updatedObs.getValue())
|| !Objects.equals(observation.getObservationTimeStamp(), updatedObs.getObservationTimeStamp())) {
String message;
if(!observation.getValue().equals(updatedObs.getValue())) {
if(!Objects.equals(observation.getValue(), updatedObs.getValue())) {
message = String.format("Updated observation, %s, from BrAPI service does not match requested update %s.", updatedObs.getValue(), observation.getValue());
} else {
message = String.format("Updated observation timestamp, %s, from BrAPI service does not match requested update timestamp %s.", updatedObs.getObservationTimeStamp(), observation.getObservationTimeStamp());
Expand All @@ -401,9 +410,7 @@ public void postBrapiData(Map<Integer, PendingImport> mappedBrAPIImport, Program
throw new InternalServerException(e.getMessage(), e);
}
});

log.debug("experiment import complete");

}

private void prepareDataForValidation(List<BrAPIImport> importRows, List<Column<?>> phenotypeCols, Map<Integer, PendingImport> mappedBrAPIImport) {
Expand Down Expand Up @@ -1091,7 +1098,12 @@ private void fetchOrCreateDatasetPIO(ExperimentObservation importRow, Program pr
addObsVarsToDatasetDetails(pio, referencedTraits, program);
}

private PendingImportObject<BrAPIStudy> fetchOrCreateStudyPIO(Program program, boolean commit, String expSequenceValue, ExperimentObservation importRow, Supplier<BigInteger> envNextVal) {
private PendingImportObject<BrAPIStudy> fetchOrCreateStudyPIO(
Program program,
boolean commit,
String expSequenceValue,
ExperimentObservation importRow,
Supplier<BigInteger> envNextVal) {
PendingImportObject<BrAPIStudy> pio;
if (studyByNameNoScope.containsKey(importRow.getEnv())) {
pio = studyByNameNoScope.get(importRow.getEnv());
Expand Down Expand Up @@ -1133,8 +1145,7 @@ private void addYearToStudyAdditionalInfo(Program program, BrAPIStudy study) {

//if it is already there, don't add it.
if(additionalInfo==null || additionalInfo.get(BrAPIAdditionalInfoFields.ENV_YEAR)==null) {
String seasonDbId = study.getSeasons().get(0);
String year = seasonDbIdToYear(seasonDbId, program.getId());
String year = study.getSeasons().get(0);
addYearToStudyAdditionalInfo(program, study, year);
}
}
Expand Down