imsweb/algorithms

calculateSurvivalTime() can return all space values

Closed this issue · 1 comments

The function SurvivalTimeUtils.calculateSurvivalTime() can return all spaces for values. For certain cases you can get this back:
SurvivalTimeOutputRecordDto.getSurvivalTimeDxYear() = “ “
SurvivalTimeOutputRecordDto.getSurvivalTimeDxMonth() = “ “
SurvivalTimeOutputRecordDto.getSurvivalTimeDxDay() = “ “

If these values are placed in a fixed-width data file, they will be considered empty/non-existent/null. But for XML, we don't want to add fields which are spaces. If a value is empty or undefined, the value should be NULL.

I changed the algorithm to return null for no-value year/month/day; there were constants for those (set to spaces) and I just changed the constants to be null instead.

This change has the potential of breaking some code in calling software, the usage of the algorithm should be reviewed!