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-sr-domain-identification
Commits
4c4030ac
Commit
4c4030ac
authored
Dec 18, 2020
by
javi
Browse files
add more data to json
parent
3dd333b9
Pipeline
#16398
passed with stage
in 2 minutes and 20 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/es/bsc/inb/ades/export/json/main/App.java
View file @
4c4030ac
...
...
@@ -8,8 +8,11 @@ import java.nio.file.DirectoryStream;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.text.DateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
...
...
@@ -206,8 +209,8 @@ public class App {
JsonObject
section
=
new
JsonObject
();
section
.
addProperty
(
"name"
,
"document"
);
Set
<
String
>
types
=
Stream
.
of
(
"FINDING"
,
"SEX"
,
"SPECIMEN"
,
"GROUP"
,
"DOSE"
,
"MANIFESTATION_FINDING"
,
"RISK_LEVEL"
,
"NO_TREATMENT_RELATED_TRIGGER"
,
"TREATMENT_RELATED_TRIGGER"
,
"STUDY_DOMAIN"
,
"STUDY_DAY_FINDING"
,
"STUDY_TESTCD"
,
"ROUTE_OF_ADMINISTRATION"
,
"MODE_OF_ACTION"
,
"STATISTICAL_SIGNIFICANCE"
,
"CYPS"
).
collect
(
Collectors
.
toCollection
(
HashSet:
:
new
));
Set
<
String
>
types
=
Stream
.
of
(
"
PRETOX_REL"
,
"
FINDING"
,
"SEX"
,
"SPECIMEN"
,
"GROUP"
,
"DOSE"
,
"MANIFESTATION_FINDING"
,
"RISK_LEVEL"
,
"NO_TREATMENT_RELATED_TRIGGER"
,
"TREATMENT_RELATED_TRIGGER"
,
"STUDY_DOMAIN"
,
"STUDY_DAY_FINDING"
,
"STUDY_TESTCD"
,
"STATISTICAL_SIGNIFICANCE"
).
collect
(
Collectors
.
toCollection
(
HashSet:
:
new
));
JsonObject
entities
=
new
JsonObject
();
AnnotationSet
as
=
doc
.
getAnnotations
(
annotationSet
).
get
(
types
);
for
(
String
type
:
as
.
getAllTypes
())
{
...
...
@@ -289,9 +292,13 @@ public class App {
annotated_document
=
null
;
//document text
DateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy/MM/dd HH:mm:ss"
);
Date
date
=
new
Date
();
JsonObject
text_document
=
new
JsonObject
();
text_document
.
addProperty
(
"id"
,
id_document
);
text_document
.
addProperty
(
"name"
,
name
);
text_document
.
addProperty
(
"fileName"
,
name
);
text_document
.
addProperty
(
"processDate"
,
dateFormat
.
format
(
date
));
text_document
.
addProperty
(
"text"
,
plainText
);
//write to file document text
java
.
io
.
Writer
writer2
=
new
java
.
io
.
BufferedWriter
(
new
java
.
io
.
OutputStreamWriter
(
new
FileOutputStream
(
outputTextFile
,
false
)));
...
...
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