Skip to content

Commit

Permalink
Merge pull request #47 from EBISPOT/dev
Browse files Browse the repository at this point in the history
add cohorts to studies apis
  • Loading branch information
ala-ebi authored Oct 23, 2023
2 parents 057410a + c113770 commit 5ed904f
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.hibernate.annotations.Where;
Expand All @@ -19,6 +20,20 @@ public class Study implements Trackable {
@JsonIgnore
private Long id;

@Transient
@JsonInclude(JsonInclude.Include.NON_NULL)
private String cohort;

@OneToOne(mappedBy = "study")
@JsonIgnore
private StudyExtension studyExtension;

@PostLoad
private void onLoad() {
if (this.studyExtension != null)
this.cohort = studyExtension.getCohort();
}

private String initialSampleSize;

@JsonProperty("replicationSampleSize")
Expand Down Expand Up @@ -189,6 +204,10 @@ public void setId(Long id) {
this.id = id;
}

public String getCohort() {
return cohort;
}

public String getInitialSampleSize() {
return initialSampleSize;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package uk.ac.ebi.spot.goci.model;

import lombok.Data;

import javax.persistence.*;
import java.util.Collection;

@Entity
@Data
public class StudyExtension {

@Id
@GeneratedValue
private Long id;

@OneToOne
@JoinColumn(name = "study_id", unique = true)
private Study study;

private String statisticalModel;

private String cohort;

private String cohortSpecificReference;

private String summaryStatisticsFile;

private String summaryStatisticsAssembly;

private String studyDescription;
}

0 comments on commit 5ed904f

Please sign in to comment.