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; package de.sekmi.histream.etl;
import java.util.List;
import de.sekmi.histream.Observation;
import de.sekmi.histream.ext.Patient; import de.sekmi.histream.ext.Patient;
import de.sekmi.histream.impl.PatientImpl; import de.sekmi.histream.impl.PatientImpl;
...@@ -9,7 +12,7 @@ import de.sekmi.histream.impl.PatientImpl; ...@@ -9,7 +12,7 @@ import de.sekmi.histream.impl.PatientImpl;
* @author Raphael * @author Raphael
* *
*/ */
public class PatientRow extends PatientImpl{ public class PatientRow extends PatientImpl implements FactRow{
String firstname; String firstname;
String lastname; String lastname;
// TODO concepts // TODO concepts
...@@ -19,4 +22,24 @@ public class PatientRow extends PatientImpl{ ...@@ -19,4 +22,24 @@ public class PatientRow extends PatientImpl{
this.firstname = first; this.firstname = first;
this.lastname = last; 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; ...@@ -6,7 +6,7 @@ import java.util.function.Supplier;
import de.sekmi.histream.ObservationFactory; import de.sekmi.histream.ObservationFactory;
import de.sekmi.histream.etl.config.Table; 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 RowSupplier rows;
private Table<R> table; private Table<R> table;
private ColumnMap map; private ColumnMap map;
......
package de.sekmi.histream.etl; package de.sekmi.histream.etl;
import java.util.List;
import de.sekmi.histream.Observation;
import de.sekmi.histream.impl.VisitImpl; 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; ...@@ -5,7 +5,7 @@ import java.util.List;
import de.sekmi.histream.Observation; import de.sekmi.histream.Observation;
public class WideRow { public class WideRow implements FactRow{
private String patid; private String patid;
private String visit; private String visit;
private List<Observation> facts; private List<Observation> facts;
...@@ -19,9 +19,12 @@ public class WideRow { ...@@ -19,9 +19,12 @@ public class WideRow {
public void addFact(Observation o){ public void addFact(Observation o){
this.facts.add(o); this.facts.add(o);
} }
@Override
public List<Observation> getFacts(){ public List<Observation> getFacts(){
return facts; return facts;
} }
@Override
public String getPatientId(){return patid;} public String getPatientId(){return patid;}
@Override
public String getVisitId(){return visit;} public String getVisitId(){return visit;}
} }
package de.sekmi.histream.etl.config; 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.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
...@@ -11,6 +14,7 @@ import javax.xml.bind.annotation.XmlSeeAlso; ...@@ -11,6 +14,7 @@ import javax.xml.bind.annotation.XmlSeeAlso;
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
@XmlSeeAlso({Column.class, StringColumn.class}) @XmlSeeAlso({Column.class, StringColumn.class})
public class DataSource { public class DataSource {
@XmlElement @XmlElement
Meta meta; Meta meta;
...@@ -28,5 +32,16 @@ public class DataSource { ...@@ -28,5 +32,16 @@ public class DataSource {
WideTable[] wideTables; 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; ...@@ -8,6 +8,7 @@ import javax.xml.bind.annotation.XmlElementWrapper;
import de.sekmi.histream.ObservationFactory; import de.sekmi.histream.ObservationFactory;
import de.sekmi.histream.etl.ColumnMap; import de.sekmi.histream.etl.ColumnMap;
import de.sekmi.histream.etl.ConceptTable;
import de.sekmi.histream.etl.ParseException; import de.sekmi.histream.etl.ParseException;
import de.sekmi.histream.etl.PatientRow; import de.sekmi.histream.etl.PatientRow;
...@@ -17,7 +18,7 @@ import de.sekmi.histream.etl.PatientRow; ...@@ -17,7 +18,7 @@ import de.sekmi.histream.etl.PatientRow;
* @author marap1 * @author marap1
* *
*/ */
public class PatientTable extends Table<PatientRow> implements WideInterface{ public class PatientTable extends Table<PatientRow> implements ConceptTable{
@XmlElement @XmlElement
IDAT idat; IDAT idat;
...@@ -61,4 +62,10 @@ public class PatientTable extends Table<PatientRow> implements WideInterface{ ...@@ -61,4 +62,10 @@ public class PatientTable extends Table<PatientRow> implements WideInterface{
return patient; return patient;
} }
@Override
public Concept[] getConcepts() {
return concepts;
}
} }
...@@ -7,11 +7,12 @@ import javax.xml.bind.annotation.XmlTransient; ...@@ -7,11 +7,12 @@ import javax.xml.bind.annotation.XmlTransient;
import de.sekmi.histream.ObservationFactory; import de.sekmi.histream.ObservationFactory;
import de.sekmi.histream.etl.ColumnMap; import de.sekmi.histream.etl.ColumnMap;
import de.sekmi.histream.etl.FactRow;
import de.sekmi.histream.etl.ParseException; import de.sekmi.histream.etl.ParseException;
import de.sekmi.histream.etl.RecordSupplier; import de.sekmi.histream.etl.RecordSupplier;
@XmlTransient @XmlTransient
public abstract class Table<T> { public abstract class Table<T extends FactRow> {
@XmlElement(required=true) @XmlElement(required=true)
TableSource source; TableSource source;
......
...@@ -8,10 +8,11 @@ import javax.xml.bind.annotation.XmlType; ...@@ -8,10 +8,11 @@ import javax.xml.bind.annotation.XmlType;
import de.sekmi.histream.ObservationFactory; import de.sekmi.histream.ObservationFactory;
import de.sekmi.histream.etl.ColumnMap; import de.sekmi.histream.etl.ColumnMap;
import de.sekmi.histream.etl.ConceptTable;
import de.sekmi.histream.etl.ParseException; import de.sekmi.histream.etl.ParseException;
import de.sekmi.histream.etl.VisitRow; import de.sekmi.histream.etl.VisitRow;
public class VisitTable extends Table<VisitRow> implements WideInterface{ public class VisitTable extends Table<VisitRow> implements ConceptTable{
@XmlElement @XmlElement
IDAT idat; IDAT idat;
...@@ -54,4 +55,10 @@ public class VisitTable extends Table<VisitRow> implements WideInterface{ ...@@ -54,4 +55,10 @@ public class VisitTable extends Table<VisitRow> implements WideInterface{
// TODO other // TODO other
// TODO concepts // TODO concepts
return visit; 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; ...@@ -6,10 +6,11 @@ import javax.xml.bind.annotation.XmlElementWrapper;
import de.sekmi.histream.Observation; import de.sekmi.histream.Observation;
import de.sekmi.histream.ObservationFactory; import de.sekmi.histream.ObservationFactory;
import de.sekmi.histream.etl.ColumnMap; import de.sekmi.histream.etl.ColumnMap;
import de.sekmi.histream.etl.ConceptTable;
import de.sekmi.histream.etl.ParseException; import de.sekmi.histream.etl.ParseException;
import de.sekmi.histream.etl.WideRow; import de.sekmi.histream.etl.WideRow;
public class WideTable extends Table<WideRow> { public class WideTable extends Table<WideRow> implements ConceptTable{
@XmlElement @XmlElement
DataTableIdat idat; DataTableIdat idat;
...@@ -40,4 +41,9 @@ public class WideTable extends Table<WideRow> { ...@@ -40,4 +41,9 @@ public class WideTable extends Table<WideRow> {
} }
return rec; 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