Commit 661fa2cb authored by Aaron Bray's avatar Aaron Bray
Browse files

Update Validation Data Algorithms

parent 56568143
......@@ -59,10 +59,10 @@ public abstract class ValidationTool
protected StringBuilder html = new StringBuilder();
protected enum DataType { Mean, WaveformMin, WaveformMax, Enum,
protected enum DataType { Min, Max, Mean, WaveformMin, WaveformMax, Enum,
Patient2SystemMean, Patient2SystemMin, Patient2SystemMax,
MeanPerWeight, WaveformMinPerWeight, WaveformMaxPerWeight,
MeanPerIdealWeight, WaveformMinPerIdealWeight, WaveformMaxPerIdealWeight }
MinPerWeight, MaxPerWeight, MeanPerWeight, WaveformMinPerWeight, WaveformMaxPerWeight,
MinPerIdealWeight, MaxPerIdealWeight, MeanPerIdealWeight, WaveformMinPerIdealWeight, WaveformMaxPerIdealWeight }
// Patient2System variables take the value from the patient file and compare it to a system property
// PerWeight calculates the expected value based on the patient weight
......@@ -313,9 +313,13 @@ public abstract class ValidationTool
cellValue = cellValue.substring(0, u);
}
vRow.dType = DataType.valueOf(cellValue);
if(vRow.dType == DataType.MeanPerWeight ||
if(vRow.dType == DataType.MinPerWeight ||
vRow.dType == DataType.MaxPerWeight ||
vRow.dType == DataType.MeanPerWeight ||
vRow.dType == DataType.WaveformMinPerWeight ||
vRow.dType == DataType.WaveformMaxPerWeight ||
vRow.dType == DataType.WaveformMaxPerWeight ||
vRow.dType == DataType.MinPerIdealWeight ||
vRow.dType == DataType.MaxPerIdealWeight ||
vRow.dType == DataType.MeanPerIdealWeight ||
vRow.dType == DataType.WaveformMinPerIdealWeight ||
vRow.dType == DataType.WaveformMaxPerIdealWeight)
......@@ -525,7 +529,9 @@ public abstract class ValidationTool
String cite = "@cite ";
if(vRow.refCites.contains("["))
cite = "";// This is an equation, not a cite
if(vRow.dType==DataType.Mean || vRow.dType == DataType.MeanPerWeight || vRow.dType == DataType.MeanPerIdealWeight ||
if(vRow.dType==DataType.Min || vRow.dType==DataType.Max || vRow.dType==DataType.Mean ||
vRow.dType == DataType.MinPerWeight || vRow.dType == DataType.MaxPerWeight || vRow.dType == DataType.MeanPerWeight ||
vRow.dType == DataType.MinPerIdealWeight ||vRow.dType == DataType.MaxPerIdealWeight ||vRow.dType == DataType.MeanPerIdealWeight ||
vRow.dType==DataType.WaveformMin || vRow.dType == DataType.WaveformMinPerWeight || vRow.dType == DataType.WaveformMinPerIdealWeight ||
vRow.dType==DataType.WaveformMax || vRow.dType == DataType.WaveformMaxPerWeight || vRow.dType == DataType.WaveformMaxPerIdealWeight)
{
......@@ -671,10 +677,15 @@ public abstract class ValidationTool
{
return false;
}
// NOTE (AB) Waveform dTypes are changed to a simple min/max from the local average of all min/max
// Waveform are not great to use for respiratory system
// We changed to a simple min/max from the local average of all min/max
// This is due to sub min/max skewing results (ex. Expiratory Flow)
// We also assume that all waveforms are of a constant amplitude (validation is on all resting waveforms)
// If we do find we need the Waveform utils, we should seriously consider new types for simple min/max
// ____
// / \ __
// / V \ <-- That second smaller waveform lowers the overall average
// / \
// Waveforms also assume a constant amplitude (All validation is on resting waveforms)
// So they are probably ok to use in CV, but not respiratory validation
switch(vRow.dType)
{
case Mean:
......@@ -684,10 +695,15 @@ public abstract class ValidationTool
vRow.engine = "Mean of " + String.format("%."+vRow.doubleFormat, vRow.result); //StringUtils.toString(vRow.mean,3);
break;
}
case WaveformMin:
case Min:
{
vRow.result = DoubleUtils.getMin(vRow.results);
//vRow.result = WaveformUtils.getMin(vRow.results);
vRow.engine = "Minimum of " + String.format("%."+vRow.doubleFormat, vRow.result); //StringUtils.toString(vRow.mean,3);
break;
}
case WaveformMin:
{
vRow.result = WaveformUtils.getMin(vRow.results);
vRow.engine = "Minimum of " + String.format("%."+vRow.doubleFormat, vRow.result); //StringUtils.toString(vRow.mean,3);
break;
}
......@@ -697,10 +713,15 @@ public abstract class ValidationTool
vRow.engine = "Minimum of " + String.format("%."+vRow.doubleFormat, vRow.result); //StringUtils.toString(vRow.mean,3);
break;
}
case WaveformMax:
case Max:
{
vRow.result = DoubleUtils.getMax(vRow.results);
//vRow.result = WaveformUtils.getMax(vRow.results);
vRow.engine = "Maximum of " + String.format("%."+vRow.doubleFormat, vRow.result); //StringUtils.toString(vRow.mean,3);
break;
}
case WaveformMax:
{
vRow.result = WaveformUtils.getMax(vRow.results);
vRow.engine = "Maximum of " + String.format("%."+vRow.doubleFormat, vRow.result); //StringUtils.toString(vRow.mean,3);
break;
}
......@@ -715,6 +736,18 @@ public abstract class ValidationTool
vRow.engine = vRow.resultEnum;
break;
}
case MinPerWeight:
{
vRow.result = DoubleUtils.getMin(vRow.results) / DoubleUtils.getAverage(vRow.weight);
vRow.engine = "Minimum of " + String.format("%."+3+"g", vRow.result); //StringUtils.toString(vRow.mean,3);
break;
}
case MaxPerWeight:
{
vRow.result = DoubleUtils.getMax(vRow.results) / DoubleUtils.getAverage(vRow.weight);
vRow.engine = "Maximum of " + String.format("%."+3+"g", vRow.result); //StringUtils.toString(vRow.mean,3);
break;
}
case MeanPerWeight:
{
List<Double> resultPerWeight = new ArrayList<Double>();
......@@ -728,7 +761,6 @@ public abstract class ValidationTool
}
case WaveformMinPerWeight:
{
/*
List<Double> xMin = new ArrayList<Double>();
List<Double> yMin = new ArrayList<Double>();
List<Double> xMax = new ArrayList<Double>();
......@@ -740,14 +772,11 @@ public abstract class ValidationTool
resultPerWeight.add(yMin.get(i) / xMin.get(i));
}
vRow.result = DoubleUtils.getMin(resultPerWeight);
*/
vRow.result = DoubleUtils.getMin(vRow.results) / DoubleUtils.getAverage(vRow.weight);
vRow.engine = "Minimum of " + String.format("%."+3+"g", vRow.result); //StringUtils.toString(vRow.mean,3);
break;
}
case WaveformMaxPerWeight:
{
/*
List<Double> xMin = new ArrayList<Double>();
List<Double> yMin = new ArrayList<Double>();
List<Double> xMax = new ArrayList<Double>();
......@@ -759,11 +788,15 @@ public abstract class ValidationTool
resultPerWeight.add(yMax.get(i) / xMax.get(i));
}
vRow.result = DoubleUtils.getMax(resultPerWeight);
*/
vRow.result = DoubleUtils.getMax(vRow.results) / DoubleUtils.getAverage(vRow.weight);
vRow.engine = "Maximum of " + String.format("%."+3+"g", vRow.result); //StringUtils.toString(vRow.mean,3);
break;
}
case MinPerIdealWeight:
{
vRow.result = DoubleUtils.getMin(vRow.results) / DoubleUtils.getAverage(vRow.idealWeight);
vRow.engine = "Minimum of " + String.format("%."+3+"g", vRow.result); //StringUtils.toString(vRow.mean,3);
break;
}
case MeanPerIdealWeight:
{
List<Double> resultPerWeight = new ArrayList<Double>();
......@@ -775,9 +808,14 @@ public abstract class ValidationTool
vRow.engine = "Mean of " + String.format("%."+3+"g", vRow.result); //StringUtils.toString(vRow.mean,3);
break;
}
case MaxPerIdealWeight:
{
vRow.result = DoubleUtils.getMax(vRow.results) / DoubleUtils.getAverage(vRow.idealWeight);
vRow.engine = "Maximum of " + String.format("%."+3+"g", vRow.result); //StringUtils.toString(vRow.mean,3);
break;
}
case WaveformMinPerIdealWeight:
{
/*
List<Double> xMin = new ArrayList<Double>();
List<Double> yMin = new ArrayList<Double>();
List<Double> xMax = new ArrayList<Double>();
......@@ -789,14 +827,10 @@ public abstract class ValidationTool
resultPerWeight.add(yMin.get(i) / xMin.get(i));
}
vRow.result = DoubleUtils.getMin(resultPerWeight);
*/
vRow.result = DoubleUtils.getMin(vRow.results) / DoubleUtils.getAverage(vRow.idealWeight);
vRow.engine = "Minimum of " + String.format("%."+3+"g", vRow.result); //StringUtils.toString(vRow.mean,3);
break;
}
case WaveformMaxPerIdealWeight:
{
/*
List<Double> xMin = new ArrayList<Double>();
List<Double> yMin = new ArrayList<Double>();
List<Double> xMax = new ArrayList<Double>();
......@@ -808,9 +842,6 @@ public abstract class ValidationTool
resultPerWeight.add(yMax.get(i) / xMax.get(i));
}
vRow.result = DoubleUtils.getMax(resultPerWeight);
*/
vRow.result = DoubleUtils.getMax(vRow.results) / DoubleUtils.getAverage(vRow.idealWeight);
vRow.engine = "Maximum of " + String.format("%."+3+"g", vRow.result); //StringUtils.toString(vRow.mean,3);
break;
}
default:
......@@ -903,7 +934,7 @@ public abstract class ValidationTool
if(vRow.name.startsWith("Carina-CarbonDioxide"))
Log.info("Here");
if(vRow.dType == DataType.MeanPerIdealWeight||
if(vRow.dType == DataType.MinPerIdealWeight || vRow.dType == DataType.MaxPerIdealWeight || vRow.dType == DataType.MeanPerIdealWeight||
vRow.dType == DataType.WaveformMinPerIdealWeight || vRow.dType == DataType.WaveformMaxPerIdealWeight)
{// Take off the weight unit from the header and unit we got from the spreadsheet
String weightHeader = "PatientIdealBodyWeight("+vRow.weightUnit+")";
......@@ -939,7 +970,7 @@ public abstract class ValidationTool
}
}
if(vRow.dType == DataType.MeanPerWeight ||
if(vRow.dType == DataType.MinPerWeight || vRow.dType == DataType.MaxPerWeight || vRow.dType == DataType.MeanPerWeight ||
vRow.dType == DataType.WaveformMinPerWeight || vRow.dType == DataType.WaveformMaxPerWeight)
{// Take off the weight unit from the header and unit we got from the spreadsheet
String weightHeader = "PatientWeight("+vRow.weightUnit+")";
......
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