imsweb / mph

Java implementation of the Multiple Primary and Histology Coding Rules.
Other
4 stars 2 forks source link

Another Exception in GroupUtility for invalid or 9 filled dates #143

Closed bekeles closed 8 months ago

bekeles commented 8 months ago

We fixed an exception which was happening when day parts where 0 and month and year were valid. But we introduced another one:

java.time.DateTimeException : Invalid value for DayOfMonth (valid values 1 - 28/31): 99 at java.base/java.time.temporal.ValueRange.checkValidValue(ValueRange.java:319) at java.base/java.time.temporal.ChronoField.checkValidValue(ChronoField.java:718) at java.base/java.time.LocalDate.of(LocalDate.java:272) at com.imsweb.mph.mpgroups.GroupUtility.daysInBetween(GroupUtility.java:353) at com.imsweb.mph.mpgroups.GroupUtility.verifyDaysApart(GroupUtility.java:321) at com.imsweb.mph.mpgroups.Mp2004SolidMalignantGroup$3.apply(Mp2004SolidMalignantGroup.java:56) at com.imsweb.mph.MphUtils.computePrimaries(MphUtils.java:261)

depryf commented 8 months ago

You need to validate the three parts at the beginning of the process.

Year needs to be 4 digits, it cannot be blank (treat 9999 as blank) Month needs to be numeric, 1-12 or blank (treat 99 as blank) Day needs to be numeric or blank (treat 99 as blank); if provided, the months also needs to be provided, and the day needs to fall into the acceptable days for that year/month

I think that's it.