edits.seer.internal.rules.DateDiagnosisEdit.xml Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of validation-edits-seer Show documentation
Show all versions of validation-edits-seer Show documentation
Java implemenation of the SEER edits.
The newest version!
<rule id="DateDiagnosisEdit" name="Date of Diagnosis (NAACCR DATEEDIT)" tag="N0021" java-path="lines.line" category="inter-field" depends="Day_of_Diagnosis,Month_of_Diagnosis,Year_of_Diagnosis"> <expression><![CDATA[Integer year = Functions.asInt(line.dateOfDiagnosisYear) Integer month = Functions.asInt(line.dateOfDiagnosisMonth) Integer day = Functions.asInt(line.dateOfDiagnosisDay) Integer yearCur = Functions.getCurrentYear() Integer monthCur = Functions.getCurrentMonth() Integer dayCur = Functions.getCurrentDay() if (line.dateOfDiagnosisYear == null) return line.dateOfDiagnosisMonth == null && line.dateOfDiagnosisDay == null if ((line.dateOfDiagnosisMonth == null && line.dateOfDiagnosisDay != null) || (month > 12 || (line.dateOfDiagnosisMonth != null && month < 1))) return false if (!Functions.between(year, 1930, yearCur)) return false if (line.dateOfDiagnosisMonth == null) //by now year fits and day is null if month is null return true if (year == yearCur && month > monthCur) return false if (line.dateOfDiagnosisDay == null) //by now year and month fit return true if (year == yearCur && month == monthCur && day > dayCur) return false Calendar cal = new GregorianCalendar(year, month - 1, 1) return cal != null && day <= cal.getActualMaximum(Calendar.DAY_OF_MONTH)]]></expression> <message>Date of Diagnosis is not valid.</message> <description><![CDATA[The Date of Diagnosis checks are performed in this order: A) If the year is blank, month and day must also be blank B) If the month is blank, the day must be blank. C) If day of diagnosis is blank, the year of diagnosis and month of diagnosis can not be greater than the current system year/month. D) Year of Diagnosis must be between 1930 and the current system year. E) If day is known, then entire date of diagnosis is verified. The date must be a valid date (leap years checked) and must be less than or equal to the current system date.]]></description> <history> <event version="SE11-001-22" user="greend" date="2008-01-21">Edit now uses Day of Diagnosis.</event> <event version="SE12-002-01" user="murphyr" date="2009-12-03">9 filled is no longer allowed.</event> <event version="SE12-002-01" user="murphyr" date="2009-12-23">Fixed edit to correctly check for blank string instead of blank int.</event> <event version="SE16-015-01" user="kirbyk" date="2016-06-20" ref="67425">Fixed documentation.</event> <event version="SE16-016-08" user="depryf" date="2017-11-22" ref="67674">Edit syntax updated to allow pre-compilation optimization; no change in behavior.</event> <event version="SE22-022-13" user="kirbyk" date="2022-10-18" ref="69045">Fixing edit behavior for future dates.</event> </history> </rule>