From d7b60e7a7a3aa39efd4222bddb9c4e6f0fdfe2b8 Mon Sep 17 00:00:00 2001 From: dert1129 Date: Mon, 4 Nov 2024 13:00:20 -0500 Subject: [PATCH 1/7] add clinical information with endpoint --- .../RepositoryDatasetDisplay.java | 207 ++++++++++++++++-- .../RepositoryDatasetService.java | 2 +- .../RepositoryFileDataset.java | 122 ++++++++++- .../resources/knowledge_environment.graphqls | 15 +- src/test/java/org/kpmp/QueryTest.java | 14 +- .../RepositoryDatasetDisplayTest.java | 87 +++++++- .../RepositoryFileDatasetTest.java | 72 +++++- 7 files changed, 487 insertions(+), 32 deletions(-) diff --git a/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java b/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java index bca8077..5d1687a 100644 --- a/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java +++ b/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java @@ -10,7 +10,7 @@ public class RepositoryDatasetDisplay { private String dlFileId; private Set redcapId; private Set sampleType; - private Set tissueType; + private Set enrollmentCategory; private Set ageBinned; private Set sex; private Set doi; @@ -28,12 +28,24 @@ public class RepositoryDatasetDisplay { private String fileName; private String packageId; private String fileNameSort; + private String primaryAdjudicatedCat; + private String kdigoStage; + private String baselineEgfr; + private String proteinuria; + private String a1c; + private String albuminuria; + private String diabetesDuration; + private String diabetesHistory; + private String hypertensionHistory; + private String hypertensionDuration; + private String race; + private String onRaasBlockade; public RepositoryDatasetDisplay(RepositoryFileDataset repositoryFile) { dlFileId = repositoryFile.getId().getDlFileId(); redcapId = new HashSet(); sampleType = new HashSet(); - tissueType = new HashSet(); + enrollmentCategory = new HashSet(); ageBinned = new HashSet(); sex = new HashSet(); doi = new TreeSet(); @@ -45,8 +57,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()); @@ -77,6 +89,19 @@ public RepositoryDatasetDisplay(RepositoryFileDataset repositoryFile) { fileSize = repositoryFile.getFileSize(); fileName = repositoryFile.getFileName(); packageId = repositoryFile.getPackageId(); + primaryAdjudicatedCat = repositoryFile.getPrimaryAdjudicatedCat(); + kdigoStage = repositoryFile.getKdigoStage(); + baselineEgfr = repositoryFile.getBaselineEgfr(); + proteinuria = repositoryFile.getProteinuria(); + a1c = repositoryFile.getA1c(); + albuminuria = repositoryFile.getAlbuminuria(); + diabetesDuration = repositoryFile.getDiabetesDuration(); + diabetesHistory = repositoryFile.getDiabetesHistory(); + hypertensionDuration = repositoryFile.getHypertensionDuration(); + hypertensionHistory = repositoryFile.getHypertensionHistory(); + race = repositoryFile.getRace(); + onRaasBlockade = repositoryFile.getOnRaasBlockade(); + } @JsonProperty("file_id") @@ -133,24 +158,24 @@ public void setSampleType(Set 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 getTissueType() { - if(tissueType.isEmpty()){ + @JsonProperty("enrollment_category") + public Set getenrollmentCategory() { + if(enrollmentCategory.isEmpty()){ return null; }else{ - return this.tissueType; + return this.enrollmentCategory; } } - public void setTissueType(Set tissueType) { - this.tissueType = tissueType; + public void setenrollmentCategory(Set enrollmentCategory) { + this.enrollmentCategory = enrollmentCategory; } public void addAgeBinned(String ageBinned) { @@ -463,4 +488,160 @@ private boolean shouldAdd(String value) { return true; } + @JsonProperty("primary_adjudicated_category") + public String getPrimaryAdjudicatedCategory() { + if(this.primaryAdjudicatedCat == null || this.primaryAdjudicatedCat.isEmpty() ){ + return null; + }else{ + return this.primaryAdjudicatedCat; + } + } + + public void setPrimaryAdjudicatedCat(String primaryAdjudicatedCat) { + this.primaryAdjudicatedCat = primaryAdjudicatedCat; + } + + @JsonProperty("kdigo_stage") + public String getKdigoStage() { + if(this.kdigoStage == null || this.kdigoStage.isEmpty()){ + return null; + }else{ + return this.kdigoStage; + } + } + + public void setKdigoStage(String kdigoStage) { + this.kdigoStage = kdigoStage; + } + + @JsonProperty("baseline_egfr") + public String getBaselineEgfr() { + if(this.baselineEgfr == null || this.baselineEgfr.isEmpty()){ + return null; + }else{ + return this.baselineEgfr; + } + } + + public void setBaselineEgfr(String baselineEgfr) { + this.baselineEgfr = baselineEgfr; + } + + @JsonProperty("proteinuria") + public String getProteinuria() { + if(this.proteinuria == null || this.proteinuria.isEmpty()){ + return null; + }else{ + return this.proteinuria; + } + } + + public void setProteinuria(String proteinuria) { + this.proteinuria = proteinuria; + } + + @JsonProperty("a1c") + public String getA1c() { + if(this.a1c == null || this.a1c.isEmpty()){ + return null; + }else{ + return this.a1c; + } + } + + public void setA1c(String a1c) { + this.a1c = a1c; + } + + @JsonProperty("albuminuria") + public String getAlbuminuria() { + if(this.albuminuria == null || this.albuminuria.isEmpty()){ + return null; + }else{ + return this.albuminuria; + } + } + + public void setAlbuminuria(String albuminuria) { + this.albuminuria = albuminuria; + } + + @JsonProperty("diabetes_duration") + public String getDiabetesDuration() { + if(this.diabetesDuration == null || this.diabetesDuration.isEmpty()){ + return null; + }else{ + return this.diabetesDuration; + } + } + + public void setDiabetesDuration(String diabetesDuration) { + this.diabetesDuration = diabetesDuration; + } + + @JsonProperty("diabetes_history") + public String getDiabetesHistory() { + if(this.diabetesHistory == null || this.diabetesHistory.isEmpty()){ + return null; + }else{ + return this.diabetesHistory; + } + } + + public void setDiabetesHistory(String diabetesHistory) { + this.diabetesHistory = diabetesHistory; + } + + @JsonProperty("hypertension_history") + public String getHypertensionHistory() { + if(this.hypertensionHistory == null || this.hypertensionHistory.isEmpty()){ + return null; + }else{ + return this.hypertensionHistory; + } + } + + public void setHypertensionHistory(String hypertensionHistory) { + this.hypertensionHistory = hypertensionHistory; + } + + @JsonProperty("hypertension_duration") + public String getHypertensionDuration() { + if(this.hypertensionDuration == null || this.hypertensionDuration.isEmpty()){ + return null; + }else{ + return this.hypertensionDuration; + } + } + + public void setHypertensionDuration(String hypertensionDuration) { + this.hypertensionDuration = hypertensionDuration; + } + + @JsonProperty("ethnicity") + public String getRace() { + if(this.race == null || this.race.isEmpty()){ + return null; + }else{ + return this.race; + } + } + + public void setRace(String race) { + this.race = race; + } + + @JsonProperty("on_raas_blockade") + public String getOnRaasBlockade() { + if(this.onRaasBlockade == null || this.onRaasBlockade.isEmpty()){ + return null; + }else{ + return this.onRaasBlockade; + } + } + + public void setOnRaasBlockade(String onRaasBlockade) { + this.onRaasBlockade = onRaasBlockade; + } + } \ No newline at end of file diff --git a/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetService.java b/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetService.java index faaef86..d574f98 100644 --- a/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetService.java +++ b/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetService.java @@ -72,7 +72,7 @@ public List 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()); diff --git a/src/main/java/org/kpmp/repositoryDataset/RepositoryFileDataset.java b/src/main/java/org/kpmp/repositoryDataset/RepositoryFileDataset.java index f3f36de..299038a 100644 --- a/src/main/java/org/kpmp/repositoryDataset/RepositoryFileDataset.java +++ b/src/main/java/org/kpmp/repositoryDataset/RepositoryFileDataset.java @@ -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; @@ -24,6 +24,20 @@ public class RepositoryFileDataset { private String packageId; private String tissueSource; private Double releaseVersion; + @Column(name = "primary_adjudicated_cat") + private String primaryAdjudicatedCat; + private String kdigoStage; + private String baselineEgfr; + private String proteinuria; + private String a1c; + private String albuminuria; + private String diabetesHistory; + private String diabetesDuration; + private String hypertensionHistory; + private String hypertensionDuration; + private String onRaasBlockade; + private String race; + public RepositoryFileDatasetId getId() { return this.id; @@ -41,12 +55,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 @@ -139,6 +153,102 @@ public void setProtocol(String protocol) { this.protocol = protocol; } + public String getPrimaryAdjudicatedCat() { + return this.primaryAdjudicatedCat; + } + + public void setPrimaryAdjudicatedCat(String primaryAdjudicatedCat) { + this.primaryAdjudicatedCat = primaryAdjudicatedCat; + } + + public String getKdigoStage() { + return this.kdigoStage; + } + + public void setKdigoStage(String kdigoStage) { + this.kdigoStage = kdigoStage; + } + + public String getBaselineEgfr() { + return this.baselineEgfr; + } + + public void setBaselineEgfr(String baselineEgfr) { + this.baselineEgfr = baselineEgfr; + } + + public String getProteinuria() { + return this.proteinuria; + } + + public void setProteinuria(String proteinuria) { + this.proteinuria = proteinuria; + } + + public String getA1c() { + return this.a1c; + } + + public void setA1c(String a1c) { + this.a1c = a1c; + } + + public String getAlbuminuria() { + return this.albuminuria; + } + + public void setAlbuminuria(String albuminuria) { + this.albuminuria = albuminuria; + } + + public String getDiabetesHistory() { + return this.diabetesHistory; + } + + public void setDiabetesHistory(String diabetesHistory) { + this.diabetesHistory = diabetesHistory; + } + + public String getDiabetesDuration() { + return this.diabetesDuration; + } + + public void setDiabetesDuration(String diabetesDuration) { + this.diabetesDuration = diabetesDuration; + } + + public String getHypertensionHistory() { + return this.hypertensionHistory; + } + + public void setHypertensionHistory(String hypertensionHistory) { + this.hypertensionHistory = hypertensionHistory; + } + + public String getHypertensionDuration() { + return this.hypertensionDuration; + } + + public void setHypertensionDuration(String hypertensionDuration) { + this.hypertensionDuration = hypertensionDuration; + } + + public String getOnRaasBlockade() { + return this.onRaasBlockade; + } + + public void setOnRaasBlockade(String onRaasBlockade) { + this.onRaasBlockade = onRaasBlockade; + } + + public String getRace() { + return race; + } + + public void setRace(String race) { + this.race = race; + } + public String getPackageId() { return packageId; } @@ -163,4 +273,6 @@ public void setReleaseVersion(Double releaseVersion) { this.releaseVersion = releaseVersion; } + + } diff --git a/src/main/resources/knowledge_environment.graphqls b/src/main/resources/knowledge_environment.graphqls index cb3c8b8..cbedb66 100755 --- a/src/main/resources/knowledge_environment.graphqls +++ b/src/main/resources/knowledge_environment.graphqls @@ -6,7 +6,7 @@ type RepositoryDatasetDisplay { dlFileId: String redcapId: [String] sampleType: [String] - tissueType: [String] + enrollmentCategory: [String] ageBinned: [String] sex: [String] doi: [String] @@ -26,4 +26,17 @@ type RepositoryDatasetDisplay { fileNameSort: String participantIdSort: String platformSort: String + primaryAdjudicatedCategory: String + kdigoStage: String + baselineEgfr: String + proteinuria: String + a1c: String + albuminuria: String + diabetesDuration: String + diabetesHistory: String + hypertensionDuration: String + hypertensionHistory: String + race: String + onRaasBlockade: String + } \ No newline at end of file diff --git a/src/test/java/org/kpmp/QueryTest.java b/src/test/java/org/kpmp/QueryTest.java index 9f107e7..a07e08d 100644 --- a/src/test/java/org/kpmp/QueryTest.java +++ b/src/test/java/org/kpmp/QueryTest.java @@ -54,9 +54,21 @@ 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.setPrimaryAdjudicatedCat("primaryAdjudicatedCategory"); + repositoryFileDataset.setKdigoStage("kdigoStage"); + repositoryFileDataset.setBaselineEgfr("baselineEgfr"); + repositoryFileDataset.setProteinuria("proteinuria"); + repositoryFileDataset.setA1c("a1c"); + repositoryFileDataset.setAlbuminuria("albuminuria"); + repositoryFileDataset.setDiabetesDuration("diabetesDuration"); + repositoryFileDataset.setDiabetesHistory("diabetesHistory"); + repositoryFileDataset.setHypertensionDuration("hypertensionDuration"); + repositoryFileDataset.setHypertensionHistory("hypertensionHistory"); + repositoryFileDataset.setRace("race"); + repositoryFileDataset.setOnRaasBlockade("onRaasBlockade"); repositoryFileDataset.setId(repositoryFileDatasetId); List expectedResult = Arrays.asList(new RepositoryDatasetDisplay(repositoryFileDataset)); diff --git a/src/test/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplayTest.java b/src/test/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplayTest.java index bf52f0e..5cc9a13 100644 --- a/src/test/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplayTest.java +++ b/src/test/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplayTest.java @@ -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 expected = new HashSet(Arrays.asList("tissue_type")); - repositoryDatasetDisplay.setTissueType(expected); - Set actual = repositoryDatasetDisplay.getTissueType(); + public void setenrollmentCategory() { + Set expected = new HashSet(Arrays.asList("enrollment_category")); + repositoryDatasetDisplay.setenrollmentCategory(expected); + Set actual = repositoryDatasetDisplay.getenrollmentCategory(); assertEquals(expected, actual); } @@ -299,5 +299,76 @@ public void setPlatformSort(){ repositoryDatasetDisplay.setPlatform("platform"); assertEquals("platform", repositoryDatasetDisplay.getPlatformSort()); } + + @Test + public void setKdigoStage(){ + repositoryDatasetDisplay.setKdigoStage("stage 1"); + assertEquals("stage 1", repositoryDatasetDisplay.getKdigoStage()); + } + + @Test + public void setPrimaryAdjudicatedCat(){ + repositoryDatasetDisplay.setPrimaryAdjudicatedCat("blah"); + assertEquals("blah", repositoryDatasetDisplay.getPrimaryAdjudicatedCategory()); + } + + @Test + public void setBaselineEgfr() { + repositoryDatasetDisplay.setBaselineEgfr("asd"); + assertEquals("asd", repositoryDatasetDisplay.getBaselineEgfr()); + } + + @Test + public void setProteinuria() { + repositoryDatasetDisplay.setProteinuria("123"); + assertEquals("123", repositoryDatasetDisplay.getProteinuria()); + } + + @Test + public void setA1c() { + repositoryDatasetDisplay.setA1c("humbug"); + assertEquals("humbug", repositoryDatasetDisplay.getA1c()); + } + + @Test + public void setAlbuminuria() { + repositoryDatasetDisplay.setAlbuminuria("albuminuria"); + assertEquals("albuminuria", repositoryDatasetDisplay.getAlbuminuria()); + } + + @Test + public void setDiabetesDuration() { + repositoryDatasetDisplay.setDiabetesDuration("1 century"); + assertEquals("1 century", repositoryDatasetDisplay.getDiabetesDuration()); + } + + @Test + public void setDiabetesHistory() { + repositoryDatasetDisplay.setDiabetesHistory("no"); + assertEquals("no", repositoryDatasetDisplay.getDiabetesHistory()); + } + + @Test + public void setHypertensionDuration() { + repositoryDatasetDisplay.setHypertensionDuration("123"); + assertEquals("123", repositoryDatasetDisplay.getHypertensionDuration()); + } + + @Test + public void setHypertensionHistory() { + repositoryDatasetDisplay.setHypertensionHistory("yes"); + assertEquals("yes", repositoryDatasetDisplay.getHypertensionHistory()); + } + + @Test + public void setRace() { + repositoryDatasetDisplay.setRace("race"); + assertEquals("race", repositoryDatasetDisplay.getRace()); + } + + public void setOnRaasBlockade() { + repositoryDatasetDisplay.setOnRaasBlockade("no"); + assertEquals("no", repositoryDatasetDisplay.getOnRaasBlockade()); + } } \ No newline at end of file diff --git a/src/test/java/org/kpmp/repositoryDataset/RepositoryFileDatasetTest.java b/src/test/java/org/kpmp/repositoryDataset/RepositoryFileDatasetTest.java index 36d81eb..82c9173 100644 --- a/src/test/java/org/kpmp/repositoryDataset/RepositoryFileDatasetTest.java +++ b/src/test/java/org/kpmp/repositoryDataset/RepositoryFileDatasetTest.java @@ -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 @@ -111,4 +111,70 @@ public void setReleaseVersion() { assertEquals(45.0, repositoryDataset.getReleaseVersion()); } + @Test + public void setPrimaryAdjudicatedCat() { + repositoryDataset.setPrimaryAdjudicatedCat("blah"); + assertEquals("blah" ,repositoryDataset.getPrimaryAdjudicatedCat()); + } + + @Test + public void setKdigoStage() { + repositoryDataset.setKdigoStage("stage 11"); + assertEquals("stage 11", repositoryDataset.getKdigoStage()); + } + + @Test + public void setBaselineEgfr() { + repositoryDataset.setBaselineEgfr("13"); + assertEquals("13", repositoryDataset.getBaselineEgfr()); + } + + @Test + public void setProteinuria() { + repositoryDataset.setProteinuria("1234"); + assertEquals("1234", repositoryDataset.getProteinuria()); + } + + @Test + public void setA1c() { + repositoryDataset.setA1c("90%"); + assertEquals("90%", repositoryDataset.getA1c()); + } + + @Test + public void setAlbuminuria() { + repositoryDataset.setAlbuminuria("yup"); + assertEquals("yup", repositoryDataset.getAlbuminuria()); + } + + @Test + public void setDiabetesDuration(){ + repositoryDataset.setDiabetesDuration("1 years"); + assertEquals("1 years", repositoryDataset.getDiabetesDuration()); + } + + @Test + public void setDiabetesHistory() { + repositoryDataset.setDiabetesHistory("no"); + assertEquals("no", repositoryDataset.getDiabetesHistory()); + } + + @Test + public void setHypertensionDuration() { + repositoryDataset.setHypertensionDuration("1 years"); + assertEquals("1 years", repositoryDataset.getHypertensionDuration()); + } + + @Test + public void setHypertensionHistory() { + repositoryDataset.setHypertensionHistory("no"); + assertEquals("no", repositoryDataset.getHypertensionHistory()); + } + + @Test + public void setOnRaasBlockade() { + repositoryDataset.setOnRaasBlockade("no"); + assertEquals("no", repositoryDataset.getOnRaasBlockade()); + } + } \ No newline at end of file From b6012b19740ef21c73da69af7a2ccd4fba075335 Mon Sep 17 00:00:00 2001 From: dert1129 Date: Mon, 4 Nov 2024 14:11:57 -0500 Subject: [PATCH 2/7] fix method names and add capitalization logic for weirdly capitalized filter data --- build.gradle | 1 + .../RepositoryDatasetDisplay.java | 18 +++++++++++++----- .../RepositoryDatasetService.java | 2 +- .../RepositoryFileDataset.java | 4 ++-- src/test/java/org/kpmp/QueryTest.java | 2 +- .../RepositoryDatasetDisplayTest.java | 8 ++++---- .../RepositoryFileDatasetTest.java | 4 ++-- 7 files changed, 24 insertions(+), 15 deletions(-) diff --git a/build.gradle b/build.gradle index 9899653..d978326 100755 --- a/build.gradle +++ b/build.gradle @@ -36,6 +36,7 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'com.mysql:mysql-connector-j:8.3.0' + implementation 'org.apache.commons:commons-text:1.12.0' implementation 'com.graphql-java:graphql-spring-boot-starter:5.0.2' implementation 'com.graphql-java:graphiql-spring-boot-starter:5.0.2' diff --git a/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java b/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java index 5d1687a..895e756 100644 --- a/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java +++ b/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java @@ -1,7 +1,12 @@ package org.kpmp.repositoryDataset; +import java.util.Arrays; import java.util.HashSet; import java.util.TreeSet; +import java.util.stream.Collectors; + +import org.apache.commons.text.WordUtils; + import java.util.Set; import com.fasterxml.jackson.annotation.JsonProperty; @@ -57,8 +62,8 @@ public RepositoryDatasetDisplay(RepositoryFileDataset repositoryFile) { if (shouldAdd(repositoryFile.getSampleType())) { sampleType.add(repositoryFile.getSampleType()); } - if (shouldAdd(repositoryFile.getenrollmentCategory())) { - enrollmentCategory.add(repositoryFile.getenrollmentCategory()); + if (shouldAdd(repositoryFile.getEnrollmentCategory())) { + enrollmentCategory.add(repositoryFile.getEnrollmentCategory()); } if(shouldAdd(repositoryFile.getAgeBinned())){ ageBinned.add(repositoryFile.getAgeBinned()); @@ -158,7 +163,7 @@ public void setSampleType(Set sampleType) { this.sampleType = sampleType; } - public void addenrollmentCategory(String enrollmentCategory) { + public void addEnrollmentCategory(String enrollmentCategory) { if(enrollmentCategory != null && !enrollmentCategory.isEmpty()){ this.enrollmentCategory.add(enrollmentCategory); } @@ -584,7 +589,7 @@ public String getDiabetesHistory() { if(this.diabetesHistory == null || this.diabetesHistory.isEmpty()){ return null; }else{ - return this.diabetesHistory; + return fixCapitalizaion(this.diabetesHistory); } } @@ -597,7 +602,7 @@ public String getHypertensionHistory() { if(this.hypertensionHistory == null || this.hypertensionHistory.isEmpty()){ return null; }else{ - return this.hypertensionHistory; + return fixCapitalizaion(this.hypertensionHistory); } } @@ -644,4 +649,7 @@ public void setOnRaasBlockade(String onRaasBlockade) { this.onRaasBlockade = onRaasBlockade; } + public String fixCapitalizaion(String input){ + return WordUtils.capitalizeFully(input, null); + } } \ No newline at end of file diff --git a/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetService.java b/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetService.java index d574f98..be5bc55 100644 --- a/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetService.java +++ b/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetService.java @@ -72,7 +72,7 @@ public List getRepositoryDataset() throws Exception { displayFile.addAgeBinned(repositoryDataset.getAgeBinned()); displayFile.addRedCapId(repositoryDataset.getId().getRedcapId()); displayFile.addSampleType(repositoryDataset.getSampleType()); - displayFile.addenrollmentCategory(repositoryDataset.getenrollmentCategory()); + displayFile.addEnrollmentCategory(repositoryDataset.getEnrollmentCategory()); displayFile.addSex(repositoryDataset.getSex()); displayFile.addProtocol(repositoryDataset.getProtocol()); displayFile.addTissueSource(repositoryDataset.getTissueSource()); diff --git a/src/main/java/org/kpmp/repositoryDataset/RepositoryFileDataset.java b/src/main/java/org/kpmp/repositoryDataset/RepositoryFileDataset.java index 299038a..3f7be8f 100644 --- a/src/main/java/org/kpmp/repositoryDataset/RepositoryFileDataset.java +++ b/src/main/java/org/kpmp/repositoryDataset/RepositoryFileDataset.java @@ -55,11 +55,11 @@ public void setSampleType(String sampleType) { this.sampleType = sampleType; } - public String getenrollmentCategory() { + public String getEnrollmentCategory() { return enrollmentCategory; } - public void setenrollmentCategory(String enrollmentCategory) { + public void setEnrollmentCategory(String enrollmentCategory) { this.enrollmentCategory = enrollmentCategory; } diff --git a/src/test/java/org/kpmp/QueryTest.java b/src/test/java/org/kpmp/QueryTest.java index a07e08d..50d7bf6 100644 --- a/src/test/java/org/kpmp/QueryTest.java +++ b/src/test/java/org/kpmp/QueryTest.java @@ -54,7 +54,7 @@ public void testGetRepositoryDataset() throws Exception { repositoryFileDataset.setSampleType("SampleType"); repositoryFileDataset.setSex("Male"); repositoryFileDataset.setTissueSource("Kidneys"); - repositoryFileDataset.setenrollmentCategory("organic"); + repositoryFileDataset.setEnrollmentCategory("organic"); repositoryFileDataset.setWorkflowType("workflowType"); repositoryFileDatasetId.setDlFileId("dlFileId"); repositoryFileDataset.setPrimaryAdjudicatedCat("primaryAdjudicatedCategory"); diff --git a/src/test/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplayTest.java b/src/test/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplayTest.java index 5cc9a13..dea0dcd 100644 --- a/src/test/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplayTest.java +++ b/src/test/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplayTest.java @@ -85,7 +85,7 @@ public void setSampleType() { public void testAddenrollmentCategory() { RepositoryDatasetDisplay repositoryDatasetDisplay = new RepositoryDatasetDisplay(repositoryFile); - repositoryDatasetDisplay.addenrollmentCategory("enrollment_category"); + repositoryDatasetDisplay.addEnrollmentCategory("enrollment_category"); assertEquals(1, repositoryDatasetDisplay.getenrollmentCategory().size()); assertEquals(true, repositoryDatasetDisplay.getenrollmentCategory().contains("enrollment_category")); @@ -344,8 +344,8 @@ public void setDiabetesDuration() { @Test public void setDiabetesHistory() { - repositoryDatasetDisplay.setDiabetesHistory("no"); - assertEquals("no", repositoryDatasetDisplay.getDiabetesHistory()); + repositoryDatasetDisplay.setDiabetesHistory("dOn't KNoW"); + assertEquals("Don't Know", repositoryDatasetDisplay.getDiabetesHistory()); } @Test @@ -357,7 +357,7 @@ public void setHypertensionDuration() { @Test public void setHypertensionHistory() { repositoryDatasetDisplay.setHypertensionHistory("yes"); - assertEquals("yes", repositoryDatasetDisplay.getHypertensionHistory()); + assertEquals("Yes", repositoryDatasetDisplay.getHypertensionHistory()); } @Test diff --git a/src/test/java/org/kpmp/repositoryDataset/RepositoryFileDatasetTest.java b/src/test/java/org/kpmp/repositoryDataset/RepositoryFileDatasetTest.java index 82c9173..4d893e1 100644 --- a/src/test/java/org/kpmp/repositoryDataset/RepositoryFileDatasetTest.java +++ b/src/test/java/org/kpmp/repositoryDataset/RepositoryFileDatasetTest.java @@ -28,8 +28,8 @@ public void setSampleType() { @Test public void setenrollmentCategory() { - repositoryDataset.setenrollmentCategory("ttype"); - assertEquals("ttype", repositoryDataset.getenrollmentCategory()); + repositoryDataset.setEnrollmentCategory("ttype"); + assertEquals("ttype", repositoryDataset.getEnrollmentCategory()); } @Test From edd7bfa03945462d49e08bf3dd105adb931470c5 Mon Sep 17 00:00:00 2001 From: dert1129 Date: Mon, 4 Nov 2024 14:12:24 -0500 Subject: [PATCH 3/7] remove unused imports --- .../org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java | 2 -- .../kpmp/repositoryDataset/RepositoryDatasetServiceTest.java | 3 --- 2 files changed, 5 deletions(-) diff --git a/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java b/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java index 895e756..1315bf3 100644 --- a/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java +++ b/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java @@ -1,9 +1,7 @@ package org.kpmp.repositoryDataset; -import java.util.Arrays; import java.util.HashSet; import java.util.TreeSet; -import java.util.stream.Collectors; import org.apache.commons.text.WordUtils; diff --git a/src/test/java/org/kpmp/repositoryDataset/RepositoryDatasetServiceTest.java b/src/test/java/org/kpmp/repositoryDataset/RepositoryDatasetServiceTest.java index d1ca5a7..6cc1b82 100644 --- a/src/test/java/org/kpmp/repositoryDataset/RepositoryDatasetServiceTest.java +++ b/src/test/java/org/kpmp/repositoryDataset/RepositoryDatasetServiceTest.java @@ -3,12 +3,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import static org.mockito.Mockito.mock; import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; import java.util.List; import org.json.JSONException; import org.junit.jupiter.api.AfterEach; From 886bc22135c464512cfaa3f8763ba858c3e23823 Mon Sep 17 00:00:00 2001 From: dert1129 Date: Mon, 4 Nov 2024 14:54:59 -0500 Subject: [PATCH 4/7] fix camelCase --- .../kpmp/repositoryDataset/RepositoryDatasetDisplayTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplayTest.java b/src/test/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplayTest.java index 145b14e..eeea5b5 100644 --- a/src/test/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplayTest.java +++ b/src/test/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplayTest.java @@ -91,8 +91,8 @@ public void testAddEnrollmentCategory() { @Test public void setenrollmentCategory() { Set expected = new HashSet(Arrays.asList("enrollment_category")); - repositoryDatasetDisplay.setenrollmentCategory(expected); - Set actual = repositoryDatasetDisplay.getenrollmentCategory(); + repositoryDatasetDisplay.setEnrollmentCategory(expected); + Set actual = repositoryDatasetDisplay.getEnrollmentCategory(); assertEquals(1, repositoryDatasetDisplay.getEnrollmentCategory().size()); assertEquals(true, repositoryDatasetDisplay.getEnrollmentCategory().contains("enrollment_category")); } From 5f6a7dbf15b10daf3e83037539accd6d6c9a3956 Mon Sep 17 00:00:00 2001 From: dert1129 Date: Tue, 5 Nov 2024 11:30:38 -0500 Subject: [PATCH 5/7] fix logic for clinical file and add tests for new methods --- .../RepositoryDatasetDisplay.java | 247 +++++++++++++----- .../RepositoryDatasetService.java | 12 + .../RepositoryDatasetDisplayTest.java | 190 ++++++++++---- 3 files changed, 337 insertions(+), 112 deletions(-) diff --git a/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java b/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java index 8851c42..f1cdfca 100644 --- a/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java +++ b/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java @@ -31,18 +31,18 @@ public class RepositoryDatasetDisplay { private String fileName; private String packageId; private String fileNameSort; - private String primaryAdjudicatedCat; - private String kdigoStage; - private String baselineEgfr; - private String proteinuria; - private String a1c; - private String albuminuria; - private String diabetesDuration; - private String diabetesHistory; - private String hypertensionHistory; - private String hypertensionDuration; - private String race; - private String onRaasBlockade; + private Set primaryAdjudicatedCategory; + private Set kdigoStage; + private Set baselineEgfr; + private Set proteinuria; + private Set a1c; + private Set albuminuria; + private Set diabetesDuration; + private Set diabetesHistory; + private Set hypertensionHistory; + private Set hypertensionDuration; + private Set race; + private Set onRaasBlockade; public RepositoryDatasetDisplay(RepositoryFileDataset repositoryFile) { dlFileId = repositoryFile.getId().getDlFileId(); @@ -56,6 +56,19 @@ public RepositoryDatasetDisplay(RepositoryFileDataset repositoryFile) { tissueSource = new HashSet(); experimentalStrategy = new TreeSet(); workflowType = new HashSet(); + a1c = new HashSet(); + albuminuria = new HashSet(); + baselineEgfr = new HashSet(); + diabetesDuration = new HashSet(); + diabetesHistory = new HashSet(); + primaryAdjudicatedCategory = new HashSet(); + kdigoStage = new HashSet(); + proteinuria = new HashSet(); + hypertensionDuration = new HashSet(); + hypertensionHistory = new HashSet(); + race = new HashSet(); + onRaasBlockade = new HashSet(); + redcapId.add(repositoryFile.getId().getRedcapId()); if (shouldAdd(repositoryFile.getSampleType())) { sampleType.add(repositoryFile.getSampleType()); @@ -84,6 +97,42 @@ public RepositoryDatasetDisplay(RepositoryFileDataset repositoryFile) { if(shouldAdd(repositoryFile.getWorkflowType())){ workflowType.add(repositoryFile.getWorkflowType()); } + if(shouldAdd(repositoryFile.getA1c())){ + a1c.add(repositoryFile.getA1c()); + } + if(shouldAdd(repositoryFile.getAlbuminuria())){ + albuminuria.add(repositoryFile.getAlbuminuria()); + } + if(shouldAdd(repositoryFile.getBaselineEgfr())){ + baselineEgfr.add(repositoryFile.getBaselineEgfr()); + } + if(shouldAdd(repositoryFile.getDiabetesDuration())){ + diabetesDuration.add(repositoryFile.getDiabetesDuration()); + } + if(shouldAdd(repositoryFile.getDiabetesHistory())){ + diabetesHistory.add(repositoryFile.getDiabetesHistory()); + } + if(shouldAdd(repositoryFile.getPrimaryAdjudicatedCat())){ + primaryAdjudicatedCategory.add(repositoryFile.getPrimaryAdjudicatedCat()); + } + if(shouldAdd(repositoryFile.getKdigoStage())){ + kdigoStage.add(repositoryFile.getKdigoStage()); + } + if(shouldAdd(repositoryFile.getProteinuria())){ + proteinuria.add(repositoryFile.getProteinuria()); + } + if(shouldAdd(repositoryFile.getHypertensionDuration())){ + hypertensionDuration.add(repositoryFile.getHypertensionDuration()); + } + if(shouldAdd(repositoryFile.getHypertensionHistory())){ + hypertensionHistory.add(repositoryFile.getHypertensionHistory()); + } + if(shouldAdd(repositoryFile.getRace())){ + race.add(repositoryFile.getRace()); + } + if(shouldAdd(repositoryFile.getOnRaasBlockade())){ + onRaasBlockade.add(repositoryFile.getOnRaasBlockade()); + } access = repositoryFile.getAccess(); dataFormat = repositoryFile.getDataFormat(); platform = repositoryFile.getPlatform(); @@ -92,19 +141,6 @@ public RepositoryDatasetDisplay(RepositoryFileDataset repositoryFile) { fileSize = repositoryFile.getFileSize(); fileName = repositoryFile.getFileName(); packageId = repositoryFile.getPackageId(); - primaryAdjudicatedCat = repositoryFile.getPrimaryAdjudicatedCat(); - kdigoStage = repositoryFile.getKdigoStage(); - baselineEgfr = repositoryFile.getBaselineEgfr(); - proteinuria = repositoryFile.getProteinuria(); - a1c = repositoryFile.getA1c(); - albuminuria = repositoryFile.getAlbuminuria(); - diabetesDuration = repositoryFile.getDiabetesDuration(); - diabetesHistory = repositoryFile.getDiabetesHistory(); - hypertensionDuration = repositoryFile.getHypertensionDuration(); - hypertensionHistory = repositoryFile.getHypertensionHistory(); - race = repositoryFile.getRace(); - onRaasBlockade = repositoryFile.getOnRaasBlockade(); - } @JsonProperty("file_id") @@ -492,162 +528,239 @@ private boolean shouldAdd(String value) { } @JsonProperty("primary_adjudicated_category") - public String getPrimaryAdjudicatedCategory() { - if(this.primaryAdjudicatedCat == null || this.primaryAdjudicatedCat.isEmpty() ){ + public Set getPrimaryAdjudicatedCategory() { + if(this.primaryAdjudicatedCategory.isEmpty() ){ return null; }else{ - return this.primaryAdjudicatedCat; + return this.primaryAdjudicatedCategory; + } + } + + public void addPrimaryAdjudicatedCategory(String primaryAdjudicatedCategory) { + if(primaryAdjudicatedCategory != null && !primaryAdjudicatedCategory.isEmpty()){ + this.primaryAdjudicatedCategory.add(primaryAdjudicatedCategory); } } - public void setPrimaryAdjudicatedCat(String primaryAdjudicatedCat) { - this.primaryAdjudicatedCat = primaryAdjudicatedCat; + public void setPrimaryAdjudicatedCat(Set primaryAdjudicatedCategory) { + this.primaryAdjudicatedCategory = primaryAdjudicatedCategory; } @JsonProperty("kdigo_stage") - public String getKdigoStage() { - if(this.kdigoStage == null || this.kdigoStage.isEmpty()){ + public Set getKdigoStage() { + if(this.kdigoStage.isEmpty()){ return null; }else{ return this.kdigoStage; } } - public void setKdigoStage(String kdigoStage) { + public void addKdigoStage(String kdigoStage) { + if(kdigoStage != null && !kdigoStage.isEmpty()){ + this.kdigoStage.add(kdigoStage); + } + } + + public void setKdigoStage(Set kdigoStage) { this.kdigoStage = kdigoStage; } @JsonProperty("baseline_egfr") - public String getBaselineEgfr() { - if(this.baselineEgfr == null || this.baselineEgfr.isEmpty()){ + public Set getBaselineEgfr() { + if(this.baselineEgfr.isEmpty()){ return null; }else{ return this.baselineEgfr; } } - public void setBaselineEgfr(String baselineEgfr) { + public void addBaselineEgfr(String baselineEgfr) { + if(baselineEgfr != null && !baselineEgfr.isEmpty()){ + this.baselineEgfr.add(baselineEgfr); + } + } + + public void setBaselineEgfr(Set baselineEgfr) { this.baselineEgfr = baselineEgfr; } @JsonProperty("proteinuria") - public String getProteinuria() { - if(this.proteinuria == null || this.proteinuria.isEmpty()){ + public Set getProteinuria() { + if(this.proteinuria.isEmpty()){ return null; }else{ return this.proteinuria; } } - public void setProteinuria(String proteinuria) { + public void addProteinuria(String proteinuria) { + if(proteinuria != null && !proteinuria.isEmpty()){ + this.proteinuria.add(proteinuria); + } + } + + public void setProteinuria(Set proteinuria) { this.proteinuria = proteinuria; } @JsonProperty("a1c") - public String getA1c() { - if(this.a1c == null || this.a1c.isEmpty()){ + public Set getA1c() { + if(this.a1c.isEmpty()){ return null; }else{ return this.a1c; } } - public void setA1c(String a1c) { + public void addA1c(String a1c) { + if(a1c != null && !a1c.isEmpty()){ + this.a1c.add(a1c); + } + } + + public void setA1c(Set a1c) { this.a1c = a1c; } @JsonProperty("albuminuria") - public String getAlbuminuria() { - if(this.albuminuria == null || this.albuminuria.isEmpty()){ + public Set getAlbuminuria() { + if(this.albuminuria.isEmpty()){ return null; }else{ return this.albuminuria; } } - public void setAlbuminuria(String albuminuria) { + public void addAlbuminuria(String albuminuria) { + if(albuminuria != null && !albuminuria.isEmpty()){ + this.albuminuria.add(albuminuria); + } + } + + public void setAlbuminuria(Set albuminuria) { this.albuminuria = albuminuria; } @JsonProperty("diabetes_duration") - public String getDiabetesDuration() { - if(this.diabetesDuration == null || this.diabetesDuration.isEmpty()){ + public Set getDiabetesDuration() { + if(this.diabetesDuration.isEmpty()){ return null; }else{ return this.diabetesDuration; } } - public void setDiabetesDuration(String diabetesDuration) { + public void addDiabetesDuration(String diabetesDuration) { + if(diabetesDuration != null && !diabetesDuration.isEmpty()){ + this.diabetesDuration.add(diabetesDuration); + } + } + + public void setDiabetesDuration(Set diabetesDuration) { this.diabetesDuration = diabetesDuration; } @JsonProperty("diabetes_history") - public String getDiabetesHistory() { - if(this.diabetesHistory == null || this.diabetesHistory.isEmpty()){ + public Set getDiabetesHistory() { + if(this.diabetesHistory.isEmpty()){ return null; }else{ - return fixCapitalizaion(this.diabetesHistory); + return fixCapitalization(this.diabetesHistory); + } + } + + public void addDiabetesHistory(String diabetesHistory) { + if(diabetesHistory != null && !diabetesHistory.isEmpty()){ + this.diabetesHistory.add(diabetesHistory); } } - public void setDiabetesHistory(String diabetesHistory) { + public void setDiabetesHistory(Set diabetesHistory) { this.diabetesHistory = diabetesHistory; } @JsonProperty("hypertension_history") - public String getHypertensionHistory() { - if(this.hypertensionHistory == null || this.hypertensionHistory.isEmpty()){ + public Set getHypertensionHistory() { + if(this.hypertensionHistory.isEmpty()){ return null; }else{ - return fixCapitalizaion(this.hypertensionHistory); + return fixCapitalization(this.hypertensionHistory); } } - public void setHypertensionHistory(String hypertensionHistory) { + public void addHypertensionHistory(String hypertensionHistory) { + if(hypertensionHistory != null && !hypertensionHistory.isEmpty()){ + this.hypertensionHistory.add(hypertensionHistory); + } + } + + public void setHypertensionHistory(Set hypertensionHistory) { this.hypertensionHistory = hypertensionHistory; } @JsonProperty("hypertension_duration") - public String getHypertensionDuration() { - if(this.hypertensionDuration == null || this.hypertensionDuration.isEmpty()){ + public Set getHypertensionDuration() { + if(this.hypertensionDuration.isEmpty()){ return null; }else{ return this.hypertensionDuration; } } - public void setHypertensionDuration(String hypertensionDuration) { + public void addHypertensionDuration(String hypertensionDuration) { + if(hypertensionDuration != null && !hypertensionDuration.isEmpty()){ + this.hypertensionDuration.add(hypertensionDuration); + } + } + + public void setHypertensionDuration(Set hypertensionDuration) { this.hypertensionDuration = hypertensionDuration; } @JsonProperty("ethnicity") - public String getRace() { - if(this.race == null || this.race.isEmpty()){ + public Set getRace() { + if(this.race.isEmpty()){ return null; }else{ return this.race; } } - public void setRace(String race) { + public void addRace(String race) { + if(race != null && !race.isEmpty()){ + this.race.add(race); + } + } + + public void setRace(Set race) { this.race = race; } @JsonProperty("on_raas_blockade") - public String getOnRaasBlockade() { - if(this.onRaasBlockade == null || this.onRaasBlockade.isEmpty()){ + public Set getOnRaasBlockade() { + if(this.onRaasBlockade.isEmpty()){ return null; }else{ return this.onRaasBlockade; } } - public void setOnRaasBlockade(String onRaasBlockade) { + public void addOnRaasBlockade(String onRaasBlockade) { + if(onRaasBlockade != null && !onRaasBlockade.isEmpty()){ + this.onRaasBlockade.add(onRaasBlockade); + } + } + + public void setOnRaasBlockade(Set onRaasBlockade) { this.onRaasBlockade = onRaasBlockade; } - public String fixCapitalizaion(String input){ - return WordUtils.capitalizeFully(input, null); + public Set fixCapitalization(Set input){ + Set wordList = new HashSet(); + for (String string : input) { + String updatedInput = WordUtils.capitalizeFully(string); + wordList.add(updatedInput); + } + return wordList; } } \ No newline at end of file diff --git a/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetService.java b/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetService.java index be5bc55..fae90a7 100644 --- a/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetService.java +++ b/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetService.java @@ -79,6 +79,18 @@ public List getRepositoryDataset() throws Exception { displayFile.addExperimentalStrategy(repositoryDataset.getId().getExperimentalStrategy()); displayFile.addDoi(repositoryDataset.getId().getDoi()); displayFile.addWorkflowType(repositoryDataset.getWorkflowType()); + displayFile.addA1c(repositoryDataset.getA1c()); + displayFile.addAlbuminuria(repositoryDataset.getAlbuminuria()); + displayFile.addBaselineEgfr(repositoryDataset.getBaselineEgfr()); + displayFile.addDiabetesDuration(repositoryDataset.getDiabetesDuration()); + displayFile.addDiabetesHistory(repositoryDataset.getDiabetesHistory()); + displayFile.addPrimaryAdjudicatedCategory(repositoryDataset.getPrimaryAdjudicatedCat()); + displayFile.addKdigoStage(repositoryDataset.getKdigoStage()); + displayFile.addProteinuria(repositoryDataset.getProteinuria()); + displayFile.addHypertensionDuration(repositoryDataset.getHypertensionDuration()); + displayFile.addHypertensionHistory(repositoryDataset.getHypertensionHistory()); + displayFile.addRace(repositoryDataset.getRace()); + displayFile.addOnRaasBlockade(repositoryDataset.getOnRaasBlockade()); displayFile.setAccess(repositoryDataset.getAccess()); displayFiles.put(repositoryDataset.getId().getDlFileId(), displayFile); } else { diff --git a/src/test/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplayTest.java b/src/test/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplayTest.java index eeea5b5..21d3e5c 100644 --- a/src/test/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplayTest.java +++ b/src/test/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplayTest.java @@ -88,15 +88,6 @@ public void testAddEnrollmentCategory() { assertEquals(1, repositoryDatasetDisplay.getEnrollmentCategory().size()); } - @Test - public void setenrollmentCategory() { - Set expected = new HashSet(Arrays.asList("enrollment_category")); - repositoryDatasetDisplay.setEnrollmentCategory(expected); - Set actual = repositoryDatasetDisplay.getEnrollmentCategory(); - assertEquals(1, repositoryDatasetDisplay.getEnrollmentCategory().size()); - assertEquals(true, repositoryDatasetDisplay.getEnrollmentCategory().contains("enrollment_category")); - } - @Test public void setEnrollmentCategory() { Set expected = new HashSet(Arrays.asList("enrollment_category")); @@ -303,78 +294,187 @@ public void setPlatformSort(){ assertEquals("aaaaa", repositoryDatasetDisplay.getPlatformSort()); repositoryDatasetDisplay.setPlatform("platform"); - assertEquals("platform", repositoryDatasetDisplay.getPlatformSort()); + assertEquals("PLATFORM", repositoryDatasetDisplay.getPlatformSort()); } @Test - public void setKdigoStage(){ - repositoryDatasetDisplay.setKdigoStage("stage 1"); - assertEquals("stage 1", repositoryDatasetDisplay.getKdigoStage()); + public void setKdigoStage() { + Set expected = new HashSet(Arrays.asList("kdigo_stage")); + repositoryDatasetDisplay.setKdigoStage(expected); + Set actual = repositoryDatasetDisplay.getKdigoStage(); + assertEquals(expected, actual); + } + + @Test + public void testAddKdigoStage() { + RepositoryDatasetDisplay repositoryDatasetDisplay = new RepositoryDatasetDisplay(repositoryFile); + repositoryDatasetDisplay.addKdigoStage("kdigo_stage"); + assertEquals(1, repositoryDatasetDisplay.getKdigoStage().size()); } @Test public void setPrimaryAdjudicatedCat(){ - repositoryDatasetDisplay.setPrimaryAdjudicatedCat("blah"); - assertEquals("blah", repositoryDatasetDisplay.getPrimaryAdjudicatedCategory()); + Set expected = new HashSet(Arrays.asList("category")); + repositoryDatasetDisplay.setPrimaryAdjudicatedCat(expected); + Set actual = repositoryDatasetDisplay.getPrimaryAdjudicatedCategory(); + assertEquals(expected, actual); + } + + @Test + public void testAddPrimaryAdjudicatedCat() { + RepositoryDatasetDisplay repositoryDatasetDisplay = new RepositoryDatasetDisplay(repositoryFile); + repositoryDatasetDisplay.addPrimaryAdjudicatedCategory("category"); + assertEquals(1, repositoryDatasetDisplay.getPrimaryAdjudicatedCategory().size()); + } + + @Test + public void setBaselineEgfr(){ + Set expected = new HashSet(Arrays.asList("baseline")); + repositoryDatasetDisplay.setBaselineEgfr(expected); + Set actual = repositoryDatasetDisplay.getBaselineEgfr(); + assertEquals(expected, actual); + } + + @Test + public void testAddBaselineEgfr() { + RepositoryDatasetDisplay repositoryDatasetDisplay = new RepositoryDatasetDisplay(repositoryFile); + repositoryDatasetDisplay.addBaselineEgfr("baseline"); + assertEquals(1, repositoryDatasetDisplay.getBaselineEgfr().size()); + } + + @Test + public void testSetProteinuria(){ + Set expected = new HashSet(Arrays.asList("proteinuria")); + repositoryDatasetDisplay.setProteinuria(expected); + Set actual = repositoryDatasetDisplay.getProteinuria(); + assertEquals(expected, actual); + } + + @Test + public void testAddProteinuria() { + RepositoryDatasetDisplay repositoryDatasetDisplay = new RepositoryDatasetDisplay(repositoryFile); + repositoryDatasetDisplay.addProteinuria("proteinuria"); + assertEquals(1, repositoryDatasetDisplay.getProteinuria().size()); } @Test - public void setBaselineEgfr() { - repositoryDatasetDisplay.setBaselineEgfr("asd"); - assertEquals("asd", repositoryDatasetDisplay.getBaselineEgfr()); + public void testSetA1c(){ + Set expected = new HashSet(Arrays.asList("a1c")); + repositoryDatasetDisplay.setA1c(expected); + Set actual = repositoryDatasetDisplay.getA1c(); + assertEquals(expected, actual); } @Test - public void setProteinuria() { - repositoryDatasetDisplay.setProteinuria("123"); - assertEquals("123", repositoryDatasetDisplay.getProteinuria()); + public void testAddA1c() { + RepositoryDatasetDisplay repositoryDatasetDisplay = new RepositoryDatasetDisplay(repositoryFile); + repositoryDatasetDisplay.addA1c("A1c"); + assertEquals(1, repositoryDatasetDisplay.getA1c().size()); } @Test - public void setA1c() { - repositoryDatasetDisplay.setA1c("humbug"); - assertEquals("humbug", repositoryDatasetDisplay.getA1c()); + public void testSetAlbuminuria(){ + Set expected = new HashSet(Arrays.asList("albuminuria")); + repositoryDatasetDisplay.setAlbuminuria(expected); + Set actual = repositoryDatasetDisplay.getAlbuminuria(); + assertEquals(expected, actual); } @Test - public void setAlbuminuria() { - repositoryDatasetDisplay.setAlbuminuria("albuminuria"); - assertEquals("albuminuria", repositoryDatasetDisplay.getAlbuminuria()); + public void testAddAlbuminuria() { + RepositoryDatasetDisplay repositoryDatasetDisplay = new RepositoryDatasetDisplay(repositoryFile); + repositoryDatasetDisplay.addAlbuminuria("albuminuria"); + assertEquals(1, repositoryDatasetDisplay.getAlbuminuria().size()); } @Test - public void setDiabetesDuration() { - repositoryDatasetDisplay.setDiabetesDuration("1 century"); - assertEquals("1 century", repositoryDatasetDisplay.getDiabetesDuration()); + public void testAddDiabetesDuration() { + RepositoryDatasetDisplay repositoryDatasetDisplay = new RepositoryDatasetDisplay(repositoryFile); + repositoryDatasetDisplay.addDiabetesDuration("A1c"); + assertEquals(1, repositoryDatasetDisplay.getDiabetesDuration().size()); } @Test - public void setDiabetesHistory() { - repositoryDatasetDisplay.setDiabetesHistory("dOn't KNoW"); - assertEquals("Don't Know", repositoryDatasetDisplay.getDiabetesHistory()); + public void testSetDiabetesDuration(){ + Set expected = new HashSet(Arrays.asList("duration")); + repositoryDatasetDisplay.setDiabetesDuration(expected); + Set actual = repositoryDatasetDisplay.getDiabetesDuration(); + assertEquals(expected, actual); } @Test - public void setHypertensionDuration() { - repositoryDatasetDisplay.setHypertensionDuration("123"); - assertEquals("123", repositoryDatasetDisplay.getHypertensionDuration()); + public void testAddDiabetesHistory() { + RepositoryDatasetDisplay repositoryDatasetDisplay = new RepositoryDatasetDisplay(repositoryFile); + repositoryDatasetDisplay.addDiabetesHistory("history"); + assertEquals(1, repositoryDatasetDisplay.getDiabetesHistory().size()); } @Test - public void setHypertensionHistory() { - repositoryDatasetDisplay.setHypertensionHistory("yes"); - assertEquals("Yes", repositoryDatasetDisplay.getHypertensionHistory()); + public void testSetDiabetesHistory(){ + Set expected = new HashSet(Arrays.asList("dOn't KNoW")); + repositoryDatasetDisplay.setDiabetesHistory(expected); + Set actual = repositoryDatasetDisplay.getDiabetesHistory(); + assertEquals(new HashSet(Arrays.asList("Don't Know")), actual); } @Test - public void setRace() { - repositoryDatasetDisplay.setRace("race"); - assertEquals("race", repositoryDatasetDisplay.getRace()); + public void testAddHypertensionDuration() { + RepositoryDatasetDisplay repositoryDatasetDisplay = new RepositoryDatasetDisplay(repositoryFile); + repositoryDatasetDisplay.addHypertensionDuration("duration"); + assertEquals(1, repositoryDatasetDisplay.getHypertensionDuration().size()); } - public void setOnRaasBlockade() { - repositoryDatasetDisplay.setOnRaasBlockade("no"); - assertEquals("no", repositoryDatasetDisplay.getOnRaasBlockade()); + @Test + public void testSetHypertensionDuration(){ + Set expected = new HashSet(Arrays.asList("duration")); + repositoryDatasetDisplay.setHypertensionDuration(expected); + Set actual = repositoryDatasetDisplay.getHypertensionDuration(); + assertEquals(expected, actual); + } + + @Test + public void testAddHypertensionHistory() { + RepositoryDatasetDisplay repositoryDatasetDisplay = new RepositoryDatasetDisplay(repositoryFile); + repositoryDatasetDisplay.addHypertensionHistory("don't KnoW"); + assertEquals(1, repositoryDatasetDisplay.getHypertensionHistory().size()); + } + + @Test + public void testSetHypertensionHistory(){ + Set expected = new HashSet(Arrays.asList("dOn't KNoW")); + repositoryDatasetDisplay.setHypertensionHistory(expected); + Set actual = repositoryDatasetDisplay.getHypertensionHistory(); + assertEquals(new HashSet(Arrays.asList("Don't Know")), actual); + } + + @Test + public void testAddRace() { + RepositoryDatasetDisplay repositoryDatasetDisplay = new RepositoryDatasetDisplay(repositoryFile); + repositoryDatasetDisplay.addRace("race"); + assertEquals(1, repositoryDatasetDisplay.getRace().size()); + } + + @Test + public void testSetRace(){ + Set expected = new HashSet(Arrays.asList("race")); + repositoryDatasetDisplay.setRace(expected); + Set actual = repositoryDatasetDisplay.getRace(); + assertEquals(expected, actual); + } + + @Test + public void testAddOnRaasBlockade() { + RepositoryDatasetDisplay repositoryDatasetDisplay = new RepositoryDatasetDisplay(repositoryFile); + repositoryDatasetDisplay.addOnRaasBlockade("OnRaasBlockade"); + assertEquals(1, repositoryDatasetDisplay.getOnRaasBlockade().size()); + } + + @Test + public void testSetOnRaasBlockade(){ + Set expected = new HashSet(Arrays.asList("onRaasBlockade")); + repositoryDatasetDisplay.setOnRaasBlockade(expected); + Set actual = repositoryDatasetDisplay.getOnRaasBlockade(); + assertEquals(expected, actual); } } \ No newline at end of file From cfbb8b253486c7d6cbcd84ca08c65adcca84a1ca Mon Sep 17 00:00:00 2001 From: dert1129 Date: Tue, 5 Nov 2024 14:31:53 -0500 Subject: [PATCH 6/7] Move types to be together --- .../RepositoryDatasetDisplay.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java b/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java index f1cdfca..4f809fd 100644 --- a/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java +++ b/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java @@ -11,19 +11,9 @@ public class RepositoryDatasetDisplay { private static final int UUID_LENGTH = 37; private String dlFileId; - private Set redcapId; - private Set sampleType; - private Set enrollmentCategory; - private Set ageBinned; - private Set sex; - private Set doi; private String access; private String platform; private String releaseVersion; - private Set protocol; - private Set tissueSource; - private Set experimentalStrategy; - private Set workflowType; private String dataFormat; private String dataCategory; private String dataType; @@ -31,6 +21,16 @@ public class RepositoryDatasetDisplay { private String fileName; private String packageId; private String fileNameSort; + private Set protocol; + private Set tissueSource; + private Set experimentalStrategy; + private Set workflowType; + private Set redcapId; + private Set sampleType; + private Set enrollmentCategory; + private Set ageBinned; + private Set sex; + private Set doi; private Set primaryAdjudicatedCategory; private Set kdigoStage; private Set baselineEgfr; From 3ee637b0c60791c8fee36d93a028c89aa813b3cb Mon Sep 17 00:00:00 2001 From: dert1129 Date: Tue, 5 Nov 2024 14:39:10 -0500 Subject: [PATCH 7/7] rename variable --- .../repositoryDataset/RepositoryDatasetDisplay.java | 4 ++-- .../repositoryDataset/RepositoryDatasetService.java | 2 +- .../kpmp/repositoryDataset/RepositoryFileDataset.java | 10 +++++----- src/test/java/org/kpmp/QueryTest.java | 2 +- .../repositoryDataset/RepositoryFileDatasetTest.java | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java b/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java index 4f809fd..309fb30 100644 --- a/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java +++ b/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java @@ -112,8 +112,8 @@ public RepositoryDatasetDisplay(RepositoryFileDataset repositoryFile) { if(shouldAdd(repositoryFile.getDiabetesHistory())){ diabetesHistory.add(repositoryFile.getDiabetesHistory()); } - if(shouldAdd(repositoryFile.getPrimaryAdjudicatedCat())){ - primaryAdjudicatedCategory.add(repositoryFile.getPrimaryAdjudicatedCat()); + if(shouldAdd(repositoryFile.getPrimaryAdjudicatedCategory())){ + primaryAdjudicatedCategory.add(repositoryFile.getPrimaryAdjudicatedCategory()); } if(shouldAdd(repositoryFile.getKdigoStage())){ kdigoStage.add(repositoryFile.getKdigoStage()); diff --git a/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetService.java b/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetService.java index fae90a7..270a6c5 100644 --- a/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetService.java +++ b/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetService.java @@ -84,7 +84,7 @@ public List getRepositoryDataset() throws Exception { displayFile.addBaselineEgfr(repositoryDataset.getBaselineEgfr()); displayFile.addDiabetesDuration(repositoryDataset.getDiabetesDuration()); displayFile.addDiabetesHistory(repositoryDataset.getDiabetesHistory()); - displayFile.addPrimaryAdjudicatedCategory(repositoryDataset.getPrimaryAdjudicatedCat()); + displayFile.addPrimaryAdjudicatedCategory(repositoryDataset.getPrimaryAdjudicatedCategory()); displayFile.addKdigoStage(repositoryDataset.getKdigoStage()); displayFile.addProteinuria(repositoryDataset.getProteinuria()); displayFile.addHypertensionDuration(repositoryDataset.getHypertensionDuration()); diff --git a/src/main/java/org/kpmp/repositoryDataset/RepositoryFileDataset.java b/src/main/java/org/kpmp/repositoryDataset/RepositoryFileDataset.java index 3f7be8f..a3e4d35 100644 --- a/src/main/java/org/kpmp/repositoryDataset/RepositoryFileDataset.java +++ b/src/main/java/org/kpmp/repositoryDataset/RepositoryFileDataset.java @@ -25,7 +25,7 @@ public class RepositoryFileDataset { private String tissueSource; private Double releaseVersion; @Column(name = "primary_adjudicated_cat") - private String primaryAdjudicatedCat; + private String primaryAdjudicatedCategory; private String kdigoStage; private String baselineEgfr; private String proteinuria; @@ -153,12 +153,12 @@ public void setProtocol(String protocol) { this.protocol = protocol; } - public String getPrimaryAdjudicatedCat() { - return this.primaryAdjudicatedCat; + public String getPrimaryAdjudicatedCategory() { + return this.primaryAdjudicatedCategory; } - public void setPrimaryAdjudicatedCat(String primaryAdjudicatedCat) { - this.primaryAdjudicatedCat = primaryAdjudicatedCat; + public void setPrimaryAdjudicatedCategory(String primaryAdjudicatedCat) { + this.primaryAdjudicatedCategory = primaryAdjudicatedCat; } public String getKdigoStage() { diff --git a/src/test/java/org/kpmp/QueryTest.java b/src/test/java/org/kpmp/QueryTest.java index 50d7bf6..b80f757 100644 --- a/src/test/java/org/kpmp/QueryTest.java +++ b/src/test/java/org/kpmp/QueryTest.java @@ -57,7 +57,7 @@ public void testGetRepositoryDataset() throws Exception { repositoryFileDataset.setEnrollmentCategory("organic"); repositoryFileDataset.setWorkflowType("workflowType"); repositoryFileDatasetId.setDlFileId("dlFileId"); - repositoryFileDataset.setPrimaryAdjudicatedCat("primaryAdjudicatedCategory"); + repositoryFileDataset.setPrimaryAdjudicatedCategory("primaryAdjudicatedCategory"); repositoryFileDataset.setKdigoStage("kdigoStage"); repositoryFileDataset.setBaselineEgfr("baselineEgfr"); repositoryFileDataset.setProteinuria("proteinuria"); diff --git a/src/test/java/org/kpmp/repositoryDataset/RepositoryFileDatasetTest.java b/src/test/java/org/kpmp/repositoryDataset/RepositoryFileDatasetTest.java index 4c2b6ad..b75c202 100644 --- a/src/test/java/org/kpmp/repositoryDataset/RepositoryFileDatasetTest.java +++ b/src/test/java/org/kpmp/repositoryDataset/RepositoryFileDatasetTest.java @@ -113,8 +113,8 @@ public void setReleaseVersion() { @Test public void setPrimaryAdjudicatedCat() { - repositoryDataset.setPrimaryAdjudicatedCat("blah"); - assertEquals("blah" ,repositoryDataset.getPrimaryAdjudicatedCat()); + repositoryDataset.setPrimaryAdjudicatedCategory("blah"); + assertEquals("blah" ,repositoryDataset.getPrimaryAdjudicatedCategory()); } @Test