Commit 25cb49f3 authored by jcorvi's avatar jcorvi
Browse files

Merge branch 'develop' into 'master'

"Merge branch 'allevidence' into 'develop'"

See merge request !15
parents e76edc20 ec4987b3
Pipeline #25857 passed with stage
in 3 seconds
......@@ -8,7 +8,6 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -17,8 +16,6 @@ import es.bsc.inb.ades.rest.api.model.Document;
import es.bsc.inb.ades.rest.api.model.DocumentAnnotations;
import es.bsc.inb.ades.rest.api.model.DocumentTracking;
import es.bsc.inb.ades.rest.api.model.Status;
import es.bsc.inb.ades.rest.api.model.Tracking;
import es.bsc.inb.ades.rest.api.security.basic.inmemory.AuthenticationBean;
import es.bsc.inb.ades.rest.api.services.DocumentService;
......@@ -79,6 +76,12 @@ public class DocumentController {
return "true";
}
@RequestMapping("/documents/{id}/srFindingValidation/{srDomainId}/{status}")
public String setSRFindingValidation(@PathVariable(value="id") Long id, @PathVariable(value="srDomainId") Integer srDomainId, @PathVariable(value="status") String status) {
documentService.setValidationSRDomainFinding(id, srDomainId, status);
return "true";
}
@RequestMapping("/documents/{id}/findingValidation/{findingId}/{status}")
public String setFindingValidation(@PathVariable(value="id") Long id, @PathVariable(value="findingId") Integer findingId, @PathVariable(value="status") String status) {
documentService.setFindingValidation(id, findingId, status);
......@@ -91,19 +94,37 @@ public class DocumentController {
return snippet;
}
@RequestMapping("/documents/{id}/evidence/findings")
public String findAllFindingEvidence(@PathVariable(value="id") Long id) {
String snippet = documentService.findFindingsEvidenceByDocumentId(id);
return snippet;
}
@RequestMapping("/documents/{id}/evidence/all")
public String findAllEvidence(@PathVariable(value="id") Long id) {
String snippet = documentService.findFindingsEvidenceByDocumentId(id);
String snippet = documentService.findAllEvidenceByDocumentId(id);
return snippet;
}
@RequestMapping("/documents/{id}/evidence/sentences")
public String findSentencesEvidence(@PathVariable(value="id") Long id) {
String snippet = documentService.findSentencesEvidenceByDocumentId(id);
//String snippet = documentService.findAllEvidenceByDocumentId(id);
return snippet;
}
@RequestMapping("/documents/{id}/finding2/{findingId}")
public String findFinding2(@PathVariable(value="id") Long id, @PathVariable(value="findingId") Integer findingId) {
String snippet = documentService.findTextSnippetByDocumentIdAndFindingId2(id, findingId);
@RequestMapping("/documents/{id}/text")
public String findDocumentText(@PathVariable(value="id") Long id) {
String snippet = documentService.findTextByDocumentId(id);
return snippet;
}
// @RequestMapping("/documents/{id}/finding2/{findingId}")
// public String findFinding2(@PathVariable(value="id") Long id, @PathVariable(value="findingId") Integer findingId) {
// String snippet = documentService.findTextSnippetByDocumentIdAndFindingId2(id, findingId);
// return snippet;
// }
@RequestMapping(value = "/documents/export/{id}")
public ResponseEntity<byte[]> generateReport(@PathVariable("id") long documentId){
String filename = "Study_Report_" + documentId +".txt";
......
package es.bsc.inb.ades.rest.api.model;
import org.apache.tomcat.util.bcel.classfile.Constant;
import es.bsc.inb.ades.rest.api.util.Constants;
/**
* This class describes a finding in SR-Domain format.
* No textual evidence.
......@@ -23,11 +27,16 @@ public class SRDomainFinding implements Cloneable{
private String SRENPHSE="";
private String SROBENDY="";
private String SRDOMAIN="";
private String SRDOMAIN_DESC="";
private String SRSPEC="";
private String SRSPEC_DESC="";
private String SRTSTCD="";
private String SRTSTCD_DESC="";
private String SRFNDG="";
private String SRFNDG_DESC="";
private String SRORES="";
private String SROBSV="";
private String SROBSV_DESC="";
private String SROBSQ="";
private String SRSEV="";
private String SRPCNT="";
......@@ -38,6 +47,59 @@ public class SRDomainFinding implements Cloneable{
private Boolean export;
private Integer findingId;
private Integer srDomainId;
private String status="non_curated";
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getSrdomain_value() {
if(Constants.SEND_DOMAIN_NAMES.get(SRDOMAIN)!=null) {
return Constants.SEND_DOMAIN_NAMES.get(SRDOMAIN) + "(" + SRDOMAIN + ")";
}else if(SRDOMAIN==null || SRDOMAIN.equals("")) {
return "";
}else {
return SRDOMAIN;
}
}
public String getSrfndg_value() {
if(SRFNDG ==null || SRFNDG.equals("")) {
return SRORES;
}
return SRFNDG_DESC + "(" + SRFNDG + ")";
}
public String getSrtstcd_value() {
if(SRTSTCD ==null || SRTSTCD.equals("")) {
return SRTSTCD_DESC;
}
return SRTSTCD_DESC + "(" + SRTSTCD + ")";
}
public String getSrobsv_value() {
if(SROBSV ==null || SROBSV.equals("")) {
return SROBSV_DESC;
}
return SROBSV_DESC + "(" + SROBSV + ")";
}
public String getSrspec_value() {
if(SRSPEC ==null || SRSPEC.equals("")) {
return SRSPEC_DESC;
}
return SRSPEC_DESC + "(" + SRSPEC + ")";
}
public String getSTUDYID() {
return STUDYID;
......@@ -156,9 +218,9 @@ public class SRDomainFinding implements Cloneable{
public String getSROBSV() {
return SROBSV;
}
public void setSROBSV(String sROBSV) {
SROBSV = sROBSV;
}
public String getSROBSQ() {
return SROBSQ;
}
......@@ -195,10 +257,41 @@ public class SRDomainFinding implements Cloneable{
public void setSRCOMNT(String sRCOMNT) {
SRCOMNT = sRCOMNT;
}
public void setSRDOMAIN_DESC(String sRDOMAIN_DESC) {
SRDOMAIN_DESC = sRDOMAIN_DESC;
}
public void setSROBSV(String sROBSV) {
SROBSV = sROBSV;
}
public String getSRDOMAIN_DESC() {
return SRDOMAIN_DESC;
}
public String getSRSPEC_DESC() {
return SRSPEC_DESC;
}
public void setSRSPEC_DESC(String sRSPEC_DESC) {
SRSPEC_DESC = sRSPEC_DESC;
}
public String getSRTSTCD_DESC() {
return SRTSTCD_DESC;
}
public void setSRTSTCD_DESC(String sRTSTCD_DESC) {
SRTSTCD_DESC = sRTSTCD_DESC;
}
public String getSRFNDG_DESC() {
return SRFNDG_DESC;
}
public void setSRFNDG_DESC(String sRFNDG_DESC) {
SRFNDG_DESC = sRFNDG_DESC;
}
public String getSROBSV_DESC() {
return SROBSV_DESC;
}
public void setSROBSV_DESC(String sROBSV_DESC) {
SROBSV_DESC = sROBSV_DESC;
}
public Boolean getExport() {
if(export==null)return true;
return export;
......
......@@ -6,7 +6,6 @@ import es.bsc.inb.ades.rest.api.model.Document;
import es.bsc.inb.ades.rest.api.model.DocumentAnnotations;
import es.bsc.inb.ades.rest.api.model.DocumentTracking;
import es.bsc.inb.ades.rest.api.model.Status;
import es.bsc.inb.ades.rest.api.model.Tracking;
public interface DocumentService {
......@@ -17,7 +16,7 @@ public interface DocumentService {
Document findByDocumentId2(Long id);
String findTextSnippetByDocumentIdAndFindingId2(Long id, Integer findingId);
//String findTextSnippetByDocumentIdAndFindingId2(Long id, Integer findingId);
String findFindingEvidenceByDocumentIdAndFindingId(Long id, Integer findingId);
......@@ -31,8 +30,16 @@ public interface DocumentService {
String findFindingsEvidenceByDocumentId(Long id);
String findAllEvidenceByDocumentId(Long id);
String findSentencesEvidenceByDocumentId(Long id);
String findTextByDocumentId(Long id);
Boolean setExportSRDomainFinding(Long id, Integer findingId, Boolean export_srdomain);
Boolean setValidationSRDomainFinding(Long id, Integer srDomainFindingId,String status);
Boolean setFindingValidation(Long id, Integer findingId,String status);
Status moveDocument(Long id, Status status);
......
package es.bsc.inb.ades.rest.api.util;
import java.util.HashMap;
import java.util.Map;
public class Constants {
public static int SLICE_START = 1000;
......@@ -7,4 +10,26 @@ public class Constants {
public static int POINTS_INT = 5;
public static String POINTS = ".....";
public static Map<String, String> SEND_DOMAIN_NAMES = new HashMap<String, String>(){{
put("LB", "Laboratory Test Results");
put("BW", "Body Weight");
put("BG", "Body Weight Gain");
put("CV", "Cardiovascular Domain");
put("CL", "Clinical");
put("DD", "Death Diagnosis");
put("EG", "ECG Test Results");
put("FM", "Fetal Measurements");
put("FW", "Food And Water");
put("FX", "Fetal Pathology Findings");
put("MA", "Macroscopic Findings");
put("MI", "Microscopic Findings");
put("OM", "Organ Measurements");
put("RE", "Respiratory Findings");
put("TF", "Tumor Findings");
put("VS", "Vital Signs");
}};
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment