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
b2b13333
Commit
b2b13333
authored
Jul 31, 2015
by
R.W.Majeed
Browse files
Import module for any table based format
parent
70b98829
Changes
27
Hide whitespace changes
Inline
Side-by-side
histream-import/.gitignore
0 → 100644
View file @
b2b13333
.settings/
.classpath
.project
target/
histream-import/pom.xml
0 → 100644
View file @
b2b13333
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<name>
HIStream : Import
</name>
<groupId>
de.sekmi.histream
</groupId>
<artifactId>
histream-import
</artifactId>
<version>
0.2-alpha
</version>
<parent>
<groupId>
de.sekmi.histream
</groupId>
<artifactId>
histream
</artifactId>
<version>
0.2-alpha
</version>
</parent>
<build>
<plugins>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>
de.sekmi.histream
</groupId>
<artifactId>
histream-core
</artifactId>
<version>
0.2-alpha
</version>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
histream-import/src/main/java/de/sekmi/histream/etl/ETLObservationSupplier.java
0 → 100644
View file @
b2b13333
package
de.sekmi.histream.etl
;
import
de.sekmi.histream.Observation
;
import
de.sekmi.histream.ObservationSupplier
;
public
class
ETLObservationSupplier
implements
ObservationSupplier
{
@Override
public
Observation
get
()
{
// TODO Auto-generated method stub
return
null
;
}
@Override
public
void
close
()
throws
Exception
{
// TODO Auto-generated method stub
}
@Override
public
String
getMeta
(
String
arg0
)
{
// TODO Auto-generated method stub
return
null
;
}
}
histream-import/src/main/java/de/sekmi/histream/etl/config/Column.java
0 → 100644
View file @
b2b13333
package
de.sekmi.histream.etl.config
;
import
javax.xml.bind.annotation.XmlAttribute
;
import
javax.xml.bind.annotation.XmlValue
;
public
class
Column
{
private
Column
(){
}
public
Column
(
String
name
){
this
();
this
.
name
=
name
;
}
@XmlAttribute
String
na
;
@XmlAttribute
(
name
=
"constant-value"
)
String
constantValue
;
@XmlValue
String
name
;
}
histream-import/src/main/java/de/sekmi/histream/etl/config/Concept.java
0 → 100644
View file @
b2b13333
package
de.sekmi.histream.etl.config
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlAttribute
;
import
javax.xml.bind.annotation.XmlElement
;
/**
* Concept from a wide table
* @author Raphael
*
*/
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
class
Concept
{
@XmlAttribute
(
required
=
true
)
String
id
;
// TODO: value should contain also type (string,decimal,integer,...)
Column
value
;
Column
unit
;
@XmlElement
(
required
=
true
)
Column
start
;
Column
end
;
@XmlElement
(
name
=
"modifier"
)
Modifier
[]
modifiers
;
// ...
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
static
class
Modifier
{
@XmlAttribute
(
required
=
true
)
String
id
;
// TODO: value with type
Column
value
;
Column
unit
;
private
Modifier
(){
}
public
Modifier
(
String
id
){
this
();
this
.
id
=
id
;
}
}
private
Concept
(){
}
public
Concept
(
String
id
,
String
startColumn
){
this
();
this
.
id
=
id
;
this
.
start
=
new
Column
(
startColumn
);
}
}
\ No newline at end of file
histream-import/src/main/java/de/sekmi/histream/etl/config/DataSource.java
0 → 100644
View file @
b2b13333
package
de.sekmi.histream.etl.config
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlElement
;
import
javax.xml.bind.annotation.XmlElementWrapper
;
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
class
DataSource
{
@XmlElement
Meta
meta
;
@XmlElementWrapper
(
name
=
"transformation"
)
@XmlElement
(
name
=
"xml-source"
)
XmlSource
[]
xmlSources
;
@XmlElement
(
name
=
"patient-table"
,
required
=
true
)
PatientTable
patientTable
;
@XmlElement
(
name
=
"visit-table"
)
VisitTable
visitTable
;
@XmlElement
(
name
=
"wide-table"
)
WideTable
[]
wideTables
;
}
histream-import/src/main/java/de/sekmi/histream/etl/config/DataTableIdat.java
0 → 100644
View file @
b2b13333
package
de.sekmi.histream.etl.config
;
import
javax.xml.bind.annotation.XmlElement
;
public
class
DataTableIdat
extends
IdatColumns
{
@XmlElement
(
name
=
"visit-id"
)
Column
visitId
;
}
histream-import/src/main/java/de/sekmi/histream/etl/config/FileSource.java
0 → 100644
View file @
b2b13333
package
de.sekmi.histream.etl.config
;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.util.stream.Stream
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlElement
;
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
class
FileSource
extends
TableSource
{
@XmlElement
URL
url
;
@XmlElement
String
type
;
private
FileSource
(){
}
public
FileSource
(
String
url
,
String
type
)
throws
MalformedURLException
{
this
();
this
.
url
=
new
URL
(
url
);
this
.
type
=
type
;
}
@Override
public
String
[]
getHeaders
()
{
// TODO Auto-generated method stub
return
null
;
}
@Override
public
Stream
<
String
[]>
rows
()
{
return
null
;
}
}
histream-import/src/main/java/de/sekmi/histream/etl/config/IdatColumns.java
0 → 100644
View file @
b2b13333
package
de.sekmi.histream.etl.config
;
import
javax.xml.bind.annotation.XmlElement
;
public
class
IdatColumns
{
@XmlElement
(
name
=
"patient-id"
)
Column
patientId
;
}
histream-import/src/main/java/de/sekmi/histream/etl/config/Meta.java
0 → 100644
View file @
b2b13333
package
de.sekmi.histream.etl.config
;
import
javax.xml.bind.annotation.XmlElement
;
public
class
Meta
{
@XmlElement
(
name
=
"source-id"
)
String
sourceId
;
@XmlElement
(
name
=
"etl-strategy"
)
String
etlStrategy
;
}
histream-import/src/main/java/de/sekmi/histream/etl/config/PatientTable.java
0 → 100644
View file @
b2b13333
package
de.sekmi.histream.etl.config
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlElement
;
import
javax.xml.bind.annotation.XmlElementWrapper
;
/**
* Patient table. Contains patient id and other identifying information.
* Can also contain medical data
* @author marap1
*
*/
public
class
PatientTable
extends
Table
implements
WideInterface
{
@XmlElement
IDAT
idat
;
@XmlElementWrapper
(
name
=
"mdat"
)
@XmlElement
(
name
=
"concept"
)
Concept
[]
concepts
;
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
static
class
IDAT
extends
IdatColumns
{
Column
firstname
;
Column
lastname
;
Column
birthdate
;
Column
deathdate
;
Column
gender
;
Column
[]
ignore
;
}
}
histream-import/src/main/java/de/sekmi/histream/etl/config/SQLSource.java
0 → 100644
View file @
b2b13333
package
de.sekmi.histream.etl.config
;
import
java.util.stream.Stream
;
import
javax.xml.bind.annotation.XmlElement
;
public
class
SQLSource
extends
TableSource
{
@XmlElement
String
jdbcDriver
;
@XmlElement
String
connectString
;
@XmlElement
String
sql
;
private
SQLSource
()
{
}
public
SQLSource
(
String
driver
,
String
connectString
){
this
();
this
.
jdbcDriver
=
driver
;
this
.
connectString
=
connectString
;
}
@Override
public
String
[]
getHeaders
()
{
// TODO Auto-generated method stub
return
null
;
}
@Override
public
Stream
<
String
[]>
rows
()
{
// TODO Auto-generated method stub
return
null
;
}
}
histream-import/src/main/java/de/sekmi/histream/etl/config/Table.java
0 → 100644
View file @
b2b13333
package
de.sekmi.histream.etl.config
;
import
javax.xml.bind.annotation.XmlElement
;
import
javax.xml.bind.annotation.XmlTransient
;
@XmlTransient
public
class
Table
{
@XmlElement
(
required
=
true
)
TableSource
source
;
}
histream-import/src/main/java/de/sekmi/histream/etl/config/TableSource.java
0 → 100644
View file @
b2b13333
package
de.sekmi.histream.etl.config
;
import
java.util.stream.Stream
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlSeeAlso
;
import
javax.xml.bind.annotation.XmlTransient
;
@XmlTransient
@XmlAccessorType
(
XmlAccessType
.
NONE
)
@XmlSeeAlso
({
FileSource
.
class
,
SQLSource
.
class
})
public
abstract
class
TableSource
{
public
abstract
String
[]
getHeaders
();
public
abstract
Stream
<
String
[]>
rows
();
}
\ No newline at end of file
histream-import/src/main/java/de/sekmi/histream/etl/config/VisitTable.java
0 → 100644
View file @
b2b13333
package
de.sekmi.histream.etl.config
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlElement
;
import
javax.xml.bind.annotation.XmlElementWrapper
;
import
javax.xml.bind.annotation.XmlType
;
public
class
VisitTable
extends
Table
implements
WideInterface
{
@XmlElement
IDAT
idat
;
@XmlElementWrapper
(
name
=
"mdat"
)
@XmlElement
(
name
=
"concept"
)
Concept
[]
concepts
;
@XmlType
(
name
=
"patient-idat"
)
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
static
class
IDAT
extends
IdatColumns
{
@XmlElement
(
name
=
"visit-id"
)
Column
visitId
;
Column
start
;
Column
end
;
// TODO inpatient/outpatient state
Column
[]
ignore
;
}
}
histream-import/src/main/java/de/sekmi/histream/etl/config/WideInterface.java
0 → 100644
View file @
b2b13333
package
de.sekmi.histream.etl.config
;
public
interface
WideInterface
{
}
histream-import/src/main/java/de/sekmi/histream/etl/config/WideTable.java
0 → 100644
View file @
b2b13333
package
de.sekmi.histream.etl.config
;
import
javax.xml.bind.annotation.XmlElement
;
import
javax.xml.bind.annotation.XmlElementWrapper
;
public
class
WideTable
extends
Table
{
@XmlElement
DataTableIdat
idat
;
@XmlElementWrapper
(
name
=
"mdat"
)
@XmlElement
(
name
=
"concept"
)
Concept
[]
concepts
;
}
histream-import/src/main/java/de/sekmi/histream/etl/config/XmlSource.java
0 → 100644
View file @
b2b13333
package
de.sekmi.histream.etl.config
;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlAttribute
;
import
javax.xml.bind.annotation.XmlElement
;
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
class
XmlSource
{
@XmlAttribute
URL
url
;
@XmlElement
Transform
[]
transform
;
public
static
class
Transform
{
@XmlAttribute
URL
with
;
@XmlAttribute
String
to
;
// TODO use Path internally
public
Transform
(){
}
public
Transform
(
String
with
,
String
to
)
throws
MalformedURLException
{
this
.
with
=
new
URL
(
with
);
this
.
to
=
to
;
}
}
}
histream-import/src/main/java/de/sekmi/histream/etl/config/package-info.java
0 → 100644
View file @
b2b13333
/**
*
*/
/**
* @author marap1
*
*/
package
de.sekmi.histream.etl.config
;
\ No newline at end of file
histream-import/src/main/java/de/sekmi/histream/etl/package-info.java
0 → 100644
View file @
b2b13333
/**
*
*/
/**
* @author marap1
*
*/
package
de.sekmi.histream.etl
;
\ No newline at end of file
Prev
1
2
Next
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