Skip to content

Commit

Permalink
Merge pull request #124 from TheJacksonLaboratory/develop
Browse files Browse the repository at this point in the history
Release 1.0.6
  • Loading branch information
iimpulse committed Jun 14, 2023
2 parents 8c31f7a + d1e1418 commit b6c97f4
Show file tree
Hide file tree
Showing 86 changed files with 11,583 additions and 11,426 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/sanity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: Java CI with Gradle

on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: test
30 changes: 23 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
}

group = 'org.monarchinitiative.poet'
version = '1.0.5'
version = '1.0.6'
sourceCompatibility = '11'

configurations {
Expand Down Expand Up @@ -57,6 +57,7 @@ task genJaxb {
repositories {
mavenCentral()
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
Expand All @@ -67,28 +68,30 @@ dependencies {
implementation 'org.springframework.security:spring-security-oauth2-jose'
implementation 'org.springframework.security:spring-security-config'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation group: 'org.monarchinitiative.phenol', name: 'phenol-core', version: '1.6.1'
implementation group: 'org.monarchinitiative.phenol', name: 'phenol-core', version: '2.0.0'
implementation 'org.mariadb.jdbc:mariadb-java-client:2.7.4'
implementation 'org.monarchinitiative.phenol:phenol-annotations:1.6.2'
implementation 'org.monarchinitiative.phenol:phenol-io:1.6.2'
implementation 'org.monarchinitiative.phenol:phenol-annotations:2.0.0'
implementation 'org.monarchinitiative.phenol:phenol-io:2.0.0'
implementation 'org.apache.commons:commons-csv:1.9.0'
implementation 'org.springframework.ws:spring-ws-core'
implementation 'org.apache.commons:commons-text:1.10.0'
// For Java 11:
implementation 'org.glassfish.jaxb:jaxb-runtime'
implementation(files(genJaxb.classesDir).builtBy(genJaxb))
implementation ('org.springframework.boot:spring-boot-starter-web-services') {
implementation('org.springframework.boot:spring-boot-starter-web-services') {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
}

jaxb "com.sun.xml.bind:jaxb-xjc:2.1.7"

runtimeOnly 'com.h2database:h2'
testRuntimeOnly 'com.h2database:h2'
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testImplementation group: 'org.spockframework', name: 'spock-core', version: '1.3-groovy-2.4'
testImplementation group: 'org.spockframework', name: 'spock-spring', version: '1.3-groovy-2.4'
testImplementation 'org.springframework.security:spring-security-test:4.2.3.RELEASE'
}

def profile = 'development'
Expand Down Expand Up @@ -128,8 +131,21 @@ test {
systemProperty 'spring.profiles.active', 'test'
}

jacocoTestReport {
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
"org/monarchinitiative/poet/service/InitDatabaseService.class",
"org/monarchinitiative/poet/views/*",
"org/monarchinitiative/poet/model/utility/HpoAnnotationLine.class",
])
}))
}
}

test.finalizedBy(jacocoTestReport)


clean {
delete fileTree(dir: "src/main/resources/static")
}
Expand Down Expand Up @@ -174,4 +190,4 @@ bootRun {
profile = "initialize"
}
systemProperty "spring.profiles.active", profile
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package org.monarchinitiative.poet.controller;

import org.apache.commons.csv.CSVFormat;
import org.monarchinitiative.poet.model.entities.Version;
import org.monarchinitiative.poet.model.enumeration.AnnotationStatus;
import org.monarchinitiative.poet.service.ExportService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@
import org.springframework.data.domain.Sort;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.*;

import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collector;
import java.util.stream.Collectors;

