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
ab53c664
Commit
ab53c664
authored
Aug 24, 2015
by
R.W.Majeed
Browse files
Constants for Meta strings
parent
3ef9354e
Changes
4
Hide whitespace changes
Inline
Side-by-side
histream-core/src/main/java/de/sekmi/histream/ObservationSupplier.java
View file @
ab53c664
...
...
@@ -37,35 +37,36 @@ import java.util.function.Supplier;
*
*/
public
interface
ObservationSupplier
extends
Supplier
<
Observation
>,
AutoCloseable
{
/**
* Retrieve meta information for this supply of observations.
* <p>
* Possible keys are source.id, source.timestamp, etl.strategy, order.grouped, order.sorted
* <dl>
* <dt>source.id</dt>
* <dd>ID for the source which provides the observations
*
* <dt>source.timestamp</dt>
* <dd>Timestamp when the source data was extracted/downloaded/queried</dd>
*
* <dt>etl.strategy</dt>
* <dd>Strategy how to handle imported data.
/**
* ID for the source which provides the observations
*/
public
static
final
String
META_SOURCE_ID
=
"source.id"
;
/**
* Timestamp when the source data was extracted/downloaded/queried
*/
public
static
final
String
META_SOURCE_TIMESTAMP
=
"source.timestamp"
;
/**
* Strategy how to handle imported data.
* {@code replace-source} will drop any previous imports
* with the same {@code source.id}, {@code replace-visit} will
* delete any previous data with the same patient+visit combination.
*
</dd>
*
* <dt>order.grouped</dt>
*
<dd>
If set to true, guarantees that all facts belonging to the same
*
/
public
static
final
String
META_ETL_STRATEGY
=
"etl.strategy"
;
/**
* If set to true, guarantees that all facts belonging to the same
* patient+visit combination are provided en bloc.
*
</dd>
*
* <dt>order.sorted</dt>
*
<dd>
If set to true, guarantees that all facts within the same
*
/
public
static
final
String
META_ORDER_GROUPED
=
"order.grouped"
;
/**
* If set to true, guarantees that all facts within the same
* patient+visit combination occur in ascending order of start timestamp.
* </dd>
* </dl>
*/
public
static
final
String
META_ORDER_SORTED
=
"order.sorted"
;
/**
* Retrieve meta information for this supply of observations.
* For possible keys see {@link #META_ETL_STRATEGY} ...
* @param key meta key
* @return value for the meta key
*/
...
...
histream-core/src/main/java/de/sekmi/histream/io/JAXBObservationSupplier.java
View file @
ab53c664
...
...
@@ -93,16 +93,16 @@ public class JAXBObservationSupplier extends AbstractObservationParser implement
if
(
reader
.
getLocalName
().
equals
(
"etl"
)
){
String
etlStrategy
=
reader
.
getAttributeValue
(
null
,
"strategy"
);
// TODO use constants for etl.strategy, etc.
if
(
etlStrategy
!=
null
)
setMeta
(
"etl.strategy"
,
etlStrategy
);
if
(
etlStrategy
!=
null
)
setMeta
(
ObservationSupplier
.
META_ETL_STRATEGY
,
etlStrategy
);
reader
.
nextTag
();
// should be end element
reader
.
nextTag
();
}
if
(
reader
.
getLocalName
().
equals
(
"source"
)
){
String
sourceTimestamp
=
reader
.
getAttributeValue
(
null
,
"timestamp"
);
setMeta
(
"source.timestamp"
,
sourceTimestamp
);
setMeta
(
ObservationSupplier
.
META_SOURCE_TIMESTAMP
,
sourceTimestamp
);
String
sourceId
=
reader
.
getAttributeValue
(
null
,
"id"
);
setMeta
(
"source.id"
,
sourceId
);
setMeta
(
ObservationSupplier
.
META_SOURCE_ID
,
sourceId
);
// will be set automatically by setMeta
//setSourceId(sourceId);
//setSourceTimestamp(parseSourceTimestamp(sourceTimestamp));
...
...
histream-core/src/main/java/de/sekmi/histream/io/XMLObservationParser.java
View file @
ab53c664
...
...
@@ -30,6 +30,7 @@ import de.sekmi.histream.AbnormalFlag;
import
de.sekmi.histream.DateTimeAccuracy
;
import
de.sekmi.histream.Modifier
;
import
de.sekmi.histream.Observation
;
import
de.sekmi.histream.ObservationSupplier
;
import
de.sekmi.histream.Value
;
import
de.sekmi.histream.Value.Type
;
import
de.sekmi.histream.ext.Patient
;
...
...
@@ -204,8 +205,8 @@ class XMLObservationParser extends AbstractObservationParser{
}
protected
void
parseSource
(
AttributeAccessor
atts
){
setMeta
(
"source.timestamp"
,
atts
.
getValue
(
"timestamp"
));
setMeta
(
"source.id"
,
atts
.
getValue
(
"id"
));
setMeta
(
ObservationSupplier
.
META_SOURCE_TIMESTAMP
,
atts
.
getValue
(
"timestamp"
));
setMeta
(
ObservationSupplier
.
META_SOURCE_ID
,
atts
.
getValue
(
"id"
));
}
protected
void
parseEncounter
(
AttributeAccessor
atts
){
encounterStart
=
DateTimeAccuracy
.
parsePartialIso8601
(
atts
.
getValue
(
"start"
));
...
...
histream-core/src/main/java/de/sekmi/histream/io/XMLObservationSupplier.java
View file @
ab53c664
...
...
@@ -81,7 +81,7 @@ public class XMLObservationSupplier extends XMLObservationParser implements Obse
if
(
reader
.
getLocalName
().
equals
(
"etl"
)
){
String
etlStrategy
=
reader
.
getAttributeValue
(
null
,
"strategy"
);
// TODO use constants for etl.strategy, etc.
if
(
etlStrategy
!=
null
)
setMeta
(
"etl.strategy"
,
etlStrategy
);
if
(
etlStrategy
!=
null
)
setMeta
(
ObservationSupplier
.
META_ETL_STRATEGY
,
etlStrategy
);
reader
.
nextTag
();
// should be end element
reader
.
nextTag
();
...
...
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