edits.seer.internal.rules.SEER_IR06B.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.
<rule id="SEER_IR06B" name="Seq-num (60 to 87) and Date Dx not Consistent for Patient (SEER IR06)" tag="S028" java-path="lines" category="inter-record"> <expression><![CDATA[List<Map> filteredLines = (List<Map>)((Closure)Context.SEER_IR06B_Filter).call(lines) if (filteredLines.size() < 2) return true // sort tumors by sequence number (null seq go to the end of the list) filteredLines.sort(true, (Comparator)Context.seqComparator) int index = 1 Map currLine = filteredLines.get(0) Integer currYearDx = Functions.asInt(currLine.dateOfDiagnosisYear) Integer currMonthDx = Functions.asInt(currLine.dateOfDiagnosisMonth) Integer currDayDx = Functions.asInt(currLine.dateOfDiagnosisDay) while (index < filteredLines.size()) { Map line = filteredLines.get(index) Integer nextYearDx = Functions.asInt(line.dateOfDiagnosisYear) Integer nextMonthDx = Functions.asInt(line.dateOfDiagnosisMonth) Integer nextDayDx = Functions.asInt(line.dateOfDiagnosisDay) if (((Integer)((Closure)Context.compareDate).call(currYearDx, currMonthDx, currDayDx, nextYearDx, nextMonthDx, nextDayDx)) > 0) { Functions.forceFailureOnEntity(binding, currLine, 'line.sequenceNumberCentral', 'line.dateOfDiagnosisYear', 'line.dateOfDiagnosisMonth', 'line.dateOfDiagnosisDay') Functions.forceFailureOnEntity(binding, line, 'line.sequenceNumberCentral', 'line.dateOfDiagnosisYear', 'line.dateOfDiagnosisMonth', 'line.dateOfDiagnosisDay') return false } currLine = line if (nextDayDx != '99' && nextDayDx != null) { currYearDx = nextYearDx currMonthDx = nextMonthDx currDayDx = nextDayDx } else if (nextMonthDx != 99 || nextMonthDx != null) { if (nextMonthDx > currMonthDx || nextYearDx > currYearDx) { currYearDx = nextYearDx currMonthDx = nextMonthDx currDayDx = 0 } } else if (nextYearDx != 99 || nextYearDx != null) { if (nextYearDx > currYearDx) { currYearDx = nextYearDx currMonthDx = 0 currDayDx = 0 } } index += 1 } return true]]></expression> <message>Seq_num (60 to 87) and Date_dx Inter-Record Error</message> <description><![CDATA[This edit is skipped if any record for the person has the "Date of Diagnosis is invalid" inter-field edit flag triggered. IR06B compares the records for a patient where sequence number is between 60 and 87. This edit determines whether Sequence number--central[380] and Date of diagnosis[390] are in logical sequence (i.e., the tumor with Sequence number--central[380]= 61 must have a Diagnosis date[390] prior or equal to the diagnosis date[390] of the tumor with Sequence number--central[380]= 62, etc.). When this edit compares two dates, if either Month of Diagnosis [390] is blank then only the years are compared. If either day is blank, then the years and months are compared. Otherwise, the entire dates are compared. Records with a blank Year of Diagnosis [390] are skipped.]]></description> <history> <event version="SE11-001-22" user="greend" date="2007-12-30">Records with a blank Year of Diagnosis [390] are skipped.</event> <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-22">Edit no longer recognizes 9 filled year of diagnosis.</event> <event version="SE14-011-04" user="depryf" date="2014-04-21" ref="67077">Now reporting all the tumors when this edit fails.</event> <event version="SE15-013-01" user="kirbyk" date="2015-01-26" ref="67112">Reports only the two tumors that fail the edit.</event> <event version="SE15-014-01" user="depryf" date="2015-06-25" ref="67203">Fixed syntax of the Groovy 'sort' method, they added a boolean parameter to it.</event> <event version="SE16-016-07" user="kirbyk" date="2017-11-16" ref="67672">Moved filtering logic to context SEER_IR06B_Filter.</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="SE18-019-03" user="kirbyk" date="2019-08-07" ref="68207">Changed how edit compares dates with unknown parts.</event> <event version="SE22-022-01" user="beverung" date="2022-01-24" ref="68782">Update edit to use compareDate context entry.</event> </history> </rule>