Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
INB
eTRANSAFE
pretox-rest-api
Commits
447c7c35
Commit
447c7c35
authored
Jun 21, 2021
by
javi
Browse files
improves srdomaintemplate tab
parent
27066537
Pipeline
#22655
passed with stage
in 4 minutes and 38 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/es/bsc/inb/ades/rest/api/controllers/DocumentController.java
View file @
447c7c35
...
...
@@ -30,7 +30,12 @@ public class DocumentController {
@RequestMapping
(
"/documents/{id}"
)
public
DocumentAnnotations
find
(
@PathVariable
(
value
=
"id"
)
Long
id
)
{
return
documentService
.
findByDocumentAnnotationsByDocumentId
(
id
);
return
documentService
.
findDocumentAnnotationsByDocumentId
(
id
);
}
@RequestMapping
(
"/documents/{id}/srdomain"
)
public
DocumentAnnotations
findDocumentSRDomain
(
@PathVariable
(
value
=
"id"
)
Long
id
)
{
return
documentService
.
findDocumentSRDomainByDocumentId
(
id
);
}
// @RequestMapping("/documents/{id}")
...
...
src/main/java/es/bsc/inb/ades/rest/api/model/DocumentAnnotations.java
View file @
447c7c35
package
es.bsc.inb.ades.rest.api.model
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.bson.types.ObjectId
;
import
org.springframework.data.annotation.Id
;
...
...
@@ -22,6 +23,8 @@ public class DocumentAnnotations {
private
ArrayList
<
Annotation
>
relevantSentences
;
private
ArrayList
<
Finding
>
findings
;
private
List
<
SRDomainFinding
>
srdomainfindings
;
public
DocumentAnnotations
()
{}
...
...
@@ -46,7 +49,6 @@ public class DocumentAnnotations {
return
documentId
;
}
public
ArrayList
<
Annotation
>
getRelevantSentences
()
{
return
relevantSentences
;
}
...
...
@@ -59,20 +61,22 @@ public class DocumentAnnotations {
this
.
documentId
=
documentId
;
}
public
ArrayList
<
Finding
>
getFindings
()
{
return
findings
;
}
public
void
setFindings
(
ArrayList
<
Finding
>
findings
)
{
this
.
findings
=
findings
;
}
public
List
<
SRDomainFinding
>
getSrdomainfindings
()
{
return
srdomainfindings
;
}
public
void
setSrdomainfindings
(
List
<
SRDomainFinding
>
srdomainfindings
)
{
this
.
srdomainfindings
=
srdomainfindings
;
}
}
src/main/java/es/bsc/inb/ades/rest/api/model/SRDomainFinding.java
View file @
447c7c35
...
...
@@ -34,6 +34,11 @@ public class SRDomainFinding implements Cloneable{
private
String
SRSIGF
=
""
;
private
String
SRTRTEF
=
""
;
private
String
SRCOMNT
=
""
;
private
Boolean
export
;
private
Integer
findingId
;
private
Integer
srDomainId
;
public
String
getSTUDYID
()
{
return
STUDYID
;
}
...
...
@@ -191,6 +196,27 @@ public class SRDomainFinding implements Cloneable{
SRCOMNT
=
sRCOMNT
;
}
public
Boolean
getExport
()
{
return
export
;
}
public
void
setExport
(
Boolean
export
)
{
this
.
export
=
export
;
}
public
Integer
getSrDomainId
()
{
return
srDomainId
;
}
public
void
setSrDomainId
(
Integer
srDomainId
)
{
this
.
srDomainId
=
srDomainId
;
}
public
Integer
getFindingId
()
{
return
findingId
;
}
public
void
setFindingId
(
Integer
findingId
)
{
this
.
findingId
=
findingId
;
}
public
SRDomainFinding
clone
()
{
try
{
return
(
SRDomainFinding
)
super
.
clone
();
...
...
src/main/java/es/bsc/inb/ades/rest/api/services/DocumentService.java
View file @
447c7c35
...
...
@@ -18,7 +18,9 @@ public interface DocumentService {
String
findFindingEvidenceByDocumentIdAndFindingId
(
Long
id
,
Integer
findingId
);
DocumentAnnotations
findByDocumentAnnotationsByDocumentId
(
Long
id
);
DocumentAnnotations
findDocumentAnnotationsByDocumentId
(
Long
id
);
DocumentAnnotations
findDocumentSRDomainByDocumentId
(
Long
id
);
String
findSentenceEvidenceByDocumentIdAndSentenceId
(
Long
id
,
Integer
sentenceId
);
...
...
src/main/java/es/bsc/inb/ades/rest/api/services/DocumentServiceImpl.java
View file @
447c7c35
...
...
@@ -28,6 +28,7 @@ import es.bsc.inb.ades.rest.api.model.Annotation;
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.Finding
;
import
es.bsc.inb.ades.rest.api.model.SRDomainFinding
;
import
es.bsc.inb.ades.rest.api.repository.DocumentAnnotationsRepository
;
import
es.bsc.inb.ades.rest.api.repository.DocumentRepository
;
import
es.bsc.inb.ades.rest.api.util.Constants
;
...
...
@@ -60,10 +61,25 @@ public class DocumentServiceImpl implements DocumentService {
return
documentRepository
.
findDocumentTextSubstringByDocumentId
(
id
,
start
,
end
);
}
public
DocumentAnnotations
find
By
DocumentAnnotationsByDocumentId
(
Long
id
)
{
public
DocumentAnnotations
findDocumentAnnotationsByDocumentId
(
Long
id
)
{
return
documentAnnotationsRepository
.
findByDocumentId
(
id
);
}
public
DocumentAnnotations
findDocumentSRDomainByDocumentId
(
Long
id
)
{
DocumentAnnotations
docAnno
=
documentAnnotationsRepository
.
findByDocumentId
(
id
);
List
<
SRDomainFinding
>
srdomains
=
new
ArrayList
<
SRDomainFinding
>();
for
(
Annotation
sentence
:
docAnno
.
getRelevantSentences
())
{
for
(
Finding
finding
:
sentence
.
getFindings
())
{
for
(
SRDomainFinding
sr
:
finding
.
getSrDomainFindings
())
{
srdomains
.
add
(
sr
);
}
}
}
docAnno
.
setSrdomainfindings
(
srdomains
);
docAnno
.
setRelevantSentences
(
null
);
docAnno
.
setFindings
(
null
);
return
docAnno
;
}
public
Document
findByDocumentId2
(
Long
id
)
{
documentRepository
.
findByDocumentId
(
id
);
...
...
@@ -91,7 +107,7 @@ public class DocumentServiceImpl implements DocumentService {
@Override
public
String
findTextSnippetByDocumentIdAndFindingId2
(
Long
id
,
Integer
findingId
)
{
DocumentAnnotations
documentAnnotations
=
this
.
find
By
DocumentAnnotationsByDocumentId
(
id
);
DocumentAnnotations
documentAnnotations
=
this
.
findDocumentAnnotationsByDocumentId
(
id
);
Document
document
=
this
.
findByDocumentId
(
id
);
Finding
findingSelected
=
null
;
for
(
Finding
finding
:
documentAnnotations
.
getFindings
())
{
...
...
@@ -111,7 +127,7 @@ public class DocumentServiceImpl implements DocumentService {
@Override
public
Boolean
acceptFinding
(
Long
id
,
Integer
findingId
)
{
DocumentAnnotations
documentAnnotations
=
this
.
find
By
DocumentAnnotationsByDocumentId
(
id
);
DocumentAnnotations
documentAnnotations
=
this
.
findDocumentAnnotationsByDocumentId
(
id
);
Finding
findingSelected
=
null
;
for
(
Annotation
annotation
:
documentAnnotations
.
getRelevantSentences
())
{
for
(
Finding
finding
:
annotation
.
getFindings
())
{
...
...
@@ -131,7 +147,7 @@ public class DocumentServiceImpl implements DocumentService {
@Override
public
Boolean
rejectFinding
(
Long
id
,
Integer
findingId
)
{
DocumentAnnotations
documentAnnotations
=
this
.
find
By
DocumentAnnotationsByDocumentId
(
id
);
DocumentAnnotations
documentAnnotations
=
this
.
findDocumentAnnotationsByDocumentId
(
id
);
Finding
findingSelected
=
null
;
for
(
Annotation
annotation
:
documentAnnotations
.
getRelevantSentences
())
{
for
(
Finding
finding
:
annotation
.
getFindings
())
{
...
...
@@ -152,7 +168,7 @@ public class DocumentServiceImpl implements DocumentService {
@Override
public
Boolean
setExportFinding
(
Long
id
,
Integer
findingId
,
String
export_finding
)
{
DocumentAnnotations
documentAnnotations
=
this
.
find
By
DocumentAnnotationsByDocumentId
(
id
);
DocumentAnnotations
documentAnnotations
=
this
.
findDocumentAnnotationsByDocumentId
(
id
);
Finding
findingSelected
=
null
;
for
(
Annotation
annotation
:
documentAnnotations
.
getRelevantSentences
())
{
for
(
Finding
finding
:
annotation
.
getFindings
())
{
...
...
@@ -174,7 +190,7 @@ public class DocumentServiceImpl implements DocumentService {
@Override
public
String
findSentenceEvidenceByDocumentIdAndSentenceId
(
Long
id
,
Integer
sentenceId
)
{
DocumentAnnotations
documentAnnotations
=
this
.
find
By
DocumentAnnotationsByDocumentId
(
id
);
DocumentAnnotations
documentAnnotations
=
this
.
findDocumentAnnotationsByDocumentId
(
id
);
Annotation
annotation
=
null
;
for
(
Annotation
sentence
:
documentAnnotations
.
getRelevantSentences
())
{
if
(
sentence
.
getId
().
equals
(
sentenceId
))
{
...
...
@@ -205,14 +221,14 @@ public class DocumentServiceImpl implements DocumentService {
}
public
String
findFindingsEvidenceByDocumentId
(
Long
id
)
{
DocumentAnnotations
documentAnnotations
=
this
.
find
By
DocumentAnnotationsByDocumentId
(
id
);
DocumentAnnotations
documentAnnotations
=
this
.
findDocumentAnnotationsByDocumentId
(
id
);
Document
document
=
this
.
findByDocumentId
(
id
);
return
this
.
generateFindingsSnippet4
(
document
.
getText
(),
documentAnnotations
.
getFindings
());
}
@Override
public
String
findFindingEvidenceByDocumentIdAndFindingId
(
Long
id
,
Integer
findingId
)
{
DocumentAnnotations
documentAnnotations
=
this
.
find
By
DocumentAnnotationsByDocumentId
(
id
);
DocumentAnnotations
documentAnnotations
=
this
.
findDocumentAnnotationsByDocumentId
(
id
);
Finding
findingSelected
=
null
;
for
(
Annotation
annotation
:
documentAnnotations
.
getRelevantSentences
())
{
for
(
Finding
finding
:
annotation
.
getFindings
())
{
...
...
@@ -267,7 +283,7 @@ public class DocumentServiceImpl implements DocumentService {
public
byte
[]
exportDocumentAnnotation
(
Long
id
)
{
DocumentAnnotations
documentAnnotations
=
this
.
find
By
DocumentAnnotationsByDocumentId
(
id
);
DocumentAnnotations
documentAnnotations
=
this
.
findDocumentAnnotationsByDocumentId
(
id
);
StringBuilder
retStr
=
new
StringBuilder
(
""
);
retStr
.
append
(
"STUDYID|DOMAIN|SRSEQ|SRRISK|SPGRPCD|GRPLBL|SRGRPDOS|SRSEX|SRSTDY|SRSTPHSE|SROBSTDY|SRENDY|SRENPHSE|SROBENDY|SRDOMAIN|SRSPEC|SRTSTCD|SRFNDG|SRORES|SROBSV|SROBSQ|SRSEV|SRPCNT|SRSIGF|SRTRTEF|SRCOMNT"
);
retStr
.
append
(
System
.
getProperty
(
"line.separator"
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment