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 f41d9a5..309fb30 100644 --- a/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java +++ b/src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java @@ -2,25 +2,18 @@ import java.util.HashSet; import java.util.TreeSet; + +import org.apache.commons.text.WordUtils; + import java.util.Set; import com.fasterxml.jackson.annotation.JsonProperty; 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; @@ -28,6 +21,28 @@ 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; + 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(); @@ -41,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()); @@ -69,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.getPrimaryAdjudicatedCategory())){ + primaryAdjudicatedCategory.add(repositoryFile.getPrimaryAdjudicatedCategory()); + } + 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(); @@ -463,4 +527,240 @@ private boolean shouldAdd(String value) { return true; } + @JsonProperty("primary_adjudicated_category") + public Set getPrimaryAdjudicatedCategory() { + if(this.primaryAdjudicatedCategory.isEmpty() ){ + return null; + }else{ + return this.primaryAdjudicatedCategory; + } + } + + public void addPrimaryAdjudicatedCategory(String primaryAdjudicatedCategory) { + if(primaryAdjudicatedCategory != null && !primaryAdjudicatedCategory.isEmpty()){ + this.primaryAdjudicatedCategory.add(primaryAdjudicatedCategory); + } + } + + public void setPrimaryAdjudicatedCat(Set primaryAdjudicatedCategory) { + this.primaryAdjudicatedCategory = primaryAdjudicatedCategory; + } + + @JsonProperty("kdigo_stage") + public Set getKdigoStage() { + if(this.kdigoStage.isEmpty()){ + return null; + }else{ + return this.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 Set getBaselineEgfr() { + if(this.baselineEgfr.isEmpty()){ + return null; + }else{ + return this.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 Set getProteinuria() { + if(this.proteinuria.isEmpty()){ + return null; + }else{ + return this.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 Set getA1c() { + if(this.a1c.isEmpty()){ + return null; + }else{ + return this.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 Set getAlbuminuria() { + if(this.albuminuria.isEmpty()){ + return null; + }else{ + return this.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 Set getDiabetesDuration() { + if(this.diabetesDuration.isEmpty()){ + return null; + }else{ + return this.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 Set getDiabetesHistory() { + if(this.diabetesHistory.isEmpty()){ + return null; + }else{ + return fixCapitalization(this.diabetesHistory); + } + } + + public void addDiabetesHistory(String diabetesHistory) { + if(diabetesHistory != null && !diabetesHistory.isEmpty()){ + this.diabetesHistory.add(diabetesHistory); + } + } + + public void setDiabetesHistory(Set diabetesHistory) { + this.diabetesHistory = diabetesHistory; + } + + @JsonProperty("hypertension_history") + public Set getHypertensionHistory() { + if(this.hypertensionHistory.isEmpty()){ + return null; + }else{ + return fixCapitalization(this.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 Set getHypertensionDuration() { + if(this.hypertensionDuration.isEmpty()){ + return null; + }else{ + return this.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 Set getRace() { + if(this.race.isEmpty()){ + return null; + }else{ + return this.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 Set getOnRaasBlockade() { + if(this.onRaasBlockade.isEmpty()){ + return null; + }else{ + return this.onRaasBlockade; + } + } + + public void addOnRaasBlockade(String onRaasBlockade) { + if(onRaasBlockade != null && !onRaasBlockade.isEmpty()){ + this.onRaasBlockade.add(onRaasBlockade); + } + } + + public void setOnRaasBlockade(Set onRaasBlockade) { + this.onRaasBlockade = onRaasBlockade; + } + + 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..270a6c5 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.getPrimaryAdjudicatedCategory()); + 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/main/java/org/kpmp/repositoryDataset/RepositoryFileDataset.java b/src/main/java/org/kpmp/repositoryDataset/RepositoryFileDataset.java index cd812d3..a3e4d35 100644 --- a/src/main/java/org/kpmp/repositoryDataset/RepositoryFileDataset.java +++ b/src/main/java/org/kpmp/repositoryDataset/RepositoryFileDataset.java @@ -24,6 +24,20 @@ public class RepositoryFileDataset { private String packageId; private String tissueSource; private Double releaseVersion; + @Column(name = "primary_adjudicated_cat") + private String primaryAdjudicatedCategory; + 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; @@ -139,6 +153,102 @@ public void setProtocol(String protocol) { this.protocol = protocol; } + public String getPrimaryAdjudicatedCategory() { + return this.primaryAdjudicatedCategory; + } + + public void setPrimaryAdjudicatedCategory(String primaryAdjudicatedCat) { + this.primaryAdjudicatedCategory = 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 89d4ca2..cbedb66 100755 --- a/src/main/resources/knowledge_environment.graphqls +++ b/src/main/resources/knowledge_environment.graphqls @@ -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 4dd2706..b80f757 100644 --- a/src/test/java/org/kpmp/QueryTest.java +++ b/src/test/java/org/kpmp/QueryTest.java @@ -57,6 +57,18 @@ public void testGetRepositoryDataset() throws Exception { repositoryFileDataset.setEnrollmentCategory("organic"); repositoryFileDataset.setWorkflowType("workflowType"); repositoryFileDatasetId.setDlFileId("dlFileId"); + repositoryFileDataset.setPrimaryAdjudicatedCategory("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 bcbba95..21d3e5c 100644 --- a/src/test/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplayTest.java +++ b/src/test/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplayTest.java @@ -83,12 +83,9 @@ public void setSampleType() { @Test public void testAddEnrollmentCategory() { - RepositoryDatasetDisplay repositoryDatasetDisplay = new RepositoryDatasetDisplay(repositoryFile); repositoryDatasetDisplay.addEnrollmentCategory("enrollment_category"); - assertEquals(1, repositoryDatasetDisplay.getEnrollmentCategory().size()); - assertEquals(true, repositoryDatasetDisplay.getEnrollmentCategory().contains("enrollment_category")); } @Test @@ -297,7 +294,187 @@ public void setPlatformSort(){ assertEquals("aaaaa", repositoryDatasetDisplay.getPlatformSort()); repositoryDatasetDisplay.setPlatform("platform"); - assertEquals("platform", repositoryDatasetDisplay.getPlatformSort()); + assertEquals("PLATFORM", repositoryDatasetDisplay.getPlatformSort()); + } + + @Test + 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(){ + 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 testSetA1c(){ + Set expected = new HashSet(Arrays.asList("a1c")); + repositoryDatasetDisplay.setA1c(expected); + Set actual = repositoryDatasetDisplay.getA1c(); + assertEquals(expected, actual); + } + + @Test + public void testAddA1c() { + RepositoryDatasetDisplay repositoryDatasetDisplay = new RepositoryDatasetDisplay(repositoryFile); + repositoryDatasetDisplay.addA1c("A1c"); + assertEquals(1, repositoryDatasetDisplay.getA1c().size()); + } + + @Test + public void testSetAlbuminuria(){ + Set expected = new HashSet(Arrays.asList("albuminuria")); + repositoryDatasetDisplay.setAlbuminuria(expected); + Set actual = repositoryDatasetDisplay.getAlbuminuria(); + assertEquals(expected, actual); + } + + @Test + public void testAddAlbuminuria() { + RepositoryDatasetDisplay repositoryDatasetDisplay = new RepositoryDatasetDisplay(repositoryFile); + repositoryDatasetDisplay.addAlbuminuria("albuminuria"); + assertEquals(1, repositoryDatasetDisplay.getAlbuminuria().size()); + } + + @Test + public void testAddDiabetesDuration() { + RepositoryDatasetDisplay repositoryDatasetDisplay = new RepositoryDatasetDisplay(repositoryFile); + repositoryDatasetDisplay.addDiabetesDuration("A1c"); + assertEquals(1, repositoryDatasetDisplay.getDiabetesDuration().size()); + } + + @Test + public void testSetDiabetesDuration(){ + Set expected = new HashSet(Arrays.asList("duration")); + repositoryDatasetDisplay.setDiabetesDuration(expected); + Set actual = repositoryDatasetDisplay.getDiabetesDuration(); + assertEquals(expected, actual); + } + + @Test + public void testAddDiabetesHistory() { + RepositoryDatasetDisplay repositoryDatasetDisplay = new RepositoryDatasetDisplay(repositoryFile); + repositoryDatasetDisplay.addDiabetesHistory("history"); + assertEquals(1, repositoryDatasetDisplay.getDiabetesHistory().size()); + } + + @Test + 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 testAddHypertensionDuration() { + RepositoryDatasetDisplay repositoryDatasetDisplay = new RepositoryDatasetDisplay(repositoryFile); + repositoryDatasetDisplay.addHypertensionDuration("duration"); + assertEquals(1, repositoryDatasetDisplay.getHypertensionDuration().size()); + } + + @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 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; diff --git a/src/test/java/org/kpmp/repositoryDataset/RepositoryFileDatasetTest.java b/src/test/java/org/kpmp/repositoryDataset/RepositoryFileDatasetTest.java index 05d1a34..b75c202 100644 --- a/src/test/java/org/kpmp/repositoryDataset/RepositoryFileDatasetTest.java +++ b/src/test/java/org/kpmp/repositoryDataset/RepositoryFileDatasetTest.java @@ -111,4 +111,70 @@ public void setReleaseVersion() { assertEquals(45.0, repositoryDataset.getReleaseVersion()); } + @Test + public void setPrimaryAdjudicatedCat() { + repositoryDataset.setPrimaryAdjudicatedCategory("blah"); + assertEquals("blah" ,repositoryDataset.getPrimaryAdjudicatedCategory()); + } + + @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