Commit eee07bd3 authored by R.W.Majeed's avatar R.W.Majeed

separate exceptions for validation

parent 1622ad9e
package de.sekmi.histream.etl.validation;
import de.sekmi.histream.Observation;
/**
* Validation encountered a duplicate fact. A fact is regarded as duplicate,
* if the concept is not marked repeatable and patient id, visit id,
* start date and visit id are equal.
*
* <p>
* The corresponding observation can be accessed via {@link #getObservation()}
*
* @author R.W.Majeed
*
*/
public class DuplicateConceptException extends ValidationException {
private static final long serialVersionUID = 1L;
public DuplicateConceptException(Observation fact) {
super("Duplicate fact patient="+fact.getPatientId()+", visit="+fact.getEncounterId()+", start="+fact.getStartTime()+", concept="+fact.getConceptId());
setObservation(fact);
}
}
package de.sekmi.histream.etl.validation;
import de.sekmi.histream.Observation;
/**
* Validation encountered a duplicate patient.
* <p>
* The corresponding observation can be accessed via {@link #getObservation()}
*
* @author R.W.Majeed
*
*/
public class DuplicatePatientException extends ValidationException {
/**
*
*/
private static final long serialVersionUID = 1L;
public DuplicatePatientException(String patientId) {
super("Duplicate patient '"+patientId+"'");
public DuplicatePatientException(Observation fact) {
super("Duplicate patient '"+fact.getPatientId()+"'");
setObservation(fact);
}
}
package de.sekmi.histream.etl.validation;
import de.sekmi.histream.Observation;
/**
* Validation encountered a duplicate visit.
* <p>
* The corresponding observation can be accessed via {@link #getObservation()}
*
* @author R.W.Majeed
*
*/
public class DuplicateVisitException extends ValidationException {
private static final long serialVersionUID = 1L;
public DuplicateVisitException(Observation fact) {
super("Duplicate visit '"+fact.getEncounterId()+"' for patient '"+fact.getPatientId());
setObservation(fact);
}
}
......@@ -2,11 +2,7 @@ package de.sekmi.histream.etl.validation;
import de.sekmi.histream.ObservationException;
public class ValidationException extends ObservationException {
/**
*
*/
public abstract class ValidationException extends ObservationException {
private static final long serialVersionUID = 1L;
public ValidationException(String message) {
......
......@@ -43,7 +43,7 @@ public class Validator extends AbstractObservationHandler{
prevPatient = patid; // remember patient to suppress errors for the same patient
if( patients.contains(patid) ){
throw new DuplicatePatientException(patid);
throw new DuplicatePatientException(t);
}else{
patients.add(patid);
}
......@@ -54,7 +54,7 @@ public class Validator extends AbstractObservationHandler{
prevVisit = encid; // remember encounter to suppress errors for the same encounter
if( visits.contains(encid) ){
throw new ValidationException("Duplicate encounter '"+encid+"' for patient '"+patid+"'");
throw new DuplicateVisitException(t);
}else{
visits.add(encid);
}
......@@ -64,7 +64,7 @@ public class Validator extends AbstractObservationHandler{
if( duplicateConceptCheck ){
StartPlusConcept spc = new StartPlusConcept(t);
if( concepts.contains(spc) ){
throw new ValidationException("Duplicate concept: patid="+patid+", visit="+encid+", concept="+t.getConceptId()+", start="+t.getStartTime());
throw new DuplicateConceptException(t);
}else{
concepts.add(spc);
}
......
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