From 706bc9d4855bb2e3020b47f1604c193bebc10755 Mon Sep 17 00:00:00 2001 From: rlreamy <34109594+rlreamy@users.noreply.github.com> Date: Tue, 2 Jan 2024 11:40:19 -0500 Subject: [PATCH 01/30] Update build.gradle Set version number correctly for next release. Also updated the docker step to include the version when creating an image to reduce confusion, reduce work. --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 8794730..0208702 100755 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,7 @@ apply plugin: 'io.spring.dependency-management' jar { baseName='pegasus-data' - version= '1.6.3' + version= '2.3' } repositories { @@ -60,7 +60,7 @@ task unpack(type: Copy) { } docker { - name "${project.group}/${jar.baseName}:latest" + name "${project.group}/${jar.baseName}:${jar.version}" copySpec.from(tasks.unpack.outputs).into("dependency") buildArgs(['DEPENDENCY': "dependency"]) } From 2bab44657afa66f9011c69a17335d1008833d2c5 Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Tue, 23 Jan 2024 10:41:37 -0500 Subject: [PATCH 02/30] KPMP-5070: Clean up warnings --- .../kpmp/atlasMessage/AtlasMessageRepository.java | 1 - .../org/kpmp/atlasMessage/AtlasMessageService.java | 5 ++--- .../cellTypeSummary/ClusterHierarchyService.java | 8 ++++++-- .../kpmp/geneExpression/RPExpressionDataService.java | 8 +++----- .../kpmp/atlasMessage/AtlasMessageServiceTest.java | 4 +++- .../org/kpmp/dataSummary/DataSummaryServiceTest.java | 2 +- .../java/org/kpmp/file/ARFileInfoServiceTest.java | 2 +- .../org/kpmp/participant/ParticipantServiceTest.java | 12 ++++++------ 8 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/main/java/org/kpmp/atlasMessage/AtlasMessageRepository.java b/src/main/java/org/kpmp/atlasMessage/AtlasMessageRepository.java index 2fb9014..20f6fec 100644 --- a/src/main/java/org/kpmp/atlasMessage/AtlasMessageRepository.java +++ b/src/main/java/org/kpmp/atlasMessage/AtlasMessageRepository.java @@ -3,7 +3,6 @@ import java.util.List; -import org.springframework.cache.annotation.Cacheable; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; diff --git a/src/main/java/org/kpmp/atlasMessage/AtlasMessageService.java b/src/main/java/org/kpmp/atlasMessage/AtlasMessageService.java index fafbfd8..9954484 100644 --- a/src/main/java/org/kpmp/atlasMessage/AtlasMessageService.java +++ b/src/main/java/org/kpmp/atlasMessage/AtlasMessageService.java @@ -1,11 +1,10 @@ package org.kpmp.atlasMessage; +import java.util.List; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.List; - @Service public class AtlasMessageService { diff --git a/src/main/java/org/kpmp/cellTypeSummary/ClusterHierarchyService.java b/src/main/java/org/kpmp/cellTypeSummary/ClusterHierarchyService.java index bb817dd..d97223a 100755 --- a/src/main/java/org/kpmp/cellTypeSummary/ClusterHierarchyService.java +++ b/src/main/java/org/kpmp/cellTypeSummary/ClusterHierarchyService.java @@ -1,10 +1,14 @@ package org.kpmp.cellTypeSummary; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.kpmp.DataTypeEnum; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.data.neo4j.DataNeo4jTypeExcludeFilter; import org.springframework.stereotype.Service; @Service diff --git a/src/main/java/org/kpmp/geneExpression/RPExpressionDataService.java b/src/main/java/org/kpmp/geneExpression/RPExpressionDataService.java index 42c3a6e..415fde6 100755 --- a/src/main/java/org/kpmp/geneExpression/RPExpressionDataService.java +++ b/src/main/java/org/kpmp/geneExpression/RPExpressionDataService.java @@ -1,14 +1,12 @@ package org.kpmp.geneExpression; +import java.util.ArrayList; +import java.util.List; + import org.kpmp.TissueTypeEnum; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - @Service public class RPExpressionDataService { diff --git a/src/test/java/org/kpmp/atlasMessage/AtlasMessageServiceTest.java b/src/test/java/org/kpmp/atlasMessage/AtlasMessageServiceTest.java index c7db503..ae21f72 100644 --- a/src/test/java/org/kpmp/atlasMessage/AtlasMessageServiceTest.java +++ b/src/test/java/org/kpmp/atlasMessage/AtlasMessageServiceTest.java @@ -4,10 +4,10 @@ import static org.mockito.Mockito.when; import java.text.SimpleDateFormat; +import java.util.Arrays; import java.util.Date; import java.util.List; -import java.util.Arrays; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -51,5 +51,7 @@ public void testGetAtlasMessage() throws Exception { message2.setId(2); List messageList = Arrays.asList(message, message2); when(atlasMessageRepository.getAtlasMessages()).thenReturn(messageList); + + assertEquals(messageList, atlasMessageService.getAtlasMessage()); } } diff --git a/src/test/java/org/kpmp/dataSummary/DataSummaryServiceTest.java b/src/test/java/org/kpmp/dataSummary/DataSummaryServiceTest.java index 106b5e5..bb64de3 100755 --- a/src/test/java/org/kpmp/dataSummary/DataSummaryServiceTest.java +++ b/src/test/java/org/kpmp/dataSummary/DataSummaryServiceTest.java @@ -94,7 +94,7 @@ public void testGetAtlasRepoSummary() throws Exception { assertEquals(10, summaryRows.get(2).getOpenCount()); assertEquals(new AtlasRepoSummaryLinkInformation("experimental_strategy", "strategy1"), summaryRows.get(2).getLinkInformation()); - assertEquals(new Long(36), result.getTotalFiles()); + assertEquals(Long.valueOf(36), result.getTotalFiles()); } diff --git a/src/test/java/org/kpmp/file/ARFileInfoServiceTest.java b/src/test/java/org/kpmp/file/ARFileInfoServiceTest.java index 9854a51..81d1470 100644 --- a/src/test/java/org/kpmp/file/ARFileInfoServiceTest.java +++ b/src/test/java/org/kpmp/file/ARFileInfoServiceTest.java @@ -31,6 +31,6 @@ public void tearDown() throws Exception { @Test void testGetRepositoryTotalFileCount() { when(fileInfoRepository.getTotalFileCount()).thenReturn(2l); - assertEquals(new Long(2), service.getRepositoryTotalFileCount()); + assertEquals(Long.valueOf(2), service.getRepositoryTotalFileCount()); } } diff --git a/src/test/java/org/kpmp/participant/ParticipantServiceTest.java b/src/test/java/org/kpmp/participant/ParticipantServiceTest.java index 872ae19..15814c0 100755 --- a/src/test/java/org/kpmp/participant/ParticipantServiceTest.java +++ b/src/test/java/org/kpmp/participant/ParticipantServiceTest.java @@ -106,15 +106,15 @@ public void testGetExperimentCounts() { assertEquals(4, explorerDataTypes.size()); for (ParticipantDataTypeInformation participantDataTypeInformation : spatialViewerDataTypes) { if (participantDataTypeInformation.getDataType().equals("Light Microscopy")) { - assertEquals(new Integer(5), participantDataTypeInformation.getCount()); + assertEquals(Integer.valueOf(5), participantDataTypeInformation.getCount()); assertEquals(false, participantDataTypeInformation.isAggregatedData()); } else if (participantDataTypeInformation.getDataType().equals("Spatial Lipidomics")) { - assertEquals(new Integer(2), participantDataTypeInformation.getCount()); + assertEquals(Integer.valueOf(2), participantDataTypeInformation.getCount()); assertEquals(false, participantDataTypeInformation.isAggregatedData()); } } for (ParticipantDataTypeInformation participantDataTypeInformation : explorerDataTypes) { - assertEquals(new Integer(1), participantDataTypeInformation.getCount()); + assertEquals(Integer.valueOf(1), participantDataTypeInformation.getCount()); assertEquals(true, participantDataTypeInformation.isAggregatedData()); } @@ -142,10 +142,10 @@ public void testGetDataTypeCounts() throws Exception { assertEquals(2, repositoryDataTypes.size()); for (ParticipantRepoDataTypeInformation participantDataTypeInformation : repositoryDataTypes) { if(participantDataTypeInformation.getDataType().equals("Transcriptomics")) { - assertEquals(new Integer(3), participantDataTypeInformation.getCount()); + assertEquals(Integer.valueOf(3), participantDataTypeInformation.getCount()); } else if (participantDataTypeInformation.getDataType().equals("Imaging")) { - assertEquals(new Integer(4), participantDataTypeInformation.getCount()); + assertEquals(Integer.valueOf(4), participantDataTypeInformation.getCount()); } } } @@ -174,7 +174,7 @@ public void testGetTotalFilesCount() throws Exception { ParticipantRepoDataTypeInformation result = participantService.getTotalFilesCount("123"); - assertEquals(new Integer(5), result.getCount()); + assertEquals(Integer.valueOf(5), result.getCount()); assertEquals("redcap_id", result.getLinkInformation().getLinkType()); assertEquals("123", result.getLinkInformation().getLinkValue()); } From a1e80de6521c93b3a016d431d3b5999e83a57090 Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Tue, 23 Jan 2024 10:48:43 -0500 Subject: [PATCH 03/30] KPMP-5070: Remove tissue types except for ALL from RP calls --- .../RPExpressionByTissueType.java | 38 +--------- .../RPExpressionDataService.java | 4 -- .../resources/knowledge_environment.graphqls | 4 -- .../RPExpressionByTissueTypeTest.java | 31 -------- .../RPExpressionDataByTissueTypeTest.java | 71 ------------------- .../RPExpressionDataServiceTest.java | 50 +------------ 6 files changed, 3 insertions(+), 195 deletions(-) delete mode 100755 src/test/java/org/kpmp/geneExpression/RPExpressionDataByTissueTypeTest.java diff --git a/src/main/java/org/kpmp/geneExpression/RPExpressionByTissueType.java b/src/main/java/org/kpmp/geneExpression/RPExpressionByTissueType.java index df2f5de..511b977 100755 --- a/src/main/java/org/kpmp/geneExpression/RPExpressionByTissueType.java +++ b/src/main/java/org/kpmp/geneExpression/RPExpressionByTissueType.java @@ -5,11 +5,7 @@ public class RPExpressionByTissueType { private List all; - private List aki; - private List ckd; - private List hrt; - private List dmr; - + public List getAll() { return all; } @@ -18,36 +14,4 @@ public void setAll(List all) { this.all = all; } - public List getAki() { - return aki; - } - - public void setAki(List aki) { - this.aki = aki; - } - - public List getCkd() { - return ckd; - } - - public void setCkd(List ckd) { - this.ckd = ckd; - } - - public List getHrt() { - return hrt; - } - - public void setHrt(List hrt) { - this.hrt = hrt; - } - - public List getDmr() { - return dmr; - } - - public void setDmr(List dmr) { - this.dmr = dmr; - } - } diff --git a/src/main/java/org/kpmp/geneExpression/RPExpressionDataService.java b/src/main/java/org/kpmp/geneExpression/RPExpressionDataService.java index 415fde6..b3f6b11 100755 --- a/src/main/java/org/kpmp/geneExpression/RPExpressionDataService.java +++ b/src/main/java/org/kpmp/geneExpression/RPExpressionDataService.java @@ -31,10 +31,6 @@ public List getByGeneSymbolPerTissue(String geneSymbol) { public RPExpressionByTissueType getByGeneSymbolAndProteinPerTissue(String geneSymbol, String protein) { RPExpressionByTissueType rpExpressionByTissueType = new RPExpressionByTissueType(); - rpExpressionByTissueType.setAki(rpExpressionDataRepository.findByGeneSymbolAndTissueTypeAndProteinWithCounts(geneSymbol, TissueTypeEnum.AKI.getParticipantTissueType(), protein)); - rpExpressionByTissueType.setCkd(rpExpressionDataRepository.findByGeneSymbolAndTissueTypeAndProteinWithCounts(geneSymbol, TissueTypeEnum.CKD.getParticipantTissueType(), protein)); - rpExpressionByTissueType.setDmr(rpExpressionDataRepository.findByGeneSymbolAndTissueTypeAndProteinWithCounts(geneSymbol, TissueTypeEnum.DMR.getParticipantTissueType(), protein)); - rpExpressionByTissueType.setHrt(rpExpressionDataRepository.findByGeneSymbolAndTissueTypeAndProteinWithCounts(geneSymbol, TissueTypeEnum.HEALTHY_REFERENCE.getParticipantTissueType(), protein)); rpExpressionByTissueType.setAll(rpExpressionDataRepository.findByGeneSymbolAndTissueTypeAndProteinWithCounts(geneSymbol, TissueTypeEnum.ALL.getParticipantTissueType(), protein)); return rpExpressionByTissueType; diff --git a/src/main/resources/knowledge_environment.graphqls b/src/main/resources/knowledge_environment.graphqls index 45ed169..69d6dcf 100755 --- a/src/main/resources/knowledge_environment.graphqls +++ b/src/main/resources/knowledge_environment.graphqls @@ -208,10 +208,6 @@ type RPGeneExpression { type RPExpressionByTissueType { all: [RPGeneExpression] - hrt: [RPGeneExpression] - ckd: [RPGeneExpression] - dmr: [RPGeneExpression] - aki: [RPGeneExpression] } type ParticipantSummaryDataset { diff --git a/src/test/java/org/kpmp/geneExpression/RPExpressionByTissueTypeTest.java b/src/test/java/org/kpmp/geneExpression/RPExpressionByTissueTypeTest.java index ef8452b..e83b25b 100644 --- a/src/test/java/org/kpmp/geneExpression/RPExpressionByTissueTypeTest.java +++ b/src/test/java/org/kpmp/geneExpression/RPExpressionByTissueTypeTest.java @@ -32,36 +32,5 @@ public void setAll() { assertEquals(allataList, actual); } - @Test - public void setAki() { - List allAkiDataList = Arrays.asList(mock(RPExpressionData.class)); - rpExpression.setAki(allAkiDataList); - List actual = rpExpression.getAki(); - assertEquals(allAkiDataList, actual); - } - - @Test - public void setCkd() { - List allCkdDataList = Arrays.asList(mock(RPExpressionData.class)); - rpExpression.setCkd(allCkdDataList); - List actual = rpExpression.getCkd(); - assertEquals(allCkdDataList, actual); - } - - @Test - public void setHrt() { - List allHrtDataList = Arrays.asList(mock(RPExpressionData.class)); - rpExpression.setHrt(allHrtDataList); - List actual = rpExpression.getHrt(); - assertEquals(allHrtDataList, actual); - } - - @Test - public void setDmr() { - List allDmrDataList = Arrays.asList(mock(RPExpressionData.class)); - rpExpression.setDmr(allDmrDataList); - List actual = rpExpression.getDmr(); - assertEquals(allDmrDataList, actual); - } } \ No newline at end of file diff --git a/src/test/java/org/kpmp/geneExpression/RPExpressionDataByTissueTypeTest.java b/src/test/java/org/kpmp/geneExpression/RPExpressionDataByTissueTypeTest.java deleted file mode 100755 index 61f54b3..0000000 --- a/src/test/java/org/kpmp/geneExpression/RPExpressionDataByTissueTypeTest.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.kpmp.geneExpression; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import java.util.Arrays; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class RPExpressionDataByTissueTypeTest { - - private RPExpressionByTissueType rpExpressionByTissueType; - - @Before - public void setUp() throws Exception { - rpExpressionByTissueType = new RPExpressionByTissueType(); - } - - @After - public void tearDown() throws Exception { - rpExpressionByTissueType = null; - } - - @Test - public void setAll() { - RPExpressionData allData = new RPExpressionData(); - List allataList = Arrays.asList(allData); - rpExpressionByTissueType.setAll(allataList); - List actual = rpExpressionByTissueType.getAll(); - assertEquals(allataList, actual); - } - - @Test - public void setAki() { - RPExpressionData allAkiData = new RPExpressionData(); - List allAkiDataList = Arrays.asList(allAkiData); - rpExpressionByTissueType.setAki(allAkiDataList); - List actual = rpExpressionByTissueType.getAki(); - assertEquals(allAkiDataList, actual); - } - - @Test - public void setCkd() { - RPExpressionData allCkdData = new RPExpressionData(); - List allCkdDataList = Arrays.asList(allCkdData); - rpExpressionByTissueType.setCkd(allCkdDataList); - List actual = rpExpressionByTissueType.getCkd(); - assertEquals(allCkdDataList, actual); - } - - @Test - public void setHrt() { - RPExpressionData allHrtData = new RPExpressionData(); - List allHrtDataList = Arrays.asList(allHrtData); - rpExpressionByTissueType.setHrt(allHrtDataList); - List actual = rpExpressionByTissueType.getHrt(); - assertEquals(allHrtDataList, actual); - } - - @Test - public void setDmr() { - RPExpressionData allDmrData = new RPExpressionData(); - List allDmrDataList = Arrays.asList(allDmrData); - rpExpressionByTissueType.setDmr(allDmrDataList); - List actual = rpExpressionByTissueType.getDmr(); - assertEquals(allDmrDataList, actual); - } - -} diff --git a/src/test/java/org/kpmp/geneExpression/RPExpressionDataServiceTest.java b/src/test/java/org/kpmp/geneExpression/RPExpressionDataServiceTest.java index 853b9a7..dab2141 100755 --- a/src/test/java/org/kpmp/geneExpression/RPExpressionDataServiceTest.java +++ b/src/test/java/org/kpmp/geneExpression/RPExpressionDataServiceTest.java @@ -42,37 +42,13 @@ public void testGetByGeneSymbolPerTissue() throws Exception { accessions.add("a2"); when(rpExpressionDataRepository.findAccessionByGeneSymbol("gene")).thenReturn(accessions); - List rpExpressionDataAki = Arrays.asList(new RPExpressionData[]{new RPExpressionData()}); - List rpExpressionDataCkd = Arrays.asList(new RPExpressionData[]{new RPExpressionData()}); - List rpExpressionDataHrt = Arrays.asList(new RPExpressionData[]{new RPExpressionData()}); - List rpExpressionDataDmr = Arrays.asList(new RPExpressionData[]{new RPExpressionData()}); List rpExpressionDataAll = Arrays.asList(new RPExpressionData[]{new RPExpressionData()}); - List rpExpressionDataAki2 = Arrays.asList(new RPExpressionData[]{new RPExpressionData()}); - List rpExpressionDataCkd2 = Arrays.asList(new RPExpressionData[]{new RPExpressionData()}); - List rpExpressionDataHrt2 = Arrays.asList(new RPExpressionData[]{new RPExpressionData()}); - List rpExpressionDataDmr2 = Arrays.asList(new RPExpressionData[]{new RPExpressionData()}); List rpExpressionDataAll2 = Arrays.asList(new RPExpressionData[]{new RPExpressionData()}); - when(rpExpressionDataRepository.findByGeneSymbolAndTissueTypeAndProteinWithCounts("gene", TissueTypeEnum.AKI.getParticipantTissueType(), "a1")). - thenReturn(rpExpressionDataAki); - when(rpExpressionDataRepository.findByGeneSymbolAndTissueTypeAndProteinWithCounts("gene", TissueTypeEnum.CKD.getParticipantTissueType(), "a1")). - thenReturn(rpExpressionDataCkd); - when(rpExpressionDataRepository.findByGeneSymbolAndTissueTypeAndProteinWithCounts("gene", TissueTypeEnum.HEALTHY_REFERENCE.getParticipantTissueType(), "a1")). - thenReturn(rpExpressionDataHrt); - when(rpExpressionDataRepository.findByGeneSymbolAndTissueTypeAndProteinWithCounts("gene", TissueTypeEnum.DMR.getParticipantTissueType(), "a1")). - thenReturn(rpExpressionDataDmr); when(rpExpressionDataRepository.findByGeneSymbolAndTissueTypeAndProteinWithCounts("gene", TissueTypeEnum.ALL.getParticipantTissueType(), "a1")). thenReturn(rpExpressionDataAll); - when(rpExpressionDataRepository.findByGeneSymbolAndTissueTypeAndProteinWithCounts("gene", TissueTypeEnum.AKI.getParticipantTissueType(), "a2")). - thenReturn(rpExpressionDataAki2); - when(rpExpressionDataRepository.findByGeneSymbolAndTissueTypeAndProteinWithCounts("gene", TissueTypeEnum.CKD.getParticipantTissueType(), "a2")). - thenReturn(rpExpressionDataCkd2); - when(rpExpressionDataRepository.findByGeneSymbolAndTissueTypeAndProteinWithCounts("gene", TissueTypeEnum.HEALTHY_REFERENCE.getParticipantTissueType(), "a2")). - thenReturn(rpExpressionDataHrt2); - when(rpExpressionDataRepository.findByGeneSymbolAndTissueTypeAndProteinWithCounts("gene", TissueTypeEnum.DMR.getParticipantTissueType(), "a2")). - thenReturn(rpExpressionDataDmr2); when(rpExpressionDataRepository.findByGeneSymbolAndTissueTypeAndProteinWithCounts("gene", TissueTypeEnum.ALL.getParticipantTissueType(), "a2")). thenReturn(rpExpressionDataAll2); @@ -84,43 +60,21 @@ public void testGetByGeneSymbolPerTissue() throws Exception { RPExpressionByTissueType rpExpressionByTissueType2 = rpAccessionGroups.get(1).getRpExpressionByTissueType(); - assertEquals(rpExpressionByTissueType1.getHrt(), rpExpressionDataHrt); - assertEquals(rpExpressionByTissueType1.getCkd(), rpExpressionDataCkd); assertEquals(rpExpressionByTissueType1.getAll(), rpExpressionDataAll); - assertEquals(rpExpressionByTissueType1.getDmr(), rpExpressionDataDmr); - - assertEquals(rpExpressionByTissueType2.getHrt(), rpExpressionDataHrt2); - assertEquals(rpExpressionByTissueType2.getCkd(), rpExpressionDataCkd2); assertEquals(rpExpressionByTissueType2.getAll(), rpExpressionDataAll2); - assertEquals(rpExpressionByTissueType2.getDmr(), rpExpressionDataDmr2); - + } @Test public void testGetByGeneSymbolAndProteinPerTissue() throws Exception { - List rpExpressionDataAki = Arrays.asList(new RPExpressionData[]{new RPExpressionData()}); - List rpExpressionDataCkd = Arrays.asList(new RPExpressionData[]{new RPExpressionData()}); - List rpExpressionDataHrt = Arrays.asList(new RPExpressionData[]{new RPExpressionData()}); - List rpExpressionDataDmr = Arrays.asList(new RPExpressionData[]{new RPExpressionData()}); List rpExpressionDataAll = Arrays.asList(new RPExpressionData[]{new RPExpressionData()}); - when(rpExpressionDataRepository.findByGeneSymbolAndTissueTypeAndProteinWithCounts("gene", TissueTypeEnum.AKI.getParticipantTissueType(), "protein")). - thenReturn(rpExpressionDataAki); - when(rpExpressionDataRepository.findByGeneSymbolAndTissueTypeAndProteinWithCounts("gene", TissueTypeEnum.CKD.getParticipantTissueType(), "protein")). - thenReturn(rpExpressionDataCkd); - when(rpExpressionDataRepository.findByGeneSymbolAndTissueTypeAndProteinWithCounts("gene", TissueTypeEnum.HEALTHY_REFERENCE.getParticipantTissueType(), "protein")). - thenReturn(rpExpressionDataHrt); - when(rpExpressionDataRepository.findByGeneSymbolAndTissueTypeAndProteinWithCounts("gene", TissueTypeEnum.DMR.getParticipantTissueType(), "protein")). - thenReturn(rpExpressionDataDmr); + when(rpExpressionDataRepository.findByGeneSymbolAndTissueTypeAndProteinWithCounts("gene", TissueTypeEnum.ALL.getParticipantTissueType(), "protein")). thenReturn(rpExpressionDataAll); RPExpressionByTissueType rpExpressionByTissueType = rpExpressionDataService.getByGeneSymbolAndProteinPerTissue("gene", "protein"); - assertEquals(rpExpressionByTissueType.getAki(), rpExpressionDataAki); - assertEquals(rpExpressionByTissueType.getHrt(), rpExpressionDataHrt); - assertEquals(rpExpressionByTissueType.getCkd(), rpExpressionDataCkd); assertEquals(rpExpressionByTissueType.getAll(), rpExpressionDataAll); - assertEquals(rpExpressionByTissueType.getDmr(), rpExpressionDataDmr); } @Test From 12985916b8159ca39ca568f2cefea3a5e8ed2152 Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Thu, 8 Feb 2024 14:56:50 -0500 Subject: [PATCH 04/30] KPMP-4959: Clean up warnings --- .../org/kpmp/atlasMessage/AtlasMessageRepository.java | 2 +- src/main/java/org/kpmp/cellType/CellType.java | 6 ++++-- .../org/kpmp/cellType/CellTypeStructureSubregion.java | 7 ++++--- .../SCRNAGeneExpressionExpressionSummaryValue.java | 9 +++++---- .../dataSummary/AtlasRepoSummaryLinkInformationTest.java | 1 + .../SCRNAGeneExpressionSummaryValueTest.java | 7 +++++++ 6 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/kpmp/atlasMessage/AtlasMessageRepository.java b/src/main/java/org/kpmp/atlasMessage/AtlasMessageRepository.java index 20f6fec..25ece14 100644 --- a/src/main/java/org/kpmp/atlasMessage/AtlasMessageRepository.java +++ b/src/main/java/org/kpmp/atlasMessage/AtlasMessageRepository.java @@ -8,7 +8,7 @@ import org.springframework.stereotype.Repository; @Repository -interface AtlasMessageRepository extends CrudRepository{ +interface AtlasMessageRepository extends CrudRepository>{ @Query(value = "SELECT * FROM atlas_messages am WHERE start_date <= CURRENT_DATE() AND end_date >= CURRENT_DATE() ORDER BY start_date ASC", nativeQuery = true) List getAtlasMessages(); } diff --git a/src/main/java/org/kpmp/cellType/CellType.java b/src/main/java/org/kpmp/cellType/CellType.java index e336d0d..0e872f5 100755 --- a/src/main/java/org/kpmp/cellType/CellType.java +++ b/src/main/java/org/kpmp/cellType/CellType.java @@ -13,6 +13,8 @@ import javax.persistence.OneToMany; import javax.persistence.Table; +import org.apache.commons.lang3.builder.HashCodeBuilder; + @Entity @Table(name = "cell_type") public class CellType implements Serializable { @@ -120,7 +122,7 @@ public void setCellTypeOrdering(int cellTypeOrdering) { @Override public int hashCode() { - return cellType.hashCode(); + return new HashCodeBuilder().append(cellTypeId).build(); } @Override @@ -130,7 +132,7 @@ public boolean equals(Object obj) { if (!(obj instanceof CellType)) return false; CellType cellType = (CellType) obj; - return cellType.getCellType().equals(this.getCellType()); + return cellType.getCellTypeId() == (this.getCellTypeId()); } } diff --git a/src/main/java/org/kpmp/cellType/CellTypeStructureSubregion.java b/src/main/java/org/kpmp/cellType/CellTypeStructureSubregion.java index b6be2c0..a94a1f1 100755 --- a/src/main/java/org/kpmp/cellType/CellTypeStructureSubregion.java +++ b/src/main/java/org/kpmp/cellType/CellTypeStructureSubregion.java @@ -4,7 +4,8 @@ import java.util.ArrayList; import java.util.List; -import com.google.common.base.Objects; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; public class CellTypeStructureSubregion implements Serializable { @@ -46,13 +47,13 @@ public boolean equals(Object obj) { return false; } CellTypeStructureSubregion other = (CellTypeStructureSubregion) obj; - return Objects.equal(this.subregionName, other.subregionName); + return new EqualsBuilder().append(this.subregionName, other.subregionName).build(); } @Override public int hashCode() { - return Objects.hashCode(subregionName); + return new HashCodeBuilder().append(this.subregionName).build(); } } diff --git a/src/main/java/org/kpmp/geneExpressionSummary/singleCell/SCRNAGeneExpressionExpressionSummaryValue.java b/src/main/java/org/kpmp/geneExpressionSummary/singleCell/SCRNAGeneExpressionExpressionSummaryValue.java index 420c53c..cd4e971 100755 --- a/src/main/java/org/kpmp/geneExpressionSummary/singleCell/SCRNAGeneExpressionExpressionSummaryValue.java +++ b/src/main/java/org/kpmp/geneExpressionSummary/singleCell/SCRNAGeneExpressionExpressionSummaryValue.java @@ -10,6 +10,8 @@ import javax.persistence.IdClass; import javax.persistence.Table; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; import org.kpmp.DataTypeEnum; import org.kpmp.geneExpressionSummary.GeneExpressionId; import org.kpmp.geneExpressionSummary.GeneExpressionSummary; @@ -188,7 +190,7 @@ public void setCluster(String cluster) { @Override public int hashCode() { - return (gene + cluster).hashCode(); + return new HashCodeBuilder().append(gene).append(cluster).build(); } @Override @@ -197,9 +199,8 @@ public boolean equals(Object obj) { return true; if (!(obj instanceof SCRNAGeneExpressionExpressionSummaryValue)) return false; - SCRNAGeneExpressionExpressionSummaryValue scrnaGeneExpressionExpressionSummaryValue = (SCRNAGeneExpressionExpressionSummaryValue) obj; - return (scrnaGeneExpressionExpressionSummaryValue.getGene().equals(this.getGene()) - && scrnaGeneExpressionExpressionSummaryValue.getCluster().equals(this.getCluster())); + SCRNAGeneExpressionExpressionSummaryValue that = (SCRNAGeneExpressionExpressionSummaryValue) obj; + return new EqualsBuilder().append(this.gene, that.gene).append(this.cluster, that.cluster).build(); } } diff --git a/src/test/java/org/kpmp/dataSummary/AtlasRepoSummaryLinkInformationTest.java b/src/test/java/org/kpmp/dataSummary/AtlasRepoSummaryLinkInformationTest.java index 5d12f92..c7a7425 100644 --- a/src/test/java/org/kpmp/dataSummary/AtlasRepoSummaryLinkInformationTest.java +++ b/src/test/java/org/kpmp/dataSummary/AtlasRepoSummaryLinkInformationTest.java @@ -41,6 +41,7 @@ public void testSetLinkValue() { assertEquals("another value", linkInfo.getLinkValue()); } + @SuppressWarnings("unlikely-arg-type") @Test public void testEqualsAndHashCode() throws Exception { AtlasRepoSummaryLinkInformation base = new AtlasRepoSummaryLinkInformation("linkType", "linkValue"); diff --git a/src/test/java/org/kpmp/geneExpressionSummary/SCRNAGeneExpressionSummaryValueTest.java b/src/test/java/org/kpmp/geneExpressionSummary/SCRNAGeneExpressionSummaryValueTest.java index 7252d58..40711e2 100755 --- a/src/test/java/org/kpmp/geneExpressionSummary/SCRNAGeneExpressionSummaryValueTest.java +++ b/src/test/java/org/kpmp/geneExpressionSummary/SCRNAGeneExpressionSummaryValueTest.java @@ -26,6 +26,7 @@ public void testGetDataType() throws Exception { assertEquals("sc", scrnaGeneExpressionValue.getDataType()); } + @SuppressWarnings("null") @Test public void testSetAvgExpression() throws Exception { scrnaGeneExpressionValue.setAvgExp(0.1); @@ -39,6 +40,7 @@ public void testSetCluster() throws Exception { assertEquals("cluster", scrnaGeneExpressionValue.getCluster()); } + @SuppressWarnings("null") @Test public void testSetFoldChange() throws Exception { scrnaGeneExpressionValue.setFoldChange(0.2); @@ -52,6 +54,7 @@ public void testSetGene() throws Exception { } + @SuppressWarnings("null") @Test public void testSetId() throws Exception { scrnaGeneExpressionValue.setId(1); @@ -59,6 +62,7 @@ public void testSetId() throws Exception { } + @SuppressWarnings("null") @Test public void testSetPct1() throws Exception { scrnaGeneExpressionValue.setPct1(0.3); @@ -66,6 +70,7 @@ public void testSetPct1() throws Exception { } + @SuppressWarnings("null") @Test public void testSetPct2() throws Exception { scrnaGeneExpressionValue.setPct2(0.4); @@ -73,6 +78,7 @@ public void testSetPct2() throws Exception { } + @SuppressWarnings("null") @Test public void testSetPVal() throws Exception { scrnaGeneExpressionValue.setPVal(0.5); @@ -80,6 +86,7 @@ public void testSetPVal() throws Exception { } + @SuppressWarnings("null") @Test public void testSetPValAdj() throws Exception { scrnaGeneExpressionValue.setPValAdj(0.6); From ceadff7a5666f186b683b236be59c54d763aee6d Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Fri, 9 Feb 2024 15:33:30 -0500 Subject: [PATCH 05/30] KPMP-4959: Some additional cleanup steps before implementation --- src/main/java/org/kpmp/Query.java | 4 ---- .../java/org/kpmp/dataSummary/DataSummaryRepository.java | 5 +++++ src/main/resources/knowledge_environment.graphqls | 5 ++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/kpmp/Query.java b/src/main/java/org/kpmp/Query.java index df1487a..76bf8bf 100755 --- a/src/main/java/org/kpmp/Query.java +++ b/src/main/java/org/kpmp/Query.java @@ -195,10 +195,6 @@ public ParticipantSummaryDataset participantSummaryDataset(String redcap_id) thr } } - public ParticipantSummaryDataset participantClinicalDataset(String redcap_id) throws Exception { - return this.participantSummaryDataset(redcap_id); - } - public ParticipantRepoDataTypeInformation getTotalParticipantFilesCount(String redcap_id) throws Exception { try { return this.participantService.getTotalFilesCount(redcap_id); diff --git a/src/main/java/org/kpmp/dataSummary/DataSummaryRepository.java b/src/main/java/org/kpmp/dataSummary/DataSummaryRepository.java index cda6f40..44df46c 100755 --- a/src/main/java/org/kpmp/dataSummary/DataSummaryRepository.java +++ b/src/main/java/org/kpmp/dataSummary/DataSummaryRepository.java @@ -55,4 +55,9 @@ public interface DataSummaryRepository extends CrudRepository Date: Fri, 9 Feb 2024 16:21:23 -0500 Subject: [PATCH 06/30] KPMP-4959: Add new entity for the participant data count --- src/main/java/org/kpmp/Query.java | 4 + .../dataSummary/DataSummaryRepository.java | 5 -- .../kpmp/participant/ParticipantRepoData.java | 83 +++++++++++++++++++ .../kpmp/participant/ParticipantService.java | 9 ++ 4 files changed, 96 insertions(+), 5 deletions(-) create mode 100644 src/main/java/org/kpmp/participant/ParticipantRepoData.java diff --git a/src/main/java/org/kpmp/Query.java b/src/main/java/org/kpmp/Query.java index 76bf8bf..be4754a 100755 --- a/src/main/java/org/kpmp/Query.java +++ b/src/main/java/org/kpmp/Query.java @@ -230,4 +230,8 @@ public List getAtlasMessages() throws Exception { throw e; } } + + public List getRepoCountsByExperimentalStrategy(String redcapId) { + return null; + } } \ No newline at end of file diff --git a/src/main/java/org/kpmp/dataSummary/DataSummaryRepository.java b/src/main/java/org/kpmp/dataSummary/DataSummaryRepository.java index 44df46c..cda6f40 100755 --- a/src/main/java/org/kpmp/dataSummary/DataSummaryRepository.java +++ b/src/main/java/org/kpmp/dataSummary/DataSummaryRepository.java @@ -55,9 +55,4 @@ public interface DataSummaryRepository extends CrudRepository getRepoCountsByExperimentalStrategy(String redcapId) { + // @Query(value="select a.experimental_strategy, b.data_type, b.data_category ,coalesce(count,0) as count " + // + "from (select distinct experimental_strategy from repo_file_v) as a " + // + "left join (select count(*) as count, experimental_strategy, data_type, data_category from repo_file_v where redcap_id= :redcap_id " + // + "group by experimental_strategy) as b on a.experimental_strategy=b.experimental_strategy;", nativeQuery = true) + // List< + return null; + } + private List getExplorerCounts(String redcapId) { List explorerExperiments = new ArrayList<>(); int scCount = 0; From 5adec88c0a2a259ec3b67865c7ae1b2396e6279f Mon Sep 17 00:00:00 2001 From: Nathan Creger Date: Mon, 12 Feb 2024 15:06:37 -0500 Subject: [PATCH 07/30] upgrade image OS --- Dockerfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5ee7682..559051d 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,6 @@ -FROM alpine +FROM alpine:3.19.1 -RUN apk update && \ - apk upgrade +RUN apk update RUN apk add openjdk8 VOLUME /tmp @@ -15,4 +14,4 @@ RUN apk add --no-cache tzdata ENV TZ=America/Detroit RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone -ENTRYPOINT ["java","-cp","app:app/lib/*","org.kpmp.Application"] +ENTRYPOINT ["java","-cp","app:app/lib/*","org.kpmp.Application"] \ No newline at end of file From 77608873360eba9257c73467a0e54cfd423567ee Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Mon, 12 Feb 2024 16:54:24 -0500 Subject: [PATCH 08/30] KPMP-4959: Initial implementation of getting files by experiment type for participant --- src/main/java/org/kpmp/Query.java | 4 +- .../kpmp/dataSummary/AtlasRepoSummaryRow.java | 8 +-- ...va => AtlasRepositoryLinkInformation.java} | 11 +-- .../kpmp/dataSummary/DataSummaryService.java | 20 +++--- .../kpmp/participant/ParticipantRepoData.java | 40 ++--------- .../ParticipantRepoDataRepository.java | 17 +++++ .../ParticipantRepoDataTypeInformation.java | 10 +-- .../kpmp/participant/ParticipantService.java | 69 ++++++++++++++++--- src/main/resources/application.properties | 7 +- .../resources/knowledge_environment.graphqls | 1 + src/test/java/org/kpmp/QueryTest.java | 20 +++--- .../AtlasRepoSummaryLinkInformationTest.java | 14 ++-- .../dataSummary/AtlasRepoSummaryRowTest.java | 6 +- .../dataSummary/DataSummaryServiceTest.java | 6 +- ...articipantRepoDataTypeInformationTest.java | 6 +- 15 files changed, 146 insertions(+), 93 deletions(-) rename src/main/java/org/kpmp/dataSummary/{AtlasRepoSummaryLinkInformation.java => AtlasRepositoryLinkInformation.java} (68%) create mode 100644 src/main/java/org/kpmp/participant/ParticipantRepoDataRepository.java diff --git a/src/main/java/org/kpmp/Query.java b/src/main/java/org/kpmp/Query.java index be4754a..aedcf67 100755 --- a/src/main/java/org/kpmp/Query.java +++ b/src/main/java/org/kpmp/Query.java @@ -231,7 +231,7 @@ public List getAtlasMessages() throws Exception { } } - public List getRepoCountsByExperimentalStrategy(String redcapId) { - return null; + public List getRepoCountsForParticipantByExperimentalStrategy(String redcapId) { + return participantService.getRepoCountsByExperimentalStrategy(redcapId); } } \ No newline at end of file diff --git a/src/main/java/org/kpmp/dataSummary/AtlasRepoSummaryRow.java b/src/main/java/org/kpmp/dataSummary/AtlasRepoSummaryRow.java index 60e356a..f470977 100644 --- a/src/main/java/org/kpmp/dataSummary/AtlasRepoSummaryRow.java +++ b/src/main/java/org/kpmp/dataSummary/AtlasRepoSummaryRow.java @@ -4,9 +4,9 @@ public class AtlasRepoSummaryRow { private int openCount; private int controlledCount; private String omicsType; - private AtlasRepoSummaryLinkInformation linkInformation; + private AtlasRepositoryLinkInformation linkInformation; - public AtlasRepoSummaryRow(String omicsType, AtlasRepoSummaryLinkInformation linkInformation) { + public AtlasRepoSummaryRow(String omicsType, AtlasRepositoryLinkInformation linkInformation) { this.omicsType = omicsType; this.linkInformation = linkInformation; } @@ -43,11 +43,11 @@ public void addToOpenCount(int count) { this.openCount = this.openCount + count; } - public AtlasRepoSummaryLinkInformation getLinkInformation() { + public AtlasRepositoryLinkInformation getLinkInformation() { return linkInformation; } - public void setLinkInformation(AtlasRepoSummaryLinkInformation linkInformation) { + public void setLinkInformation(AtlasRepositoryLinkInformation linkInformation) { this.linkInformation = linkInformation; } } diff --git a/src/main/java/org/kpmp/dataSummary/AtlasRepoSummaryLinkInformation.java b/src/main/java/org/kpmp/dataSummary/AtlasRepositoryLinkInformation.java similarity index 68% rename from src/main/java/org/kpmp/dataSummary/AtlasRepoSummaryLinkInformation.java rename to src/main/java/org/kpmp/dataSummary/AtlasRepositoryLinkInformation.java index e4e1edb..79e2434 100644 --- a/src/main/java/org/kpmp/dataSummary/AtlasRepoSummaryLinkInformation.java +++ b/src/main/java/org/kpmp/dataSummary/AtlasRepositoryLinkInformation.java @@ -3,12 +3,15 @@ import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; -public class AtlasRepoSummaryLinkInformation { +public class AtlasRepositoryLinkInformation { + public static final String EXPERIMENTAL_STRATEGY = "experimental_strategy"; + public static final String DATA_CATEGORY = "data_category"; + private String linkType; private String linkValue; - public AtlasRepoSummaryLinkInformation(String linkType, String linkValue) { + public AtlasRepositoryLinkInformation(String linkType, String linkValue) { this.setLinkType(linkType); this.setLinkValue(linkValue); } @@ -36,8 +39,8 @@ public int hashCode() { @Override public boolean equals(Object obj) { - if (obj instanceof AtlasRepoSummaryLinkInformation) { - final AtlasRepoSummaryLinkInformation other = (AtlasRepoSummaryLinkInformation) obj; + if (obj instanceof AtlasRepositoryLinkInformation) { + final AtlasRepositoryLinkInformation other = (AtlasRepositoryLinkInformation) obj; return new EqualsBuilder().append(linkType, other.getLinkType()).append(linkValue, other.getLinkValue()).isEquals(); } else { diff --git a/src/main/java/org/kpmp/dataSummary/DataSummaryService.java b/src/main/java/org/kpmp/dataSummary/DataSummaryService.java index 9a3fc9e..6ac2f07 100755 --- a/src/main/java/org/kpmp/dataSummary/DataSummaryService.java +++ b/src/main/java/org/kpmp/dataSummary/DataSummaryService.java @@ -13,17 +13,21 @@ import org.kpmp.TissueTypeEnum; import org.kpmp.file.ARFileInfoService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @Service public class DataSummaryService { - private static final String EXPERIMENTAL_STRATEGY = "experimental_strategy"; - private static final String DATA_CATEGORY = "data_category"; + + @Value("${experiment.label.clinicalStudyData}") + private String CLINICAL_STUDY_DATA; + @Value("${experiment.label.biomarkers}") + private String BIOMARKERS; + @Value("${experiment.category.biomarker}") + private String BIOMARKER; + private static final String CONTROLLED_ACCESS = "controlled"; private static final String OPEN_ACCESS = "open"; - private static final String BIOMARKERS = "Biomarkers"; - private static final String BIOMARKER = "Biomarker"; - private static final String CLINICAL_STUDY_DATA = "Clinical Study Data"; private DataSummaryRepository dataSummaryRepository; private AtlasRepoSummaryRepository repoSummaryRepository; @@ -73,12 +77,12 @@ public int compare(AtlasRepoSummaryRow one, AtlasRepoSummaryRow two) { return new AtlasRepoSummaryResult(results, fileInfoService.getRepositoryTotalFileCount()); } - private AtlasRepoSummaryLinkInformation getLinkInformation(ExperimentalStrategyValue experimentalStrategy) { + private AtlasRepositoryLinkInformation getLinkInformation(ExperimentalStrategyValue experimentalStrategy) { if (experimentalStrategy.getDataCategory().equalsIgnoreCase(BIOMARKER) || experimentalStrategy.getDataType().equalsIgnoreCase(CLINICAL_STUDY_DATA)) { - return new AtlasRepoSummaryLinkInformation(DATA_CATEGORY, experimentalStrategy.getDataCategory()); + return new AtlasRepositoryLinkInformation(AtlasRepositoryLinkInformation.DATA_CATEGORY, experimentalStrategy.getDataCategory()); } else { - return new AtlasRepoSummaryLinkInformation(EXPERIMENTAL_STRATEGY, + return new AtlasRepositoryLinkInformation(AtlasRepositoryLinkInformation.EXPERIMENTAL_STRATEGY, experimentalStrategy.getExperimentalStrategy()); } } diff --git a/src/main/java/org/kpmp/participant/ParticipantRepoData.java b/src/main/java/org/kpmp/participant/ParticipantRepoData.java index 91ecc09..7bd6443 100644 --- a/src/main/java/org/kpmp/participant/ParticipantRepoData.java +++ b/src/main/java/org/kpmp/participant/ParticipantRepoData.java @@ -1,51 +1,23 @@ package org.kpmp.participant; +import javax.persistence.Column; import javax.persistence.Entity; -import javax.persistence.EntityResult; -import javax.persistence.FieldResult; import javax.persistence.Id; -import javax.persistence.NamedNativeQuery; -import javax.persistence.SqlResultSetMapping; - -@Entity -@NamedNativeQuery (name="fileCountByExperimentAndParticipant", - query="select a.experimental_strategy, b.data_type, b.data_category, coalesce(count,0) as count " - + "from (select distinct experimental_strategy from repo_file_v) as a " - + "left join (select count(*) as count, experimental_strategy, data_type, data_category from repo_file_v where redcap_id= :redcap_id " - + "group by experimental_strategy) as b on a.experimental_strategy=b.experimental_strategy", - resultSetMapping = "participantRepoData") -@SqlResultSetMapping( - name = "participantRepoData", - entities = { - @EntityResult( - entityClass=org.kpmp.participant.ParticipantRepoData.class, - fields={ - @FieldResult(name="experimentalStrategy",column="experimental_strategy"), - @FieldResult(name="dataType", column="data_type"), - @FieldResult(name="dataCategory", column="data_category"), - @FieldResult(name="count", column="count") - } - ) - } -) +@Entity public class ParticipantRepoData { @Id + @Column(name = "experimental_strategy") private String experimentalStrategy; + @Column(name = "data_type") private String dataType; + @Column(name = "data_category") private String dataCategory; + @Column(name = "count") private int count; - public ParticipantRepoData(String experimentalStrategy, String dataType, String dataCategory, int count) { - this.experimentalStrategy = experimentalStrategy; - this.dataCategory = dataCategory; - this.dataType = dataType; - this.count = count; - } - - public String getDataCategory() { return dataCategory; } diff --git a/src/main/java/org/kpmp/participant/ParticipantRepoDataRepository.java b/src/main/java/org/kpmp/participant/ParticipantRepoDataRepository.java new file mode 100644 index 0000000..03a1d20 --- /dev/null +++ b/src/main/java/org/kpmp/participant/ParticipantRepoDataRepository.java @@ -0,0 +1,17 @@ +package org.kpmp.participant; +import java.util.List; + +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +public interface ParticipantRepoDataRepository extends CrudRepository { + + + @Query(value = "select a.experimental_strategy, b.data_type, b.data_category, coalesce(count,0) as count " + + "from (select distinct experimental_strategy from repo_file_v) as a " + + "left join (select count(*) as count, experimental_strategy, data_type, data_category from repo_file_v where redcap_id= :redcap_id " + + "group by experimental_strategy) as b on a.experimental_strategy=b.experimental_strategy", nativeQuery = true) + public List findFileCountsByParticipant(@Param("redcap_id") String redcapId); + +} \ No newline at end of file diff --git a/src/main/java/org/kpmp/participant/ParticipantRepoDataTypeInformation.java b/src/main/java/org/kpmp/participant/ParticipantRepoDataTypeInformation.java index 14bef60..bd640eb 100644 --- a/src/main/java/org/kpmp/participant/ParticipantRepoDataTypeInformation.java +++ b/src/main/java/org/kpmp/participant/ParticipantRepoDataTypeInformation.java @@ -1,14 +1,14 @@ package org.kpmp.participant; -import org.kpmp.dataSummary.AtlasRepoSummaryLinkInformation; +import org.kpmp.dataSummary.AtlasRepositoryLinkInformation; public class ParticipantRepoDataTypeInformation { private String dataType; private Integer count; - private AtlasRepoSummaryLinkInformation linkInformation; + private AtlasRepositoryLinkInformation linkInformation; - public ParticipantRepoDataTypeInformation(String dataType, Integer count, AtlasRepoSummaryLinkInformation linkInformation) { + public ParticipantRepoDataTypeInformation(String dataType, Integer count, AtlasRepositoryLinkInformation linkInformation) { this.dataType = dataType; this.count = count; this.linkInformation = linkInformation; @@ -30,11 +30,11 @@ public void setCount(Integer count) { this.count = count; } - public AtlasRepoSummaryLinkInformation getLinkInformation() { + public AtlasRepositoryLinkInformation getLinkInformation() { return linkInformation; } - public void setLinkInformation(AtlasRepoSummaryLinkInformation linkInformation) { + public void setLinkInformation(AtlasRepositoryLinkInformation linkInformation) { this.linkInformation = linkInformation; } } diff --git a/src/main/java/org/kpmp/participant/ParticipantService.java b/src/main/java/org/kpmp/participant/ParticipantService.java index 1cc0b94..272d4cc 100755 --- a/src/main/java/org/kpmp/participant/ParticipantService.java +++ b/src/main/java/org/kpmp/participant/ParticipantService.java @@ -1,21 +1,34 @@ package org.kpmp.participant; import java.util.ArrayList; +import java.util.Collection; +import java.util.Comparator; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.kpmp.FullDataTypeEnum; import org.kpmp.TissueTypeEnum; -import org.kpmp.dataSummary.AtlasRepoSummaryLinkInformation; +import org.kpmp.dataSummary.AtlasRepositoryLinkInformation; import org.kpmp.dataSummary.DataSummaryRepository; import org.kpmp.geneExpressionSummary.regionalProteomics.RPParticipantRepository; import org.kpmp.geneExpressionSummary.regionalTranscriptomics.RTParticipantRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @Service public class ParticipantService { + @Value("${experiment.label.clinicalStudyData}") + private String CLINICAL_STUDY_DATA; + @Value("${experiment.label.biomarkers}") + private String BIOMARKERS; + @Value("${experiment.category.biomarker}") + private String BIOMARKER; + + private ParticipantSummaryDatasetRepository participantSummaryDatasetRepository; private DataSummaryRepository dataSummaryRepo; private SpatialViewerTypeRepository svTypeRepo; @@ -26,14 +39,15 @@ public class ParticipantService { private final String SPATIAL_VIEWER_LINK_VIEW = "sv_link_v"; private SingleNucleusMetadataRepository snMetadataRepo; private RTParticipantRepository rtParticipantRepo; - + private ParticipantRepoDataRepository fileByParticipantRepo; private RPParticipantRepository rpParticipantRepository; @Autowired public ParticipantService(DataSummaryRepository dataSummaryRepo, SpatialViewerTypeRepository svTypeRepo, SingleCellMetadataRepository scMetadataRepo, SingleNucleusMetadataRepository snMetadataRepo, RTParticipantRepository rtParticipantRepo, - ParticipantSummaryDatasetRepository participantSummaryDatasetRepository, RPParticipantRepository rpParticipantRepository) { + ParticipantSummaryDatasetRepository participantSummaryDatasetRepository, RPParticipantRepository rpParticipantRepository, + ParticipantRepoDataRepository fileByParticipantRepo) { this.dataSummaryRepo = dataSummaryRepo; this.svTypeRepo = svTypeRepo; this.scMetadataRepo = scMetadataRepo; @@ -41,6 +55,7 @@ public ParticipantService(DataSummaryRepository dataSummaryRepo, SpatialViewerTy this.rtParticipantRepo = rtParticipantRepo; this.participantSummaryDatasetRepository = participantSummaryDatasetRepository; this.rpParticipantRepository = rpParticipantRepository; + this.fileByParticipantRepo = fileByParticipantRepo; } public ParticipantSummaryDataset getParticipantSummaryDataset(String redcapId) { @@ -75,19 +90,51 @@ public ParticipantDataTypeSummary getExperimentCounts(String redcapId) { public ParticipantRepoDataTypeInformation getTotalFilesCount(String redcapId) { String participant_id = dataSummaryRepo.getParticipantIDString(redcapId); Integer totalCount = dataSummaryRepo.getParticipantTotalFileCount(participant_id); - AtlasRepoSummaryLinkInformation linkInfo = new AtlasRepoSummaryLinkInformation("redcap_id", redcapId); + AtlasRepositoryLinkInformation linkInfo = new AtlasRepositoryLinkInformation("redcap_id", redcapId); ParticipantRepoDataTypeInformation res = new ParticipantRepoDataTypeInformation("", totalCount, linkInfo); return res; } public List getRepoCountsByExperimentalStrategy(String redcapId) { - // @Query(value="select a.experimental_strategy, b.data_type, b.data_category ,coalesce(count,0) as count " - // + "from (select distinct experimental_strategy from repo_file_v) as a " - // + "left join (select count(*) as count, experimental_strategy, data_type, data_category from repo_file_v where redcap_id= :redcap_id " - // + "group by experimental_strategy) as b on a.experimental_strategy=b.experimental_strategy;", nativeQuery = true) - // List< - return null; + // this behaves in much the same way as DataSummaryService.getAtlasRepoSummary does to coallate link types together + // But, the underlying object structure was different enough I couldn't figure out a way to merge them into one implemention + + List fileCountsForParticipant = fileByParticipantRepo.findFileCountsByParticipant(redcapId); + Map resultMap = new HashMap<>(); + + for (ParticipantRepoData participantRepoData : fileCountsForParticipant) { + String experimentalStrategy = participantRepoData.getExperimentalStrategy(); + AtlasRepositoryLinkInformation linkInfo = new AtlasRepositoryLinkInformation(AtlasRepositoryLinkInformation.EXPERIMENTAL_STRATEGY, experimentalStrategy); + if (experimentalStrategy.isEmpty() && participantRepoData.getDataType().equalsIgnoreCase(CLINICAL_STUDY_DATA)) { + experimentalStrategy = CLINICAL_STUDY_DATA; + linkInfo = new AtlasRepositoryLinkInformation(AtlasRepositoryLinkInformation.DATA_CATEGORY, participantRepoData.getDataCategory()); + } else if (participantRepoData.getDataCategory().equalsIgnoreCase(BIOMARKER)) { + experimentalStrategy = BIOMARKERS; + linkInfo = new AtlasRepositoryLinkInformation(AtlasRepositoryLinkInformation.DATA_CATEGORY, participantRepoData.getDataCategory()); + } + + if (resultMap.containsKey(experimentalStrategy)) { + ParticipantRepoDataTypeInformation existingRecord = resultMap.get(experimentalStrategy); + existingRecord.setCount(existingRecord.getCount() + participantRepoData.getCount()); + } else { + + ParticipantRepoDataTypeInformation dataInformation = new ParticipantRepoDataTypeInformation(experimentalStrategy, participantRepoData.getCount(), linkInfo); + + resultMap.put(experimentalStrategy, dataInformation); + } + + } + + Collection values = resultMap.values(); + List results = new ArrayList<>(values); + results.sort(new Comparator() { + public int compare(ParticipantRepoDataTypeInformation one, ParticipantRepoDataTypeInformation two) { + return one.getDataType().compareToIgnoreCase(two.getDataType()); + } + }); + + return results; } private List getExplorerCounts(String redcapId) { @@ -158,7 +205,7 @@ private List getRepositoryCounts(String redc List repoDataTypes = dataSummaryRepo.getRepoDataTypes(); for (String repoDataType : repoDataTypes) { Integer count = dataSummaryRepo.getParticipantRepoFileDataTypeCount(redcapId, repoDataType); - AtlasRepoSummaryLinkInformation linkInformation = new AtlasRepoSummaryLinkInformation("data_type", repoDataType); + AtlasRepositoryLinkInformation linkInformation = new AtlasRepositoryLinkInformation("data_type", repoDataType); ParticipantRepoDataTypeInformation dataTypeInfo = new ParticipantRepoDataTypeInformation(repoDataType, count, linkInformation); repoCounts.add(dataTypeInfo); } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index ce7be51..ed75838 100755 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -8,4 +8,9 @@ graphql.servlet.exception-handlers-enabled=true spring.jpa.show_sql=false spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect server.port=3030 -spring.jpa.properties.hibernate.jdbc.time_zone=America/Detroit \ No newline at end of file +spring.jpa.properties.hibernate.jdbc.time_zone=America/Detroit + + +experiment.label.clinicalStudyData="Clinical Study Data" +experiment.label.biomarkers="Biomarkers" +experiment.category.biomarker="Biomarker" \ No newline at end of file diff --git a/src/main/resources/knowledge_environment.graphqls b/src/main/resources/knowledge_environment.graphqls index 2150d36..79d5199 100755 --- a/src/main/resources/knowledge_environment.graphqls +++ b/src/main/resources/knowledge_environment.graphqls @@ -19,6 +19,7 @@ type Query { getTissueTypeSummaryData: [ParticipantTissueTypeSummary] getAtlasSummaryRows: AtlasRepoSummaryResult getAtlasMessages: [AtlasMessages] + getRepoCountsForParticipantByExperimentalStrategy(redcapId: String!): [ParticipantRepoDataTypeInformation] } type AtlasMessages { diff --git a/src/test/java/org/kpmp/QueryTest.java b/src/test/java/org/kpmp/QueryTest.java index b54428e..25920ea 100755 --- a/src/test/java/org/kpmp/QueryTest.java +++ b/src/test/java/org/kpmp/QueryTest.java @@ -38,6 +38,7 @@ import org.kpmp.geneExpressionSummary.singleCell.SCRNAGeneExpressionExpressionSummaryValue; import org.kpmp.geneExpressionSummary.singleNucleus.SNRNAGeneExpressionExpressionSummaryValue; import org.kpmp.participant.ParticipantDataTypeSummary; +import org.kpmp.participant.ParticipantRepoDataTypeInformation; import org.kpmp.participant.ParticipantRepoDataTypeSummary; import org.kpmp.participant.ParticipantService; import org.kpmp.participant.ParticipantSummaryDataset; @@ -290,13 +291,6 @@ public void testParticipantSummaryDataset() throws Exception { verify(participantService).getParticipantSummaryDataset("participant_id"); } - public void testParticipantClinicalDataset() throws Exception { - ParticipantSummaryDataset expected = new ParticipantSummaryDataset(); - when(participantService.getParticipantSummaryDataset("participant_id")).thenReturn(expected); - - assertEquals(expected, query.participantClinicalDataset("participant_id")); - } - public void getParticipantTissueTypeSummary() throws Exception { List expectedResult = new ArrayList<>(); @@ -311,7 +305,7 @@ public void getParticipantTissueTypeSummary() throws Exception { @Test public void testGetAtlasMessage() throws Exception { AtlasMessage atlasMessage = new AtlasMessage(); - DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); String endDateString = "2023-12-25"; String startDateString = "2023-12-01"; Date endDate = dateFormat.parse(endDateString); @@ -325,4 +319,14 @@ public void testGetAtlasMessage() throws Exception { when(atlasMessageService.getAtlasMessage()).thenReturn(expectedResult); assertEquals(expectedResult, query.getAtlasMessages()); } + + @Test + public void testGetRepoCountsForParticipantByExperimentalStrategy() { + List expectedResults = new ArrayList<>(); + when(participantService.getRepoCountsByExperimentalStrategy("redcapId")).thenReturn(expectedResults); + + List result = query.getRepoCountsForParticipantByExperimentalStrategy("redcapId"); + + assertEquals(expectedResults, result); + } } \ No newline at end of file diff --git a/src/test/java/org/kpmp/dataSummary/AtlasRepoSummaryLinkInformationTest.java b/src/test/java/org/kpmp/dataSummary/AtlasRepoSummaryLinkInformationTest.java index c7a7425..053c424 100644 --- a/src/test/java/org/kpmp/dataSummary/AtlasRepoSummaryLinkInformationTest.java +++ b/src/test/java/org/kpmp/dataSummary/AtlasRepoSummaryLinkInformationTest.java @@ -19,7 +19,7 @@ public void tearDown() throws Exception { @Test public void testConstructor() { - AtlasRepoSummaryLinkInformation linkInfo = new AtlasRepoSummaryLinkInformation("type", "value"); + AtlasRepositoryLinkInformation linkInfo = new AtlasRepositoryLinkInformation("type", "value"); assertEquals("type", linkInfo.getLinkType()); assertEquals("value", linkInfo.getLinkValue()); @@ -27,7 +27,7 @@ public void testConstructor() { @Test public void testSetLinkType() { - AtlasRepoSummaryLinkInformation linkInfo = new AtlasRepoSummaryLinkInformation("type", "value"); + AtlasRepositoryLinkInformation linkInfo = new AtlasRepositoryLinkInformation("type", "value"); linkInfo.setLinkType("anotherType"); assertEquals("anotherType", linkInfo.getLinkType()); @@ -35,7 +35,7 @@ public void testSetLinkType() { @Test public void testSetLinkValue() { - AtlasRepoSummaryLinkInformation linkInfo = new AtlasRepoSummaryLinkInformation("type", "value"); + AtlasRepositoryLinkInformation linkInfo = new AtlasRepositoryLinkInformation("type", "value"); linkInfo.setLinkValue("another value"); assertEquals("another value", linkInfo.getLinkValue()); @@ -44,11 +44,11 @@ public void testSetLinkValue() { @SuppressWarnings("unlikely-arg-type") @Test public void testEqualsAndHashCode() throws Exception { - AtlasRepoSummaryLinkInformation base = new AtlasRepoSummaryLinkInformation("linkType", "linkValue"); - AtlasRepoSummaryLinkInformation same = new AtlasRepoSummaryLinkInformation("linkType", "linkValue"); - AtlasRepoSummaryLinkInformation differentLinkType = new AtlasRepoSummaryLinkInformation("another type", + AtlasRepositoryLinkInformation base = new AtlasRepositoryLinkInformation("linkType", "linkValue"); + AtlasRepositoryLinkInformation same = new AtlasRepositoryLinkInformation("linkType", "linkValue"); + AtlasRepositoryLinkInformation differentLinkType = new AtlasRepositoryLinkInformation("another type", "linkValue"); - AtlasRepoSummaryLinkInformation differentLinkValue = new AtlasRepoSummaryLinkInformation("linkType", + AtlasRepositoryLinkInformation differentLinkValue = new AtlasRepositoryLinkInformation("linkType", "another value"); String anotherObject = "hey there"; diff --git a/src/test/java/org/kpmp/dataSummary/AtlasRepoSummaryRowTest.java b/src/test/java/org/kpmp/dataSummary/AtlasRepoSummaryRowTest.java index 1d12217..4bd8430 100644 --- a/src/test/java/org/kpmp/dataSummary/AtlasRepoSummaryRowTest.java +++ b/src/test/java/org/kpmp/dataSummary/AtlasRepoSummaryRowTest.java @@ -12,7 +12,7 @@ public class AtlasRepoSummaryRowTest { @Mock - AtlasRepoSummaryLinkInformation linkInformation; + AtlasRepositoryLinkInformation linkInformation; private AtlasRepoSummaryRow row; @Before @@ -29,7 +29,7 @@ public void tearDown() throws Exception { @Test public void testConstructor() throws Exception { - AtlasRepoSummaryLinkInformation expectedLinkInformation = mock(AtlasRepoSummaryLinkInformation.class); + AtlasRepositoryLinkInformation expectedLinkInformation = mock(AtlasRepositoryLinkInformation.class); AtlasRepoSummaryRow rowToTest = new AtlasRepoSummaryRow("stuff", expectedLinkInformation); assertEquals("stuff", rowToTest.getOmicsType()); @@ -76,7 +76,7 @@ public void testAddToOpenCount() { @Test public void testSetLinkInformation() { - AtlasRepoSummaryLinkInformation expectedLinkInformation = mock(AtlasRepoSummaryLinkInformation.class); + AtlasRepositoryLinkInformation expectedLinkInformation = mock(AtlasRepositoryLinkInformation.class); row.setLinkInformation(expectedLinkInformation); assertEquals(expectedLinkInformation, row.getLinkInformation()); diff --git a/src/test/java/org/kpmp/dataSummary/DataSummaryServiceTest.java b/src/test/java/org/kpmp/dataSummary/DataSummaryServiceTest.java index bb64de3..9de2776 100755 --- a/src/test/java/org/kpmp/dataSummary/DataSummaryServiceTest.java +++ b/src/test/java/org/kpmp/dataSummary/DataSummaryServiceTest.java @@ -82,17 +82,17 @@ public void testGetAtlasRepoSummary() throws Exception { assertEquals("Biomarkers", summaryRows.get(0).getOmicsType()); assertEquals(0, summaryRows.get(0).getControlledCount()); assertEquals(15, summaryRows.get(0).getOpenCount()); - assertEquals(new AtlasRepoSummaryLinkInformation("data_category", "Biomarker"), + assertEquals(new AtlasRepositoryLinkInformation("data_category", "Biomarker"), summaryRows.get(0).getLinkInformation()); assertEquals("Clinical Study Data", summaryRows.get(1).getOmicsType()); assertEquals(0, summaryRows.get(1).getControlledCount()); assertEquals(1, summaryRows.get(1).getOpenCount()); - assertEquals(new AtlasRepoSummaryLinkInformation("data_category", "stuff"), + assertEquals(new AtlasRepositoryLinkInformation("data_category", "stuff"), summaryRows.get(1).getLinkInformation()); assertEquals("strategy1", summaryRows.get(2).getOmicsType()); assertEquals(10, summaryRows.get(2).getControlledCount()); assertEquals(10, summaryRows.get(2).getOpenCount()); - assertEquals(new AtlasRepoSummaryLinkInformation("experimental_strategy", "strategy1"), + assertEquals(new AtlasRepositoryLinkInformation("experimental_strategy", "strategy1"), summaryRows.get(2).getLinkInformation()); assertEquals(Long.valueOf(36), result.getTotalFiles()); diff --git a/src/test/java/org/kpmp/participant/ParticipantRepoDataTypeInformationTest.java b/src/test/java/org/kpmp/participant/ParticipantRepoDataTypeInformationTest.java index 83d8de6..cc769a8 100644 --- a/src/test/java/org/kpmp/participant/ParticipantRepoDataTypeInformationTest.java +++ b/src/test/java/org/kpmp/participant/ParticipantRepoDataTypeInformationTest.java @@ -6,7 +6,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.kpmp.dataSummary.AtlasRepoSummaryLinkInformation; +import org.kpmp.dataSummary.AtlasRepositoryLinkInformation; public class ParticipantRepoDataTypeInformationTest { @@ -14,7 +14,7 @@ public class ParticipantRepoDataTypeInformationTest { @Before public void setUp() throws Exception { - info = new ParticipantRepoDataTypeInformation("abc", 1, mock(AtlasRepoSummaryLinkInformation.class)); + info = new ParticipantRepoDataTypeInformation("abc", 1, mock(AtlasRepositoryLinkInformation.class)); } @After @@ -38,7 +38,7 @@ public void testSetCount() { @Test public void testSetLinkInformation() { - AtlasRepoSummaryLinkInformation linkInfo = mock(AtlasRepoSummaryLinkInformation.class); + AtlasRepositoryLinkInformation linkInfo = mock(AtlasRepositoryLinkInformation.class); info.setLinkInformation(linkInfo); assertEquals(linkInfo, info.getLinkInformation()); } From c1a409bb037c12d94a3876968c74a6f65fd78ac2 Mon Sep 17 00:00:00 2001 From: Nathan Creger Date: Tue, 13 Feb 2024 10:03:15 -0500 Subject: [PATCH 09/30] create basic .dockerignore file --- .dockerignore | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..26c3b69 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +.* +*.iml +gradle +src +build/* +!build/docker \ No newline at end of file From 59a0af77fa8bb2fe2901df00221cbb7297882ffb Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Tue, 13 Feb 2024 14:34:47 -0500 Subject: [PATCH 10/30] KPMP-4959: Add tests around ParticipantService --- src/main/java/org/kpmp/Query.java | 4 +- .../kpmp/participant/ParticipantService.java | 2 +- .../resources/knowledge_environment.graphqls | 2 +- src/test/java/org/kpmp/QueryTest.java | 6 +- .../participant/ParticipantServiceTest.java | 104 +++++++++++++++++- 5 files changed, 109 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/kpmp/Query.java b/src/main/java/org/kpmp/Query.java index aedcf67..b3cf843 100755 --- a/src/main/java/org/kpmp/Query.java +++ b/src/main/java/org/kpmp/Query.java @@ -231,7 +231,7 @@ public List getAtlasMessages() throws Exception { } } - public List getRepoCountsForParticipantByExperimentalStrategy(String redcapId) { - return participantService.getRepoCountsByExperimentalStrategy(redcapId); + public List getExperimentalStrategyCountsByParticipant(String redcapId) { + return participantService.getExperimentalStrategyCountsByParticipant(redcapId); } } \ No newline at end of file diff --git a/src/main/java/org/kpmp/participant/ParticipantService.java b/src/main/java/org/kpmp/participant/ParticipantService.java index 272d4cc..137dd8b 100755 --- a/src/main/java/org/kpmp/participant/ParticipantService.java +++ b/src/main/java/org/kpmp/participant/ParticipantService.java @@ -96,7 +96,7 @@ public ParticipantRepoDataTypeInformation getTotalFilesCount(String redcapId) { return res; } - public List getRepoCountsByExperimentalStrategy(String redcapId) { + public List getExperimentalStrategyCountsByParticipant(String redcapId) { // this behaves in much the same way as DataSummaryService.getAtlasRepoSummary does to coallate link types together // But, the underlying object structure was different enough I couldn't figure out a way to merge them into one implemention diff --git a/src/main/resources/knowledge_environment.graphqls b/src/main/resources/knowledge_environment.graphqls index 79d5199..00b55a7 100755 --- a/src/main/resources/knowledge_environment.graphqls +++ b/src/main/resources/knowledge_environment.graphqls @@ -19,7 +19,7 @@ type Query { getTissueTypeSummaryData: [ParticipantTissueTypeSummary] getAtlasSummaryRows: AtlasRepoSummaryResult getAtlasMessages: [AtlasMessages] - getRepoCountsForParticipantByExperimentalStrategy(redcapId: String!): [ParticipantRepoDataTypeInformation] + getExperimentalStrategyCountsByParticipant(redcapId: String!): [ParticipantRepoDataTypeInformation] } type AtlasMessages { diff --git a/src/test/java/org/kpmp/QueryTest.java b/src/test/java/org/kpmp/QueryTest.java index 25920ea..ea3afde 100755 --- a/src/test/java/org/kpmp/QueryTest.java +++ b/src/test/java/org/kpmp/QueryTest.java @@ -321,11 +321,11 @@ public void testGetAtlasMessage() throws Exception { } @Test - public void testGetRepoCountsForParticipantByExperimentalStrategy() { + public void testGetExperimentalStrategyCountsByParticipant() { List expectedResults = new ArrayList<>(); - when(participantService.getRepoCountsByExperimentalStrategy("redcapId")).thenReturn(expectedResults); + when(participantService.getExperimentalStrategyCountsByParticipant("redcapId")).thenReturn(expectedResults); - List result = query.getRepoCountsForParticipantByExperimentalStrategy("redcapId"); + List result = query.getExperimentalStrategyCountsByParticipant("redcapId"); assertEquals(expectedResults, result); } diff --git a/src/test/java/org/kpmp/participant/ParticipantServiceTest.java b/src/test/java/org/kpmp/participant/ParticipantServiceTest.java index 15814c0..f7cb616 100755 --- a/src/test/java/org/kpmp/participant/ParticipantServiceTest.java +++ b/src/test/java/org/kpmp/participant/ParticipantServiceTest.java @@ -1,6 +1,7 @@ package org.kpmp.participant; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -16,6 +17,7 @@ import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +import org.springframework.test.util.ReflectionTestUtils; public class ParticipantServiceTest { @@ -32,7 +34,8 @@ public class ParticipantServiceTest { private SingleNucleusMetadataRepository snMetadataRepo; @Mock private RTParticipantRepository rtParticipantRepo; - + @Mock + private ParticipantRepoDataRepository fileByParticipantRepo; @Mock private RPParticipantRepository rpParticipantRepository; @@ -40,7 +43,7 @@ public class ParticipantServiceTest { public void setUp() throws Exception { MockitoAnnotations.openMocks(this); participantService = new ParticipantService(dataSummaryRepo, svTypeRepo, scMetadataRepo, snMetadataRepo, - rtParticipantRepo, participantSummaryDatasetRepository, rpParticipantRepository); + rtParticipantRepo, participantSummaryDatasetRepository, rpParticipantRepository,fileByParticipantRepo); } @After @@ -178,4 +181,101 @@ public void testGetTotalFilesCount() throws Exception { assertEquals("redcap_id", result.getLinkInformation().getLinkType()); assertEquals("123", result.getLinkInformation().getLinkValue()); } + + @Test + public void testGetExperimentalStrategyCountsByParticipant() { + ParticipantRepoData experimentGroup1 = new ParticipantRepoData(); + experimentGroup1.setExperimentalStrategy("experiment1"); + experimentGroup1.setCount(1); + experimentGroup1.setDataCategory("something else"); + ParticipantRepoData experimentGroup2 = new ParticipantRepoData(); + experimentGroup2.setExperimentalStrategy(""); + experimentGroup2.setCount(2); + experimentGroup2.setDataType("Clinical Study Data"); + experimentGroup2.setDataCategory("another category"); + ParticipantRepoData experimentGroup3 = new ParticipantRepoData(); + experimentGroup3.setExperimentalStrategy("biomarker data"); + experimentGroup3.setDataCategory("Biomarker"); + experimentGroup3.setCount(3); + List experimentsByParticipant = Arrays.asList(experimentGroup1, experimentGroup2, experimentGroup3); + when(fileByParticipantRepo.findFileCountsByParticipant("participantId")).thenReturn(experimentsByParticipant); + ReflectionTestUtils.setField(participantService, "CLINICAL_STUDY_DATA", "Clinical Study Data"); + ReflectionTestUtils.setField(participantService, "BIOMARKERS", "Biomarkers"); + ReflectionTestUtils.setField(participantService, "BIOMARKER", "Biomarker"); + + List actualResults = participantService.getExperimentalStrategyCountsByParticipant("participantId"); + + assertEquals(3, actualResults.size()); + for (ParticipantRepoDataTypeInformation participantRepoDataTypeInformation : actualResults) { + if (participantRepoDataTypeInformation.getDataType().equals("experiment1")) { + assertEquals(Integer.valueOf(1), participantRepoDataTypeInformation.getCount()); + } else if (participantRepoDataTypeInformation.getDataType().equals("Clinical Study Data")) { + assertEquals(Integer.valueOf(2), participantRepoDataTypeInformation.getCount()); + } else if (participantRepoDataTypeInformation.getDataType().equals("Biomarkers")) { + assertEquals(Integer.valueOf(3), participantRepoDataTypeInformation.getCount()); + } else { + fail("unexpected data type: " + participantRepoDataTypeInformation.getDataType()); + } + } + } + + @Test + public void testGetExperimentalStrategyCountsByParticipant_combinesClinicalDataCounts() { + ParticipantRepoData experimentGroup1 = new ParticipantRepoData(); + experimentGroup1.setExperimentalStrategy(""); + experimentGroup1.setCount(1); + experimentGroup1.setDataType("Clinical Study Data"); + experimentGroup1.setDataCategory("something else"); + ParticipantRepoData experimentGroup2 = new ParticipantRepoData(); + experimentGroup2.setExperimentalStrategy(""); + experimentGroup2.setCount(2); + experimentGroup2.setDataType("Clinical Study Data"); + experimentGroup2.setDataCategory("another category"); + List experimentsByParticipant = Arrays.asList(experimentGroup1, experimentGroup2); + when(fileByParticipantRepo.findFileCountsByParticipant("participantId")).thenReturn(experimentsByParticipant); + ReflectionTestUtils.setField(participantService, "CLINICAL_STUDY_DATA", "Clinical Study Data"); + ReflectionTestUtils.setField(participantService, "BIOMARKERS", "Biomarkers"); + ReflectionTestUtils.setField(participantService, "BIOMARKER", "Biomarker"); + + List actualResults = participantService.getExperimentalStrategyCountsByParticipant("participantId"); + + assertEquals(1, actualResults.size()); + for (ParticipantRepoDataTypeInformation participantRepoDataTypeInformation : actualResults) { + if (participantRepoDataTypeInformation.getDataType().equals("Clinical Study Data")) { + assertEquals(Integer.valueOf(3), participantRepoDataTypeInformation.getCount()); + } else { + fail("unexpected data type: " + participantRepoDataTypeInformation.getDataType()); + } + } + } + + @Test + public void testGetExperimentalStrategyCountsByParticipant_combinesBiomarkerCounts() { + ParticipantRepoData experimentGroup1 = new ParticipantRepoData(); + experimentGroup1.setExperimentalStrategy("strat1"); + experimentGroup1.setCount(1); + experimentGroup1.setDataType("stuff"); + experimentGroup1.setDataCategory("Biomarker"); + ParticipantRepoData experimentGroup2 = new ParticipantRepoData(); + experimentGroup2.setExperimentalStrategy("strat2"); + experimentGroup2.setCount(2); + experimentGroup2.setDataType("more stuff"); + experimentGroup2.setDataCategory("Biomarker"); + List experimentsByParticipant = Arrays.asList(experimentGroup1, experimentGroup2); + when(fileByParticipantRepo.findFileCountsByParticipant("participantId")).thenReturn(experimentsByParticipant); + ReflectionTestUtils.setField(participantService, "CLINICAL_STUDY_DATA", "Clinical Study Data"); + ReflectionTestUtils.setField(participantService, "BIOMARKERS", "Biomarkers"); + ReflectionTestUtils.setField(participantService, "BIOMARKER", "Biomarker"); + + List actualResults = participantService.getExperimentalStrategyCountsByParticipant("participantId"); + + assertEquals(1, actualResults.size()); + for (ParticipantRepoDataTypeInformation participantRepoDataTypeInformation : actualResults) { + if (participantRepoDataTypeInformation.getDataType().equals("Biomarkers")) { + assertEquals(Integer.valueOf(3), participantRepoDataTypeInformation.getCount()); + } else { + fail("unexpected data type: " + participantRepoDataTypeInformation.getDataType()); + } + } + } } \ No newline at end of file From 59a81a3efad398bd266ba47c5b2d6e65d325a8ac Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Tue, 13 Feb 2024 14:47:31 -0500 Subject: [PATCH 11/30] KPMP-4959: Finish up tests --- .../dataSummary/DataSummaryServiceTest.java | 4 ++ .../participant/ParticipantRepoDataTest.java | 50 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 src/test/java/org/kpmp/participant/ParticipantRepoDataTest.java diff --git a/src/test/java/org/kpmp/dataSummary/DataSummaryServiceTest.java b/src/test/java/org/kpmp/dataSummary/DataSummaryServiceTest.java index 9de2776..915a7ba 100755 --- a/src/test/java/org/kpmp/dataSummary/DataSummaryServiceTest.java +++ b/src/test/java/org/kpmp/dataSummary/DataSummaryServiceTest.java @@ -15,6 +15,7 @@ import org.kpmp.file.ARFileInfoService; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +import org.springframework.test.util.ReflectionTestUtils; public class DataSummaryServiceTest { private DataSummaryService dataSummaryService; @@ -29,6 +30,9 @@ public class DataSummaryServiceTest { public void setUp() throws Exception { MockitoAnnotations.openMocks(this); dataSummaryService = new DataSummaryService(dataSummaryRepository, atlasRepoSummaryRepository, fileInfoService); + ReflectionTestUtils.setField(dataSummaryService, "CLINICAL_STUDY_DATA", "Clinical Study Data"); + ReflectionTestUtils.setField(dataSummaryService, "BIOMARKERS", "Biomarkers"); + ReflectionTestUtils.setField(dataSummaryService, "BIOMARKER", "Biomarker"); } @After diff --git a/src/test/java/org/kpmp/participant/ParticipantRepoDataTest.java b/src/test/java/org/kpmp/participant/ParticipantRepoDataTest.java new file mode 100644 index 0000000..4cb1c08 --- /dev/null +++ b/src/test/java/org/kpmp/participant/ParticipantRepoDataTest.java @@ -0,0 +1,50 @@ +package org.kpmp.participant; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class ParticipantRepoDataTest { + private ParticipantRepoData participantRepoData; + + @Before + public void setUp() throws Exception { + participantRepoData = new ParticipantRepoData(); + } + + @After + public void tearDown() throws Exception { + participantRepoData = null; + } + + @Test + public void testSetDataCategory() { + participantRepoData.setDataCategory("dataCategory"); + + assertEquals("dataCategory", participantRepoData.getDataCategory()); + } + + @Test + public void testSetExperimentalStrategy() { + participantRepoData.setExperimentalStrategy("strategy"); + + assertEquals("strategy", participantRepoData.getExperimentalStrategy()); + } + + @Test + public void testSetDataType() { + participantRepoData.setDataType("dataType"); + + assertEquals("dataType", participantRepoData.getDataType()); + } + + @Test + public void testSetCount() { + participantRepoData.setCount(3); + + assertEquals(3, participantRepoData.getCount()); + } +} From ec44c55bf467e39dafcd79f3c8922d2736501516 Mon Sep 17 00:00:00 2001 From: Nathan Creger Date: Tue, 13 Feb 2024 15:42:01 -0500 Subject: [PATCH 12/30] pass version property to docker image --- README.md | 5 ++++- build.gradle | 12 ++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ba734ed..4aad256 100755 --- a/README.md +++ b/README.md @@ -15,6 +15,9 @@ Repository for the Atlas Explorer Tool service layer # Build `./gradlew build docker` +The default tag is `latest` if no verison is provided +To pass a version when building the docker image execute +`./gradlew build docker -Pversion=` # Restart Spring @@ -46,4 +49,4 @@ If you have already followed these steps and are still having trouble connecting # Buyer BEWARE Notes to ourselves about the non-dynamic nature of some things in the app (this is not exhaustive) -1. The endpoint `getDataTypeInformationByParticipant` is only partially dynamic. If we add new data types to the Spatial Viewer, it will pick those up without an issue, BUT if/when we add new data types to the Explorer, we will need to update the code that gets counts for data types in Explorer to include the new one. +1. The endpoint `getDataTypeInformationByParticipant` is only partially dynamic. If we add new data types to the Spatial Viewer, it will pick those up without an issue, BUT if/when we add new data types to the Explorer, we will need to update the code that gets counts for data types in Explorer to include the new one. \ No newline at end of file diff --git a/build.gradle b/build.gradle index 0208702..7f5de83 100755 --- a/build.gradle +++ b/build.gradle @@ -59,8 +59,16 @@ task unpack(type: Copy) { into("build/dependency") } +def getProps(){ + if (project.hasProperty("version")){ + return project.getProperty("version") + }else{ + return "latest" + } +} + docker { - name "${project.group}/${jar.baseName}:${jar.version}" + name "${project.group}/${jar.baseName}:" + getProps() copySpec.from(tasks.unpack.outputs).into("dependency") buildArgs(['DEPENDENCY': "dependency"]) -} +} \ No newline at end of file From 2255d979291feaf31b81c34ec8b58c92a999e899 Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Wed, 14 Feb 2024 09:39:04 -0500 Subject: [PATCH 13/30] KPMP-4959: Fix broken endpoint --- src/main/java/org/kpmp/WebConfig.java | 2 ++ src/main/java/org/kpmp/dataSummary/DataSummaryService.java | 4 ++-- .../org/kpmp/participant/ParticipantRepoDataRepository.java | 4 +++- src/main/resources/application.properties | 6 +++--- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/kpmp/WebConfig.java b/src/main/java/org/kpmp/WebConfig.java index 5b7f655..26be3fe 100755 --- a/src/main/java/org/kpmp/WebConfig.java +++ b/src/main/java/org/kpmp/WebConfig.java @@ -1,9 +1,11 @@ package org.kpmp; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.web.servlet.config.annotation.CorsRegistration; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +@EnableAutoConfiguration public class WebConfig extends Application implements WebMvcConfigurer { @Override diff --git a/src/main/java/org/kpmp/dataSummary/DataSummaryService.java b/src/main/java/org/kpmp/dataSummary/DataSummaryService.java index 6ac2f07..a5808cb 100755 --- a/src/main/java/org/kpmp/dataSummary/DataSummaryService.java +++ b/src/main/java/org/kpmp/dataSummary/DataSummaryService.java @@ -18,7 +18,7 @@ @Service public class DataSummaryService { - + @Value("${experiment.label.clinicalStudyData}") private String CLINICAL_STUDY_DATA; @Value("${experiment.label.biomarkers}") @@ -47,7 +47,7 @@ public AtlasRepoSummaryResult getAtlasRepoSummary() throws Exception { for (ExperimentalStrategyValue experimentalStrategyValue : experimentalStrategies) { String experimentalStrategy = experimentalStrategyValue.getExperimentalStrategy(); - if (experimentalStrategy.isEmpty() + if ((experimentalStrategy == null || experimentalStrategy.isEmpty() || experimentalStrategy.equals("")) && experimentalStrategyValue.getDataType().equalsIgnoreCase(CLINICAL_STUDY_DATA)) { experimentalStrategy = CLINICAL_STUDY_DATA; } else if (experimentalStrategyValue.getDataCategory().equalsIgnoreCase(BIOMARKER)) { diff --git a/src/main/java/org/kpmp/participant/ParticipantRepoDataRepository.java b/src/main/java/org/kpmp/participant/ParticipantRepoDataRepository.java index 03a1d20..e89b5d6 100644 --- a/src/main/java/org/kpmp/participant/ParticipantRepoDataRepository.java +++ b/src/main/java/org/kpmp/participant/ParticipantRepoDataRepository.java @@ -4,8 +4,10 @@ import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; -public interface ParticipantRepoDataRepository extends CrudRepository { +@Repository +public interface ParticipantRepoDataRepository extends CrudRepository { @Query(value = "select a.experimental_strategy, b.data_type, b.data_category, coalesce(count,0) as count " diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index ed75838..f6d43aa 100755 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -11,6 +11,6 @@ server.port=3030 spring.jpa.properties.hibernate.jdbc.time_zone=America/Detroit -experiment.label.clinicalStudyData="Clinical Study Data" -experiment.label.biomarkers="Biomarkers" -experiment.category.biomarker="Biomarker" \ No newline at end of file +experiment.label.clinicalStudyData=Clinical Study Data +experiment.label.biomarkers=Biomarkers +experiment.category.biomarker=Biomarker \ No newline at end of file From 0fb1c4452125b100efff1d20f889ba771c4156e4 Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Wed, 14 Feb 2024 10:06:34 -0500 Subject: [PATCH 14/30] KPMP-4959: Fix query to no longer get null data category values --- .../org/kpmp/participant/ParticipantRepoDataRepository.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/kpmp/participant/ParticipantRepoDataRepository.java b/src/main/java/org/kpmp/participant/ParticipantRepoDataRepository.java index e89b5d6..77430ff 100644 --- a/src/main/java/org/kpmp/participant/ParticipantRepoDataRepository.java +++ b/src/main/java/org/kpmp/participant/ParticipantRepoDataRepository.java @@ -10,8 +10,8 @@ public interface ParticipantRepoDataRepository extends CrudRepository { - @Query(value = "select a.experimental_strategy, b.data_type, b.data_category, coalesce(count,0) as count " - + "from (select distinct experimental_strategy from repo_file_v) as a " + @Query(value = "select a.experimental_strategy, a.data_type, a.data_category, coalesce(count,0) as count " + + "from (select distinct experimental_strategy, data_type, data_category from repo_file_v) as a " + "left join (select count(*) as count, experimental_strategy, data_type, data_category from repo_file_v where redcap_id= :redcap_id " + "group by experimental_strategy) as b on a.experimental_strategy=b.experimental_strategy", nativeQuery = true) public List findFileCountsByParticipant(@Param("redcap_id") String redcapId); From 7bc3a59611c7f3acec7fd6b1269fcfb9ffe663ee Mon Sep 17 00:00:00 2001 From: Nathan Creger Date: Wed, 14 Feb 2024 14:50:00 -0500 Subject: [PATCH 15/30] change variable name --- build.gradle | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index 7f5de83..28ea02d 100755 --- a/build.gradle +++ b/build.gradle @@ -59,16 +59,17 @@ task unpack(type: Copy) { into("build/dependency") } -def getProps(){ - if (project.hasProperty("version")){ - return project.getProperty("version") - }else{ - return "latest" - } +def getTagInfo() { + if (project.hasProperty('tag')) { + def tagValue = project.property('tag') + return tagValue + } else { + return "latest" + } } docker { - name "${project.group}/${jar.baseName}:" + getProps() + name "${project.group}/${jar.baseName}:" + getTagInfo() copySpec.from(tasks.unpack.outputs).into("dependency") buildArgs(['DEPENDENCY': "dependency"]) } \ No newline at end of file From 23c7b84dd1b1795abfe5bda647ba4ef489dd6140 Mon Sep 17 00:00:00 2001 From: Nathan Creger <79164481+Dert1129@users.noreply.github.com> Date: Wed, 14 Feb 2024 15:00:33 -0500 Subject: [PATCH 16/30] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4aad256..8bb3808 100755 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Repository for the Atlas Explorer Tool service layer `./gradlew build docker` The default tag is `latest` if no verison is provided To pass a version when building the docker image execute -`./gradlew build docker -Pversion=` +`./gradlew build docker -Ptag=` # Restart Spring @@ -49,4 +49,4 @@ If you have already followed these steps and are still having trouble connecting # Buyer BEWARE Notes to ourselves about the non-dynamic nature of some things in the app (this is not exhaustive) -1. The endpoint `getDataTypeInformationByParticipant` is only partially dynamic. If we add new data types to the Spatial Viewer, it will pick those up without an issue, BUT if/when we add new data types to the Explorer, we will need to update the code that gets counts for data types in Explorer to include the new one. \ No newline at end of file +1. The endpoint `getDataTypeInformationByParticipant` is only partially dynamic. If we add new data types to the Spatial Viewer, it will pick those up without an issue, BUT if/when we add new data types to the Explorer, we will need to update the code that gets counts for data types in Explorer to include the new one. From fc59d9775a7203b9f11ab9a4a8ce14e6f92f621c Mon Sep 17 00:00:00 2001 From: Nathan Creger Date: Thu, 15 Feb 2024 13:51:56 -0500 Subject: [PATCH 17/30] build and tag image with github action --- .github/workflow/build-gradle-project.yml | 38 +++++++++++++++++++++++ build.gradle | 12 ++++++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 .github/workflow/build-gradle-project.yml diff --git a/.github/workflow/build-gradle-project.yml b/.github/workflow/build-gradle-project.yml new file mode 100644 index 0000000..0a4a338 --- /dev/null +++ b/.github/workflow/build-gradle-project.yml @@ -0,0 +1,38 @@ +name: Build pegasus-data docker image + +on: + push: + +jobs: + build-gradle-project: + runs-on: ubuntu-latest + steps: + - name: Get branch names + id: branch-names + uses: tj-actions/branch-names@v8 + + - name: Get current branch name + if: steps.branch-names.outputs.is_default == 'false' + run: | + echo "Running on branch: ${{ steps.branch-names.outputs.current_branch }}" + - name: Checkout project sources + uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + java-version: '8' + distribution: 'temurin' + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + with: + gradle-version: 7.4 + + - name: Login to Docker Hub + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a + with: + username: ${{ secrets.ENV_DOCKER_USER }} + password: ${{ secrets.ENV_DOCKER_PASS }} + + - name: Run build with Gradle Wrapper + run: | + ./gradlew build docker + docker push "kingstonduo/pegasus-data:${{ steps.branch-names.outputs.current_branch }}" \ No newline at end of file diff --git a/build.gradle b/build.gradle index 28ea02d..29ae58e 100755 --- a/build.gradle +++ b/build.gradle @@ -64,7 +64,17 @@ def getTagInfo() { def tagValue = project.property('tag') return tagValue } else { - return "latest" + def gitBranch = "Unknown branch" + try { + def workingDir = new File("${project.projectDir}") + def result = 'git rev-parse --abbrev-ref HEAD'.execute(null, workingDir) + result.waitFor() + if (result.exitValue() == 0) { + gitBranch = result.text.trim() + } + } catch (e) { + } + return gitBranch } } From d3a9621b509507c14edce55cd0145a2dc88f4702 Mon Sep 17 00:00:00 2001 From: Nathan Creger Date: Thu, 15 Feb 2024 13:53:30 -0500 Subject: [PATCH 18/30] rename directory --- .github/{workflow => workflows}/build-gradle-project.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{workflow => workflows}/build-gradle-project.yml (100%) diff --git a/.github/workflow/build-gradle-project.yml b/.github/workflows/build-gradle-project.yml similarity index 100% rename from .github/workflow/build-gradle-project.yml rename to .github/workflows/build-gradle-project.yml From c93ae7382544f11454774f6bdf6debc27ff3cdf5 Mon Sep 17 00:00:00 2001 From: Nathan Creger Date: Thu, 15 Feb 2024 14:34:31 -0500 Subject: [PATCH 19/30] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8bb3808..af22510 100755 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Repository for the Atlas Explorer Tool service layer # Build `./gradlew build docker` -The default tag is `latest` if no verison is provided +The default tag is the github branch name if no verison is provided To pass a version when building the docker image execute `./gradlew build docker -Ptag=` From 33d62e150b2a0ed3ee8760381aa600206b867520 Mon Sep 17 00:00:00 2001 From: Nathan Creger Date: Fri, 16 Feb 2024 15:24:22 -0500 Subject: [PATCH 20/30] tag image on develop or master branch --- build.gradle | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 29ae58e..235f3c1 100755 --- a/build.gradle +++ b/build.gradle @@ -74,7 +74,11 @@ def getTagInfo() { } } catch (e) { } - return gitBranch + if (gitBranch == "develop" || gitBranch == "master"){ + return "${jar.version}" + }else{ + return gitBranch + } } } From d31c61788df9e9566b6b6f249547a8ca4d9868a9 Mon Sep 17 00:00:00 2001 From: Nathan Creger Date: Mon, 19 Feb 2024 09:06:43 -0500 Subject: [PATCH 21/30] fix github action depending on branch --- .github/workflows/build-gradle-project.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-gradle-project.yml b/.github/workflows/build-gradle-project.yml index 0a4a338..5f5e6a0 100644 --- a/.github/workflows/build-gradle-project.yml +++ b/.github/workflows/build-gradle-project.yml @@ -5,6 +5,8 @@ on: jobs: build-gradle-project: + env: + IMAGE_TAG: 1.1 runs-on: ubuntu-latest steps: - name: Get branch names @@ -34,5 +36,14 @@ jobs: - name: Run build with Gradle Wrapper run: | - ./gradlew build docker - docker push "kingstonduo/pegasus-data:${{ steps.branch-names.outputs.current_branch }}" \ No newline at end of file + ./gradlew build docker + + - name: Push to Docker Hub if branch is develop + if: steps.branch-names.outputs.current_branch == 'develop' + run: | + docker push "kingstonduo/hydra-data:$IMAGE_TAG" + + - name: Push to Docker Hub if branch is not develop + if: ${{ !steps.branch-names.outputs.current_branch == 'develop' }} + run: | + docker push "kingstonduo/hydra-data:${{ steps.branch-names.outputs.current_branch }}" \ No newline at end of file From 72d6f9f4a23060ad6676f745359623ec0b7b0493 Mon Sep 17 00:00:00 2001 From: Nathan Creger Date: Mon, 19 Feb 2024 09:07:20 -0500 Subject: [PATCH 22/30] fix image tag number --- .github/workflows/build-gradle-project.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-gradle-project.yml b/.github/workflows/build-gradle-project.yml index 5f5e6a0..1269b16 100644 --- a/.github/workflows/build-gradle-project.yml +++ b/.github/workflows/build-gradle-project.yml @@ -6,7 +6,7 @@ on: jobs: build-gradle-project: env: - IMAGE_TAG: 1.1 + IMAGE_TAG: 2.3 runs-on: ubuntu-latest steps: - name: Get branch names From 037d4ee751352649cffaf2bea09cf1fcbe14b18a Mon Sep 17 00:00:00 2001 From: Nathan Creger Date: Mon, 19 Feb 2024 09:09:18 -0500 Subject: [PATCH 23/30] rename image to pegasus-data --- .github/workflows/build-gradle-project.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-gradle-project.yml b/.github/workflows/build-gradle-project.yml index 1269b16..7ae77c2 100644 --- a/.github/workflows/build-gradle-project.yml +++ b/.github/workflows/build-gradle-project.yml @@ -41,9 +41,9 @@ jobs: - name: Push to Docker Hub if branch is develop if: steps.branch-names.outputs.current_branch == 'develop' run: | - docker push "kingstonduo/hydra-data:$IMAGE_TAG" + docker push "kingstonduo/pegasus-data:$IMAGE_TAG" - name: Push to Docker Hub if branch is not develop if: ${{ !steps.branch-names.outputs.current_branch == 'develop' }} run: | - docker push "kingstonduo/hydra-data:${{ steps.branch-names.outputs.current_branch }}" \ No newline at end of file + docker push "kingstonduo/pegasus-data:${{ steps.branch-names.outputs.current_branch }}" \ No newline at end of file From c6216d41149aa21f024a499a26e4428a1c1a425f Mon Sep 17 00:00:00 2001 From: HaneenT Date: Wed, 21 Feb 2024 09:10:34 -0500 Subject: [PATCH 24/30] KPMP-4861: Update endpoint to return counts for tissue type --- .../kpmp/dataSummary/AtlasRepoSummaryRow.java | 46 +++--- .../dataSummary/DataSummaryRepository.java | 4 + .../kpmp/dataSummary/DataSummaryService.java | 32 +++- .../resources/knowledge_environment.graphqls | 12 +- .../AtlasRepoSummaryLinkInformationTest.java | 2 +- .../dataSummary/AtlasRepoSummaryRowTest.java | 36 ++--- .../dataSummary/DataSummaryServiceTest.java | 143 +++++++++++------- 7 files changed, 167 insertions(+), 108 deletions(-) diff --git a/src/main/java/org/kpmp/dataSummary/AtlasRepoSummaryRow.java b/src/main/java/org/kpmp/dataSummary/AtlasRepoSummaryRow.java index f470977..f2237a4 100644 --- a/src/main/java/org/kpmp/dataSummary/AtlasRepoSummaryRow.java +++ b/src/main/java/org/kpmp/dataSummary/AtlasRepoSummaryRow.java @@ -1,46 +1,56 @@ package org.kpmp.dataSummary; public class AtlasRepoSummaryRow { - private int openCount; - private int controlledCount; private String omicsType; private AtlasRepositoryLinkInformation linkInformation; + private Long akiCount; + private Long ckdCount; + private Long hrtCount; + private Long dmrCount; public AtlasRepoSummaryRow(String omicsType, AtlasRepositoryLinkInformation linkInformation) { this.omicsType = omicsType; this.linkInformation = linkInformation; } - public int getOpenCount() { - return openCount; + public Long getAkiCount() { + return this.akiCount; } - public void setOpenCount(int openCount) { - this.openCount = openCount; + public void setAkiCount(Long akiCount) { + this.akiCount = akiCount; } - public int getControlledCount() { - return controlledCount; + public Long getCkdCount() { + return this.ckdCount; } - public void setControlledCount(int controlledCount) { - this.controlledCount = controlledCount; + public void setCkdCount(Long ckdCount) { + this.ckdCount = ckdCount; } - public String getOmicsType() { - return omicsType; + public Long getHrtCount() { + return this.hrtCount; } - public void setOmicsType(String omicsType) { - this.omicsType = omicsType; + public void setHrtCount(Long hrtCount) { + this.hrtCount = hrtCount; + } + + public Long getDmrCount() { + return this.dmrCount; } - public void addToControlledCount(int count) { - this.controlledCount = this.controlledCount + count; + public void setDmrCount(Long dmrCount) { + this.dmrCount = dmrCount; } - public void addToOpenCount(int count) { - this.openCount = this.openCount + count; + public String getOmicsType() { + return omicsType; + } + + public void setOmicsType(String omicsType) { + this.omicsType = omicsType; } public AtlasRepositoryLinkInformation getLinkInformation() { diff --git a/src/main/java/org/kpmp/dataSummary/DataSummaryRepository.java b/src/main/java/org/kpmp/dataSummary/DataSummaryRepository.java index cda6f40..0d13df8 100755 --- a/src/main/java/org/kpmp/dataSummary/DataSummaryRepository.java +++ b/src/main/java/org/kpmp/dataSummary/DataSummaryRepository.java @@ -16,6 +16,10 @@ public interface DataSummaryRepository extends CrudRepository getSummaryData() { diff --git a/src/main/resources/knowledge_environment.graphqls b/src/main/resources/knowledge_environment.graphqls index 00b55a7..69712fd 100755 --- a/src/main/resources/knowledge_environment.graphqls +++ b/src/main/resources/knowledge_environment.graphqls @@ -36,13 +36,15 @@ type AtlasRepoSummaryResult { } type AtlasRepoSummaryRow { - openCount: Int - controlledCount: Int + akiCount: Long + ckdCount: Long + hrtCount: Long + dmrCount: Long omicsType: String - linkInformation: AtlasRepoSummaryLinkInformation + linkInformation: AtlasRepositoryLinkInformationInformation } -type AtlasRepoSummaryLinkInformation { +type AtlasRepositoryLinkInformationInformation { linkType: String linkValue: String } @@ -72,7 +74,7 @@ type ParticipantRepoDataTypeSummary { type ParticipantRepoDataTypeInformation { dataType: String count: Long - linkInformation: AtlasRepoSummaryLinkInformation + linkInformation: AtlasRepositoryLinkInformationInformation } type DataTypeSummaryInformation { diff --git a/src/test/java/org/kpmp/dataSummary/AtlasRepoSummaryLinkInformationTest.java b/src/test/java/org/kpmp/dataSummary/AtlasRepoSummaryLinkInformationTest.java index 053c424..7ec48e7 100644 --- a/src/test/java/org/kpmp/dataSummary/AtlasRepoSummaryLinkInformationTest.java +++ b/src/test/java/org/kpmp/dataSummary/AtlasRepoSummaryLinkInformationTest.java @@ -6,7 +6,7 @@ import org.junit.Before; import org.junit.Test; -public class AtlasRepoSummaryLinkInformationTest { +public class AtlasRepositoryLinkInformationTest { @Before public void setUp() throws Exception { diff --git a/src/test/java/org/kpmp/dataSummary/AtlasRepoSummaryRowTest.java b/src/test/java/org/kpmp/dataSummary/AtlasRepoSummaryRowTest.java index 4bd8430..3eb03df 100644 --- a/src/test/java/org/kpmp/dataSummary/AtlasRepoSummaryRowTest.java +++ b/src/test/java/org/kpmp/dataSummary/AtlasRepoSummaryRowTest.java @@ -34,44 +34,40 @@ public void testConstructor() throws Exception { assertEquals("stuff", rowToTest.getOmicsType()); assertEquals(expectedLinkInformation, rowToTest.getLinkInformation()); - assertEquals(0, rowToTest.getOpenCount()); - assertEquals(0, rowToTest.getControlledCount()); } @Test - public void testSetOpenCount() { - row.setOpenCount(43); + public void testSetAkiCount() { + row.setAkiCount(43); - assertEquals(43, row.getOpenCount()); + assertEquals(43, row.getAkiCount()); } @Test - public void testSetControlledCount() { - row.setControlledCount(44); + public void testSetCkdCount() { + row.setCkdCount(43); - assertEquals(44, row.getControlledCount()); + assertEquals(43, row.getCkdCount()); } @Test - public void testSetOmicsType() { - row.setOmicsType("omicsType 2"); - assertEquals("omicsType 2", row.getOmicsType()); + public void testSetHrtCount() { + row.setHrtCount(43); + + assertEquals(43, row.getHrtCount()); } @Test - public void testAddToControlledCount() { - row.setControlledCount(2); - row.addToControlledCount(30); + public void testSetDmrCount() { + row.setDmrCount(43); - assertEquals(32, row.getControlledCount()); + assertEquals(43, row.getDmrCount()); } @Test - public void testAddToOpenCount() { - row.setOpenCount(5); - row.addToOpenCount(5); - - assertEquals(10, row.getOpenCount()); + public void testSetOmicsType() { + row.setOmicsType("omicsType 2"); + assertEquals("omicsType 2", row.getOmicsType()); } @Test diff --git a/src/test/java/org/kpmp/dataSummary/DataSummaryServiceTest.java b/src/test/java/org/kpmp/dataSummary/DataSummaryServiceTest.java index 915a7ba..bb0299b 100755 --- a/src/test/java/org/kpmp/dataSummary/DataSummaryServiceTest.java +++ b/src/test/java/org/kpmp/dataSummary/DataSummaryServiceTest.java @@ -5,6 +5,7 @@ import java.util.Arrays; import java.util.List; +import java.util.ArrayList; import org.junit.After; import org.junit.Before; @@ -43,63 +44,93 @@ public void tearDown() throws Exception { @Test public void testGetAtlasRepoSummary() throws Exception { - ExperimentalStrategyValue clinicalData = new ExperimentalStrategyValue(); - clinicalData.setDataCategory("stuff"); - clinicalData.setExperimentalStrategy(""); - clinicalData.setDataType("Clinical Study Data"); - clinicalData.setCount(1); - clinicalData.setAccess("open"); - ExperimentalStrategyValue biomarker1 = new ExperimentalStrategyValue(); - biomarker1.setDataCategory("Biomarker"); - biomarker1.setExperimentalStrategy("something"); - biomarker1.setDataType("stuff"); - biomarker1.setDataCategory("Biomarker"); - biomarker1.setCount(5); - biomarker1.setAccess("open"); - ExperimentalStrategyValue biomarker2 = new ExperimentalStrategyValue(); - biomarker2.setDataCategory("Biomarker"); - biomarker2.setDataType("more stuff"); - biomarker2.setExperimentalStrategy("something else"); - biomarker2.setDataCategory("Biomarker"); - biomarker2.setCount(10); - biomarker2.setAccess("open"); - ExperimentalStrategyValue other1 = new ExperimentalStrategyValue(); - other1.setDataCategory("data category"); - other1.setDataType("different stuff"); - other1.setExperimentalStrategy("strategy1"); - other1.setCount(10); - other1.setAccess("open"); - ExperimentalStrategyValue other2 = new ExperimentalStrategyValue(); - other2.setDataCategory("data category2"); - other2.setDataType("even more different stuff"); - other2.setExperimentalStrategy("strategy1"); - other2.setCount(10); - other2.setAccess("controlled"); - List strategyValues = Arrays.asList(clinicalData, biomarker1, biomarker2, other1, - other2); - when(atlasRepoSummaryRepository.findAll()).thenReturn(strategyValues); - when(fileInfoService.getRepositoryTotalFileCount()).thenReturn(36l); - - AtlasRepoSummaryResult result = dataSummaryService.getAtlasRepoSummary(); - List summaryRows = result.getSummaryRows(); - assertEquals(3, summaryRows.size()); - assertEquals("Biomarkers", summaryRows.get(0).getOmicsType()); - assertEquals(0, summaryRows.get(0).getControlledCount()); - assertEquals(15, summaryRows.get(0).getOpenCount()); - assertEquals(new AtlasRepositoryLinkInformation("data_category", "Biomarker"), - summaryRows.get(0).getLinkInformation()); - assertEquals("Clinical Study Data", summaryRows.get(1).getOmicsType()); - assertEquals(0, summaryRows.get(1).getControlledCount()); - assertEquals(1, summaryRows.get(1).getOpenCount()); - assertEquals(new AtlasRepositoryLinkInformation("data_category", "stuff"), - summaryRows.get(1).getLinkInformation()); - assertEquals("strategy1", summaryRows.get(2).getOmicsType()); - assertEquals(10, summaryRows.get(2).getControlledCount()); - assertEquals(10, summaryRows.get(2).getOpenCount()); - assertEquals(new AtlasRepositoryLinkInformation("experimental_strategy", "strategy1"), - summaryRows.get(2).getLinkInformation()); - assertEquals(Long.valueOf(36), result.getTotalFiles()); + List strategies = new ArrayList<>( + Arrays.asList( + new ExperimentalStrategyValue(), + new ExperimentalStrategyValue(), + new ExperimentalStrategyValue(), + new ExperimentalStrategyValue() + ) + ); + strategies.get(0).setExperimentalStrategy("abcd"); + strategies.get(0).setDataCategory("Biomarker"); + strategies.get(0).setDataType("datatype"); + + strategies.get(1).setExperimentalStrategy(""); + strategies.get(1).setDataCategory("category"); + strategies.get(1).setDataType("Clinical Study Data"); + + strategies.get(2).setExperimentalStrategy("strategy1"); + strategies.get(2).setDataCategory("category1"); + strategies.get(2).setDataType("datatype"); + + strategies.get(3).setExperimentalStrategy("strategy2"); + strategies.get(3).setDataCategory("category2"); + strategies.get(3).setDataType("datatype"); + + when(atlasRepoSummaryRepository.findAll()).thenReturn(strategies); + when(dataSummaryRepository.getRepoDataSummaryCount(TissueTypeEnum.AKI.getParticipantTissueType(), + "abcd")).thenReturn(Long.valueOf(1)); + when(dataSummaryRepository.getRepoDataSummaryCount(TissueTypeEnum.CKD.getParticipantTissueType(), + "abcd")).thenReturn(Long.valueOf(2)); + when(dataSummaryRepository.getRepoDataSummaryCount(TissueTypeEnum.HEALTHY_REFERENCE.getParticipantTissueType(), + "abcd")).thenReturn(Long.valueOf(3)); + when(dataSummaryRepository.getRepoDataSummaryCount(TissueTypeEnum.DMR.getParticipantTissueType(), + "abcd")).thenReturn(4l); + + when(dataSummaryRepository.getRepoDataSummaryCount(TissueTypeEnum.AKI.getParticipantTissueType(), + "")).thenReturn(Long.valueOf(5)); + when(dataSummaryRepository.getRepoDataSummaryCount(TissueTypeEnum.CKD.getParticipantTissueType(), + "")).thenReturn(Long.valueOf(6)); + when(dataSummaryRepository.getRepoDataSummaryCount(TissueTypeEnum.HEALTHY_REFERENCE.getParticipantTissueType(), + "")).thenReturn(Long.valueOf(7)); + when(dataSummaryRepository.getRepoDataSummaryCount(TissueTypeEnum.DMR.getParticipantTissueType(), + "")).thenReturn(8l); + + when(dataSummaryRepository.getRepoDataSummaryCount(TissueTypeEnum.AKI.getParticipantTissueType(), + "strategy1")).thenReturn(Long.valueOf(9)); + when(dataSummaryRepository.getRepoDataSummaryCount(TissueTypeEnum.CKD.getParticipantTissueType(), + "strategy1")).thenReturn(Long.valueOf(10)); + when(dataSummaryRepository.getRepoDataSummaryCount(TissueTypeEnum.HEALTHY_REFERENCE.getParticipantTissueType(), + "strategy1")).thenReturn(Long.valueOf(11)); + when(dataSummaryRepository.getRepoDataSummaryCount(TissueTypeEnum.DMR.getParticipantTissueType(), + "strategy1")).thenReturn(12l); + + when(dataSummaryRepository.getRepoDataSummaryCount(TissueTypeEnum.AKI.getParticipantTissueType(), + "strategy2")).thenReturn(Long.valueOf(13)); + when(dataSummaryRepository.getRepoDataSummaryCount(TissueTypeEnum.CKD.getParticipantTissueType(), + "strategy2")).thenReturn(Long.valueOf(14)); + when(dataSummaryRepository.getRepoDataSummaryCount(TissueTypeEnum.HEALTHY_REFERENCE.getParticipantTissueType(), + "strategy2")).thenReturn(Long.valueOf(15)); + when(dataSummaryRepository.getRepoDataSummaryCount(TissueTypeEnum.DMR.getParticipantTissueType(), + "strategy2")).thenReturn(16l); + + List result = dataSummaryService.getAtlasRepoSummary().getSummaryRows(); + + assertEquals("Biomarkers", result.get(0).getOmicsType()); + assertEquals(Long.valueOf(1), result.get(0).getAkiCount()); + assertEquals(Long.valueOf(2), result.get(0).getCkdCount()); + assertEquals(Long.valueOf(3), result.get(0).getHrtCount()); + assertEquals(Long.valueOf(4), result.get(0).getDmrCount()); + + assertEquals("Clinical Study Data", result.get(1).getOmicsType()); + assertEquals(Long.valueOf(5), result.get(1).getAkiCount()); + assertEquals(Long.valueOf(6), result.get(1).getCkdCount()); + assertEquals(Long.valueOf(7), result.get(1).getHrtCount()); + assertEquals(Long.valueOf(8), result.get(1).getDmrCount()); + + assertEquals("strategy1", result.get(2).getOmicsType()); + assertEquals(Long.valueOf(9), result.get(2).getAkiCount()); + assertEquals(Long.valueOf(10), result.get(2).getCkdCount()); + assertEquals(Long.valueOf(11), result.get(2).getHrtCount()); + assertEquals(Long.valueOf(12), result.get(2).getDmrCount()); + + assertEquals("strategy2", result.get(3).getOmicsType()); + assertEquals(Long.valueOf(13), result.get(3).getAkiCount()); + assertEquals(Long.valueOf(14), result.get(3).getCkdCount()); + assertEquals(Long.valueOf(15), result.get(3).getHrtCount()); + assertEquals(Long.valueOf(16), result.get(3).getDmrCount()); } @Test From 168a0b61bc97c8d1fa1243c52d6ee0d9f3574f0b Mon Sep 17 00:00:00 2001 From: HaneenT Date: Thu, 22 Feb 2024 08:31:49 -0500 Subject: [PATCH 25/30] adjusting Long types and class name for test files --- .../dataSummary/AtlasRepoSummaryRowTest.java | 16 ++++++++-------- ...a => AtlasRepositoryLinkInformationTest.java} | 0 2 files changed, 8 insertions(+), 8 deletions(-) rename src/test/java/org/kpmp/dataSummary/{AtlasRepoSummaryLinkInformationTest.java => AtlasRepositoryLinkInformationTest.java} (100%) diff --git a/src/test/java/org/kpmp/dataSummary/AtlasRepoSummaryRowTest.java b/src/test/java/org/kpmp/dataSummary/AtlasRepoSummaryRowTest.java index 3eb03df..74e5450 100644 --- a/src/test/java/org/kpmp/dataSummary/AtlasRepoSummaryRowTest.java +++ b/src/test/java/org/kpmp/dataSummary/AtlasRepoSummaryRowTest.java @@ -38,30 +38,30 @@ public void testConstructor() throws Exception { @Test public void testSetAkiCount() { - row.setAkiCount(43); + row.setAkiCount(Long.valueOf(43)); - assertEquals(43, row.getAkiCount()); + assertEquals(Long.valueOf(43), row.getAkiCount()); } @Test public void testSetCkdCount() { - row.setCkdCount(43); + row.setCkdCount(Long.valueOf(44)); - assertEquals(43, row.getCkdCount()); + assertEquals(Long.valueOf(44), row.getCkdCount()); } @Test public void testSetHrtCount() { - row.setHrtCount(43); + row.setHrtCount(Long.valueOf(45)); - assertEquals(43, row.getHrtCount()); + assertEquals(Long.valueOf(45), row.getHrtCount()); } @Test public void testSetDmrCount() { - row.setDmrCount(43); + row.setDmrCount(Long.valueOf(46)); - assertEquals(43, row.getDmrCount()); + assertEquals(Long.valueOf(46), row.getDmrCount()); } @Test diff --git a/src/test/java/org/kpmp/dataSummary/AtlasRepoSummaryLinkInformationTest.java b/src/test/java/org/kpmp/dataSummary/AtlasRepositoryLinkInformationTest.java similarity index 100% rename from src/test/java/org/kpmp/dataSummary/AtlasRepoSummaryLinkInformationTest.java rename to src/test/java/org/kpmp/dataSummary/AtlasRepositoryLinkInformationTest.java From a364ea2ee19b9004a084ce2bcdd40cc36462ae20 Mon Sep 17 00:00:00 2001 From: Zach Wright Date: Mon, 26 Feb 2024 16:11:17 -0500 Subject: [PATCH 26/30] KPMP-5130: add adj pval to RT data --- .../org/kpmp/geneExpression/RTExpressionData.java | 5 +++++ .../geneExpression/RTExpressionDataAllSegments.java | 12 ++++++++++++ .../org/kpmp/geneExpression/RTExpressionDataGTI.java | 12 ++++++++++++ src/main/resources/knowledge_environment.graphqls | 1 + 4 files changed, 30 insertions(+) diff --git a/src/main/java/org/kpmp/geneExpression/RTExpressionData.java b/src/main/java/org/kpmp/geneExpression/RTExpressionData.java index 0ffe108..a9d938a 100755 --- a/src/main/java/org/kpmp/geneExpression/RTExpressionData.java +++ b/src/main/java/org/kpmp/geneExpression/RTExpressionData.java @@ -40,4 +40,9 @@ public interface RTExpressionData { Integer getSampleCount(); void setSampleCount(Integer sampleCount); + + Double getAdjPVal(); + + void setAdjPVal(Double adjPVal); + } diff --git a/src/main/java/org/kpmp/geneExpression/RTExpressionDataAllSegments.java b/src/main/java/org/kpmp/geneExpression/RTExpressionDataAllSegments.java index 30cb93b..da63cbf 100755 --- a/src/main/java/org/kpmp/geneExpression/RTExpressionDataAllSegments.java +++ b/src/main/java/org/kpmp/geneExpression/RTExpressionDataAllSegments.java @@ -31,6 +31,8 @@ public class RTExpressionDataAllSegments implements RTExpressionData, Serializab private Double pValLog10; @Column(name = "tissue_type") private String tissueType; + @Column(name = "adj_p_val") + private Double adjPVal; @Column(name = "sample_count") private Integer sampleCount; @@ -133,4 +135,14 @@ public String getSegmentName() { public void setSegmentName(String segmentName) { this.segmentName = segmentName; } + + @Override + public Double getAdjPVal() { + return adjPVal; + } + + @Override + public void setAdjPVal(Double adjPVal) { + this.adjPVal = adjPVal; + } } diff --git a/src/main/java/org/kpmp/geneExpression/RTExpressionDataGTI.java b/src/main/java/org/kpmp/geneExpression/RTExpressionDataGTI.java index 0a33cf2..2b99c90 100755 --- a/src/main/java/org/kpmp/geneExpression/RTExpressionDataGTI.java +++ b/src/main/java/org/kpmp/geneExpression/RTExpressionDataGTI.java @@ -31,6 +31,8 @@ public class RTExpressionDataGTI implements RTExpressionData, Serializable { private Double pValLog10; @Column(name = "tissue_type") private String tissueType; + @Column(name = "adj_p_val") + private Double adjPVal; @Column(name = "sample_count") private Integer sampleCount; @@ -133,4 +135,14 @@ public String getSegmentName() { public void setSegmentName(String segmentName) { this.segmentName = segmentName; } + + @Override + public Double getAdjPVal() { + return adjPVal; + } + + @Override + public void setAdjPVal(Double adjPVal) { + this.adjPVal = adjPVal; + } } diff --git a/src/main/resources/knowledge_environment.graphqls b/src/main/resources/knowledge_environment.graphqls index 69712fd..4a41426 100755 --- a/src/main/resources/knowledge_environment.graphqls +++ b/src/main/resources/knowledge_environment.graphqls @@ -176,6 +176,7 @@ type RTGeneExpression { pValLog10: Float tissueType: String sampleCount: Int + adjPVal: Float } type RTGeneExpressionByTissue { From dab6ed1085462f8d95a2acbbf2d9400b5dcacd18 Mon Sep 17 00:00:00 2001 From: Zach Wright Date: Tue, 27 Feb 2024 12:30:41 -0500 Subject: [PATCH 27/30] KPMP-5130: tests --- .../geneExpression/RTExpressionDataAllSegmentsTest.java | 6 ++++++ .../org/kpmp/geneExpression/RTExpressionDataGTITest.java | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/src/test/java/org/kpmp/geneExpression/RTExpressionDataAllSegmentsTest.java b/src/test/java/org/kpmp/geneExpression/RTExpressionDataAllSegmentsTest.java index 938b946..94fbcc3 100755 --- a/src/test/java/org/kpmp/geneExpression/RTExpressionDataAllSegmentsTest.java +++ b/src/test/java/org/kpmp/geneExpression/RTExpressionDataAllSegmentsTest.java @@ -80,4 +80,10 @@ void setSegmentName() { assertEquals("segmentName", rtExpressionDataAllSegments.getSegmentName()); } + @Test + void setAdjPVal() { + rtExpressionDataAllSegments.setAdjPVal(123.456); + assertEquals(123.456, rtExpressionDataAllSegments.getAdjPVal(), 0.001); + } + } \ No newline at end of file diff --git a/src/test/java/org/kpmp/geneExpression/RTExpressionDataGTITest.java b/src/test/java/org/kpmp/geneExpression/RTExpressionDataGTITest.java index 2ec2978..fb89396 100755 --- a/src/test/java/org/kpmp/geneExpression/RTExpressionDataGTITest.java +++ b/src/test/java/org/kpmp/geneExpression/RTExpressionDataGTITest.java @@ -2,6 +2,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.Assert; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -80,4 +81,12 @@ void setSegmentName() { assertEquals("segmentName", rtExpressionDataGTI.getSegmentName()); } + @Test + void setAdjPVal() { + rtExpressionDataGTI.setAdjPVal(123.456); + Assert.assertEquals(123.456, rtExpressionDataGTI.getAdjPVal(), 0.001); + } + + + } \ No newline at end of file From 8ab2d02396a2194db358e38c3e460a513c235bf2 Mon Sep 17 00:00:00 2001 From: HaneenT Date: Thu, 29 Feb 2024 08:50:11 -0500 Subject: [PATCH 28/30] KPMP-5154: add additional geneExpressionValues to feature data --- .../java/org/kpmp/umap/SCMetadataRepository.java | 2 ++ src/main/java/org/kpmp/umap/UmapDataService.java | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/main/java/org/kpmp/umap/SCMetadataRepository.java b/src/main/java/org/kpmp/umap/SCMetadataRepository.java index cbcad2e..8f83782 100755 --- a/src/main/java/org/kpmp/umap/SCMetadataRepository.java +++ b/src/main/java/org/kpmp/umap/SCMetadataRepository.java @@ -32,6 +32,8 @@ public interface SCMetadataRepository extends CrudRepository List findByTissueType(String tissueType); + SCMetadata findByBarcode(String barcode); + @Cacheable("scMetadataWithTissue") @Query(value = "SELECT " + "umap_x, " diff --git a/src/main/java/org/kpmp/umap/UmapDataService.java b/src/main/java/org/kpmp/umap/UmapDataService.java index f3dc921..7d6bc2f 100755 --- a/src/main/java/org/kpmp/umap/UmapDataService.java +++ b/src/main/java/org/kpmp/umap/UmapDataService.java @@ -5,6 +5,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Iterator; import org.json.JSONException; import org.json.JSONObject; @@ -78,6 +79,21 @@ public PlotData getPlotData(String dataType, String geneSymbol, String requestTi } } + if (dataTypeEnum.equals(DataTypeEnum.SINGLE_CELL) + && featureDataWithExpressionValues.getExpression().size() == 0 + && geneExpressionValues.length() <= 200) { + Iterator keys = geneExpressionValues.keys(); + while(keys.hasNext()) { + String barcode = keys.next(); + Double expressionValue = geneExpressionValues.getDouble(barcode); + UmapPoint umapPoint = scMetadataRepo.findByBarcode(barcode); + featureDataWithExpressionValues.addXValue(umapPoint.getUmapX()); + featureDataWithExpressionValues.addYValue(umapPoint.getUmapY()); + featureDataWithExpressionValues.addExpression(expressionValue); + featureDataWithExpressionValues.addHoverDisplay(Double.toString(expressionValue) + "
" + umapPoint.getClusterName()); + } + } + List referenceClusterList = new ArrayList<>(referenceClusters.values()); return new PlotData(referenceClusterList, Arrays.asList(featureDataWithExpressionValues, featureDataWithNoExpressionValues)); From fde222d80dbba55dfec7db22b239ce4c73009095 Mon Sep 17 00:00:00 2001 From: HaneenT Date: Thu, 29 Feb 2024 09:02:29 -0500 Subject: [PATCH 29/30] fix linkinformation type --- src/main/resources/knowledge_environment.graphqls | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/knowledge_environment.graphqls b/src/main/resources/knowledge_environment.graphqls index 69712fd..6840d47 100755 --- a/src/main/resources/knowledge_environment.graphqls +++ b/src/main/resources/knowledge_environment.graphqls @@ -41,10 +41,10 @@ type AtlasRepoSummaryRow { hrtCount: Long dmrCount: Long omicsType: String - linkInformation: AtlasRepositoryLinkInformationInformation + linkInformation: AtlasRepositoryLinkInformation } -type AtlasRepositoryLinkInformationInformation { +type AtlasRepositoryLinkInformation { linkType: String linkValue: String } @@ -74,7 +74,7 @@ type ParticipantRepoDataTypeSummary { type ParticipantRepoDataTypeInformation { dataType: String count: Long - linkInformation: AtlasRepositoryLinkInformationInformation + linkInformation: AtlasRepositoryLinkInformation } type DataTypeSummaryInformation { From 0440874431654c68c8638ea2f328a75e2d70def7 Mon Sep 17 00:00:00 2001 From: HaneenT Date: Tue, 5 Mar 2024 11:38:00 -0500 Subject: [PATCH 30/30] KPMP-5178: added query to fetch biomarker counts --- .../dataSummary/DataSummaryRepository.java | 4 ++ .../kpmp/dataSummary/DataSummaryService.java | 72 ++++++++++++------- .../dataSummary/DataSummaryServiceTest.java | 12 ++-- 3 files changed, 56 insertions(+), 32 deletions(-) diff --git a/src/main/java/org/kpmp/dataSummary/DataSummaryRepository.java b/src/main/java/org/kpmp/dataSummary/DataSummaryRepository.java index 0d13df8..b393fc4 100755 --- a/src/main/java/org/kpmp/dataSummary/DataSummaryRepository.java +++ b/src/main/java/org/kpmp/dataSummary/DataSummaryRepository.java @@ -20,6 +20,10 @@ public interface DataSummaryRepository extends CrudRepository getSummaryData() { diff --git a/src/test/java/org/kpmp/dataSummary/DataSummaryServiceTest.java b/src/test/java/org/kpmp/dataSummary/DataSummaryServiceTest.java index bb0299b..d80b38a 100755 --- a/src/test/java/org/kpmp/dataSummary/DataSummaryServiceTest.java +++ b/src/test/java/org/kpmp/dataSummary/DataSummaryServiceTest.java @@ -70,14 +70,10 @@ public void testGetAtlasRepoSummary() throws Exception { strategies.get(3).setDataType("datatype"); when(atlasRepoSummaryRepository.findAll()).thenReturn(strategies); - when(dataSummaryRepository.getRepoDataSummaryCount(TissueTypeEnum.AKI.getParticipantTissueType(), - "abcd")).thenReturn(Long.valueOf(1)); - when(dataSummaryRepository.getRepoDataSummaryCount(TissueTypeEnum.CKD.getParticipantTissueType(), - "abcd")).thenReturn(Long.valueOf(2)); - when(dataSummaryRepository.getRepoDataSummaryCount(TissueTypeEnum.HEALTHY_REFERENCE.getParticipantTissueType(), - "abcd")).thenReturn(Long.valueOf(3)); - when(dataSummaryRepository.getRepoDataSummaryCount(TissueTypeEnum.DMR.getParticipantTissueType(), - "abcd")).thenReturn(4l); + when(dataSummaryRepository.getRepoBiomarkerSummaryCount(TissueTypeEnum.AKI.getParticipantTissueType())).thenReturn(Long.valueOf(1)); + when(dataSummaryRepository.getRepoBiomarkerSummaryCount(TissueTypeEnum.CKD.getParticipantTissueType())).thenReturn(Long.valueOf(2)); + when(dataSummaryRepository.getRepoBiomarkerSummaryCount(TissueTypeEnum.HEALTHY_REFERENCE.getParticipantTissueType())).thenReturn(Long.valueOf(3)); + when(dataSummaryRepository.getRepoBiomarkerSummaryCount(TissueTypeEnum.DMR.getParticipantTissueType())).thenReturn(4l); when(dataSummaryRepository.getRepoDataSummaryCount(TissueTypeEnum.AKI.getParticipantTissueType(), "")).thenReturn(Long.valueOf(5));