Skip to content

Commit

Permalink
TEMPO/HERA sample tracker support (#1092)
Browse files Browse the repository at this point in the history
* Bam complete (#1084)

* HERA Sample Tracker Support: BAM Complete

This PR includes changes for supporting a new data type: BAM Complete

BAM Complete is part of the effort to support HERA Sample Tracker data in the SMILE dashboard.

General updates:
- New Neo4j models added
- New mocked data and unit tests added
- New service and persistence layer classes added
- New message handler service for TEMPO workflow with
  message handler for BAM complete topic

Signed-off-by: Angelica Ochoa <[email protected]>

---------

Signed-off-by: Angelica Ochoa <[email protected]>
Co-authored-by: Quan Nguyen <[email protected]>

Rename BamComplete's property 'timestamp' to 'date' (#1093)

* Rename BamComplete's property 'timestamp' to 'date'

* Specify Neo4j image version in tests for compatibility with arm64 machines

* Clean up debugging logs

* Update TestContainer to avoid manually specifying Neo4j image version

* Qc complete (#1094)

* Init commit QC complete

Signed-off-by: Angelica Ochoa <[email protected]>

* Updated Tempo model with QC complete events

Signed-off-by: Angelica Ochoa <[email protected]>

* Javadocs, Tempo model changes

Signed-off-by: Angelica Ochoa <[email protected]>

* Added mocked QC complete data

Signed-off-by: Angelica Ochoa <[email protected]>

* temp

* QC Complete service layer

Signed-off-by: Angelica Ochoa <[email protected]>

* QC complete handler

Signed-off-by: Angelica Ochoa <[email protected]>

---------

Signed-off-by: Angelica Ochoa <[email protected]>

* MAF Complete Support

- Add MafComplete class
- Add to Tempo class functions to handle MafComplete events
- Define Neo4j query constructors for MafComplete events
- Modify Tempo services to handle MafComplete events
- Remove seconds from BamComplete date in mock test JSONs

* MAF Complete support pt 2

- Update application.properties.EXAMPLE to include MafComplete topic
- Add MafComplete mock JSONs for testing
- Resolve checkstyle issues
- Add missing normalPrimaryId in the mergeMafComplete query
- Handle renaming of normal_primaryId to normalPrimaryId

* Cohort & CohortComplete workflow  (#1102)

* Cohort and CohortComplete support

General updates:
- Added Cohort, CohortComplete models
- Added service layer components for Cohort, CohortComplete
- Added message handler for Cohort, CohortComplete
- Added queries to support saving and updating Cohort, CohortComplete

Signed-off-by: Angelica Ochoa <[email protected]>

* Unit tests for MAF, QC, and Cohort Complete events

Added unit tests for MAF, QC, and Cohort Complete events.

Signed-off-by: Angelica Ochoa <[email protected]>

---------

Signed-off-by: Angelica Ochoa <[email protected]>

---------

Signed-off-by: Angelica Ochoa <[email protected]>
Co-authored-by: Quan Nguyen <[email protected]>
  • Loading branch information
ao508 and qu8n authored Mar 19, 2024
1 parent ae1cf12 commit 9fd6528
Show file tree
Hide file tree
Showing 48 changed files with 2,141 additions and 22 deletions.
11 changes: 11 additions & 0 deletions model/src/main/java/org/mskcc/smile/model/SmileSample.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.List;
import java.util.UUID;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.mskcc.smile.model.tempo.Tempo;
import org.neo4j.ogm.annotation.GeneratedValue;
import org.neo4j.ogm.annotation.Id;
import org.neo4j.ogm.annotation.NodeEntity;
Expand All @@ -28,6 +29,8 @@ public class SmileSample implements Serializable {
private SmilePatient patient;
@Relationship(type = "HAS_METADATA", direction = Relationship.OUTGOING)
private List<SampleMetadata> sampleMetadataList;
@Relationship(type = "HAS_TEMPO", direction = Relationship.OUTGOING)
private Tempo tempo;
private String sampleClass;
private String sampleCategory;
private String datasource;
Expand Down Expand Up @@ -215,6 +218,14 @@ public void setRevisable(Boolean revisable) {
this.revisable = revisable;
}

public Tempo getTempo() {
return tempo;
}

public void setTempo(Tempo tempo) {
this.tempo = tempo;
}

@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
Expand Down
55 changes: 55 additions & 0 deletions model/src/main/java/org/mskcc/smile/model/tempo/BamComplete.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package org.mskcc.smile.model.tempo;

import java.io.Serializable;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.neo4j.ogm.annotation.GeneratedValue;
import org.neo4j.ogm.annotation.Id;
import org.neo4j.ogm.annotation.NodeEntity;

/**
*
* @author ochoaa
*/
@NodeEntity
public class BamComplete implements Serializable {
@Id @GeneratedValue
private Long id;
private String date;
private String status;

public BamComplete() {}

public BamComplete(String date, String status) {
this.date = date;
this.status = status;
}

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public String getDate() {
return date;
}

public void setDate(String date) {
this.date = date;
}

public String getStatus() {
return status;
}

public void setStatus(String status) {
this.status = status;
}

@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
}
123 changes: 123 additions & 0 deletions model/src/main/java/org/mskcc/smile/model/tempo/Cohort.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
package org.mskcc.smile.model.tempo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.mskcc.smile.model.SmileSample;
import org.mskcc.smile.model.tempo.json.CohortCompleteJson;
import org.neo4j.ogm.annotation.GeneratedValue;
import org.neo4j.ogm.annotation.Id;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Relationship;

/**
*
* @author ochoaa
*/
@NodeEntity
public class Cohort implements Serializable {
@Id @GeneratedValue
private Long id;
private String cohortId;
@Relationship(type = "HAS_COHORT_COMPLETE", direction = Relationship.OUTGOING)
private List<CohortComplete> cohortCompleteList;
@Relationship(type = "HAS_COHORT_SAMPLE", direction = Relationship.OUTGOING)
private List<SmileSample> cohortSamples;

public Cohort() {}

public Cohort(CohortCompleteJson ccJson) {
this.cohortId = ccJson.getCohortId();
addCohortComplete(new CohortComplete(ccJson));
}

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public String getCohortId() {
return cohortId;
}

public void setCohortId(String cohortId) {
this.cohortId = cohortId;
}

/**
* Returns list of CohortComplete object instances.
* @return
*/
public List<CohortComplete> getCohortCompleteList() {
if (cohortCompleteList == null) {
this.cohortCompleteList = new ArrayList<>();
}
return cohortCompleteList;
}

/**
* Adds instance of CohortComplete to cohortCompleteList.
* @param cohortComplete
*/
public final void addCohortComplete(CohortComplete cohortComplete) {
if (cohortCompleteList == null) {
this.cohortCompleteList = new ArrayList<>();
}
cohortCompleteList.add(cohortComplete);
}

public void setCohortCompleteList(List<CohortComplete> cohortCompleteList) {
this.cohortCompleteList = cohortCompleteList;
}

/**
* Returns list of SmileSample instances.
* @return
*/
public List<SmileSample> getCohortSamples() {
if (cohortSamples == null) {
this.cohortSamples = new ArrayList<>();
}
return cohortSamples;
}

/**
* Adds instance of SmileSample to cohortSamples list.
* @param sample
*/
public final void addCohortSample(SmileSample sample) {
if (cohortSamples == null) {
this.cohortSamples = new ArrayList<>();
}
cohortSamples.add(sample);
}

public void setCohortSamples(List<SmileSample> cohortSamples) {
this.cohortSamples = cohortSamples;
}

/**
* Returns latest cohort complete data.
* @return
*/
public CohortComplete getLatestCohortComplete() {
if (cohortCompleteList != null && !cohortCompleteList.isEmpty()) {
if (cohortCompleteList.size() == 1) {
return cohortCompleteList.get(0);
}
Collections.sort(cohortCompleteList);
return cohortCompleteList.get(cohortCompleteList.size() - 1);
}
return null;
}

@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
}
137 changes: 137 additions & 0 deletions model/src/main/java/org/mskcc/smile/model/tempo/CohortComplete.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
package org.mskcc.smile.model.tempo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.mskcc.smile.model.tempo.json.CohortCompleteJson;
import org.neo4j.ogm.annotation.GeneratedValue;
import org.neo4j.ogm.annotation.Id;
import org.neo4j.ogm.annotation.NodeEntity;

/**
*
* @author ochoaa
*/
@NodeEntity
public class CohortComplete implements Serializable, Comparable<CohortComplete> {
@Id @GeneratedValue
@JsonIgnore
private Long id;
private String date;
private String status;
private String type;
private List<String> endUsers;
private List<String> pmUsers;
private String projectTitle;
private String projectSubtitle;

public CohortComplete() {}

/**
* Basic constructor from CohortCompleteJson.
* @param ccJson
*/
public CohortComplete(CohortCompleteJson ccJson) {
this.date = ccJson.getDate();
this.status = ccJson.getStatus();
this.type = ccJson.getType();
this.endUsers = ccJson.getEndUsers();
this.pmUsers = ccJson.getPmUsers();
this.projectTitle = ccJson.getProjectTitle();
this.projectSubtitle = ccJson.getProjectSubtitle();
}

public String getDate() {
return date;
}

public void setDate(String date) {
this.date = date;
}

public String getStatus() {
return status;
}

public void setStatus(String status) {
this.status = status;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

/**
* Returns list of end users.
* @return
*/
public List<String> getEndUsers() {
if (endUsers == null) {
this.endUsers = new ArrayList<>();
}
Collections.sort(endUsers);
return endUsers;
}

public void setEndUsers(List<String> endUsers) {
this.endUsers = endUsers;
}

/**
* Returns list of PM users.
* @return
*/
public List<String> getPmUsers() {
if (pmUsers == null) {
this.pmUsers = new ArrayList<>();
}
Collections.sort(pmUsers);
return pmUsers;
}

public void setPmUsers(List<String> pmUsers) {
this.pmUsers = pmUsers;
}

public String getProjectTitle() {
return projectTitle;
}

public void setProjectTitle(String projectTitle) {
this.projectTitle = projectTitle;
}

public String getProjectSubtitle() {
return projectSubtitle;
}

public void setProjectSubtitle(String projectSubtitle) {
this.projectSubtitle = projectSubtitle;
}

/**
* Override to enable Collections.sorting
* @param cohortComplete
* @return
*/
@Override
public int compareTo(CohortComplete cohortComplete) {
if (date == null || cohortComplete.getDate() == null) {
return 0;
}
return date.compareTo(cohortComplete.getDate());
}

@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
}
Loading

0 comments on commit 9fd6528

Please sign in to comment.