Skip to content

Commit

Permalink
add more data to endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Dert1129 committed Oct 31, 2024
1 parent 50b57f6 commit 1d7a5bd
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/main/java/org/kpmp/participant/ParticipantClinicalDataset.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ public class ParticipantClinicalDataset implements Serializable{
private String race;
@Column(name = "age_binned")
private String ageBinned;
@Column(name = "tissue_source")
private String tissueSource;
@Column(name = "protocol")
private String protocol;
@Column(name = "sample_type")
private String sampleType;
@Column(name = "sex")
private String sex;


public int getParticipantClinicalId() {
Expand Down Expand Up @@ -153,5 +161,39 @@ public void setAgeBinned(String ageBinned) {
this.ageBinned = ageBinned;
}


public String getTissueSource() {
return this.tissueSource;
}

public void setTissueSource(String tissueSource) {
this.tissueSource = tissueSource;
}

public String getProtocol() {
return this.protocol;
}

public void setProtocol(String protocol) {
this.protocol = protocol;
}

public String getSampleType() {
return this.sampleType;
}

public void setSampleType(String sampleType) {
this.sampleType = sampleType;
}

public String getSex() {
return this.sex;
}

public void setSex(String sex) {
this.sex = sex;
}


}

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ public interface ParticipantClinicalDatasetRepository extends CrudRepository<Par
"pc.on_raas_blockade," +
"pc.race, " +
"p.age_binned " +
"p.sex" +
"p.tissue_source" +
"p.protocol" +
"p.sample_type" +
"from participant_clinical pc join participant p on pc.participant_id = p.participant_id where pc.participant_id = :participantId ", nativeQuery = true)
ParticipantClinicalDataset findByParticipantId(@Param("participantId") Integer participantId);

Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/graphql/knowledge_environment.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -238,4 +238,8 @@ type ParticipantClinicalDataset {
onRaasBlockade: String
race: String
ageBinned: String
sex: String
sampleType: String
tissueSource: String
protocol: String
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,27 @@ void testSetAgeBinned() {
assertEquals("age-age2", participantClinicalDataset.getAgeBinned());
}

@Test
void testSetTissueSource() {
participantClinicalDataset.setTissueSource("tissue");
assertEquals("tissue", participantClinicalDataset.getTissueSource());
}

@Test
void testSetProtocol() {
participantClinicalDataset.setProtocol("protocol");
assertEquals("protocol", participantClinicalDataset.getProtocol());
}

@Test
void testSetSampleType() {
participantClinicalDataset.setSampleType("Sample");
assertEquals("Sample", participantClinicalDataset.getSampleType());
}

@Test
void testSetSex() {
participantClinicalDataset.setSex("male");
assertEquals("male", participantClinicalDataset.getSex());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ public void testGetParticipantClincialDataset() throws Exception {
expectedResult.setProteinuria("proteinuria");
expectedResult.setRace("alien from outer space");
expectedResult.setAgeBinned("age");
expectedResult.setTissueSource("tissueSource");
expectedResult.setProtocol("protocol");
expectedResult.setSampleType("sample");
expectedResult.setSex("sex");



when(participantSummaryDatasetRepository.findIdByRedcapId(newPart.getRedcapId())).thenReturn(newPart.getParticipantId());
Expand All @@ -94,6 +99,10 @@ public void testGetParticipantClincialDataset() throws Exception {
assertEquals("proteinuria", result.getProteinuria());
assertEquals("alien from outer space", result.getRace());
assertEquals("age", result.getAgeBinned());
assertEquals("tissueSource", result.getTissueSource());
assertEquals("protocol", result.getProtocol());
assertEquals("sex", result.getSex());
assertEquals("sample", result.getSampleType());
}

@Test
Expand Down

0 comments on commit 1d7a5bd

Please sign in to comment.