Skip to content

Commit

Permalink
KPMP-5365: replace tissueType
Browse files Browse the repository at this point in the history
  • Loading branch information
HaneenT committed Nov 1, 2024
1 parent 153f9c1 commit 67f3733
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class RepositoryDatasetDisplay {
private String dlFileId;
private Set<String> redcapId;
private Set<String> sampleType;
private Set<String> tissueType;
private Set<String> enrollmentCategory;
private Set<String> ageBinned;
private Set<String> sex;
private Set<String> doi;
Expand All @@ -33,7 +33,7 @@ public RepositoryDatasetDisplay(RepositoryFileDataset repositoryFile) {
dlFileId = repositoryFile.getId().getDlFileId();
redcapId = new HashSet<String>();
sampleType = new HashSet<String>();
tissueType = new HashSet<String>();
enrollmentCategory = new HashSet<String>();
ageBinned = new HashSet<String>();
sex = new HashSet<String>();
doi = new TreeSet<String>();
Expand All @@ -45,8 +45,8 @@ public RepositoryDatasetDisplay(RepositoryFileDataset repositoryFile) {
if (shouldAdd(repositoryFile.getSampleType())) {
sampleType.add(repositoryFile.getSampleType());
}
if (shouldAdd(repositoryFile.getTissueType())) {
tissueType.add(repositoryFile.getTissueType());
if (shouldAdd(repositoryFile.getEnrollmentCategory())) {
enrollmentCategory.add(repositoryFile.getEnrollmentCategory());
}
if(shouldAdd(repositoryFile.getAgeBinned())){
ageBinned.add(repositoryFile.getAgeBinned());
Expand Down Expand Up @@ -133,24 +133,24 @@ public void setSampleType(Set<String> sampleType) {
this.sampleType = sampleType;
}

public void addTissueType(String tissueType) {
if(tissueType != null && !tissueType.isEmpty()){
this.tissueType.add(tissueType);
public void addEnrollmentCategory(String enrollmentCategory) {
if(enrollmentCategory != null && !enrollmentCategory.isEmpty()){
this.enrollmentCategory.add(enrollmentCategory);
}
}

@JsonProperty("tissue_type")
public Set<String> getTissueType() {
if(tissueType.isEmpty()){
@JsonProperty("enrollment_category")
public Set<String> getEnrollmentCategory() {
if(enrollmentCategory.isEmpty()){
return null;
}else{
return this.tissueType;
return this.enrollmentCategory;
}

}

public void setTissueType(Set<String> tissueType) {
this.tissueType = tissueType;
public void setEnrollmentCategory(Set<String> enrollmentCategory) {
this.enrollmentCategory = enrollmentCategory;
}

public void addAgeBinned(String ageBinned) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public List<RepositoryDatasetDisplay> getRepositoryDataset() throws Exception {
displayFile.addAgeBinned(repositoryDataset.getAgeBinned());
displayFile.addRedCapId(repositoryDataset.getId().getRedcapId());
displayFile.addSampleType(repositoryDataset.getSampleType());
displayFile.addTissueType(repositoryDataset.getTissueType());
displayFile.addEnrollmentCategory(repositoryDataset.getEnrollmentCategory());
displayFile.addSex(repositoryDataset.getSex());
displayFile.addProtocol(repositoryDataset.getProtocol());
displayFile.addTissueSource(repositoryDataset.getTissueSource());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class RepositoryFileDataset {
@EmbeddedId
private RepositoryFileDatasetId id;
private String sampleType;
private String tissueType;
private String enrollmentCategory;
private String ageBinned;
private String sex;
private String access;
Expand Down Expand Up @@ -41,12 +41,12 @@ public void setSampleType(String sampleType) {
this.sampleType = sampleType;
}

public String getTissueType() {
return tissueType;
public String getEnrollmentCategory() {
return enrollmentCategory;
}

public void setTissueType(String tissueType) {
this.tissueType = tissueType;
public void setEnrollmentCategory(String enrollmentCategory) {
this.enrollmentCategory = enrollmentCategory;
}

@Nullable
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/knowledge_environment.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type RepositoryDatasetDisplay {
dlFileId: String
redcapId: [String]
sampleType: [String]
tissueType: [String]
enrollmentCategory: [String]
ageBinned: [String]
sex: [String]
doi: [String]
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/kpmp/QueryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void testGetRepositoryDataset() throws Exception {
repositoryFileDataset.setSampleType("SampleType");
repositoryFileDataset.setSex("Male");
repositoryFileDataset.setTissueSource("Kidneys");
repositoryFileDataset.setTissueType("organic");
repositoryFileDataset.setEnrollmentCategory("organic");
repositoryFileDataset.setWorkflowType("workflowType");
repositoryFileDatasetId.setDlFileId("dlFileId");
repositoryFileDataset.setId(repositoryFileDatasetId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,20 @@ public void setSampleType() {
}

@Test
public void testAddTissueType() {
public void testAddEnrollmentCategory() {

RepositoryDatasetDisplay repositoryDatasetDisplay = new RepositoryDatasetDisplay(repositoryFile);
repositoryDatasetDisplay.addTissueType("tissue_type");
repositoryDatasetDisplay.addEnrollmentCategory("enrollment_category");

assertEquals(1, repositoryDatasetDisplay.getTissueType().size());
assertEquals(true, repositoryDatasetDisplay.getTissueType().contains("tissue_type"));
assertEquals(1, repositoryDatasetDisplay.getEnrollmentCategory().size());
assertEquals(true, repositoryDatasetDisplay.getEnrollmentCategory().contains("enrollment_category"));
}

@Test
public void setTissueType() {
Set<String> expected = new HashSet<String>(Arrays.asList("tissue_type"));
repositoryDatasetDisplay.setTissueType(expected);
Set<String> actual = repositoryDatasetDisplay.getTissueType();
public void setEnrollmentCategory() {
Set<String> expected = new HashSet<String>(Arrays.asList("enrollment_category"));
repositoryDatasetDisplay.setEnrollmentCategory(expected);
Set<String> actual = repositoryDatasetDisplay.getEnrollmentCategory();
assertEquals(expected, actual);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public void setSampleType() {
}

@Test
public void setTissueType() {
repositoryDataset.setTissueType("ttype");
assertEquals("ttype", repositoryDataset.getTissueType());
public void setEnrollmentCategory() {
repositoryDataset.setEnrollmentCategory("ttype");
assertEquals("ttype", repositoryDataset.getEnrollmentCategory());
}

@Test
Expand Down

0 comments on commit 67f3733

Please sign in to comment.