Skip to content

Commit

Permalink
Merge pull request #129 from KPMP/develop
Browse files Browse the repository at this point in the history
Release v2.3 merge
  • Loading branch information
rlreamy authored Mar 26, 2024
2 parents ca08366 + 6879957 commit 77c5438
Show file tree
Hide file tree
Showing 45 changed files with 746 additions and 396 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.*
*.iml
gradle
src
build/*
!build/docker
49 changes: 49 additions & 0 deletions .github/workflows/build-gradle-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build pegasus-data docker image

on:
push:

jobs:
build-gradle-project:
env:
IMAGE_TAG: 2.3
runs-on: ubuntu-latest
steps:
- name: Get branch names
id: branch-names
uses: tj-actions/branch-names@v8

- name: Get current branch name
if: steps.branch-names.outputs.is_default == 'false'
run: |
echo "Running on branch: ${{ steps.branch-names.outputs.current_branch }}"
- name: Checkout project sources
uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-version: 7.4

- name: Login to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.ENV_DOCKER_USER }}
password: ${{ secrets.ENV_DOCKER_PASS }}

- name: Run build with Gradle Wrapper
run: |
./gradlew build docker
- name: Push to Docker Hub if branch is develop
if: steps.branch-names.outputs.current_branch == 'develop'
run: |
docker push "kingstonduo/pegasus-data:$IMAGE_TAG"
- name: Push to Docker Hub if branch is not develop
if: ${{ !steps.branch-names.outputs.current_branch == 'develop' }}
run: |
docker push "kingstonduo/pegasus-data:${{ steps.branch-names.outputs.current_branch }}"
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FROM alpine
FROM alpine:3.19.1

RUN apk update && \
apk upgrade
RUN apk update
RUN apk add openjdk8

VOLUME /tmp
Expand All @@ -15,4 +14,4 @@ RUN apk add --no-cache tzdata
ENV TZ=America/Detroit
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

ENTRYPOINT ["java","-cp","app:app/lib/*","org.kpmp.Application"]
ENTRYPOINT ["java","-cp","app:app/lib/*","org.kpmp.Application"]
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Repository for the Atlas Explorer Tool service layer
# Build

`./gradlew build docker`
The default tag is the github branch name if no verison is provided
To pass a version when building the docker image execute
`./gradlew build docker -Ptag=<tagNumber>`

# Restart Spring

Expand Down
29 changes: 26 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ apply plugin: 'io.spring.dependency-management'

jar {
baseName='pegasus-data'
version= '1.6.3'
version= '2.3'
}

repositories {
Expand Down Expand Up @@ -59,8 +59,31 @@ task unpack(type: Copy) {
into("build/dependency")
}

def getTagInfo() {
if (project.hasProperty('tag')) {
def tagValue = project.property('tag')
return tagValue
} else {
def gitBranch = "Unknown branch"
try {
def workingDir = new File("${project.projectDir}")
def result = 'git rev-parse --abbrev-ref HEAD'.execute(null, workingDir)
result.waitFor()
if (result.exitValue() == 0) {
gitBranch = result.text.trim()
}
} catch (e) {
}
if (gitBranch == "develop" || gitBranch == "master"){
return "${jar.version}"
}else{
return gitBranch
}
}
}

docker {
name "${project.group}/${jar.baseName}:latest"
name "${project.group}/${jar.baseName}:" + getTagInfo()
copySpec.from(tasks.unpack.outputs).into("dependency")
buildArgs(['DEPENDENCY': "dependency"])
}
}
8 changes: 4 additions & 4 deletions src/main/java/org/kpmp/Query.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,6 @@ public ParticipantSummaryDataset participantSummaryDataset(String redcap_id) thr
}
}

public ParticipantSummaryDataset participantClinicalDataset(String redcap_id) throws Exception {
return this.participantSummaryDataset(redcap_id);
}

public ParticipantRepoDataTypeInformation getTotalParticipantFilesCount(String redcap_id) throws Exception {
try {
return this.participantService.getTotalFilesCount(redcap_id);
Expand Down Expand Up @@ -234,4 +230,8 @@ public List<AtlasMessage> getAtlasMessages() throws Exception {
throw e;
}
}

public List<ParticipantRepoDataTypeInformation> getExperimentalStrategyCountsByParticipant(String redcapId) {
return participantService.getExperimentalStrategyCountsByParticipant(redcapId);
}
}
2 changes: 2 additions & 0 deletions src/main/java/org/kpmp/WebConfig.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package org.kpmp;

import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.servlet.config.annotation.CorsRegistration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@EnableAutoConfiguration
public class WebConfig extends Application implements WebMvcConfigurer {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@

import java.util.List;

import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

@Repository
interface AtlasMessageRepository extends CrudRepository<AtlasMessage, List>{
interface AtlasMessageRepository extends CrudRepository<AtlasMessage, List<AtlasMessage>>{
@Query(value = "SELECT * FROM atlas_messages am WHERE start_date <= CURRENT_DATE() AND end_date >= CURRENT_DATE() ORDER BY start_date ASC", nativeQuery = true)
List<AtlasMessage> getAtlasMessages();
}
5 changes: 2 additions & 3 deletions src/main/java/org/kpmp/atlasMessage/AtlasMessageService.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package org.kpmp.atlasMessage;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;


@Service
public class AtlasMessageService {
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/org/kpmp/cellType/CellType.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.apache.commons.lang3.builder.HashCodeBuilder;

@Entity
@Table(name = "cell_type")
public class CellType implements Serializable {
Expand Down Expand Up @@ -120,7 +122,7 @@ public void setCellTypeOrdering(int cellTypeOrdering) {

@Override
public int hashCode() {
return cellType.hashCode();
return new HashCodeBuilder().append(cellTypeId).build();
}

@Override
Expand All @@ -130,7 +132,7 @@ public boolean equals(Object obj) {
if (!(obj instanceof CellType))
return false;
CellType cellType = (CellType) obj;
return cellType.getCellType().equals(this.getCellType());
return cellType.getCellTypeId() == (this.getCellTypeId());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import java.util.ArrayList;
import java.util.List;

import com.google.common.base.Objects;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

public class CellTypeStructureSubregion implements Serializable {

Expand Down Expand Up @@ -46,13 +47,13 @@ public boolean equals(Object obj) {
return false;
}
CellTypeStructureSubregion other = (CellTypeStructureSubregion) obj;
return Objects.equal(this.subregionName, other.subregionName);
return new EqualsBuilder().append(this.subregionName, other.subregionName).build();

}

@Override
public int hashCode() {
return Objects.hashCode(subregionName);
return new HashCodeBuilder().append(this.subregionName).build();
}

}
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package org.kpmp.cellTypeSummary;

import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.kpmp.DataTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.data.neo4j.DataNeo4jTypeExcludeFilter;
import org.springframework.stereotype.Service;

@Service
Expand Down
54 changes: 32 additions & 22 deletions src/main/java/org/kpmp/dataSummary/AtlasRepoSummaryRow.java
Original file line number Diff line number Diff line change
@@ -1,53 +1,63 @@
package org.kpmp.dataSummary;

public class AtlasRepoSummaryRow {
private int openCount;
private int controlledCount;
private String omicsType;
private AtlasRepoSummaryLinkInformation linkInformation;
private AtlasRepositoryLinkInformation linkInformation;
private Long akiCount;
private Long ckdCount;
private Long hrtCount;
private Long dmrCount;

public AtlasRepoSummaryRow(String omicsType, AtlasRepoSummaryLinkInformation linkInformation) {
public AtlasRepoSummaryRow(String omicsType, AtlasRepositoryLinkInformation linkInformation) {
this.omicsType = omicsType;
this.linkInformation = linkInformation;
}

public int getOpenCount() {
return openCount;
public Long getAkiCount() {
return this.akiCount;
}

public void setOpenCount(int openCount) {
this.openCount = openCount;
public void setAkiCount(Long akiCount) {
this.akiCount = akiCount;
}

public int getControlledCount() {
return controlledCount;
public Long getCkdCount() {
return this.ckdCount;
}

public void setControlledCount(int controlledCount) {
this.controlledCount = controlledCount;
public void setCkdCount(Long ckdCount) {
this.ckdCount = ckdCount;
}

public String getOmicsType() {
return omicsType;
public Long getHrtCount() {
return this.hrtCount;
}

public void setOmicsType(String omicsType) {
this.omicsType = omicsType;
public void setHrtCount(Long hrtCount) {
this.hrtCount = hrtCount;
}

public Long getDmrCount() {
return this.dmrCount;
}

public void addToControlledCount(int count) {
this.controlledCount = this.controlledCount + count;
public void setDmrCount(Long dmrCount) {
this.dmrCount = dmrCount;
}

public void addToOpenCount(int count) {
this.openCount = this.openCount + count;
public String getOmicsType() {
return omicsType;
}

public void setOmicsType(String omicsType) {
this.omicsType = omicsType;
}

public AtlasRepoSummaryLinkInformation getLinkInformation() {
public AtlasRepositoryLinkInformation getLinkInformation() {
return linkInformation;
}

public void setLinkInformation(AtlasRepoSummaryLinkInformation linkInformation) {
public void setLinkInformation(AtlasRepositoryLinkInformation linkInformation) {
this.linkInformation = linkInformation;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

public class AtlasRepoSummaryLinkInformation {
public class AtlasRepositoryLinkInformation {

public static final String EXPERIMENTAL_STRATEGY = "experimental_strategy";
public static final String DATA_CATEGORY = "data_category";

private String linkType;
private String linkValue;

public AtlasRepoSummaryLinkInformation(String linkType, String linkValue) {
public AtlasRepositoryLinkInformation(String linkType, String linkValue) {
this.setLinkType(linkType);
this.setLinkValue(linkValue);
}
Expand Down Expand Up @@ -36,8 +39,8 @@ public int hashCode() {

@Override
public boolean equals(Object obj) {
if (obj instanceof AtlasRepoSummaryLinkInformation) {
final AtlasRepoSummaryLinkInformation other = (AtlasRepoSummaryLinkInformation) obj;
if (obj instanceof AtlasRepositoryLinkInformation) {
final AtlasRepositoryLinkInformation other = (AtlasRepositoryLinkInformation) obj;
return new EqualsBuilder().append(linkType, other.getLinkType()).append(linkValue, other.getLinkValue()).isEquals();
}
else {
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/org/kpmp/dataSummary/DataSummaryRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ public interface DataSummaryRepository extends CrudRepository<DataSummaryValue,
+ "join file f on f.file_id= fp.file_id " + "join sv_file_info sv on sv.file_id = f.file_id "
+ "where sv.config_type = :data_type " + "and p.tissue_type = :tissue_type", nativeQuery = true)
Long getDataSummaryCount(@Param("tissue_type") String tissue_type, @Param("data_type") String data_type);

@Cacheable("repoDataSummaryCount")
@Query(value = "select count(distinct(dl_file_id)) from repo_file_v where experimental_strategy = :exp_strat and tissue_type = :tissue_type", nativeQuery = true)
Long getRepoDataSummaryCount(@Param("tissue_type") String tissue_type, @Param("exp_strat") String exp_strat);

@Cacheable("repoBiomarkerSummaryCount")
@Query(value = "select count(distinct(dl_file_id)) from repo_file_v where data_category = 'Biomarker' and tissue_type = :tissue_type", nativeQuery = true)
Long getRepoBiomarkerSummaryCount(@Param("tissue_type") String tissue_type);

@Cacheable("dataSummaryLinkCount")
@Query(value = "select count(distinct(redcap_id)) " + "from sv_link_v " + "where data_type = :data_type "
Expand Down
Loading

0 comments on commit 77c5438

Please sign in to comment.