From a5b8a96a08fa1c0294463eea3d769b5ca19379a7 Mon Sep 17 00:00:00 2001 From: Nick <53413353+nickpalladino@users.noreply.github.com> Date: Mon, 4 Mar 2024 16:50:08 -0500 Subject: [PATCH 01/14] make serverinfo calls path relative and increase read timeout --- .../org/breedinginsight/brapi/v2/BrAPIV2Controller.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/breedinginsight/brapi/v2/BrAPIV2Controller.java b/src/main/java/org/breedinginsight/brapi/v2/BrAPIV2Controller.java index d6e4dde43..b5249516e 100644 --- a/src/main/java/org/breedinginsight/brapi/v2/BrAPIV2Controller.java +++ b/src/main/java/org/breedinginsight/brapi/v2/BrAPIV2Controller.java @@ -43,6 +43,7 @@ import java.io.IOException; import java.util.List; import java.util.UUID; +import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @Slf4j @@ -147,7 +148,7 @@ public BrAPIServerInfoResponse programServerinfo(@PathVariable("programId") UUID .build(); for(BrAPIService service : programServices) { - service.setService(programBrAPIBase + service.getService()); + service.setService(service.getService()); } BrAPIServerInfo programServerInfo = new BrAPIServerInfo(); @@ -230,7 +231,10 @@ private HttpResponse executeRequest(String path, UUID programId, HttpReq } private HttpResponse makeCall(Request brapiRequest) { - OkHttpClient client = new OkHttpClient(); + // TODO: use config parameter for timeout + OkHttpClient client = new OkHttpClient.Builder() + .readTimeout(5, TimeUnit.MINUTES) + .build(); try (Response brapiResponse = client.newCall(brapiRequest).execute()) { if(brapiResponse.isSuccessful()) { try(ResponseBody body = brapiResponse.body()) { From fa0c8db48f12c79cb24e09297904c49694e3baed Mon Sep 17 00:00:00 2001 From: Nick <53413353+nickpalladino@users.noreply.github.com> Date: Tue, 5 Mar 2024 00:39:31 -0500 Subject: [PATCH 02/14] Added pedigree controller placeholder --- .../brapi/v2/BrAPIPedigreeController.java | 123 ++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java diff --git a/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java b/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java new file mode 100644 index 000000000..59c1c7615 --- /dev/null +++ b/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java @@ -0,0 +1,123 @@ +/* + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.breedinginsight.brapi.v2; + +import io.micronaut.context.annotation.Property; +import io.micronaut.http.HttpResponse; +import io.micronaut.http.annotation.*; +import io.micronaut.security.annotation.Secured; +import io.micronaut.security.rules.SecurityRule; +import lombok.extern.slf4j.Slf4j; +import org.brapi.v2.model.BrAPIIndexPagination; +import org.brapi.v2.model.BrAPIMetadata; +import org.brapi.v2.model.germ.BrAPIPedigreeNode; +import org.brapi.v2.model.germ.response.BrAPIPedigreeListResponse; +import org.brapi.v2.model.germ.response.BrAPIPedigreeListResponseResult; +import org.breedinginsight.api.auth.ProgramSecured; +import org.breedinginsight.api.auth.ProgramSecuredRoleGroup; +import org.breedinginsight.brapi.v1.controller.BrapiVersion; +import org.breedinginsight.model.Program; +import org.breedinginsight.services.ProgramService; + +import javax.annotation.Nullable; +import javax.inject.Inject; +import java.util.*; + +@Slf4j +@Controller("/${micronaut.bi.api.version}/programs/{programId}" + BrapiVersion.BRAPI_V2) +@Secured(SecurityRule.IS_AUTHENTICATED) +public class BrAPIPedigreeController { + private final String referenceSource; + + //private final BrAPIObservationUnitDAO observationUnitDAO; + + private final ProgramService programService; + + @Inject + public BrAPIPedigreeController(@Property(name = "brapi.server.reference-source") String referenceSource, ProgramService programService) { + this.referenceSource = referenceSource; + //this.observationUnitDAO = observationUnitDAO; + this.programService = programService; + } + + @Get("/pedigree") + @ProgramSecured(roleGroups = {ProgramSecuredRoleGroup.ALL}) + public HttpResponse pedigreeGet(@PathVariable("programId") UUID programId, + @Nullable @QueryValue("accessionNumber") String accessionNumber, + @Nullable @QueryValue("collection") String collection, + @Nullable @QueryValue("familyCode") String familyCode, + @Nullable @QueryValue("binomialName") String binomialName, + @Nullable @QueryValue("genus") Boolean genus, + @Nullable @QueryValue("species") String species, + @Nullable @QueryValue("synonym") String synonym, + @Nullable @QueryValue("includeParents") Boolean includeParents, + @Nullable @QueryValue("includeSiblings") Boolean includeSiblings, + @Nullable @QueryValue("includeProgeny") Boolean includeProgeny, + @Nullable @QueryValue("includeFullTree") Boolean includeFullTree, + @Nullable @QueryValue("pedigreeDepth") Integer pedigreeDepth, + @Nullable @QueryValue("progenyDepth") Integer progenyDepth, + @Nullable @QueryValue("commonCropName") String commonCropName, + @Nullable @QueryValue("programDbId") String programDbId, + @Nullable @QueryValue("trialDbId") String trialDbId, + @Nullable @QueryValue("studyDbId") String studyDbId, + @Nullable @QueryValue("germplasmDbId") String germplasmDbId, + @Nullable @QueryValue("germplasmName") String germplasmName, + @Nullable @QueryValue("germplasmPUI") String germplasmPUI, + @Nullable @QueryValue("externalReferenceId") String externalReferenceId, + @Nullable @QueryValue("externalReferenceSource") String externalReferenceSource, + @Nullable @QueryValue("page") Integer page, + @Nullable @QueryValue("pageSize") Integer pageSize) { + + log.debug("pedigreeGet: fetching pedigree by filters"); + + Optional program = programService.getById(programId); + if(program.isEmpty()) { + log.warn("Program id: " + programId + " not found"); + return HttpResponse.notFound(); + } + + // TODO: implement this + List pedigree = new ArrayList<>(); + + return HttpResponse.ok( + new BrAPIPedigreeListResponse() + .metadata(new BrAPIMetadata().pagination(new BrAPIIndexPagination().currentPage(0) + .totalPages(1) + .pageSize(pedigree.size()) + .totalCount(pedigree.size()))) + .result(new BrAPIPedigreeListResponseResult().data(pedigree)) + ); + } + + @Post("/pedigree") + @ProgramSecured(roleGroups = {ProgramSecuredRoleGroup.ALL}) + public HttpResponse pedigreePost(@PathVariable("programId") UUID programId, @Body List body) { + //DO NOT IMPLEMENT - Users are only able to create pedigree via the DeltaBreed UI + return HttpResponse.notFound(); + } + + @Put("/pedigree") + @ProgramSecured(roleGroups = {ProgramSecuredRoleGroup.ALL}) + public HttpResponse pedigreePut(@PathVariable("programId") UUID programId, @Body Map body) { + //DO NOT IMPLEMENT - Users aren't yet able to update observation units + return HttpResponse.notFound(); + } + + // TODO: search and retrieve endpoints + +} From 89120b1ef6fc52098123d9b55c9ce5ea06442e85 Mon Sep 17 00:00:00 2001 From: Nick <53413353+nickpalladino@users.noreply.github.com> Date: Fri, 8 Mar 2024 10:48:10 -0500 Subject: [PATCH 03/14] Adding pedigree dao in progress --- .../brapi/v2/dao/BrAPIPedigreeDAO | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO diff --git a/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO b/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO new file mode 100644 index 000000000..20857aa8b --- /dev/null +++ b/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO @@ -0,0 +1,81 @@ +/* + * See the NOTICE file distributed with this work for additional information + * regarding copyright ownership. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.breedinginsight.brapi.v2.dao; + +import org.brapi.client.v2.model.exceptions.ApiException; +import org.brapi.client.v2.modules.germplasm.PedigreeApi; +import org.brapi.v2.model.germ.BrAPIPedigreeNode; +import org.brapi.v2.model.germ.request.BrAPIPedigreeSearchRequest; +import org.breedinginsight.brapps.importer.daos.ImportDAO; +import org.breedinginsight.daos.ProgramDAO; +import org.breedinginsight.model.Program; +import org.breedinginsight.services.brapi.BrAPIEndpointProvider; +import org.breedinginsight.utilities.BrAPIDAOUtil; + +import javax.inject.Inject; +import javax.inject.Singleton; +import java.util.*; + +@Singleton +public class BrAPIPedigreeDAO { + + private ProgramDAO programDAO; + private final BrAPIDAOUtil brAPIDAOUtil; + private final BrAPIEndpointProvider brAPIEndpointProvider; + + @Inject + public BrAPIPedigreeDAO(ProgramDAO programDAO, BrAPIDAOUtil brAPIDAOUtil, BrAPIEndpointProvider brAPIEndpointProvider) { + this.programDAO = programDAO; + this.brAPIDAOUtil = brAPIDAOUtil; + this.brAPIEndpointProvider = brAPIEndpointProvider; + } + + public List getPedigree(Program program, + Optional observationUnitId, + Optional observationUnitName, + Optional locationDbId, + Optional seasonDbId, + Optional includeObservations, + Optional observationUnitLevelName, + Optional observationUnitLevelOrder, + Optional observationUnitLevelCode, + Optional observationUnitLevelRelationshipName, + Optional observationUnitLevelRelationshipOrder, + Optional observationUnitLevelRelationshipCode, + Optional observationUnitLevelRelationshipDbId, + Optional commonCropName, + Optional experimentId, + Optional environmentId, + Optional germplasmId +// , Integer page, +// Integer pageSize + ) throws ApiException { + BrAPIPedigreeSearchRequest pedigreeSearchRequest = new BrAPIPedigreeSearchRequest(); + pedigreeSearchRequest.programDbIds(List.of(program.getBrapiProgram().getProgramDbId())); + // TODO: add pagination support + // .page(page) + // .pageSize(pageSize); + // TODO: other parameters + + PedigreeApi api = brAPIEndpointProvider.get(programDAO.getCoreClient(program.getId()), PedigreeApi.class); + + return brAPIDAOUtil.search(api::searchPedigreePost, + api::searchPedigreeSearchResultsDbIdGet, + pedigreeSearchRequest); + } +} \ No newline at end of file From 30309e2332299a1c4299c3c3426ec33fba812319 Mon Sep 17 00:00:00 2001 From: Nick <53413353+nickpalladino@users.noreply.github.com> Date: Mon, 11 Mar 2024 10:14:04 -0400 Subject: [PATCH 04/14] Some more work on pedigree dao --- .../brapi/v2/BrAPIPedigreeController.java | 35 ++++++++++------- ...BrAPIPedigreeDAO => BrAPIPedigreeDAO.java} | 38 ++++++++----------- 2 files changed, 37 insertions(+), 36 deletions(-) rename src/main/java/org/breedinginsight/brapi/v2/dao/{BrAPIPedigreeDAO => BrAPIPedigreeDAO.java} (54%) diff --git a/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java b/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java index 59c1c7615..04ee62d41 100644 --- a/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java +++ b/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java @@ -19,10 +19,12 @@ import io.micronaut.context.annotation.Property; import io.micronaut.http.HttpResponse; +import io.micronaut.http.HttpStatus; import io.micronaut.http.annotation.*; import io.micronaut.security.annotation.Secured; import io.micronaut.security.rules.SecurityRule; import lombok.extern.slf4j.Slf4j; +import org.brapi.client.v2.model.exceptions.ApiException; import org.brapi.v2.model.BrAPIIndexPagination; import org.brapi.v2.model.BrAPIMetadata; import org.brapi.v2.model.germ.BrAPIPedigreeNode; @@ -31,8 +33,10 @@ import org.breedinginsight.api.auth.ProgramSecured; import org.breedinginsight.api.auth.ProgramSecuredRoleGroup; import org.breedinginsight.brapi.v1.controller.BrapiVersion; +import org.breedinginsight.brapi.v2.dao.BrAPIPedigreeDAO; import org.breedinginsight.model.Program; import org.breedinginsight.services.ProgramService; +import org.breedinginsight.utilities.Utilities; import javax.annotation.Nullable; import javax.inject.Inject; @@ -44,14 +48,14 @@ public class BrAPIPedigreeController { private final String referenceSource; - //private final BrAPIObservationUnitDAO observationUnitDAO; + private final BrAPIPedigreeDAO pedigreeDAO; private final ProgramService programService; @Inject - public BrAPIPedigreeController(@Property(name = "brapi.server.reference-source") String referenceSource, ProgramService programService) { + public BrAPIPedigreeController(@Property(name = "brapi.server.reference-source") String referenceSource, BrAPIPedigreeDAO pedigreeDAO, ProgramService programService) { this.referenceSource = referenceSource; - //this.observationUnitDAO = observationUnitDAO; + this.pedigreeDAO = pedigreeDAO; this.programService = programService; } @@ -92,16 +96,21 @@ public HttpResponse pedigreeGet(@PathVariable("progra } // TODO: implement this - List pedigree = new ArrayList<>(); - - return HttpResponse.ok( - new BrAPIPedigreeListResponse() - .metadata(new BrAPIMetadata().pagination(new BrAPIIndexPagination().currentPage(0) - .totalPages(1) - .pageSize(pedigree.size()) - .totalCount(pedigree.size()))) - .result(new BrAPIPedigreeListResponseResult().data(pedigree)) - ); + try { + List pedigree = pedigreeDAO.getPedigree(program.get()); + + return HttpResponse.ok( + new BrAPIPedigreeListResponse() + .metadata(new BrAPIMetadata().pagination(new BrAPIIndexPagination().currentPage(0) + .totalPages(1) + .pageSize(pedigree.size()) + .totalCount(pedigree.size()))) + .result(new BrAPIPedigreeListResponseResult().data(pedigree)) + ); + } catch (ApiException e) { + log.error(Utilities.generateApiExceptionLogMessage(e), e); + return HttpResponse.status(HttpStatus.INTERNAL_SERVER_ERROR, "error fetching variables"); + } } @Post("/pedigree") diff --git a/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO b/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java similarity index 54% rename from src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO rename to src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java index 20857aa8b..210d10bc0 100644 --- a/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO +++ b/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java @@ -17,20 +17,28 @@ package org.breedinginsight.brapi.v2.dao; +import org.apache.commons.lang3.tuple.Pair; +import org.brapi.client.v2.ApiResponse; import org.brapi.client.v2.model.exceptions.ApiException; import org.brapi.client.v2.modules.germplasm.PedigreeApi; +import org.brapi.client.v2.modules.phenotype.ObservationsApi; +import org.brapi.v2.model.BrAPIAcceptedSearchResponse; import org.brapi.v2.model.germ.BrAPIPedigreeNode; import org.brapi.v2.model.germ.request.BrAPIPedigreeSearchRequest; -import org.breedinginsight.brapps.importer.daos.ImportDAO; +import org.brapi.v2.model.germ.response.BrAPIPedigreeListResponse; +import org.brapi.v2.model.pheno.response.BrAPIObservationListResponse; import org.breedinginsight.daos.ProgramDAO; import org.breedinginsight.model.Program; import org.breedinginsight.services.brapi.BrAPIEndpointProvider; import org.breedinginsight.utilities.BrAPIDAOUtil; +import org.jetbrains.annotations.NotNull; import javax.inject.Inject; import javax.inject.Singleton; import java.util.*; +import static org.brapi.v2.model.BrAPIWSMIMEDataTypes.APPLICATION_JSON; + @Singleton public class BrAPIPedigreeDAO { @@ -45,26 +53,7 @@ public BrAPIPedigreeDAO(ProgramDAO programDAO, BrAPIDAOUtil brAPIDAOUtil, BrAPIE this.brAPIEndpointProvider = brAPIEndpointProvider; } - public List getPedigree(Program program, - Optional observationUnitId, - Optional observationUnitName, - Optional locationDbId, - Optional seasonDbId, - Optional includeObservations, - Optional observationUnitLevelName, - Optional observationUnitLevelOrder, - Optional observationUnitLevelCode, - Optional observationUnitLevelRelationshipName, - Optional observationUnitLevelRelationshipOrder, - Optional observationUnitLevelRelationshipCode, - Optional observationUnitLevelRelationshipDbId, - Optional commonCropName, - Optional experimentId, - Optional environmentId, - Optional germplasmId -// , Integer page, -// Integer pageSize - ) throws ApiException { + public List getPedigree(Program program) throws ApiException { BrAPIPedigreeSearchRequest pedigreeSearchRequest = new BrAPIPedigreeSearchRequest(); pedigreeSearchRequest.programDbIds(List.of(program.getBrapiProgram().getProgramDbId())); // TODO: add pagination support @@ -74,8 +63,11 @@ public List getPedigree(Program program, PedigreeApi api = brAPIEndpointProvider.get(programDAO.getCoreClient(program.getId()), PedigreeApi.class); - return brAPIDAOUtil.search(api::searchPedigreePost, + return brAPIDAOUtil.search( + api::searchPedigreePost, api::searchPedigreeSearchResultsDbIdGet, - pedigreeSearchRequest); + pedigreeSearchRequest + ); } + } \ No newline at end of file From d1edd9942d87e8eab73e626ad23102731248f3bc Mon Sep 17 00:00:00 2001 From: Nick <53413353+nickpalladino@users.noreply.github.com> Date: Tue, 16 Apr 2024 12:02:16 -0400 Subject: [PATCH 05/14] Temporary change to build --- .../org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java b/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java index 210d10bc0..3bcbe1e5c 100644 --- a/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java +++ b/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java @@ -63,11 +63,14 @@ public List getPedigree(Program program) throws ApiException PedigreeApi api = brAPIEndpointProvider.get(programDAO.getCoreClient(program.getId()), PedigreeApi.class); + /* return brAPIDAOUtil.search( api::searchPedigreePost, api::searchPedigreeSearchResultsDbIdGet, pedigreeSearchRequest ); + */ + return new ArrayList<>(); } } \ No newline at end of file From ab4070f5cf6b92aaf76d22bef5bec656eb342aed Mon Sep 17 00:00:00 2001 From: Nick <53413353+nickpalladino@users.noreply.github.com> Date: Wed, 17 Apr 2024 17:25:30 -0400 Subject: [PATCH 06/14] Brapi pedigree endpoint now filtered by program --- .../brapi/v2/BrAPIPedigreeController.java | 3 +- .../brapi/v2/dao/BrAPIPedigreeDAO.java | 43 ++++++++++++------- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java b/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java index 04ee62d41..1c0b1b5b0 100644 --- a/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java +++ b/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java @@ -95,7 +95,6 @@ public HttpResponse pedigreeGet(@PathVariable("progra return HttpResponse.notFound(); } - // TODO: implement this try { List pedigree = pedigreeDAO.getPedigree(program.get()); @@ -109,7 +108,7 @@ public HttpResponse pedigreeGet(@PathVariable("progra ); } catch (ApiException e) { log.error(Utilities.generateApiExceptionLogMessage(e), e); - return HttpResponse.status(HttpStatus.INTERNAL_SERVER_ERROR, "error fetching variables"); + return HttpResponse.status(HttpStatus.INTERNAL_SERVER_ERROR, "error fetching pedigree"); } } diff --git a/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java b/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java index 3bcbe1e5c..4fa59d805 100644 --- a/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java +++ b/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java @@ -17,27 +17,22 @@ package org.breedinginsight.brapi.v2.dao; -import org.apache.commons.lang3.tuple.Pair; -import org.brapi.client.v2.ApiResponse; +import io.micronaut.context.annotation.Property; import org.brapi.client.v2.model.exceptions.ApiException; import org.brapi.client.v2.modules.germplasm.PedigreeApi; -import org.brapi.client.v2.modules.phenotype.ObservationsApi; -import org.brapi.v2.model.BrAPIAcceptedSearchResponse; import org.brapi.v2.model.germ.BrAPIPedigreeNode; import org.brapi.v2.model.germ.request.BrAPIPedigreeSearchRequest; -import org.brapi.v2.model.germ.response.BrAPIPedigreeListResponse; -import org.brapi.v2.model.pheno.response.BrAPIObservationListResponse; +import org.breedinginsight.brapps.importer.services.ExternalReferenceSource; import org.breedinginsight.daos.ProgramDAO; import org.breedinginsight.model.Program; import org.breedinginsight.services.brapi.BrAPIEndpointProvider; import org.breedinginsight.utilities.BrAPIDAOUtil; -import org.jetbrains.annotations.NotNull; +import org.breedinginsight.utilities.Utilities; import javax.inject.Inject; import javax.inject.Singleton; import java.util.*; - -import static org.brapi.v2.model.BrAPIWSMIMEDataTypes.APPLICATION_JSON; +import java.util.stream.Collectors; @Singleton public class BrAPIPedigreeDAO { @@ -45,17 +40,30 @@ public class BrAPIPedigreeDAO { private ProgramDAO programDAO; private final BrAPIDAOUtil brAPIDAOUtil; private final BrAPIEndpointProvider brAPIEndpointProvider; + private final String referenceSource; @Inject - public BrAPIPedigreeDAO(ProgramDAO programDAO, BrAPIDAOUtil brAPIDAOUtil, BrAPIEndpointProvider brAPIEndpointProvider) { + public BrAPIPedigreeDAO(ProgramDAO programDAO, BrAPIDAOUtil brAPIDAOUtil, + BrAPIEndpointProvider brAPIEndpointProvider, + @Property(name = "brapi.server.reference-source") String referenceSource) { this.programDAO = programDAO; this.brAPIDAOUtil = brAPIDAOUtil; this.brAPIEndpointProvider = brAPIEndpointProvider; + this.referenceSource = referenceSource; } public List getPedigree(Program program) throws ApiException { + // TODO: maybe use get instead of search + BrAPIPedigreeSearchRequest pedigreeSearchRequest = new BrAPIPedigreeSearchRequest(); - pedigreeSearchRequest.programDbIds(List.of(program.getBrapiProgram().getProgramDbId())); + // TODO: Issue with BrAPI server programDbId filtering, use external refs instead for now + //pedigreeSearchRequest.programDbIds(List.of(program.getBrapiProgram().getProgramDbId())); + + String extRefId = program.getId().toString(); + String extRefSrc = Utilities.generateReferenceSource(referenceSource, ExternalReferenceSource.PROGRAMS); + pedigreeSearchRequest.addExternalReferenceIdsItem(extRefId); + pedigreeSearchRequest.addExternalReferenceSourcesItem(extRefSrc); + // TODO: add pagination support // .page(page) // .pageSize(pageSize); @@ -63,14 +71,19 @@ public List getPedigree(Program program) throws ApiException PedigreeApi api = brAPIEndpointProvider.get(programDAO.getCoreClient(program.getId()), PedigreeApi.class); - /* - return brAPIDAOUtil.search( + List pedigreeNodes = brAPIDAOUtil.search( api::searchPedigreePost, api::searchPedigreeSearchResultsDbIdGet, pedigreeSearchRequest ); - */ - return new ArrayList<>(); + + // search on external references is id OR source, need to filter for id AND source + pedigreeNodes = pedigreeNodes.stream() + .filter(node -> node.getExternalReferences().stream() + .anyMatch(ref -> ref.getReferenceSource().equals(extRefSrc) && ref.getReferenceId().equals(extRefId))) + .collect(Collectors.toList()); + + return pedigreeNodes; } } \ No newline at end of file From e932d9d94a222d5542514a49a41e6bdb9e7710a9 Mon Sep 17 00:00:00 2001 From: Nick <53413353+nickpalladino@users.noreply.github.com> Date: Fri, 19 Apr 2024 15:56:52 -0400 Subject: [PATCH 07/14] Filtering work --- .../brapi/v2/BrAPIPedigreeController.java | 14 ++++- .../brapi/v2/dao/BrAPIPedigreeDAO.java | 53 ++++++++++++++++++- .../breedinginsight/utilities/Utilities.java | 5 ++ 3 files changed, 68 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java b/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java index 1c0b1b5b0..bdc5c1d98 100644 --- a/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java +++ b/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java @@ -53,7 +53,9 @@ public class BrAPIPedigreeController { private final ProgramService programService; @Inject - public BrAPIPedigreeController(@Property(name = "brapi.server.reference-source") String referenceSource, BrAPIPedigreeDAO pedigreeDAO, ProgramService programService) { + public BrAPIPedigreeController(@Property(name = "brapi.server.reference-source") String referenceSource, + BrAPIPedigreeDAO pedigreeDAO, + ProgramService programService) { this.referenceSource = referenceSource; this.pedigreeDAO = pedigreeDAO; this.programService = programService; @@ -96,7 +98,15 @@ public HttpResponse pedigreeGet(@PathVariable("progra } try { - List pedigree = pedigreeDAO.getPedigree(program.get()); + List pedigree = pedigreeDAO.getPedigree( + program.get(), + Optional.ofNullable(includeParents), + Optional.ofNullable(includeSiblings), + Optional.ofNullable(includeProgeny), + Optional.ofNullable(includeFullTree), + Optional.ofNullable(pedigreeDepth), + Optional.ofNullable(progenyDepth), + Optional.ofNullable(germplasmName)); return HttpResponse.ok( new BrAPIPedigreeListResponse() diff --git a/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java b/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java index 4fa59d805..ae504fbce 100644 --- a/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java +++ b/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java @@ -52,7 +52,16 @@ public BrAPIPedigreeDAO(ProgramDAO programDAO, BrAPIDAOUtil brAPIDAOUtil, this.referenceSource = referenceSource; } - public List getPedigree(Program program) throws ApiException { + public List getPedigree( + Program program, + Optional includeParents, + Optional includeSiblings, + Optional includeProgeny, + Optional includeFullTree, + Optional pedigreeDepth, + Optional progenyDepth, + Optional germplasmName + ) throws ApiException { // TODO: maybe use get instead of search BrAPIPedigreeSearchRequest pedigreeSearchRequest = new BrAPIPedigreeSearchRequest(); @@ -62,7 +71,15 @@ public List getPedigree(Program program) throws ApiException String extRefId = program.getId().toString(); String extRefSrc = Utilities.generateReferenceSource(referenceSource, ExternalReferenceSource.PROGRAMS); pedigreeSearchRequest.addExternalReferenceIdsItem(extRefId); - pedigreeSearchRequest.addExternalReferenceSourcesItem(extRefSrc); + //pedigreeSearchRequest.addExternalReferenceSourcesItem(extRefSrc); + + includeParents.ifPresent(pedigreeSearchRequest::includeParents); + includeSiblings.ifPresent(pedigreeSearchRequest::includeSiblings); + includeProgeny.ifPresent(pedigreeSearchRequest::includeProgeny); + includeFullTree.ifPresent(pedigreeSearchRequest::includeFullTree); + pedigreeDepth.ifPresent(pedigreeSearchRequest::setPedigreeDepth); + progenyDepth.ifPresent(pedigreeSearchRequest::setProgenyDepth); + germplasmName.ifPresent(pedigreeSearchRequest::addGermplasmNamesItem); // TODO: add pagination support // .page(page) @@ -78,12 +95,44 @@ public List getPedigree(Program program) throws ApiException ); // search on external references is id OR source, need to filter for id AND source + /* pedigreeNodes = pedigreeNodes.stream() .filter(node -> node.getExternalReferences().stream() .anyMatch(ref -> ref.getReferenceSource().equals(extRefSrc) && ref.getReferenceId().equals(extRefId))) .collect(Collectors.toList()); + */ + + //stripProgramKeys(pedigreeNodes, program.getKey()); return pedigreeNodes; } + public List searchPedigree() { + return new ArrayList<>(); + } + + /** + * Removes the program key from the germplasm names in the list of pedigree nodes. + * + * @param pedigreeNodes The list of pedigree nodes. + * @param programKey The program key to be removed. + */ + private void stripProgramKeys(List pedigreeNodes, String programKey) { + pedigreeNodes.forEach(node -> { + node.setGermplasmName(Utilities.removeProgramKeyAnyAccession(node.getGermplasmName(), programKey)); + // TODO: pedigree stripping not right + //node.setPedigreeString(Utilities.removeProgramKeyAnyAccession(node.getPedigreeString(), programKey)); + if (node.getParents() != null) { + node.getParents().forEach(parent -> { + parent.setGermplasmName(Utilities.removeProgramKeyAnyAccession(parent.getGermplasmName(), programKey)); + }); + } + if (node.getProgeny() != null) { + node.getProgeny().forEach(progeny -> { + progeny.setGermplasmName(Utilities.removeProgramKeyAnyAccession(progeny.getGermplasmName(), programKey)); + }); + } + }); + } + } \ No newline at end of file diff --git a/src/main/java/org/breedinginsight/utilities/Utilities.java b/src/main/java/org/breedinginsight/utilities/Utilities.java index c885eaa97..36dacb767 100644 --- a/src/main/java/org/breedinginsight/utilities/Utilities.java +++ b/src/main/java/org/breedinginsight/utilities/Utilities.java @@ -87,6 +87,11 @@ public static String removeUnknownProgramKey(String original) { } + public static String removeProgramKeyAnyAccession(String str, String programKey) { + return str.replaceAll("\\[" + programKey + "-.*\\]", "").trim(); + + } + /** * Remove program key from a string. Returns a new value instead of altering original string. * From 1fe76b4f0b0cee485b4a1634a2c86979f86bc9d0 Mon Sep 17 00:00:00 2001 From: Nick <53413353+nickpalladino@users.noreply.github.com> Date: Fri, 19 Apr 2024 16:25:26 -0400 Subject: [PATCH 08/14] Changed to using get call instead of search --- .../brapi/v2/dao/BrAPIPedigreeDAO.java | 113 ++++++++++++++---- 1 file changed, 91 insertions(+), 22 deletions(-) diff --git a/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java b/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java index ae504fbce..aa76f5030 100644 --- a/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java +++ b/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java @@ -18,10 +18,15 @@ package org.breedinginsight.brapi.v2.dao; import io.micronaut.context.annotation.Property; +import io.micronaut.http.server.exceptions.InternalServerException; +import lombok.extern.slf4j.Slf4j; +import org.brapi.client.v2.ApiResponse; import org.brapi.client.v2.model.exceptions.ApiException; +import org.brapi.client.v2.model.queryParams.germplasm.PedigreeQueryParams; import org.brapi.client.v2.modules.germplasm.PedigreeApi; import org.brapi.v2.model.germ.BrAPIPedigreeNode; import org.brapi.v2.model.germ.request.BrAPIPedigreeSearchRequest; +import org.brapi.v2.model.germ.response.BrAPIPedigreeListResponse; import org.breedinginsight.brapps.importer.services.ExternalReferenceSource; import org.breedinginsight.daos.ProgramDAO; import org.breedinginsight.model.Program; @@ -32,9 +37,9 @@ import javax.inject.Inject; import javax.inject.Singleton; import java.util.*; -import java.util.stream.Collectors; @Singleton +@Slf4j public class BrAPIPedigreeDAO { private ProgramDAO programDAO; @@ -52,6 +57,20 @@ public BrAPIPedigreeDAO(ProgramDAO programDAO, BrAPIDAOUtil brAPIDAOUtil, this.referenceSource = referenceSource; } + /** + * Retrieves the pedigree of a given program and optional filters. Used by Helium. TODO: Add rest of parameters + * + * @param program The program for which the pedigree is requested. + * @param includeParents Flag to indicate whether to include parent nodes in the pedigree. (optional) + * @param includeSiblings Flag to indicate whether to include sibling nodes in the pedigree. (optional) + * @param includeProgeny Flag to indicate whether to include progeny nodes in the pedigree. (optional) + * @param includeFullTree Flag to indicate whether to include the full pedigree tree or only immediate ancestors and descendants. (optional) + * @param pedigreeDepth The maximum depth of ancestors and descendants to include in the pedigree. (optional) + * @param progenyDepth The maximum depth of progeny to include in the pedigree. (optional) + * @param germplasmName The name of the germplasm to which the pedigree is limited. (optional) + * @return A list of pedigree nodes representing the pedigree of the program. + * @throws ApiException If an error occurs while making the BrAPI call. + */ public List getPedigree( Program program, Optional includeParents, @@ -62,16 +81,81 @@ public List getPedigree( Optional progenyDepth, Optional germplasmName ) throws ApiException { - // TODO: maybe use get instead of search - BrAPIPedigreeSearchRequest pedigreeSearchRequest = new BrAPIPedigreeSearchRequest(); - // TODO: Issue with BrAPI server programDbId filtering, use external refs instead for now + PedigreeQueryParams pedigreeRequest = new PedigreeQueryParams(); + + // TODO: Issue with BrAPI server programDbId filtering, think germplasm are linked to program through observation + // units and doesn't work if don't have any loaded + // use external refs instead for now //pedigreeSearchRequest.programDbIds(List.of(program.getBrapiProgram().getProgramDbId())); String extRefId = program.getId().toString(); String extRefSrc = Utilities.generateReferenceSource(referenceSource, ExternalReferenceSource.PROGRAMS); + pedigreeRequest.externalReferenceId(extRefId); + pedigreeRequest.externalReferenceSource(extRefSrc); + + includeParents.ifPresent(pedigreeRequest::includeParents); + includeSiblings.ifPresent(pedigreeRequest::includeSiblings); + includeProgeny.ifPresent(pedigreeRequest::includeProgeny); + includeFullTree.ifPresent(pedigreeRequest::includeFullTree); + pedigreeDepth.ifPresent(pedigreeRequest::pedigreeDepth); + progenyDepth.ifPresent(pedigreeRequest::progenyDepth); + germplasmName.ifPresent(pedigreeRequest::germplasmName); + // TODO: other parameters + + // TODO: write utility to do paging instead of hardcoding + pedigreeRequest.pageSize(100000); + + ApiResponse brapiPedigree; + try { + brapiPedigree = brAPIEndpointProvider + .get(programDAO.getCoreClient(program.getId()), PedigreeApi.class) + .pedigreeGet(pedigreeRequest); + } catch (ApiException e) { + log.warn(Utilities.generateApiExceptionLogMessage(e)); + throw new InternalServerException("Error making BrAPI call", e); + } + + List pedigreeNodes = brapiPedigree.getBody().getResult().getData(); + // TODO: once Helium is constructing nodes from DbId we can strip program keys but won't in the mean time + //stripProgramKeys(pedigreeNodes, program.getKey()); + return pedigreeNodes; + } + + /** + * Searches for pedigree nodes based on the given parameters. Not used by Helium TODO: Add rest of parameters + * + * @param program The program to search for pedigree nodes. + * @param includeParents Optional boolean to include parents in the search. + * @param includeSiblings Optional boolean to include siblings in the search. + * @param includeProgeny Optional boolean to include progeny in the search. + * @param includeFullTree Optional boolean to include the full pedigree tree in the search. + * @param pedigreeDepth Optional integer for the maximum depth of the pedigree tree. + * @param progenyDepth Optional integer for the maximum depth of the progeny tree. + * @param germplasmName Optional String to filter the search by germplasm name. + * @return A List of BrAPIPedigreeNode objects that match the search criteria. + * @throws ApiException If an error occurs while searching for pedigree nodes. + */ + public List searchPedigree(Program program, + Optional includeParents, + Optional includeSiblings, + Optional includeProgeny, + Optional includeFullTree, + Optional pedigreeDepth, + Optional progenyDepth, + Optional germplasmName + ) throws ApiException { + + BrAPIPedigreeSearchRequest pedigreeSearchRequest = new BrAPIPedigreeSearchRequest(); + // TODO: Issue with BrAPI server programDbId filtering, think germplasm are linked to program through observation + // units and doesn't work if don't have any loaded + // use external refs instead for now + //pedigreeSearchRequest.programDbIds(List.of(program.getBrapiProgram().getProgramDbId())); + + // Just use program UUID, shouldn't have any collisions and don't want to get all the germplasm if we were also + // using source because search is OR rather than AND + String extRefId = program.getId().toString(); pedigreeSearchRequest.addExternalReferenceIdsItem(extRefId); - //pedigreeSearchRequest.addExternalReferenceSourcesItem(extRefSrc); includeParents.ifPresent(pedigreeSearchRequest::includeParents); includeSiblings.ifPresent(pedigreeSearchRequest::includeSiblings); @@ -80,10 +164,6 @@ public List getPedigree( pedigreeDepth.ifPresent(pedigreeSearchRequest::setPedigreeDepth); progenyDepth.ifPresent(pedigreeSearchRequest::setProgenyDepth); germplasmName.ifPresent(pedigreeSearchRequest::addGermplasmNamesItem); - - // TODO: add pagination support - // .page(page) - // .pageSize(pageSize); // TODO: other parameters PedigreeApi api = brAPIEndpointProvider.get(programDAO.getCoreClient(program.getId()), PedigreeApi.class); @@ -94,23 +174,12 @@ public List getPedigree( pedigreeSearchRequest ); - // search on external references is id OR source, need to filter for id AND source - /* - pedigreeNodes = pedigreeNodes.stream() - .filter(node -> node.getExternalReferences().stream() - .anyMatch(ref -> ref.getReferenceSource().equals(extRefSrc) && ref.getReferenceId().equals(extRefId))) - .collect(Collectors.toList()); - */ - + // TODO: once Helium is constructing nodes from DbId we can strip program keys but won't in the mean time //stripProgramKeys(pedigreeNodes, program.getKey()); return pedigreeNodes; } - public List searchPedigree() { - return new ArrayList<>(); - } - /** * Removes the program key from the germplasm names in the list of pedigree nodes. * @@ -120,7 +189,7 @@ public List searchPedigree() { private void stripProgramKeys(List pedigreeNodes, String programKey) { pedigreeNodes.forEach(node -> { node.setGermplasmName(Utilities.removeProgramKeyAnyAccession(node.getGermplasmName(), programKey)); - // TODO: pedigree stripping not right + // TODO: pedigree stripping not working right //node.setPedigreeString(Utilities.removeProgramKeyAnyAccession(node.getPedigreeString(), programKey)); if (node.getParents() != null) { node.getParents().forEach(parent -> { From 5a78119bdb6e4828787f4c9039b913d145996f52 Mon Sep 17 00:00:00 2001 From: Nick <53413353+nickpalladino@users.noreply.github.com> Date: Fri, 19 Apr 2024 16:41:30 -0400 Subject: [PATCH 09/14] Added comment --- .../org/breedinginsight/brapi/v2/BrAPIPedigreeController.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java b/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java index bdc5c1d98..9ebc8d135 100644 --- a/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java +++ b/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java @@ -137,5 +137,6 @@ public HttpResponse pedigreePut(@PathVariable("programId") UUID programId, @B } // TODO: search and retrieve endpoints + // already have some work done, search call in BrAPIPedigreeDAO } From 4b41a96d96195c0ce136d54525e01b9a2b43e880 Mon Sep 17 00:00:00 2001 From: Nick <53413353+nickpalladino@users.noreply.github.com> Date: Fri, 19 Apr 2024 16:44:28 -0400 Subject: [PATCH 10/14] Commented out unused search call for now, github actions build error --- .../java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java b/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java index aa76f5030..3138b6e7a 100644 --- a/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java +++ b/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java @@ -136,6 +136,7 @@ public List getPedigree( * @return A List of BrAPIPedigreeNode objects that match the search criteria. * @throws ApiException If an error occurs while searching for pedigree nodes. */ + /* public List searchPedigree(Program program, Optional includeParents, Optional includeSiblings, @@ -179,6 +180,7 @@ public List searchPedigree(Program program, return pedigreeNodes; } + */ /** * Removes the program key from the germplasm names in the list of pedigree nodes. From 8d16b80615a4aec7527a442f9b33ba11d05e3260 Mon Sep 17 00:00:00 2001 From: Nick <53413353+nickpalladino@users.noreply.github.com> Date: Fri, 19 Apr 2024 17:05:07 -0400 Subject: [PATCH 11/14] Added comment to utility function --- .../java/org/breedinginsight/utilities/Utilities.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/breedinginsight/utilities/Utilities.java b/src/main/java/org/breedinginsight/utilities/Utilities.java index 36dacb767..5cdac442f 100644 --- a/src/main/java/org/breedinginsight/utilities/Utilities.java +++ b/src/main/java/org/breedinginsight/utilities/Utilities.java @@ -86,10 +86,15 @@ public static String removeUnknownProgramKey(String original) { return original.replaceAll("\\[.*\\]", "").trim(); } - + /** + * Removes the program key from a string with any accession number. + * + * @param str The string to remove the program key from + * @param programKey The program key to remove + * @return The modified string + */ public static String removeProgramKeyAnyAccession(String str, String programKey) { return str.replaceAll("\\[" + programKey + "-.*\\]", "").trim(); - } /** From d283ded97c4ac665ea9ff19f00c619b82758f405 Mon Sep 17 00:00:00 2001 From: Nick <53413353+nickpalladino@users.noreply.github.com> Date: Thu, 2 May 2024 14:09:09 -0400 Subject: [PATCH 12/14] Removed unused reference source --- .../breedinginsight/brapi/v2/BrAPIPedigreeController.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java b/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java index 9ebc8d135..51799b346 100644 --- a/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java +++ b/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java @@ -17,7 +17,6 @@ package org.breedinginsight.brapi.v2; -import io.micronaut.context.annotation.Property; import io.micronaut.http.HttpResponse; import io.micronaut.http.HttpStatus; import io.micronaut.http.annotation.*; @@ -46,17 +45,13 @@ @Controller("/${micronaut.bi.api.version}/programs/{programId}" + BrapiVersion.BRAPI_V2) @Secured(SecurityRule.IS_AUTHENTICATED) public class BrAPIPedigreeController { - private final String referenceSource; - private final BrAPIPedigreeDAO pedigreeDAO; private final ProgramService programService; @Inject - public BrAPIPedigreeController(@Property(name = "brapi.server.reference-source") String referenceSource, - BrAPIPedigreeDAO pedigreeDAO, + public BrAPIPedigreeController(BrAPIPedigreeDAO pedigreeDAO, ProgramService programService) { - this.referenceSource = referenceSource; this.pedigreeDAO = pedigreeDAO; this.programService = programService; } From 5b43b9fceb5a41e2651d616cf59ff5bd707d1d26 Mon Sep 17 00:00:00 2001 From: Nick <53413353+nickpalladino@users.noreply.github.com> Date: Thu, 2 May 2024 14:21:38 -0400 Subject: [PATCH 13/14] Added details to method documentation justifying commented code --- .../org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java b/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java index 3138b6e7a..259e9cf81 100644 --- a/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java +++ b/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java @@ -123,7 +123,11 @@ public List getPedigree( } /** - * Searches for pedigree nodes based on the given parameters. Not used by Helium TODO: Add rest of parameters + * Searches for pedigree nodes based on the given parameters. Not used by Helium but keeping commented out for + * now in case we want to implement the search endpoints in the future, work here has already been started to + * support that. + * + * TODO: Add rest of parameters * * @param program The program to search for pedigree nodes. * @param includeParents Optional boolean to include parents in the search. From a113a49e39c717d53eb9999711d9a0c3bbd89ef0 Mon Sep 17 00:00:00 2001 From: Nick <53413353+nickpalladino@users.noreply.github.com> Date: Thu, 2 May 2024 14:24:55 -0400 Subject: [PATCH 14/14] Added documentation for stripProgramKeys --- .../org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java b/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java index 259e9cf81..a00957f2c 100644 --- a/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java +++ b/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java @@ -187,7 +187,9 @@ public List searchPedigree(Program program, */ /** - * Removes the program key from the germplasm names in the list of pedigree nodes. + * Removes the program key from the germplasm names in the list of pedigree nodes. Not used currently but will be in + * future if we decide to strip the program keys when Helium has been updated to use the germplasmDbId for uniqueness + * rather than germplasmName. * * @param pedigreeNodes The list of pedigree nodes. * @param programKey The program key to be removed.