private boolean vitalStatusChanged(String value1, String value2) { return ((VitalStatusAlive.has(value1) || VitalStatusDead.has(value1) || VitalStatusAlive.has(value2) || VitalStatusDead.has(value2)) && !value1.equals(value2)); }
private String returnHigherPrecendenceString(String value1, String value2) { if (value1.equals(value2)) { return value1; } else if (oneStringEmpty(value1, value2)) { return returnNonEmptyString(value1, value2); } else if (vitalStatusChanged(value1, value2)) { if (VitalStatusAlive.has(value1) && VitalStatusDead.has(value2)) return VitalStatusDead.DEAD.toString(); // alive - dead --> dead if (VitalStatusDead.has(value1) && VitalStatusAlive.has(value2)) return VitalStatusDead.DEAD.toString(); // dead - alive --> dead if (VitalStatusAlive.has(value1) && !VitalStatusDead.has(value2)) return VitalStatusAlive.ALIVE.toString(); // alive - [Not Available] --> alive if (VitalStatusDead.has(value1) && !VitalStatusAlive.has(value2)) return VitalStatusDead.DEAD.toString(); // dead - [Not Available] --> dead if (!VitalStatusAlive.has(value1) && VitalStatusAlive.has(value2)) return VitalStatusAlive.ALIVE.toString(); // [Not Available] - alive --> alive if (!VitalStatusAlive.has(value1) && VitalStatusDead.has(value2)) return VitalStatusDead.DEAD.toString(); // [Not Available] - deade --> dead return VitalStatusDead.DEAD.toString(); } else if (missingAttributeChanged(value1, value2)) { return returnHigherPrecedenceMissingAttribute(value1, value2); } assert true == false : String.format("returnHigherPrecendenceString, %s, %s", value1, value2); return MissingAttributeValues.MISSING.toString(); }
private List<String> computeOverallSurvivalStatus(Map<String, SurvivalData> survivalData) { List<String> osStatus = initializeList(canonicalPatientList.size()); for (String patientId : survivalData.keySet()) { int osStatusIndex = canonicalPatientList.indexOf(patientId); SurvivalData sd = survivalData.get(patientId); if (VitalStatusAlive.has(sd.vitalStatus)) { osStatus.set(osStatusIndex, VitalStatusAlive.LIVING.toString()); } else if (VitalStatusDead.has(sd.vitalStatus)) { osStatus.set(osStatusIndex, VitalStatusDead.DECEASED.toString()); } else { osStatus.set(osStatusIndex, ClinicalAttribute.NA); } } return osStatus; }
private List<String> computeOverallSurvivalMonths(Map<String, SurvivalData> survivalData) { List<String> osStatusMonths = initializeList(canonicalPatientList.size()); for (String patientId : survivalData.keySet()) { int osStatusMonthsIndex = canonicalPatientList.indexOf(patientId); SurvivalData sd = survivalData.get(patientId); if (VitalStatusAlive.has(sd.vitalStatus)) { osStatusMonths.set( osStatusMonthsIndex, convertDaysToMonths(sd.lastFollowUp, sd.lastKnownAlive)); } else if (VitalStatusDead.has(sd.vitalStatus)) { osStatusMonths.set(osStatusMonthsIndex, convertDaysToMonths(sd.daysToDeath)); } else { osStatusMonths.set(osStatusMonthsIndex, ClinicalAttribute.NA); } } return osStatusMonths; }