Skip to content

[BI-1193] Associate phenotypes with experiment observation dataset#247

Merged
dmeidlin merged 16 commits intodevelopfrom
feature/BI-1193
May 10, 2023
Merged

[BI-1193] Associate phenotypes with experiment observation dataset#247
dmeidlin merged 16 commits intodevelopfrom
feature/BI-1193

Conversation

@dmeidlin
Copy link
Contributor

@dmeidlin dmeidlin commented Apr 3, 2023

Description

Story: BI-1193

Changes made to ExperimentProcessor:

  • new field obsVarDatasetByName to hold a map for dataset pending import objects
  • #getExistingBrAPIData--dataset pios for any existing trials set in the map
  • #process--new datasets created and existing or new trial additionalInfo.observationDatasetId set; and additional obsvars added to existing dataset
  • #post--new obsvars added to existing datasets and existing trials updated with additionalInfo

To handle the case when an import object needs to be updated the following were added:

  • ImportObjectState.MUTATED
  • BrAPIDAOUtil#put
  • ProcessorData#getMutationsByObjectId

For updating Trials:

  • AdditionalInfoField.observationDatasetId
  • BrAPITrialDAO#updateBrAPITrial

For creating/updating Datasets

  • ExternalReferenceSource.DATASET
  • ExperimentObservation#contructDatasetDetails
  • BrAPIListDAO#updateBrAPIList

Dependencies

none

Testing

see acceptance criteria in the card

Checklist:

  • I have performed a self-review of my own code
  • I have tested my code and ensured it meets the acceptance criteria of the story
  • I have tested that my code works with both the brapi-java-server and BreedBase
  • I have create/modified unit tests to cover this change
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to documentation
  • I have run TAF: <please include a link to TAF run>

@dmeidlin dmeidlin changed the title update import service [BI-1193] Associate phenotypes with experiment observation dataset Apr 26, 2023
@dmeidlin dmeidlin requested review from a team, davedrp and timparsons and removed request for a team April 26, 2023 20:23
@dmeidlin dmeidlin marked this pull request as ready for review April 27, 2023 20:21
try {
response = api.listsListDbIdItemsPost(brAPIListDbId, data);
} catch (ApiException e) {
log.warn(Utilities.generateApiExceptionLogMessage(e));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be log.error

// Do manually, it doesn't like List<Object> to List<BrAPIListNewRequest> for some reason
ApiResponse<BrAPIListResponse> response;
try {
response = api.listsListDbIdItemsPost(brAPIListDbId, data);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method should be changed to use PUT /lists/{listDbId} to allow for full replacement of the contents of the list

}
}
addObsVarsToDatasetDetails(pio, referencedTraits);
obsVarDatasetByName.put(name, pio);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be done in the else block

return (T) body.getResult();

} catch (ApiException e) {
log.warn(Utilities.generateApiExceptionLogMessage(e));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should use log.error

Copy link
Member

@timparsons timparsons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Approving assuming the commented out code is removed.


private void processAndCacheTrial(BrAPITrial existingTrial, Program program, String trialRefSource, Map<String, PendingImportObject<BrAPITrial>> trialByNameNoScope) {
existingTrial.setTrialName(Utilities.removeProgramKey(existingTrial.getTrialName(), program.getKey()));
//existingTrial.setTrialName(Utilities.removeProgramKey(existingTrial.getTrialName(), program.getKey()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this line be removed?

@dmeidlin dmeidlin merged commit d903e94 into develop May 10, 2023
@dmeidlin dmeidlin deleted the feature/BI-1193 branch May 10, 2023 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants