Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Raphael
histream
Commits
ac86335e
Commit
ac86335e
authored
Aug 25, 2015
by
R.W.Majeed
Browse files
Fill observation from context as methodÃ
parent
5d8301bc
Changes
3
Hide whitespace changes
Inline
Side-by-side
histream-core/src/main/java/de/sekmi/histream/impl/ObservationImpl.java
View file @
ac86335e
...
...
@@ -351,5 +351,36 @@ public class ObservationImpl implements Observation, Cloneable{
this
.
source
=
s
;
}
}
/**
* Fill some information from the provided context
* @param patientId patient context
* @param encounterId visit context
* @param startTime start time context
* @param source source context
*/
public
void
fillFromContext
(
String
patientId
,
String
encounterId
,
DateTimeAccuracy
startTime
,
ExternalSourceType
source
)
{
if
(
this
.
source
==
null
){
setSource
(
source
);
}
else
if
(
source
!=
null
){
if
(
this
.
source
.
getSourceId
()
==
null
&&
source
.
getSourceId
()
!=
null
){
this
.
source
.
setSourceId
(
source
.
getSourceId
());
}
if
(
this
.
source
.
getSourceTimestamp
()
==
null
&&
source
.
getSourceTimestamp
()
!=
null
){
this
.
source
.
setSourceTimestamp
(
source
.
getSourceTimestamp
());
}
}
if
(
this
.
patientId
==
null
){
setPatientId
(
patientId
);
}
if
(
this
.
encounterId
==
null
){
setEncounterId
(
encounterId
);
}
if
(
this
.
startTime
==
null
){
this
.
startTime
=
startTime
;
}
}
}
histream-core/src/main/java/de/sekmi/histream/io/JAXBObservationSupplier.java
View file @
ac86335e
...
...
@@ -215,24 +215,8 @@ public class JAXBObservationSupplier implements ObservationSupplier {
throw
new
XMLStreamException
(
"Fact patid differs from patient id"
,
reader
.
getLocation
());
}
if
(
fact
.
getSource
()
==
null
){
fact
.
setSource
(
meta
.
source
);
}
else
{
if
(
fact
.
getSource
().
getSourceId
()
==
null
&&
meta
.
source
.
getSourceId
()
!=
null
){
fact
.
getSource
().
setSourceId
(
meta
.
source
.
getSourceId
());
}
if
(
fact
.
getSource
().
getSourceTimestamp
()
==
null
&&
meta
.
source
.
getSourceTimestamp
()
!=
null
){
fact
.
getSource
().
setSourceTimestamp
(
meta
.
source
.
getSourceTimestamp
());
}
}
fact
.
fillFromContext
(
patientId
,
encounterId
,
encounterStart
,
meta
.
source
);
fact
.
setPatientId
(
patientId
);
fact
.
setEncounterId
(
encounterId
);
if
(
fact
.
getStartTime
()
==
null
){
fact
.
setStartTime
(
encounterStart
);
fact
.
setEndTime
(
encounterEnd
);
}
// TODO set etc. from visit
// set ObservationFactory, initialize extensions
...
...
histream-core/src/test/java/de/sekmi/histream/impl/ObservationImplJAXBTest.java
View file @
ac86335e
...
...
@@ -190,6 +190,12 @@ public class ObservationImplJAXBTest {
o
.
removeContext
(
null
,
null
,
new
ExternalSourceImpl
(
"source1"
,
Instant
.
parse
(
"2000-01-01T00:00:00Z"
)));
Assert
.
assertNull
(
o
.
getSource
());
}
@Test
public
void
testFillContext
(){
// TODO implement test
}
/*
@Test
public void testModifierListBug() throws JAXBException{
...
...
Write
Preview
Supports
Markdown
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