diff --git a/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDataset.java b/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDataset.java index a1c656e..3cf8267 100644 --- a/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDataset.java +++ b/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDataset.java @@ -5,6 +5,7 @@ import jakarta.persistence.Transient; import jakarta.persistence.Id; import jakarta.persistence.Column; +import jakarta.persistence.EmbeddedId; import com.fasterxml.jackson.annotation.*; import org.springframework.lang.Nullable; @@ -17,7 +18,8 @@ @Table(name = "sv_link_v") public class SpatialViewerExternalLinkDataset { - @Id + @EmbeddedId + private SpatialViewerExternalLinkId id; @Column(name = "external_link") private String externalLink; private String configType; @@ -54,6 +56,14 @@ public class SpatialViewerExternalLinkDataset { @Transient private String imageTypeSort; + public SpatialViewerExternalLinkId getId() { + return id; + } + + public void setId(SpatialViewerExternalLinkId id){ + this.id = id; + } + public String getPrimaryAdjudicatedCategory() { return this.primaryAdjudicatedCategory; diff --git a/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDatasetDisplay.java b/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDatasetDisplay.java index 67c11ba..5f5a792 100644 --- a/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDatasetDisplay.java +++ b/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkDatasetDisplay.java @@ -1,30 +1,383 @@ package org.kpmp.spatialViewerDataset; -public class SpatialViewerExternalLinkDatasetDisplay implements SpatialViewerDataset{ +import java.util.Set; + +public class SpatialViewerExternalLinkDatasetDisplay { private String externalLink; private String configType; private String imageType; private String dataType; private String spectrackSampleId; - private String redcapId; private int participantId; - private String age; - private String protocol; - private String sampleType; - private String sex; - private String tissueSource; - private String enrollmentCategory; - private Double releaseVersion; - 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; + private Set redcapId; + private Set age; + private Set protocol; + private Set sampleType; + private Set sex; + private Set tissueSource; + private Set enrollmentCategory; + private Set primaryAdjudicatedCategory; + private Set kdigoStage; + private Set baselineEgfr; + private Set proteinuria; + private Set a1c; + private Set albuminuria; + private Set diabetesHistory; + private Set diabetesDuration; + private Set hypertensionHistory; + private Set hypertensionDuration; + private Set onRaasBlockade; + private Set race; + + + public SpatialViewerExternalLinkDatasetDisplay(SpatialViewerExternalLinkDataset svLink){ + configType = svLink.getConfigType(); + imageType = svLink.getImageType(); + dataType = svLink.getDataType(); + spectrackSampleId = svLink.getSpectrackSampleId(); + externalLink = svLink.getExternalLink(); + + redcapId.add(svLink.getId().getRedcapId()); + if(shouldAdd(svLink.getAge())){ + age.add(svLink.getAge()); + } + if(shouldAdd(svLink.getProtocol())){ + protocol.add(svLink.getProtocol()); + } + if(shouldAdd(svLink.getSampleType())){ + sampleType.add(svLink.getSampleType()); + } + if(shouldAdd(svLink.getSex())){ + sex.add(svLink.getSex()); + } + if(shouldAdd(svLink.getTissueSource())){ + tissueSource.add(svLink.getTissueSource()); + } + if(shouldAdd(svLink.getEnrollmentCategory())){ + enrollmentCategory.add(svLink.getEnrollmentCategory()); + } + if(shouldAdd(svLink.getPrimaryAdjudicatedCategory())){ + primaryAdjudicatedCategory.add(svLink.getEnrollmentCategory()); + } + if(shouldAdd(svLink.getKdigoStage())){ + kdigoStage.add(svLink.getKdigoStage()); + } + if(shouldAdd(svLink.getBaselineEgfr())){ + baselineEgfr.add(svLink.getBaselineEgfr()); + } + if(shouldAdd(svLink.getProteinuria())){ + proteinuria.add(svLink.getProteinuria()); + } + if(shouldAdd(svLink.getA1c())){ + a1c.add(svLink.getA1c()); + } + if(shouldAdd(svLink.getAlbuminuria())){ + albuminuria.add(svLink.getAlbuminuria()); + } + if(shouldAdd(svLink.getDiabetesDuration())){ + diabetesDuration.add(svLink.getDiabetesDuration()); + } + if(shouldAdd(svLink.getDiabetesHistory())){ + diabetesHistory.add(svLink.getDiabetesHistory()); + } + if(shouldAdd(svLink.getHypertensionDuration())){ + hypertensionDuration.add(svLink.getHypertensionDuration()); + } + if(shouldAdd(svLink.getHypertensionHistory())){ + hypertensionHistory.add(svLink.getHypertensionHistory()); + } + if(shouldAdd(svLink.getOnRaasBlockade())){ + onRaasBlockade.add(svLink.getOnRaasBlockade()); + } + if(shouldAdd(svLink.getRace())){ + race.add(svLink.getRace()); + } + + } + + + public String getExternalLink() { + return this.externalLink; + } + + public void setExternalLink(String externalLink) { + this.externalLink = externalLink; + } + + public String getConfigType() { + return this.configType; + } + + public void setConfigType(String configType) { + this.configType = configType; + } + + public String getImageType() { + return this.imageType; + } + + public void setImageType(String imageType) { + this.imageType = imageType; + } + + public String getDataType() { + return this.dataType; + } + + public void setDataType(String dataType) { + this.dataType = dataType; + } + + public String getSpectrackSampleId() { + return this.spectrackSampleId; + } + + public void setSpectrackSampleId(String spectrackSampleId) { + this.spectrackSampleId = spectrackSampleId; + } + + public int getParticipantId() { + return this.participantId; + } + + public void setParticipantId(int participantId) { + this.participantId = participantId; + } + + + public Set getRedcapId() { + if(redcapId.isEmpty()){ + return null; + }else{ + return this.redcapId; + } + } + + public void setRedcapId(Set redcapId) { + this.redcapId = redcapId; + } + + public Set getAge() { + if(redcapId.isEmpty()){ + return null; + }else{ + return this.age; + } + } + + public void setAge(Set age) { + this.age = age; + } + + public Set getProtocol() { + if(protocol.isEmpty()) { + return null; + }else{ + return this.protocol; + } + } + + public void setProtocol(Set protocol) { + this.protocol = protocol; + } + + public Set getSampleType() { + if(sampleType.isEmpty()){ + return null; + }else{ + return this.sampleType; + } + } + + public void setSampleType(Set sampleType) { + this.sampleType = sampleType; + } + + public Set getSex() { + if(sex.isEmpty()){ + return null; + }else{ + return this.sex; + } + } + + public void setSex(Set sex) { + this.sex = sex; + } + + public Set getTissueSource() { + if(tissueSource.isEmpty()){ + return null; + }else{ + return this.tissueSource; + } + } + + public void setTissueSource(Set tissueSource) { + this.tissueSource = tissueSource; + } + + public Set getEnrollmentCategory() { + if(enrollmentCategory.isEmpty()){ + return null; + }else{ + return this.enrollmentCategory; + } + } + + public void setEnrollmentCategory(Set enrollmentCategory) { + this.enrollmentCategory = enrollmentCategory; + } + + public Set getPrimaryAdjudicatedCategory() { + if(primaryAdjudicatedCategory.isEmpty()){ + return null; + }else{ + return this.primaryAdjudicatedCategory; + } + } + + public void setPrimaryAdjudicatedCategory(Set primaryAdjudicatedCategory) { + this.primaryAdjudicatedCategory = primaryAdjudicatedCategory; + } + + public Set getKdigoStage() { + if(kdigoStage.isEmpty()){ + return null; + }else{ + return this.kdigoStage; + } + } + + public void setKdigoStage(Set kdigoStage) { + this.kdigoStage = kdigoStage; + } + + public Set getBaselineEgfr() { + if(baselineEgfr.isEmpty()){ + return null; + }else{ + return this.baselineEgfr; + } + } + + public void setBaselineEgfr(Set baselineEgfr) { + this.baselineEgfr = baselineEgfr; + } + + public Set getProteinuria() { + if(proteinuria.isEmpty()){ + return null; + }else{ + return this.proteinuria; + } + } + + public void setProteinuria(Set proteinuria) { + this.proteinuria = proteinuria; + } + + public Set getA1c() { + if(a1c.isEmpty()){ + return null; + }else{ + return this.a1c; + } + } + + public void setA1c(Set a1c) { + this.a1c = a1c; + } + + public Set getAlbuminuria() { + if(albuminuria.isEmpty()){ + return null; + }else{ + return this.albuminuria; + } + } + + public void setAlbuminuria(Set albuminuria) { + this.albuminuria = albuminuria; + } + + public Set getDiabetesHistory() { + if(diabetesHistory.isEmpty()){ + return null; + }else{ + return this.diabetesHistory; + } + } + + public void setDiabetesHistory(Set diabetesHistory) { + this.diabetesHistory = diabetesHistory; + } + + public Set getDiabetesDuration() { + if(this.diabetesDuration.isEmpty()){ + return null; + }else{ + return this.diabetesDuration; + } + } + + public void setDiabetesDuration(Set diabetesDuration) { + this.diabetesDuration = diabetesDuration; + } + + public Set getHypertensionHistory() { + if(hypertensionHistory.isEmpty()){ + return null; + }else{ + return this.hypertensionHistory; + } + } + + public void setHypertensionHistory(Set hypertensionHistory) { + this.hypertensionHistory = hypertensionHistory; + } + + public Set getHypertensionDuration() { + if(hypertensionDuration.isEmpty()){ + return null; + }else{ + return this.hypertensionDuration; + } + } + + public void setHypertensionDuration(Set hypertensionDuration) { + this.hypertensionDuration = hypertensionDuration; + } + + public Set getOnRaasBlockade() { + if(onRaasBlockade.isEmpty()){ + return null; + }else{ + return this.onRaasBlockade; + } + } + + public void setOnRaasBlockade(Set onRaasBlockade) { + this.onRaasBlockade = onRaasBlockade; + } + + public Set getRace() { + if(race.isEmpty()){ + return null; + }else{ + return this.race; + } + } + + public void setRace(Set race) { + this.race = race; + } + + + private boolean shouldAdd(String value) { + if (value == null || value.isEmpty()) { + return false; + } + return true; + } } diff --git a/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkId.java b/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkId.java new file mode 100644 index 0000000..d532d38 --- /dev/null +++ b/src/main/java/org/kpmp/spatialViewerDataset/SpatialViewerExternalLinkId.java @@ -0,0 +1,48 @@ +package org.kpmp.spatialViewerDataset; + +import java.io.Serializable; + +import jakarta.persistence.Column; +import jakarta.persistence.Embeddable; +@Embeddable +public class SpatialViewerExternalLinkId implements Serializable{ + private String dlFileId; + private String redcapId; + private String experimentalStrategy; + private String doi; + + @Column(name = "dl_file_id") + public String getDlFileId() { + return this.dlFileId; + } + + public void setDlFileId(String dlFileId) { + this.dlFileId = dlFileId; + } + + public String getRedcapId() { + return this.redcapId; + } + + public void setRedcapId(String redcapId) { + this.redcapId = redcapId; + } + + public String getExperimentalStrategy() { + return this.experimentalStrategy; + } + + public void setExperimentalStrategy(String experimentalStrategy) { + this.experimentalStrategy = experimentalStrategy; + } + + public String getDoi() { + return this.doi; + } + + public void setDoi(String doi) { + if (doi != null && !doi.isEmpty()){ + this.doi = doi; + } + } +}