Skip to content

[BI-1818] View exp: Obs dataset tab, details, and summary stats#268

Merged
dmeidlin merged 13 commits intodevelopfrom
feature/BI-1818
Jul 18, 2023
Merged

[BI-1818] View exp: Obs dataset tab, details, and summary stats#268
dmeidlin merged 13 commits intodevelopfrom
feature/BI-1818

Conversation

@dmeidlin
Copy link
Contributor

@dmeidlin dmeidlin commented Jun 22, 2023

Description

Story: BI-1818

  1. Created a new controller named ListController within the org.breedinginsight.brapi.v2 package
  • Moved the getLists method from BrAPIV2Controller to this class
  • Updated ListQuery to include externalReferenceId and externalReferenceSource
  • Updated getLists to handle a listType of observationVariables and to pass-through externalReferenceId and externalReferenceSource, stripping the program key from the listName for each list that is returned
  1. Created a Dataset model within the org.breedinginsight.model package, with fields:
  • experimentId - String
  • additionalInfo - JsonObject
  • data - List
  • observationUnits - List
  • observationVariables - List
  1. In ExperimentController created a method to fetch a dataset’s data for an experiment
    method: GET
    url: /${micronaut.bi.api.version}/programs/{programId}/experiments/{experimentId}/datasets/{datasetId}?stats=[true|false]
    the result field of the response is of typeDataset

  2. In BrAPITrialService created a method to fetch a dataset’s data for an experiment parameters

  • programId - UUID
  • experimentId - UUID
  • datasetId - UUID
  • includeStats - boolean
  • returns → Dataset

Dependencies

these backend changes are a dependency for BI-1645

Testing

  1. Verify that the germplam lists table still display as expected and clicking on details displays the list as expected.
  2. Import an experiment with observation variables included as columns in the import. Add observation data for some of the rows of the import, but leave some rows empty, without data.
  3. Using a client like curl, GET http:///v1/programs/7c0d1523-0cc7-4a7f-b262-3e81746df5e7/brapi/v2/lists?externalReferenceSource=dataset&externalReferenceId=82d55336-0856-4fe2-a33d-a711a5af6bfc&listType=observationVariables, and verify the list in the response contains the observation variables used in the experiment import.
  4. Using curl, GET http:///v1/programs/7c0d1523-0cc7-4a7f-b262-3e81746df5e7/experiments/bdb3bd47-020a-459c-a254-5a0e062a33c2/dataset/82d55336-0856-4fe2-a33d-a711a5af6bfc?stats=true, and verify the response contains an entity of Dataset with the imported observations.
  5. Compare the statistics in the additionalInfo field of the response dataset with the experiment import and confirm the counts are accurate.

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 marked this pull request as ready for review June 23, 2023 18:44
@dmeidlin dmeidlin requested review from a team, davedrp and timparsons and removed request for a team June 23, 2023 18:44
throw new DoesNotExistException("list not returned from BrAPI service");
}

for (BrAPIListSummary list: lists) {
Copy link
Member

Choose a reason for hiding this comment

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

In this for loop, I think you should also ensure that the program ID matches the program.id value that was passed in to the method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, that check was added

private String name;
private String description;
private String size;
private ExternalReferenceSource externalReferenceSource;
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this should be the enum that we have internally, but should be a String. This would make the query params BrAPI compliant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, made the change

if (type == null) {
type = BrAPIListTypes.GERMPLASM;
}
ExternalReferenceSource source = queryParams.getExternalReferenceSource() == null ?
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 be a String instead of the BI enum

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

Comment on lines +40 to +41
ExternalReferenceSource xrefSource,
UUID xrefId,
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 both of these fields should be of type String

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, made the change

@dmeidlin dmeidlin requested review from davedrp and timparsons July 10, 2023 19:25
type = BrAPIListTypes.GERMPLASM;
}
String source = queryParams.getExternalReferenceSource() == null ?
ExternalReferenceSource.PROGRAMS.getName() : queryParams.getExternalReferenceSource();
Copy link
Member

Choose a reason for hiding this comment

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

if the externalReferenceSource is null, then the source value will be "programs". I think the default code should be referenceSource + ExternalReferenceSource.PROGRAMS.getName()

List<BrAPIListSummary> lists = listDAO.getListByTypeAndExternalRef(
type,
program.getId(),
String.format("%s/%s", referenceSource, xrefSource),
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 will cause problems. If the xrefSource coming in is "breedinginsight.net/program", then this line will result in a string of "breedinginsight.net/breedinginsight.net/program"

String source = queryParams.getExternalReferenceSource() == null ?
String.format("%s/%s", referenceSource, ExternalReferenceSource.PROGRAMS.getName()) :
queryParams.getExternalReferenceSource();
UUID id = queryParams.getExternalReferenceId() == null || queryParams.getExternalReferenceId().isBlank() ?
Copy link
Member

Choose a reason for hiding this comment

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

I tried testing with only setting the externalReferenceSource query param and got no results back. This line appears to be the reason why. I don't think a default should be set for this (maybe not even for the externalReferenceSource either). Changing this to allow nulls may require changes to downstream code in this call stack

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed the default settings for the xref params in ListController, added checks in BrAPIListService so that the a search request could be formed from the params, and added BrAPIListDAO::getListsBySearch. The xrefSource and XrefId params can now be set independently and return any lists. The service and DAO are set up to treat listType as an independent search param, too; however, the default value of germplasm is still being set in the controller unitl the existing germplasm code is updated. So, just setting xrefSource=breeding-insight.net/dataset will return no data because a listType=germplasm is also being used in the search.

@dmeidlin dmeidlin requested a review from timparsons July 18, 2023 17:26
@dmeidlin dmeidlin merged commit 4afac5d into develop Jul 18, 2023
@dmeidlin dmeidlin deleted the feature/BI-1818 branch July 18, 2023 18:36
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