Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
histream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Raphael
histream
Commits
be90af66
Commit
be90af66
authored
Jan 23, 2017
by
R.W.Majeed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#feature modifier support
#feature unit support for string values
parent
81e8afb1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
24 deletions
+57
-24
histream-core/src/main/java/de/sekmi/histream/impl/StringValue.java
...ore/src/main/java/de/sekmi/histream/impl/StringValue.java
+4
-0
histream-import/src/main/java/de/sekmi/histream/etl/config/Concept.java
...t/src/main/java/de/sekmi/histream/etl/config/Concept.java
+52
-23
histream-import/src/test/resources/data/test-1-datasource.xml
...ream-import/src/test/resources/data/test-1-datasource.xml
+1
-1
No files found.
histream-core/src/main/java/de/sekmi/histream/impl/StringValue.java
View file @
be90af66
...
...
@@ -42,6 +42,10 @@ public class StringValue extends AbstractValue{
public
StringValue
(
String
value
){
this
.
value
=
value
;
}
public
StringValue
(
String
value
,
String
unit
){
this
.
value
=
value
;
this
.
units
=
unit
;
}
@Override
public
boolean
equals
(
Object
other
){
...
...
histream-import/src/main/java/de/sekmi/histream/etl/config/Concept.java
View file @
be90af66
...
...
@@ -10,6 +10,7 @@ import javax.xml.bind.annotation.XmlElement;
import
de.sekmi.histream.DateTimeAccuracy
;
import
de.sekmi.histream.Observation
;
import
de.sekmi.histream.ObservationFactory
;
import
de.sekmi.histream.Value
;
import
de.sekmi.histream.etl.ColumnMap
;
import
de.sekmi.histream.etl.MapFeedback
;
import
de.sekmi.histream.etl.ParseException
;
...
...
@@ -58,7 +59,24 @@ public class Concept{
this
.
id
=
id
;
this
.
start
=
new
DateTimeColumn
(
startColumn
,
format
);
}
private
Value
createObservationValue
(
Object
val
,
String
unit
)
throws
ParseException
{
if
(
val
==
null
){
// no value
return
null
;
}
else
if
(
val
instanceof
String
){
// string
return
new
StringValue
((
String
)
val
,
unit
);
}
else
if
(
val
instanceof
BigDecimal
){
// numeric
return
new
NumericValue
((
BigDecimal
)
val
,
unit
);
}
else
if
(
val
instanceof
Long
){
// numeric
return
new
NumericValue
((
Long
)
val
,
unit
);
}
else
{
throw
new
ParseException
(
"Unsupported value type for concept id "
+
this
.
id
+
": "
+
val
.
getClass
());
}
}
/**
* Create an observation for this concept with the given row data.
* TODO allow mapping actions to happen at this place, e.g. drop concept, log warning, change value
...
...
@@ -90,6 +108,7 @@ public class Concept{
if
(
this
.
value
!=
null
){
// Objects.requireNonNull(this.value, "No value for concept: "+id);
val
=
this
.
value
.
valueOf
(
map
,
row
,
mf
);
mf
.
resetValue
();
}
if
(
mf
.
hasConceptOverride
()
){
...
...
@@ -106,32 +125,42 @@ public class Concept{
}
Observation
o
=
factory
.
createObservation
(
patid
,
concept
,
start
);
if
(
visit
!=
null
){
o
.
setEncounterId
(
visit
);
}
o
.
setValue
(
createObservationValue
(
val
,
unit
));
if
(
val
==
null
){
// no value
o
.
setValue
(
null
);
}
else
if
(
val
instanceof
String
){
// string
o
.
setValue
(
new
StringValue
((
String
)
val
));
// TODO: set unit
}
else
if
(
val
instanceof
BigDecimal
){
// numeric
NumericValue
v
=
new
NumericValue
((
BigDecimal
)
val
,
unit
);
o
.
setValue
(
v
);
}
else
if
(
val
instanceof
Long
){
// numeric
NumericValue
v
=
new
NumericValue
((
Long
)
val
,
unit
);
o
.
setValue
(
v
);
}
else
{
throw
new
ParseException
(
"Unsupported value type for concept id "
+
this
.
id
+
": "
+
val
.
getClass
());
// load modifiers
if
(
modifiers
!=
null
){
for
(
int
i
=
0
;
i
<
modifiers
.
length
;
i
++
){
mf
=
new
MapFeedback
();
Modifier
m
=
modifiers
[
i
];
// parse value
val
=
null
;
if
(
m
.
value
!=
null
){
val
=
m
.
value
.
valueOf
(
map
,
row
,
mf
);
mf
.
resetValue
();
}
// parse unit
unit
=
null
;
if
(
m
.
unit
!=
null
){
unit
=
m
.
unit
.
valueOf
(
map
,
row
,
mf
);
mf
.
resetValue
();
}
concept
=
m
.
id
;
// modifier values can override the modifier-ids via concept override
if
(
mf
.
hasConceptOverride
()
){
concept
=
mf
.
getConceptOverride
();
}
// or drop the modifier
if
(
mf
.
isActionDrop
()
){
continue
;
// ignore this modifier
}
o
.
addModifier
(
concept
,
createObservationValue
(
val
,
unit
));
}
}
if
(
visit
!=
null
){
o
.
setEncounterId
(
visit
);
}
// TODO: modifiers
return
o
;
}
}
\ No newline at end of file
histream-import/src/test/resources/data/test-1-datasource.xml
View file @
be90af66
...
...
@@ -68,7 +68,7 @@
<start
column=
"zeitpunkt"
format=
"d.M.u[ H[:m[:s]]]"
na=
""
/>
<unit
constant-value=
"mmol/L"
/>
<modifier
id=
"other"
>
<value
xsi:type=
"string"
na=
""
constant-value=
""
/>
<value
column=
"en"
xsi:type=
"string"
na=
"2"
na-action=
"drop-fact"
/>
</modifier>
</concept>
<concept
id=
"kalium"
>
...
...
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