Commit 0a81fd62 authored by R.W.Majeed's avatar R.W.Majeed

start element now optional for concepts in datasource xml

parent 2145a3b4
......@@ -28,7 +28,6 @@ public class Concept{
// TODO: value should contain also type (string,decimal,integer,...)
Column<?> value;
StringColumn unit;
@XmlElement(required=true)
DateTimeColumn start;
DateTimeColumn end;
@XmlElement(name="modifier")
......
......@@ -63,4 +63,16 @@ public class DateTimeColumn extends Column<DateTimeAccuracy>{
throw new ParseException("Unable to parse date '"+input+"' in column '"+this.column+"'", e);
}
}
public static final DateTimeColumn alwaysNull(){
DateTimeColumn c = new DateTimeColumn(){
@Override
public DateTimeAccuracy valueFromString(String input){return null;}
@Override
public DateTimeAccuracy valueOf(Object input){return null;}
};
c.constantValue = "";
c.na = "";
return c;
}
}
\ No newline at end of file
......@@ -127,5 +127,18 @@ public class PatientTable extends Table<PatientRow> implements ConceptTable{
public Concept[] getConcepts() {
return concepts;
}
@Override
protected void mapRegisterConcept(ColumnMap map, Concept c) throws ParseException {
if( true ){
throw new ParseException("Patient table concepts not supported yet");
}
if( c.start == null ){
// patient table does not have a default timestamp, facts always need explici timestamps
throw new ParseException("Start timestamp required for patient table concept '"+c.id+"'");
}
super.mapRegisterConcept(map, c);
}
}
......@@ -33,7 +33,9 @@ public abstract class Table<T extends FactRow> {
*/
protected void mapRegisterConcept(ColumnMap map, Concept c) throws ParseException{
if( c.start == null ){
throw new ParseException("Start timestamp undefined for concept '"+c.id+"'");
// concepts without a start column will always have null start dates
// thus, the visit timestamp will be used instead
c.start = DateTimeColumn.alwaysNull();
}
map.registerColumn(c.start);
if( c.end != null ){
......
......@@ -86,14 +86,7 @@
<start column="zeitpunkt" format="d.M.u[ H[:m[:s]]]" na="" />
</concept>
<concept id="bun">
<value column="bun\ /,.]+" na="" xsi:type="string">
<map>
<case value="1" set-value="" set-concept="enum1_1"/>
<case value="2" set-value="" set-concept="enum1_2"/>
<otherwise action="drop-fact" />
</map>
</value>
<start column="zeitpunkt" format="d.M.u[ H[:m[:s]]]" na="" />
<value column="bun\ /,.]+" na="" xsi:type="decimal"/>
</concept>
</mdat>
......
Markdown is supported
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