Commit c0520a2e authored by R.W.Majeed's avatar R.W.Majeed
Browse files

Added interfaces for FactTable and FactRow

parent a90b0f1d
package de.sekmi.histream.etl;
import de.sekmi.histream.etl.config.Concept;
public interface ConceptTable {
public Concept[] getConcepts();
}
package de.sekmi.histream.etl;
import java.util.List;
import de.sekmi.histream.Observation;
/**
* Row containing parsed and processed facts from concept table
*
* @author Raphael
*
*/
public interface FactRow {
List<Observation> getFacts();
String getPatientId();
String getVisitId();
}
package de.sekmi.histream.etl;
import java.util.List;
import de.sekmi.histream.Observation;
import de.sekmi.histream.ext.Patient;
import de.sekmi.histream.impl.PatientImpl;
......@@ -9,7 +12,7 @@ import de.sekmi.histream.impl.PatientImpl;
* @author Raphael
*
*/
public class PatientRow extends PatientImpl{
public class PatientRow extends PatientImpl implements FactRow{
String firstname;
String lastname;
// TODO concepts
......@@ -19,4 +22,24 @@ public class PatientRow extends PatientImpl{
this.firstname = first;
this.lastname = last;
}
@Override
public List<Observation> getFacts() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getPatientId() {
return this.getId();
}
@Override
public String getVisitId() {
// no visit id for patient facts
return null;
}
}
......@@ -6,7 +6,7 @@ import java.util.function.Supplier;
import de.sekmi.histream.ObservationFactory;
import de.sekmi.histream.etl.config.Table;
public class RecordSupplier<R> implements Supplier<R>, AutoCloseable{
public class RecordSupplier<R extends FactRow> implements Supplier<R>, AutoCloseable{
private RowSupplier rows;
private Table<R> table;
private ColumnMap map;
......
package de.sekmi.histream.etl;
import java.util.List;
import de.sekmi.histream.Observation;
import de.sekmi.histream.impl.VisitImpl;
public class VisitRow extends VisitImpl{
public class VisitRow extends VisitImpl implements FactRow{
@Override
public List<Observation> getFacts() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getVisitId() {
return this.getId();
}
}
......@@ -5,7 +5,7 @@ import java.util.List;
import de.sekmi.histream.Observation;
public class WideRow {
public class WideRow implements FactRow{
private String patid;
private String visit;
private List<Observation> facts;
......@@ -19,9 +19,12 @@ public class WideRow {
public void addFact(Observation o){
this.facts.add(o);
}
@Override
public List<Observation> getFacts(){
return facts;
}
@Override
public String getPatientId(){return patid;}
@Override
public String getVisitId(){return visit;}
}
package de.sekmi.histream.etl.config;
import java.util.Arrays;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
......@@ -11,6 +14,7 @@ import javax.xml.bind.annotation.XmlSeeAlso;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlSeeAlso({Column.class, StringColumn.class})
public class DataSource {
@XmlElement
Meta meta;
......@@ -28,5 +32,16 @@ public class DataSource {
WideTable[] wideTables;
public PatientTable getPatientTable(){
return patientTable;
}
public VisitTable getVisitTable(){
return visitTable;
}
public List<WideTable> getWideTables(){
return Arrays.asList(wideTables);
}
}
......@@ -8,6 +8,7 @@ import javax.xml.bind.annotation.XmlElementWrapper;
import de.sekmi.histream.ObservationFactory;
import de.sekmi.histream.etl.ColumnMap;
import de.sekmi.histream.etl.ConceptTable;
import de.sekmi.histream.etl.ParseException;
import de.sekmi.histream.etl.PatientRow;
......@@ -17,7 +18,7 @@ import de.sekmi.histream.etl.PatientRow;
* @author marap1
*
*/
public class PatientTable extends Table<PatientRow> implements WideInterface{
public class PatientTable extends Table<PatientRow> implements ConceptTable{
@XmlElement
IDAT idat;
......@@ -61,4 +62,10 @@ public class PatientTable extends Table<PatientRow> implements WideInterface{
return patient;
}
@Override
public Concept[] getConcepts() {
return concepts;
}
}
......@@ -7,11 +7,12 @@ import javax.xml.bind.annotation.XmlTransient;
import de.sekmi.histream.ObservationFactory;
import de.sekmi.histream.etl.ColumnMap;
import de.sekmi.histream.etl.FactRow;
import de.sekmi.histream.etl.ParseException;
import de.sekmi.histream.etl.RecordSupplier;
@XmlTransient
public abstract class Table<T> {
public abstract class Table<T extends FactRow> {
@XmlElement(required=true)
TableSource source;
......
......@@ -8,10 +8,11 @@ import javax.xml.bind.annotation.XmlType;
import de.sekmi.histream.ObservationFactory;
import de.sekmi.histream.etl.ColumnMap;
import de.sekmi.histream.etl.ConceptTable;
import de.sekmi.histream.etl.ParseException;
import de.sekmi.histream.etl.VisitRow;
public class VisitTable extends Table<VisitRow> implements WideInterface{
public class VisitTable extends Table<VisitRow> implements ConceptTable{
@XmlElement
IDAT idat;
......@@ -54,4 +55,10 @@ public class VisitTable extends Table<VisitRow> implements WideInterface{
// TODO other
// TODO concepts
return visit;
}}
}
@Override
public Concept[] getConcepts() {
return concepts;
}
}
package de.sekmi.histream.etl.config;
public interface WideInterface {
}
......@@ -6,10 +6,11 @@ import javax.xml.bind.annotation.XmlElementWrapper;
import de.sekmi.histream.Observation;
import de.sekmi.histream.ObservationFactory;
import de.sekmi.histream.etl.ColumnMap;
import de.sekmi.histream.etl.ConceptTable;
import de.sekmi.histream.etl.ParseException;
import de.sekmi.histream.etl.WideRow;
public class WideTable extends Table<WideRow> {
public class WideTable extends Table<WideRow> implements ConceptTable{
@XmlElement
DataTableIdat idat;
......@@ -40,4 +41,9 @@ public class WideTable extends Table<WideRow> {
}
return rec;
}
@Override
public Concept[] getConcepts() {
return concepts;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment