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-app
Commits
231e8b6e
Commit
231e8b6e
authored
Nov 12, 2021
by
jcorvi
Browse files
Merge branch 'develop' into 'master'
"Merge branch 'draft_version' into 'develop'" See merge request
!15
parents
c2ba3bf0
b0c4d3f4
Pipeline
#25858
passed with stage
in 1 minute
Changes
11
Pipelines
2
Expand all
Hide whitespace changes
Inline
Side-by-side
src/app/app-routing.module.ts
View file @
231e8b6e
...
...
@@ -20,7 +20,7 @@ const routes: Routes = [
{
path
:
'
find/:id
'
,
component
:
DocumentDetailComponent
,
children
:
[
{
path
:
''
,
redirectTo
:
'
third
'
,
pathMatch
:
'
full
'
},
{
path
:
''
,
redirectTo
:
'
first
'
,
pathMatch
:
'
full
'
},
{
path
:
'
first
'
,
component
:
PretoxsentencesTabulatorComponent
},
{
path
:
'
second
'
,
component
:
FindingTabulatorComponent
},
{
path
:
'
third
'
,
component
:
SrdomaintemplateTabulatorComponent
},
...
...
src/app/app.module.ts
View file @
231e8b6e
...
...
@@ -24,6 +24,10 @@ import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import
{
SrdomainLevelComponent
}
from
'
./srdomain-level/srdomain-level.component
'
;
import
{
LogoutComponent
}
from
'
./logout/logout.component
'
;
import
{
HistoryTrackingComponent
}
from
'
./history-tracking/history-tracking.component
'
;
import
{
MatProgressSpinnerModule
,
MatProgressBarModule
}
from
'
@angular/material
'
@
NgModule
({
declarations
:
[
AppComponent
,
...
...
@@ -50,7 +54,10 @@ import { HistoryTrackingComponent } from './history-tracking/history-tracking.co
HttpModule
,
MatTabsModule
,
BrowserAnimationsModule
,
MatToolbarModule
MatToolbarModule
,
MatProgressSpinnerModule
,
MatProgressBarModule
],
providers
:
[
LoginService
,
CookieService
,
{
provide
:
HTTP_INTERCEPTORS
,
...
...
src/app/document-detail/document-detail.component.css
View file @
231e8b6e
.loader
{
position
:
absolute
;
top
:
0px
;
right
:
0px
;
width
:
100%
;
height
:
100%
;
background-color
:
#eceaea
;
background-image
:
url('loader.gif')
;
background-size
:
100px
;
background-repeat
:
no-repeat
;
background-position
:
center
;
z-index
:
10000000
;
opacity
:
0.4
;
filter
:
alpha
(
opacity
=
40
);
}
.FixedHeightContainer
{
}
.brat_div
{
overflow
:
auto
;
}
\ No newline at end of file
src/app/document-detail/document-detail.component.html
View file @
231e8b6e
...
...
@@ -56,11 +56,10 @@
</div>
</div>
<div
id=
"data2"
class=
"w3-container"
>
<div
id=
"data1"
data-ng-init=
"clear()"
>
</div>
</div>
<div
id=
"commentpopup"
></div>
<!-- <mat-spinner></mat-spinner>
<div id="loadingDiv8" class="loader"></div> -->
<!-- <nav class="navbar navbar-light bg-light">
...
...
@@ -89,14 +88,17 @@
<a
href=
"#data2"
style=
"text-decoration:none;cursor: pointer;"
data-toggle=
"collapse"
>
<i
class=
"fa fa-angle-down"
style=
"color:black;padding: 10px 30px; font-size: 3rem;"
title=
"Minimize Evidence"
></i>
</a>
<a
(click)=
"clear()"
style=
"text-decoration:none;cursor: pointer;"
>
<!--
<a (click)="clear()" style="text-decoration:none;cursor: pointer;">
<i class="fa fa-eraser" style="color:black;padding: 10px 30px; font-size: 2rem;" title="Clear Evidence"></i>
</a>
</a>
-->
<!-- <a title="Export Findings" (click)="exportDocument" download="download.json">
<i class="fa fa-file-export" style="color:black;padding: 10px 30px; font-size: 2rem;"></i>
</a> -->
<a
(click)=
"getAllEvidence()"
style=
"text-decoration:none;cursor: pointer;"
>
<i
class=
"fa fa-eye"
style=
"color:black;padding: 10px 30px; font-size: 2rem;"
title=
"Show All Evidence"
>
</i>
</a>
<a
(click)=
"findDocumentText()"
style=
"text-decoration:none;cursor: pointer;"
>
<i
class=
"fa fa-file-text"
style=
"color:black;padding: 10px 30px; font-size: 2rem;"
title=
"Show Plain Text"
>
</i>
</a>
<a
(click)=
"exportDocument()"
style=
"text-decoration:none;cursor: pointer;"
>
<i
class=
"fa fa-download"
style=
"color:black;padding: 10px 30px; font-size: 2rem;"
title=
"Export Findings"
>
</i>
...
...
@@ -104,7 +106,12 @@
<a
routerLink=
"./tracking"
style=
"text-decoration:none;cursor: pointer;"
>
<i
class=
"fa fa-history"
style=
"color:black;padding: 10px 30px; font-size: 2rem;"
title=
"History changes"
>
</i>
</a>
<div
id=
"data2"
>
<div
id=
"loadingDiv"
></div>
<div
id=
"data1"
data-ng-init=
"clear()"
>
</div>
</div>
<div
id=
"commentpopup"
></div>
<!-- <a mat-tab-link md-align-tabs="right" style="padding-left: 650px;"
routerLink="./tracking"
routerLinkActive #rla="routerLinkActive"
...
...
@@ -174,6 +181,9 @@
<app-srdomaintemplate-tabulator [tableData]=tableDataSRDomainTemplate (rowClickEventSRDomainTemplateEvidence)="rowClickSRDomainTemplateEvidence($event)" (rowClickExportSRDomainEvent)="setExportSRDomain($event)"></app-srdomaintemplate-tabulator>
</div> -->
</div>
<!-- <div>
<app-pretoxsentences-tabulator [columnNames]=columnNamesPretoxSentences [tableData]=tableDataPretoxSentences (rowClickEventFinding)="rowClick($event)" (rowClickEvent)="rowClickSentence($event)" (rowClickAcceptFindingEvent)="acceptFinding($event)" (rowClickRejectFindingEvent)="rejectFinding($event)" (rowClickExportFindingEvent)="setExportFinding($event)">></app-pretoxsentences-tabulator>
</div> -->
...
...
src/app/document-detail/document-detail.component.ts
View file @
231e8b6e
...
...
@@ -8,12 +8,14 @@ import { Finding } from '../finding';
import
{
Annotation
}
from
'
../annotation
'
;
import
{
environment
}
from
'
./../../environments/environment
'
;
import
{
MatToolbarModule
}
from
'
@angular/material/toolbar
'
;
import
{
Router
}
from
'
@angular/router
'
;
//brat
declare
var
head
:
any
;
declare
var
Util
:
any
;
declare
var
Visualizer
:
any
;
var
displaySpanComment
=
function
(
evt
,
target
,
spanId
,
spanType
,
mods
,
spanText
,
commentText
,
commentType
,
normalizations
)
{
var
left
=
evt
.
clientX
+
"
px
"
;
...
...
@@ -159,36 +161,92 @@ export class DocumentDetailComponent implements OnInit {
this
.
navLinks
=
[
{
label
:
'
Sentence
Level
'
,
label
:
'
Relevant
Sentence
s
'
,
link
:
'
./first
'
,
index
:
0
},
{
},
/*
{
label: 'Findings Level',
link: './second',
index: 1
},
{
label
:
'
SR-Domain Level
'
,
},
*/
{
label
:
'
Findings
'
,
link
:
'
./third
'
,
index
:
2
index
:
1
}
];
this
.
nextStatus
=
[
'
DRAFT
'
,
'
IN_PROGRESS
'
,
'
FINISHED
'
];
;
}
loadBratVisualizer
():
void
{
const
bratLocation
=
environment
.
bratUrl
;
//const bratLocation = 'http://10.32.6.2:8001';
head
.
js
(
// External libraries
bratLocation
+
'
/client/lib/jquery.min.js
'
,
bratLocation
+
'
/client/lib/jquery.svg.min.js
'
,
bratLocation
+
'
/client/lib/jquery.svgdom.min.js
'
,
// brat helper modules
bratLocation
+
'
/client/src/configuration.js
'
,
bratLocation
+
'
/client/src/util.js
'
,
bratLocation
+
'
/client/src/annotation_log.js
'
,
bratLocation
+
'
/client/lib/webfont.js
'
,
// brat modules
bratLocation
+
'
/client/src/dispatcher.js
'
,
bratLocation
+
'
/client/src/url_monitor.js
'
,
bratLocation
+
'
/client/src/visualizer.js
'
);
}
// ngOnInit() {
// this.getDocument();
// }
loaded
():
void
{
alert
(
'
loaded
'
);
var
loading
=
document
.
getElementById
(
'
loadingDiv
'
);
loading
.
style
.
display
=
'
none
'
;
}
ngOnInit
():
void
{
this
.
router
.
events
.
subscribe
((
res
)
=>
{
this
.
activeLinkIndex
=
this
.
navLinks
.
indexOf
(
this
.
navLinks
.
find
(
tab
=>
tab
.
link
===
'
.
'
+
this
.
router
.
url
));
});
this
.
getDocument
();
//this.getEvidence();
}
getEvidence
()
{
//alert('getAllEvidence');
const
id
=
+
this
.
route
.
snapshot
.
paramMap
.
get
(
'
id
'
);
//this.documentService.getAllEvidence(this.document.documentId)
this
.
documentService
.
getEvidence
(
id
)
.
subscribe
(
text
=>
{
this
.
docData
=
text
;
//console.log(this.docData);
// console.log(JSON.parse(this.docData));
document
.
getElementById
(
'
data2
'
).
className
=
'
collapse show
'
;
document
.
getElementById
(
'
data1
'
).
innerHTML
=
''
;
document
.
getElementById
(
'
data1
'
).
className
=
''
;
//document.getElementById('loadingDiv').className = 'loader';
var
j
=
JSON
.
parse
(
this
.
docData
);
//this.loadBratVisualizer();
head
.
ready
(
function
()
{
const
dispatcher
=
Util
.
embed
(
'
data1
'
,
DocumentDetailComponent
.
collData
,
j
,
DocumentDetailComponent
.
webFontURLs
);
//dispatcher.on('displaySpanComment', displaySpanComment);
//dispatcher.on('hideComment', hideComment);
// setTimeout(() => {
// document.getElementById('loadingDiv').className = '';
// }, 4000);
});
});
}
save
():
void
{
this
.
documentService
.
updateDocument
(
this
.
document
)
.
subscribe
(()
=>
this
.
goBack
());
...
...
@@ -201,26 +259,26 @@ export class DocumentDetailComponent implements OnInit {
.
subscribe
(
document
=>
{
this
.
document
=
document
;
this
.
setNextStatus
(
this
.
document
.
status
);
var
data
=
[];
//
var data = [];
var
data_relevant_sentences
=
[];
document
.
findings
.
forEach
(
find
=>
{
data
.
push
({
id
:
find
.
findingId
,
finding
:
find
.
finding
!=
null
?
find
.
finding
.
value
:
''
,
study_testcd
:
find
.
study_testcd
!=
null
?
find
.
study_testcd
.
value
:
''
,
manifestation_finding
:
find
.
manifestation_finding
!=
null
?
find
.
manifestation_finding
.
value
:
''
,
study_domain
:
find
.
study_domain
!=
null
?
find
.
study_domain
.
value
:
''
,
specimen
:
find
.
specimen
!=
null
?
find
.
specimen
.
value
:
''
,
sex
:
find
.
sex
!=
null
?
find
.
sex
.
value
:
''
,
dose
:
find
.
dose
!=
null
?
find
.
dose
.
value
:
''
,
group
:
find
.
group
!=
null
?
find
.
group
.
value
:
''
,
is_trf
:
find
.
is_treatment_related
!=
null
?
find
.
is_treatment_related
.
value
:
''
});
});
//
document.findings.forEach(find => {
//
data.push({
//
id : find.findingId,
//
finding: find.finding != null ? find.finding.value : '',
//
study_testcd: find.study_testcd != null ? find.study_testcd.value : '',
//
manifestation_finding: find.manifestation_finding != null ? find.manifestation_finding.value : '',
//
study_domain: find.study_domain != null ? find.study_domain.value : '',
//
specimen: find.specimen != null ? find.specimen.value : '',
//
sex: find.sex != null ? find.sex.value : '',
//
dose: find.dose != null ? find.dose.value : '',
//
group: find.group != null ? find.group.value : '',
//
is_trf: find.is_treatment_related != null ? find.is_treatment_related.value : ''
//
});
//
});
//alert(data);
//alert(JSON.stringify(data));
this
.
tableData
=
data
;
//
this.tableData = data;
//this.clear();
//alert(JSON.stringify(document.findings));
//var j = JSON.parse('{ text:' + document.text + '}');
...
...
@@ -338,39 +396,138 @@ export class DocumentDetailComponent implements OnInit {
findingSelected
(
finding
):
void
{
this
.
documentService
.
findingSelected
(
this
.
document
.
documentId
,
finding
)
.
subscribe
(
text
=>
{
this
.
docData
=
text
;
console
.
log
(
this
.
docData
);
var
loading
=
document
.
getElementById
(
'
loadingDiv
'
);
//loading.style.display='block';
loading
.
addEventListener
(
"
load
"
,
this
.
loaded
);
this
.
docData
=
text
;
//console.log(this.docData);
// console.log(JSON.parse(this.docData));
document
.
getElementById
(
'
data2
'
).
className
=
'
collapse show
'
;
document
.
getElementById
(
'
data1
'
).
innerHTML
=
''
;
document
.
getElementById
(
'
data1
'
).
className
=
''
;
//document.getElementById('loadingDiv').className = 'loader';
var
j
=
JSON
.
parse
(
this
.
docData
);
//this.loadBratVisualizer();
head
.
ready
(
function
()
{
const
dispatcher
=
Util
.
embed
(
'
data1
'
,
DocumentDetailComponent
.
collData
,
j
,
DocumentDetailComponent
.
webFontURLs
);
dispatcher
.
on
(
'
displaySpanComment
'
,
displaySpanComment
);
dispatcher
.
on
(
'
hideComment
'
,
hideComment
);
//dispatcher.on('displaySpanComment', displaySpanComment);
//dispatcher.on('hideComment', hideComment);
// setTimeout(() => {
// document.getElementById('loadingDiv').className = '';
// }, 4000);
});
});
}
pretoxSentenceSelected
(
pretoxSentence
):
void
{
this
.
documentService
.
pretoxSentenceSelected
(
this
.
document
.
documentId
,
pretoxSentence
)
.
subscribe
(
text
=>
{
this
.
docData
=
text
;
console
.
log
(
this
.
docData
);
//
console.log(this.docData);
// console.log(JSON.parse(this.docData));
document
.
getElementById
(
'
data2
'
).
className
=
'
collapse show
'
;
document
.
getElementById
(
'
data1
'
).
innerHTML
=
''
;
document
.
getElementById
(
'
data1
'
).
className
=
''
;
//document.getElementById('loadingDiv').className = 'loader';
var
j
=
JSON
.
parse
(
this
.
docData
);
//this.loadBratVisualizer();
head
.
ready
(
function
()
{
const
dispatcher
=
Util
.
embed
(
'
data1
'
,
DocumentDetailComponent
.
collData
,
j
,
DocumentDetailComponent
.
webFontURLs
);
//dispatcher.post('resetData');
//dispatcher.post('collectionChanged');
//dispatcher.post('triggerRender');
dispatcher
.
on
(
'
displaySpanComment
'
,
displaySpanComment
);
dispatcher
.
on
(
'
hideComment
'
,
hideComment
);
// setTimeout(() => {
// document.getElementById('loadingDiv').className = '';
// }, 4000);
});
});
}
findDocumentText
():
void
{
this
.
documentService
.
findDocumentText
(
this
.
document
.
documentId
)
.
subscribe
(
text
=>
{
this
.
docData
=
text
;
//console.log(this.docData);
document
.
getElementById
(
'
data2
'
).
className
=
'
collapse show
'
;
document
.
getElementById
(
'
data1
'
).
innerHTML
=
''
;
document
.
getElementById
(
'
data1
'
).
className
=
''
;
//document.getElementById('loadingDiv').className = 'loader';
var
j
=
JSON
.
parse
(
this
.
docData
);
//this.loadBratVisualizer();
head
.
ready
(
function
()
{
const
dispatcher
=
Util
.
embed
(
'
data1
'
,
DocumentDetailComponent
.
collData
,
j
,
DocumentDetailComponent
.
webFontURLs
);
//dispatcher.on('displaySpanComment', displaySpanComment);
//dispatcher.on('hideComment', hideComment);
// setTimeout(() => {
// document.getElementById('loadingDiv').className = '';
// }, 4000);
});
});
}
getAllEvidence
()
{
//alert('getAllEvidence');
const
id
=
+
this
.
route
.
snapshot
.
paramMap
.
get
(
'
id
'
);
//this.documentService.getAllEvidence(this.document.documentId)
this
.
documentService
.
getAllEvidence
(
id
)
.
subscribe
(
text
=>
{
this
.
docData
=
text
;
//console.log(this.docData);
// console.log(JSON.parse(this.docData));
document
.
getElementById
(
'
data2
'
).
className
=
'
collapse show
'
;
document
.
getElementById
(
'
data1
'
).
innerHTML
=
''
;
document
.
getElementById
(
'
data1
'
).
className
=
''
;
//document.getElementById('loadingDiv').className = 'loader';
var
j
=
JSON
.
parse
(
this
.
docData
);
//this.loadBratVisualizer();
head
.
ready
(
function
()
{
const
dispatcher
=
Util
.
embed
(
'
data1
'
,
DocumentDetailComponent
.
collData
,
j
,
DocumentDetailComponent
.
webFontURLs
);
//dispatcher.on('displaySpanComment', displaySpanComment);
//dispatcher.on('hideComment', hideComment);
// setTimeout(() => {
// document.getElementById('loadingDiv').className = '';
// }, 4000);
});
});
}
getSentencesEvidence
()
{
//alert('getSentencesEvidence');
const
id
=
+
this
.
route
.
snapshot
.
paramMap
.
get
(
'
id
'
);
//this.documentService.getAllEvidence(this.document.documentId)
this
.
documentService
.
getSentencesEvidence
(
id
)
.
subscribe
(
text
=>
{
this
.
docData
=
text
;
//console.log(this.docData);
// console.log(JSON.parse(this.docData));
document
.
getElementById
(
'
data2
'
).
className
=
'
collapse show
'
;
document
.
getElementById
(
'
data1
'
).
innerHTML
=
''
;
document
.
getElementById
(
'
data1
'
).
className
=
''
;
document
.
getElementById
(
'
loadingDiv
'
).
className
=
'
loader
'
;
var
j
=
JSON
.
parse
(
this
.
docData
);
this
.
loadBratVisualizer
();
head
.
ready
(
function
()
{
const
dispatcher
=
Util
.
embed
(
'
data1
'
,
DocumentDetailComponent
.
collData
,
j
,
DocumentDetailComponent
.
webFontURLs
);
dispatcher
.
on
(
'
displaySpanComment
'
,
displaySpanComment
);
dispatcher
.
on
(
'
hideComment
'
,
hideComment
);
document
.
getElementById
(
'
data2
'
).
className
=
'
FixedHeightContainer
'
;
document
.
getElementById
(
'
data1
'
).
className
=
'
brat_div
'
;
setTimeout
(()
=>
{
document
.
getElementById
(
'
loadingDiv
'
).
className
=
''
;
},
4000
);
});
});
}
setExportSRDomain
(
data
)
{
const
id
=
+
this
.
route
.
snapshot
.
paramMap
.
get
(
'
id
'
);
//alert(data);
...
...
@@ -390,6 +547,15 @@ export class DocumentDetailComponent implements OnInit {
//alert(text);
});
}
setSRFindingValidation
(
data
)
{
const
id
=
+
this
.
route
.
snapshot
.
paramMap
.
get
(
'
id
'
);
//alert(data.status);
this
.
documentService
.
setSRFindingValidation
(
id
,
data
.
srDomainId
,
data
.
status
)
.
subscribe
(
text
=>
{
//alert(text);
});
}
setNextStatus
(
status
){
if
(
status
==
'
DRAFT
'
){
...
...
@@ -422,48 +588,48 @@ export class DocumentDetailComponent implements OnInit {
exportDocument
()
{
const
id
=
+
this
.
route
.
snapshot
.
paramMap
.
get
(
'
id
'
);
this
.
documentService
.
exportDocument
(
id
);
this
.
documentService
.
exportDocument
(
id
,
this
.
document
.
name
);
}
getAllEvidence
()
{
const
id
=
+
this
.
route
.
snapshot
.
paramMap
.
get
(
'
id
'
);
this
.
documentService
.
getAllEvidence
(
this
.
document
.
documentId
)
.
subscribe
(
text
=>
{
this
.
docData
=
text
;
console
.
log
(
this
.
docData
);
// console.log(JSON.parse(this.docData));
document
.
getElementById
(
'
data2
'
).
className
=
'
collapse show
'
;
document
.
getElementById
(
'
data1
'
).
innerHTML
=
''
;
document
.
getElementById
(
'
data1
'
).
className
=
''
;
var
j
=
JSON
.
parse
(
this
.
docData
);
head
.
ready
(
function
()
{
const
dispatcher
=
Util
.
embed
(
'
data1
'
,
DocumentDetailComponent
.
collData
,
j
,
DocumentDetailComponent
.
webFontURLs
);
dispatcher
.
on
(
'
displaySpanComment
'
,
displaySpanComment
);
dispatcher
.
on
(
'
hideComment
'
,
hideComment
);
});
});
}
onActivate
(
componentReference
)
{
console
.
log
(
componentReference
)
componentReference
.
activation
(
this
.
document
);
// if(componentReference.constructor.name=='PretoxsentencesTabulatorComponent'){
// this.getSentencesEvidence();
// }else if(componentReference.constructor.name=='SrdomaintemplateTabulatorComponent'){
// this.getAllEvidence();
// }else if(componentReference.constructor.name=='FindingTabulatorComponent'){
// this.getAllEvidence();
// }
//Below will subscribe to the searchItem emitter
if
(
componentReference
.
rowClickEventFinding
!=
undefined
){
componentReference
.
rowClickEventFinding
.
subscribe
((
data
)
=>
{
//alert('rowClickEventFinding');
this
.
rowClickFindingEvidence
(
data
);
})
}
}
//Below will subscribe to the searchItem emitter
if
(
componentReference
.
rowClickEvent
!=
undefined
){
//alert('sentence activation');
this
.
getSentencesEvidence
();
componentReference
.
rowClickEvent
.
subscribe
((
data
)
=>
{
//alert('rowClickEvent');
this
.
rowClickSentenceEvidence
(
data
);
})
}
//Below will subscribe to the searchItem emitter
if
(
componentReference
.
rowClickSRFindingValidationEvent
!=
undefined
){
componentReference
.
rowClickSRFindingValidationEvent
.
subscribe
((
data
)
=>
{
//alert('rowClickFindingValidationEvent');
this
.
setSRFindingValidation
(
data
);
})
}
//Below will subscribe to the searchItem emitter
if
(
componentReference
.
rowClickFindingValidationEvent
!=
undefined
){
...
...
@@ -473,8 +639,14 @@ export class DocumentDetailComponent implements OnInit {
})
}
if
(
componentReference
.
srFindingType
!=
undefined
){
this
.
getAllEvidence
();
}
//Below will subscribe to the searchItem emitter
if
(
componentReference
.
rowClickEventSRDomainTemplateEvidence
!=
undefined
){
//alert('sr-domain activation');
//this.getAllEvidence();
componentReference
.
rowClickEventSRDomainTemplateEvidence
.
subscribe
((
data
)
=>
{
//alert('rowClickSRDomainTemplateEvidence');
this
.
rowClickSRDomainTemplateEvidence
(
data
);
...
...
src/app/document-detail/loader.gif
0 → 100644
View file @
231e8b6e
8.03 KB
src/app/document.service.ts
View file @
231e8b6e
...
...
@@ -48,15 +48,17 @@ export class DocumentService {
}
/** GET document by id. Will 404 if id not found */
exportDocument
(
id
:
number
):
any
{
exportDocument
(
id
:
number
,
name
:
string
):
any
{
const
url
=
`
${
this
.
documentsUrl
}
export/
${
id
}
`
;
return
this
.
http
.
get
(
url
,
{
responseType
:
'
blob
'
,
observe
:
'
response
'
})
.
pipe
(
map
(
res
=>
{
console
.
log
(
res
.
headers
.
get
(
'
content-disposition
'
));
return
{
filename
:
id
+
'
.txt
'
,
data
:
res
filename
:
name
+
'
.csv
'
,
data
:
res
.
body
};
}))
.
subscribe
(
res
=>
{
...
...
@@ -82,6 +84,15 @@ export class DocumentService {
);
}
/** set validation of finding */
setSRFindingValidation
(
id
:
number
,
srfindingId
:
number
,
finding_validation
:
string
):
Observable
<
string
>
{
const
url
=
`
${
this
.
documentsUrl
}${
id
}
/srFindingValidation/
${
srfindingId
}
/
${
finding_validation
}
`
;
return
this
.
http
.
get
(
url
,
{
responseType
:
'
text
'
}).
pipe
(
tap
(
_
=>
this
.
log
(
`finding_validation id=
${
srfindingId
}
`
)),
catchError
(
this
.
handleError
<
string
>
(
`finding_validation id=
${
srfindingId
}
`
))
);
}
/** set export finding */
setExportSRDomain
(
id
:
number
,
findingId
:
number
,
export_finding
:
string
):
Observable
<
string
>
{
const
url
=
`
${
this
.
documentsUrl
}${
id
}
/setExportSRDomain/
${
findingId
}
/
${
export_finding
}
`
;
...
...
@@ -117,6 +128,17 @@ export class DocumentService {
catchError
(
this
.
handleError
<
string
>
(
`getFinding id=
${
finding
.
findingId
}
`
))
);
}
/** GET Snipped of the full text with no annotations */
findDocumentText
(
id
:
number
):
Observable
<
string
>
{
const
url
=
`
${
this
.
documentsUrl
}${
id
}
/text/`
;
return
this
.
http
.
get
(
url
,
{
responseType
:
'
text
'
}).
pipe
(
tap
(
_
=>
this
.
log
(
`fetched text id=
${
id
}
`
)),
catchError
(
this
.
handleError
<
string
>
(
`getText id=
${
id
}
`
))
);
}
/** GET Snipped of findings selected just in case is needed, is not complete only the calls againt rest api is done*/
findingsSelected
(
id
:
number
,
finding
:
Finding
):
Observable
<
string
>
{
...
...
@@ -130,13 +152,30 @@ export class DocumentService {
/** GET Snipped of all finding evidence */
getAllEvidence
(
id
:
number
):
Observable
<
string
>
{
const
url
=
`
${
this
.
documentsUrl
}${
id
}
/evidence/
all
`
;
const
url
=
`
${
this
.
documentsUrl
}${
id
}
/evidence/
findings
`
;
return
this
.
http
.
get
(
url
,
{
responseType
:
'
text
'
}).
pipe
(
tap
(
_
=>
this
.
log
(
`fetched all evidence id=
${
id
}
`
)),
catchError
(
this
.
handleError
<
string
>
(
`getFindings id=
${
id
}
`
))
);
}
/** GET Snipped of all finding evidence */