/**
Expand Down Expand Up @@ -79,9 +75,11 @@ public List<DiseaseCount> getDiseaseActivity(@RequestParam(value = "all", defaul
map(UserActivity::getAnnotation).map(Annotation::getAnnotationSource)
.collect(Collectors.groupingByConcurrent(AnnotationSource::getDisease, Collectors.counting()))
.entrySet().stream()
.map(entry ->
new DiseaseCount(entry.getKey().getDiseaseId(), entry.getKey().getDiseaseName(),
entry.getValue())).collect(Collectors.toList());
.map(entry -> {
return new DiseaseCount(entry.getKey().getDiseaseId(), entry.getKey().getDiseaseName(),
entry.getValue());

}).collect(Collectors.toList());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

import javax.persistence.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Locale;
import java.util.Objects;

@Entity
Expand Down Expand Up @@ -47,6 +49,9 @@ public class Annotation {
@JsonView({AnnotationViews.Simple.class, AnnotationViews.UserSpecific.class})
private LocalDateTime lastUpdatedDate;

@Transient
private LocalDateTime createdDate;

@OneToOne
@JsonView({AnnotationViews.Simple.class, AnnotationViews.UserSpecific.class})
private User owner;
Expand Down Expand Up @@ -102,10 +107,22 @@ public LocalDateTime getLastUpdatedDate() {
return lastUpdatedDate;
}

public String getExportLastUpdatedDate(){
return DateTimeFormatter.ofPattern("yyyy-MM-dd", Locale.ENGLISH).format(this.lastUpdatedDate);
}

public void setLastUpdatedDate(LocalDateTime lastUpdatedDate) {
this.lastUpdatedDate = lastUpdatedDate;
}

public String getCreatedDate() {
return DateTimeFormatter.ofPattern("yyyy-MM-dd", Locale.ENGLISH).format(this.createdDate);
}

public void setCreatedDate(LocalDateTime createdDate) {
this.createdDate = createdDate;
}

public void newMessage(Message message){
this.reviewMessages.add(message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ public void setTreatmentCount(int treatmentCount) {
this.treatmentCount = treatmentCount;
}

public String getExportDiseaseId(){
return this.equivalentId == null || this.equivalentId.isBlank() ? this.diseaseId : this.equivalentId;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import com.fasterxml.jackson.annotation.JsonView;
import org.monarchinitiative.poet.model.enumeration.AnnotationStatus;
import org.monarchinitiative.poet.model.enumeration.Relation;
import org.monarchinitiative.poet.model.requests.TreatmentRequest;
import org.monarchinitiative.poet.views.AnnotationViews;

Expand Down Expand Up @@ -30,7 +31,8 @@ public class TreatmentAnnotation extends Annotation {
private String evidence;
@JsonView(AnnotationViews.Simple.class)
@NotNull
private String relation;
@Enumerated(EnumType.STRING)
private Relation relation;
@JsonView(AnnotationViews.Simple.class)
private String extensionId;
@JsonView(AnnotationViews.Simple.class)
Expand All @@ -51,7 +53,7 @@ public TreatmentAnnotation(AnnotationSource annotationSource, AnnotationStatus s
this.hpoId = hpoId;
this.evidence = evidence;
this.comment = comment;
this.relation = relation;
this.relation = Relation.valueOf(relation);
this.extensionId = extensionId;
this.extensionLabel = extensionLabel;
}
Expand All @@ -64,7 +66,7 @@ public TreatmentAnnotation(String maxoId, String maxoName, String hpoName, Strin
this.hpoId = hpoId;
this.evidence = evidence;
this.comment = comment;
this.relation = relation;
this.relation = Relation.valueOf(relation);
this.extensionId = extensionId;
this.extensionLabel = extensionLabel;
}
Expand All @@ -79,7 +81,7 @@ public TreatmentAnnotation(TreatmentRequest treatmentRequest, AnnotationSource a
this.hpoName = treatmentRequest.getHpoName();
this.evidence = treatmentRequest.getEvidence();
this.comment = treatmentRequest.getComment();
this.relation = treatmentRequest.getRelation();
this.relation = Relation.valueOf(treatmentRequest.getRelation());
this.extensionId = treatmentRequest.getExtensionId();
this.extensionLabel = treatmentRequest.getExtensionLabel();
}
Expand All @@ -91,7 +93,7 @@ public void updateAnnotation(TreatmentRequest treatmentRequest, AnnotationSource
this.hpoName = treatmentRequest.getHpoName();
this.evidence = treatmentRequest.getEvidence();
this.comment = treatmentRequest.getComment();
this.relation = treatmentRequest.getRelation();
this.relation = Relation.valueOf(treatmentRequest.getRelation());
this.extensionId = treatmentRequest.getExtensionId();
this.extensionLabel = treatmentRequest.getExtensionLabel();
this.setAnnotationSource(annotationSource);
Expand Down Expand Up @@ -121,7 +123,7 @@ public String getComment() {
return comment;
}

public String getRelation() {
public Relation getRelation() {
return relation;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import org.monarchinitiative.poet.views.UserViews;

import javax.persistence.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Locale;
import java.util.Objects;

@Entity
Expand Down Expand Up @@ -62,10 +65,10 @@ public String getOrcid(){
}

public String getExportName(){
if (orcid != null) {
return String.format("%s[%s]", nickname, orcid);
if (orcid != null && !orcid.isBlank()) {
return String.format("ORCID:%s",orcid);
} else {
return String.format("%s[]", nickname);
return email;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,8 @@ public boolean equals(Object o) {
public int hashCode() {
return Objects.hash(id, owner, annotation, dateTime, curationAction);
}

public Annotation getOldAnnotation() {
return oldAnnotation;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.monarchinitiative.poet.model.enumeration;

public enum Category {
PHENOTYPE, TREATMENT
PHENOTYPE, TREATMENT, UNKNOWN
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.monarchinitiative.poet.model.enumeration;

/**
* The relation of the MAXO term to the HPO term.
*/
public enum Relation {
TREATS, PREVENTS, INVESTIGATES, CONTRAINDICATED, NO_OBSERVED_BENEFIT
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
package org.monarchinitiative.poet.model.requests;

public class DiseaseRequest {
private final String id;
private final String diseaseId;
private final String diseaseName;
private final String description;
private final String equivalentId;

public DiseaseRequest(String id, String diseaseId, String diseaseName, String description, String equivalentId) {
this.id = id;
public DiseaseRequest(String diseaseId, String diseaseName, String description, String equivalentId) {
this.diseaseId = diseaseId;
this.diseaseName = diseaseName;
this.description = description;
this.equivalentId = equivalentId;
}

public String getId() {
return id;
}

public String getDiseaseId() {
return diseaseId;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
package org.monarchinitiative.poet.model.responses;

public class Contribution {
Integer treatment;
Integer phenotype;
Integer phenopackets;
private final int treatment;
private final int phenotype;

public Contribution(Integer treatment, Integer phenotype, Integer phenopackets) {
this.treatment = treatment == null ? 0 : treatment;
this.phenotype = phenotype == null ? 0 : phenotype;
this.phenopackets = phenopackets == null ? 0 : phenopackets;
public Contribution(int treatment, int phenotype) {
this.treatment = Math.max(treatment, 0);
this.phenotype = Math.max(phenotype, 0);
}

public Integer getTreatment() {
public int getTreatment() {
return treatment;
}

public Integer getPhenotype() {
public int getPhenotype() {
return phenotype;
}

public Integer getPhenopackets() {
return phenopackets;
}
}
Loading

0 comments on commit b6c97f4

Please sign in to comment.