Skip to content

Commit

Permalink
Merge pull request #154 from KPMP/KPMP-5366_fix_graphql_endpoints
Browse files Browse the repository at this point in the history
KPMP-5366: update endpoints, remove clinicalData from participant summary
  • Loading branch information
rlreamy authored Nov 11, 2024
2 parents e3694ff + db0a720 commit 8973644
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 40 deletions.
10 changes: 5 additions & 5 deletions src/main/java/org/kpmp/QueryController.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public List<String> dataTypesForConcept(@Argument String geneSymbol, @Argument S
}

@QueryMapping
public RTExpressionByEnrollmentCategory getRTGeneExpressionByTissue(@Argument String comparisonType, @Argument String geneSymbol)
public RTExpressionByEnrollmentCategory getRTGeneExpressionByEnrollment(@Argument String comparisonType, @Argument String geneSymbol)
throws Exception {
try {
return rtExpressionDataService.getByComparisonTypeAndGeneSymbolPerEnrollment(comparisonType, geneSymbol);
Expand All @@ -152,9 +152,9 @@ public RTExpressionByEnrollmentCategory getRTGeneExpressionByTissue(@Argument St
}

@QueryMapping
public RPExpressionByEnrollmentCategory getRPGeneExpressionByTissueAndProtein(@Argument String geneSymbol, @Argument String protein) throws Exception {
public RPExpressionByEnrollmentCategory getRPGeneExpressionByEnrollmentAndProtein(@Argument String geneSymbol, @Argument String protein) throws Exception {
try {
return rpExpressionDataService.getByGeneSymbolAndProteinPerTissue(geneSymbol, protein);
return rpExpressionDataService.getByGeneSymbolAndProteinPerEnrollment(geneSymbol, protein);
} catch (Exception e) {
logger.error(e.getMessage());
throw e;
Expand Down Expand Up @@ -182,10 +182,10 @@ public List<RPExpressionData> getRPGeneExpressionByStructure(@Argument String st
}

@QueryMapping
public List<RPAccessionGroup> getRPGeneExpressionByTissue(@Argument String geneSymbol)
public List<RPAccessionGroup> getRPGeneExpressionByEnrollment(@Argument String geneSymbol)
throws Exception {
try {
return rpExpressionDataService.getByGeneSymbolPerTissue(geneSymbol);
return rpExpressionDataService.getByGeneSymbolPerEnrollment(geneSymbol);
} catch (Exception e) {
logger.error(e.getMessage());
throw e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ public RPExpressionDataService(RPExpressionDataRepository rpExpressionDataReposi
this.rpExpressionDataRepository = rpExpressionDataRepository;
}

public List<RPAccessionGroup> getByGeneSymbolPerTissue(String geneSymbol) {
public List<RPAccessionGroup> getByGeneSymbolPerEnrollment(String geneSymbol) {
List<String> accessionNums = rpExpressionDataRepository.findAccessionByGeneSymbol(geneSymbol);
List<RPAccessionGroup> groups = new ArrayList<>();
for (String accession: accessionNums) {
RPExpressionByEnrollmentCategory rpExpressionByEnrollmentCategory = getByGeneSymbolAndProteinPerTissue(geneSymbol, accession);
RPExpressionByEnrollmentCategory rpExpressionByEnrollmentCategory = getByGeneSymbolAndProteinPerEnrollment(geneSymbol, accession);
RPAccessionGroup group = new RPAccessionGroup(accession, rpExpressionByEnrollmentCategory);
groups.add(group);
}
return groups;
}

public RPExpressionByEnrollmentCategory getByGeneSymbolAndProteinPerTissue(String geneSymbol, String protein) {
public RPExpressionByEnrollmentCategory getByGeneSymbolAndProteinPerEnrollment(String geneSymbol, String protein) {
RPExpressionByEnrollmentCategory rpExpressionByEnrollmentCategory = new RPExpressionByEnrollmentCategory();

rpExpressionByEnrollmentCategory.setAll(rpExpressionDataRepository.findByGeneSymbolAndEnrollmentCategoryAndProteinWithCounts(geneSymbol, EnrollmentCategoryEnum.ALL.getParticipantEnrollmentCategory(), protein));
Expand Down
10 changes: 0 additions & 10 deletions src/main/java/org/kpmp/participant/ParticipantSummaryDataset.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ public class ParticipantSummaryDataset implements Serializable {
private String sampleType;
@Column(name = "enrollment_category")
private String enrollmentCategory;
@Column(name = "clinical_data")
private String clinicalData;

public int getParticipantId() {
return participantId;
Expand Down Expand Up @@ -103,12 +101,4 @@ public void setEnrollmentCategory(String enrollmentCategory) {
this.enrollmentCategory = enrollmentCategory;
}

public String getClinicalData() {
return clinicalData;
}

public void setClinicalData(String clinicalData) {
this.clinicalData = clinicalData;
}

}
1 change: 0 additions & 1 deletion src/main/resources/graphql/knowledge_environment.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ type ParticipantSummaryDataset {
participantId: String
redcapId: String
enrollmentCategory: String
clinicalData: String
}

type ParticipantClinicalDataset {
Expand Down
8 changes: 4 additions & 4 deletions src/test/java/org/kpmp/QueryControllerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public void testGetRTGeneExpression() throws Exception {
rtExpressionByEnrollmentCategory.setAki(data);
when(rtExpressionDataService.getByComparisonTypeAndGeneSymbolPerEnrollment("all_segments", "gene"))
.thenReturn(rtExpressionByEnrollmentCategory);
assertEquals(rtExpressionByEnrollmentCategory, query.getRTGeneExpressionByTissue("all_segments", "gene"));
assertEquals(rtExpressionByEnrollmentCategory, query.getRTGeneExpressionByEnrollment("all_segments", "gene"));
assertEquals(rtExpressionByEnrollmentCategory.getAki(), data);
}

Expand All @@ -253,11 +253,11 @@ public void testGetRTGeneExpressionByStructure() throws Exception {
}

@Test
public void testGetRPGeneExpressionByTissueAndProtein() throws Exception {
public void testGetRPGeneExpressionByEnrollmentAndProtein() throws Exception {
RPExpressionByEnrollmentCategory expected = new RPExpressionByEnrollmentCategory();
when(rpExpressionDataService.getByGeneSymbolAndProteinPerTissue("APOL1", "steak")).thenReturn(expected);
when(rpExpressionDataService.getByGeneSymbolAndProteinPerEnrollment("APOL1", "steak")).thenReturn(expected);

RPExpressionByEnrollmentCategory result = query.getRPGeneExpressionByTissueAndProtein("APOL1", "steak");
RPExpressionByEnrollmentCategory result = query.getRPGeneExpressionByEnrollmentAndProtein("APOL1", "steak");

assertEquals(expected, result);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void tearDown() throws Exception {
}

@Test
public void testGetByGeneSymbolPerTissue() throws Exception {
public void testGetByGeneSymbolPerEnrollment() throws Exception {

List<String> accessions = new ArrayList<>();
accessions.add("a1");
Expand All @@ -52,7 +52,7 @@ public void testGetByGeneSymbolPerTissue() throws Exception {
when(rpExpressionDataRepository.findByGeneSymbolAndEnrollmentCategoryAndProteinWithCounts("gene", EnrollmentCategoryEnum.ALL.getParticipantEnrollmentCategory(), "a2")).
thenReturn(rpExpressionDataAll2);

List<RPAccessionGroup> rpAccessionGroups = rpExpressionDataService.getByGeneSymbolPerTissue("gene");
List<RPAccessionGroup> rpAccessionGroups = rpExpressionDataService.getByGeneSymbolPerEnrollment("gene");

assertEquals("a1", rpAccessionGroups.get(0).getAccession());
assertEquals("a2", rpAccessionGroups.get(1).getAccession());
Expand All @@ -66,13 +66,13 @@ public void testGetByGeneSymbolPerTissue() throws Exception {
}

@Test
public void testGetByGeneSymbolAndProteinPerTissue() throws Exception {
public void testgetByGeneSymbolAndProteinPerEnrollment() throws Exception {
List<RPExpressionData> rpExpressionDataAll = Arrays.asList(new RPExpressionData[]{new RPExpressionData()});

when(rpExpressionDataRepository.findByGeneSymbolAndEnrollmentCategoryAndProteinWithCounts("gene", EnrollmentCategoryEnum.ALL.getParticipantEnrollmentCategory(), "protein")).
thenReturn(rpExpressionDataAll);

RPExpressionByEnrollmentCategory rpExpressionByEnrollmentCategory = rpExpressionDataService.getByGeneSymbolAndProteinPerTissue("gene", "protein");
RPExpressionByEnrollmentCategory rpExpressionByEnrollmentCategory = rpExpressionDataService.getByGeneSymbolAndProteinPerEnrollment("gene", "protein");

assertEquals(rpExpressionByEnrollmentCategory.getAll(), rpExpressionDataAll);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void tearDown() throws Exception {
}

@Test
public void testGetByComparisonTypeAndGeneSymbolPerTissue_all() throws Exception {
public void testGetByComparisonTypeAndGeneSymbolPerEnrollment_all() throws Exception {

RTExpressionDataAllSegments allallData = new RTExpressionDataAllSegments();
List<RTExpressionDataAllSegments> allallDataList = Arrays.asList(allallData);
Expand All @@ -58,7 +58,7 @@ public void testGetByComparisonTypeAndGeneSymbolPerTissue_all() throws Exception
}

@Test
public void testGetByComparisonTypeAndGeneSymbolPerTissue_hrt() throws Exception {
public void testGetByComparisonTypeAndGeneSymbolPerEnrollment_hrt() throws Exception {

RTExpressionDataAllSegments allhrtData = new RTExpressionDataAllSegments();
List<RTExpressionDataAllSegments> allhrtDataList = Arrays.asList(allhrtData);
Expand All @@ -81,7 +81,7 @@ public void testGetByComparisonTypeAndGeneSymbolPerTissue_hrt() throws Exception
}

@Test
public void testGetByComparisonTypeAndGeneSymbolPerTissue_ckd() throws Exception {
public void testGetByComparisonTypeAndGeneSymbolPerEnrollment_ckd() throws Exception {
RTExpressionDataAllSegments allckdData = new RTExpressionDataAllSegments();
List<RTExpressionDataAllSegments> allckdDataList = Arrays.asList(allckdData);
RTExpressionDataGTI gckdData = new RTExpressionDataGTI();
Expand All @@ -103,7 +103,7 @@ public void testGetByComparisonTypeAndGeneSymbolPerTissue_ckd() throws Exception
}

@Test
public void testGetByComparisonTypeAndGeneSymbolPerTissue_aki() throws Exception {
public void testGetByComparisonTypeAndGeneSymbolPerEnrollment_aki() throws Exception {
RTExpressionDataAllSegments allAkiData = new RTExpressionDataAllSegments();
List<RTExpressionDataAllSegments> allAkiDataList = Arrays.asList(allAkiData);
RTExpressionDataGTI gAkiData = new RTExpressionDataGTI();
Expand All @@ -125,7 +125,7 @@ public void testGetByComparisonTypeAndGeneSymbolPerTissue_aki() throws Exception
}

@Test
public void testGetByComparisonTypeAndGeneSymbolPerTissue_dmr() throws Exception {
public void testGetByComparisonTypeAndGeneSymbolPerEnrollment_dmr() throws Exception {
RTExpressionDataAllSegments allDmrData = new RTExpressionDataAllSegments();
List<RTExpressionDataAllSegments> allDmrDataList = Arrays.asList(allDmrData);
RTExpressionDataGTI gDmrData = new RTExpressionDataGTI();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ public void testGetParticipantSummaryDataset() throws Exception {
expectedResult.setProtocol("7");
expectedResult.setSampleType("8");
expectedResult.setEnrollmentCategory("9");
expectedResult.setClinicalData("10");

when(participantSummaryDatasetRepository.findByRedcapId("1")).thenReturn(expectedResult);

Expand All @@ -135,7 +134,6 @@ public void testGetParticipantSummaryDataset() throws Exception {
assertEquals("7", result.getProtocol());
assertEquals("8", result.getSampleType());
assertEquals("9", result.getEnrollmentCategory());
assertEquals("10", result.getClinicalData());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,4 @@ void setEnrollmentCategory() {
assertEquals("tissue", participantSummaryDataset.getEnrollmentCategory());
}

@Test
void setClinicalData() {
participantSummaryDataset.setClinicalData("clinical");
assertEquals("clinical", participantSummaryDataset.getClinicalData());
}

}

0 comments on commit 8973644

Please sign in to comment.