Skip to content

Commit

Permalink
Merge branch 'release/0.11.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
dermatologist committed Apr 26, 2021
2 parents c8a577b + a627758 commit 771f489
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 9 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: Java Publish

on:
push:
branches:
- master
release:
types: [published]

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>com.canehealth.ckblib</groupId>
<artifactId>ckblib-application</artifactId>
<version>0.9.0</version>
<version>0.11.0</version>
<name>ckblib-application</name>
<description>Demo project for Spring Boot</description>
<properties>
Expand Down
2 changes: 1 addition & 1 deletion graph/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>com.canehealth.ckblib</groupId>
<artifactId>graph</artifactId>
<version>0.9.0</version>
<version>0.11.0</version>
<name>ckblib-graph</name>
<description>Demo project for Spring Boot</description>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,10 @@ public interface BaseRelationRepository extends ReactiveNeo4jRepository<BaseRela
@Query("" + "MATCH (d {cui: $cui}) -[r]- (s) \n" + "RETURN r")
Mono<BaseRelation> getRelationsByCui(String cui);

@Query(""
+ "MATCH (d {cui: $dcui}) -[r]- (s {cui: $scui})\n"
+ "SET r.confidence = r.confidence + $c, r.upvote = r.upvote + $u, r.downvote = r.downvote + $d \n"
)
Mono<Object> updateRelationshipAttributes(String dcui, String scui, int c, int u, int d);

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,28 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import reactor.core.publisher.Mono;

@Service
public class BaseRelationService {

@Autowired
Driver driver;

@Autowired
BaseRelationRepository baseRelationRepository;

public String getRelationsByCui(String cui) {
String externalQuery = "MATCH (d {cui: '" + cui + "'}) -[r]- (s) RETURN d, r, s";
D3Map d3Map = new D3Map.Builder(driver).withQuery(externalQuery).build();
return d3Map.fetch();
}

// Cannot use above method
// Writing in read access mode not allowed. Attempted write to internal graph 0
// (neo4j)
public Mono<Object> addAttributes(String dcui, String scui, int confidence, int upvote, int downvote) {
return baseRelationRepository.updateRelationshipAttributes(dcui, scui, confidence, upvote, downvote);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;

import com.canehealth.ckblib.graph.model.BaseRelation;
import com.canehealth.ckblib.graph.model.DiseaseDisorderMention;
Expand Down Expand Up @@ -93,6 +94,11 @@ void shouldRetrieveDiseases() {
assertEquals(signSymptomService.addRelation("C0041834", "C1041834", 0, 0, 0).block().getName(), "Pruritus");
assertEquals(signSymptomService.addRelation("C0041834", "C1041835", 0, 0, 0).block().getName(), "Erythema");
assertFalse(baseRelationService.getRelationsByCui("C0041834").length() < 10);
String before = baseRelationService.getRelationsByCui("C0041834");
baseRelationService.addAttributes("C0041834", "C1041834",0, 1, 1).block();
String after = baseRelationService.getRelationsByCui("C0041834");
assertNotEquals(before, after);

}

}
2 changes: 1 addition & 1 deletion library/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>com.canehealth.ckblib</groupId>
<artifactId>library</artifactId>
<version>0.9.0</version>
<version>0.11.0</version>
<name>ckblib-library</name>
<description>Demo project for Spring Boot</description>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class BaseQuery {
private int retmax = 10;
private int reldate = 0;
private int retstart = 0;
private String api_key = "";

public String getQuery() {
String query = "?retmode=json&db=" + db + "&term=" + term + "&retmax=" + Integer.toString(retmax);
Expand All @@ -22,6 +23,9 @@ public String getQuery() {
if (retstart > 0) {
query += "&retstart=" + Integer.toString(retstart);
}
if(!"".equals(api_key)){
query += "&api_key=" + api_key;
}
return query.replace(" ", "+");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.w3c.dom.Node;

import lombok.Getter;
import lombok.Setter;
import reactor.core.publisher.Mono;

@Service
Expand All @@ -31,10 +32,12 @@ public class CkbEfetch {

private WebClient webClient;

@Setter
List<EsearchResultRoot> esearch_results = new ArrayList<EsearchResultRoot>();


@Getter
@Setter
List<String> results = new ArrayList<String>();

public CkbEfetch() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class CkbEsearch {
private WebClient webClient;

@Getter
@Setter
List<EsearchResultRoot> results = new ArrayList<EsearchResultRoot>();

public CkbEsearch() {
Expand Down
2 changes: 1 addition & 1 deletion pom-deploy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.canehealth.ckblib</groupId>
<artifactId>cklib-core</artifactId>
<version>0.9.0</version>
<version>0.11.0</version>
<packaging>pom</packaging>

<modules>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.canehealth.ckblib</groupId>
<artifactId>cklib-core</artifactId>
<version>0.9.0</version>
<version>0.11.0</version>
<packaging>pom</packaging>

<modules>
Expand Down
2 changes: 1 addition & 1 deletion qtakes/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>com.canehealth.ckblib</groupId>
<artifactId>qtakes</artifactId>
<version>0.9.0</version>
<version>0.11.0</version>
<name>ckblib-qtakes</name>
<description>Demo project for Spring Boot</description>

Expand Down

0 comments on commit 771f489

Please sign in to comment.