Skip to content

Commit

Permalink
fix logic for clinical file and add tests for new methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Dert1129 committed Nov 5, 2024
1 parent 886bc22 commit 5f6a7db
Show file tree
Hide file tree
Showing 3 changed files with 337 additions and 112 deletions.
247 changes: 180 additions & 67 deletions src/main/java/org/kpmp/repositoryDataset/RepositoryDatasetDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> primaryAdjudicatedCategory;
private Set<String> kdigoStage;
private Set<String> baselineEgfr;
private Set<String> proteinuria;
private Set<String> a1c;
private Set<String> albuminuria;
private Set<String> diabetesDuration;
private Set<String> diabetesHistory;
private Set<String> hypertensionHistory;
private Set<String> hypertensionDuration;
private Set<String> race;
private Set<String> onRaasBlockade;

public RepositoryDatasetDisplay(RepositoryFileDataset repositoryFile) {
dlFileId = repositoryFile.getId().getDlFileId();
Expand All @@ -56,6 +56,19 @@ public RepositoryDatasetDisplay(RepositoryFileDataset repositoryFile) {
tissueSource = new HashSet<String>();
experimentalStrategy = new TreeSet<String>();
workflowType = new HashSet<String>();
a1c = new HashSet<String>();
albuminuria = new HashSet<String>();
baselineEgfr = new HashSet<String>();
diabetesDuration = new HashSet<String>();
diabetesHistory = new HashSet<String>();
primaryAdjudicatedCategory = new HashSet<String>();
kdigoStage = new HashSet<String>();
proteinuria = new HashSet<String>();
hypertensionDuration = new HashSet<String>();
hypertensionHistory = new HashSet<String>();
race = new HashSet<String>();
onRaasBlockade = new HashSet<String>();

redcapId.add(repositoryFile.getId().getRedcapId());
if (shouldAdd(repositoryFile.getSampleType())) {
sampleType.add(repositoryFile.getSampleType());
Expand Down Expand Up @@ -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();
Expand All @@ -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")
Expand Down Expand Up @@ -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<String> 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<String> primaryAdjudicatedCategory) {
this.primaryAdjudicatedCategory = primaryAdjudicatedCategory;
}

@JsonProperty("kdigo_stage")
public String getKdigoStage() {
if(this.kdigoStage == null || this.kdigoStage.isEmpty()){
public Set<String> 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<String> kdigoStage) {
this.kdigoStage = kdigoStage;
}

@JsonProperty("baseline_egfr")
public String getBaselineEgfr() {
if(this.baselineEgfr == null || this.baselineEgfr.isEmpty()){
public Set<String> 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<String> baselineEgfr) {
this.baselineEgfr = baselineEgfr;
}

@JsonProperty("proteinuria")
public String getProteinuria() {
if(this.proteinuria == null || this.proteinuria.isEmpty()){
public Set<String> 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<String> proteinuria) {
this.proteinuria = proteinuria;
}

@JsonProperty("a1c")
public String getA1c() {
if(this.a1c == null || this.a1c.isEmpty()){
public Set<String> 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<String> a1c) {
this.a1c = a1c;
}

@JsonProperty("albuminuria")
public String getAlbuminuria() {
if(this.albuminuria == null || this.albuminuria.isEmpty()){
public Set<String> 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<String> albuminuria) {
this.albuminuria = albuminuria;
}

@JsonProperty("diabetes_duration")
public String getDiabetesDuration() {
if(this.diabetesDuration == null || this.diabetesDuration.isEmpty()){
public Set<String> 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<String> diabetesDuration) {
this.diabetesDuration = diabetesDuration;
}

@JsonProperty("diabetes_history")
public String getDiabetesHistory() {
if(this.diabetesHistory == null || this.diabetesHistory.isEmpty()){
public Set<String> 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<String> diabetesHistory) {
this.diabetesHistory = diabetesHistory;
}

@JsonProperty("hypertension_history")
public String getHypertensionHistory() {
if(this.hypertensionHistory == null || this.hypertensionHistory.isEmpty()){
public Set<String> 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<String> hypertensionHistory) {
this.hypertensionHistory = hypertensionHistory;
}

@JsonProperty("hypertension_duration")
public String getHypertensionDuration() {
if(this.hypertensionDuration == null || this.hypertensionDuration.isEmpty()){
public Set<String> 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<String> hypertensionDuration) {
this.hypertensionDuration = hypertensionDuration;
}

@JsonProperty("ethnicity")
public String getRace() {
if(this.race == null || this.race.isEmpty()){
public Set<String> 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<String> race) {
this.race = race;
}

@JsonProperty("on_raas_blockade")
public String getOnRaasBlockade() {
if(this.onRaasBlockade == null || this.onRaasBlockade.isEmpty()){
public Set<String> 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<String> onRaasBlockade) {
this.onRaasBlockade = onRaasBlockade;
}

public String fixCapitalizaion(String input){
return WordUtils.capitalizeFully(input, null);
public Set<String> fixCapitalization(Set<String> input){
Set<String> wordList = new HashSet<String>();
for (String string : input) {
String updatedInput = WordUtils.capitalizeFully(string);
wordList.add(updatedInput);
}
return wordList;
}
}
Loading

0 comments on commit 5f6a7db

Please sign in to comment.