[BI-1720] - Export Multiple Environment Datasets as Zip#263
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
…tudy BrAPI Study - strip program key
| import io.micronaut.http.HttpStatus; | ||
| import io.micronaut.http.MediaType; | ||
| import io.micronaut.http.annotation.*; | ||
| import io.micronaut.http.server.exceptions.InternalServerException; |
There was a problem hiding this comment.
this import is unused and can be removed
| import org.breedinginsight.brapi.v1.controller.BrapiVersion; | ||
| import org.breedinginsight.brapi.v2.model.request.query.StudyQuery; | ||
| import org.breedinginsight.brapi.v2.services.BrAPIStudyService; | ||
| import org.breedinginsight.services.exceptions.DoesNotExistException; |
There was a problem hiding this comment.
this import can also be removed
| import org.breedinginsight.daos.cache.ProgramCacheProvider; | ||
| import org.breedinginsight.model.Program; | ||
| import org.breedinginsight.services.brapi.BrAPIEndpointProvider; | ||
| import org.breedinginsight.services.exceptions.DoesNotExistException; |
There was a problem hiding this comment.
import is unused and can be removed
| Map<String, BrAPIStudy> programStudyByFullName = new HashMap<>(); | ||
| for (BrAPIStudy study: programStudy) { | ||
| programStudyByFullName.put(study.getStudyName(), study); |
There was a problem hiding this comment.
programStudyByFullName isn't used after storing study refs and updating the studies. Can it be removed?
| return downloadFile; | ||
| } | ||
|
|
||
| private StreamedFile writeToStreamedFile(List<Column> columns, List<Map<String, Object>> data, FileType extension, String sheetName) throws IOException { |
There was a problem hiding this comment.
The only value passed in for sheetName is "Experiment Data'. Can this arg be removed from the method signature?
There was a problem hiding this comment.
I think it's worth keeping the sheetName parameter for extensibility.
|
|
||
| private final String defaultSortField = "studyName"; | ||
| private final SortOrder defaultSortOrder = SortOrder.ASC; | ||
| private Map<String, Function<BrAPIStudy, ?>> fields; |
timparsons
left a comment
There was a problem hiding this comment.
If I created a new environment in a second upload, that environment didn't show up to choose on the experiment download modal until I cleared the cache. Once you merge the BrAPIStudyDAO you created with the existing one (org.breedinginsight.brapps.importer.daos.BrAPIStudyDAO), then you should update the createBrAPIStudies method to create the records via the cache (example implementation is in BrAPITrialDAOImpl#createBrAPITrials).
|
|
||
| @Getter | ||
| @Introspected | ||
| public class StudyQuery extends BrapiQuery { |
There was a problem hiding this comment.
I think externalReferenceId and externalReferenceSource should be added to the query param, and probably change the frontend to send the request using those params instead of trialDbId
There was a problem hiding this comment.
There is already a BrAPIStudyDAO in the org.breedinginsight.brapps.importer.daos package. I think this code should be merged into that class.
changed when externalReferenceSource was made a different type, wasn't changed back when it was made a String again
Thanks for this! Implemented, 88a4cd5. |
|
@timparsons I updated the naming to mirror |
Description
Story: https://breedinginsight.atlassian.net/browse/BI-1720
See details of UI changes on the bi-web PR: Breeding-Insight/bi-web#320.
The behavior of the
/${micronaut.bi.api.version}/programs/{programId}/experiments/{experimentId}/export{?queryParams*}endpoint was extended to handle the case when one or more environmentIds are sent in theenvironmentsquery param. When multiple separate files are required to satisfy a request, they are returned as a zip file.environmentsquery param:I implemented a GET controller method for Study (
StudyController::getStudies) which returns studies with the Program Key stripped from Trial, Study and Location names, as this was needed to correctly display the Study (aka Environment) names on the frontend.I stripped the Program Key and any characters that may cause issues on different operating systems from the filenames generated for the file export.
Dependencies
Accompanying UI changes are in the bi-web feature/BI-1720 branch.
Testing
Try uploading experiments with multiple locations, with or without phenotypic data. Then, download experiment data with different options selected for "Environments", "File Format", and "With Timestamps?". Make sure the output file is the expected type (CSV/Excel/Zip) and the contents are consistent with what was uploaded. Note that ordering of rows in the output is not yet expected to be preserved, same goes for the ordering of phenotypic columns https://breedinginsight.atlassian.net/browse/BI-1819.
Checklist: