All Downloads are FREE. Search and download functionalities are using the official Maven repository.

edits.seer.internal.rules.SEER_IR06A.xml Maven / Gradle / Ivy

There is a newer version: 024-13
Show newest version
        <rule id="SEER_IR06A" name="Seq-num (00 to 59) and Date Dx not Consistent for Patient (SEER IR06)" tag="S027" java-path="lines" category="inter-record">
            <expression><![CDATA[List<Map> filteredLines = (List<Map>)((Closure)Context.SEER_IR06A_Filter).call(lines)

if (filteredLines.size() < 2)
    return true

for (line in filteredLines) {
    if ( line.dateOfDiagnosisYear != null && !(Functions.matches(line.dateOfDiagnosisYear, /^[12]\d\d\d$/)) && !Functions.between(line.dateOfDiagnosisYear, 1930, Functions.getCurrentYear()) )
         return true
    if ( line.dateOfDiagnosisMonth != null && !(Functions.matches(line.dateOfDiagnosisMonth, /^(0?[1-9]|1[0-2])$/) ) )
         return true
    if ( line.dateOfDiagnosisDay != null && !(Functions.matches(line.dateOfDiagnosisDay, /^(0[1-9]|[12][0-9]|3[01]|\s\s)$/)) )
         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 (00 to 59) 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.

IR06A compares the records for a patient where sequence number is between 00 and 59.  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]= 01 must have a Diagnosis date[390] prior or equal to the diagnosis date[390] of the tumor with Sequence number--central[380]= 02, 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-19" user="greend" date="2005-05-25">Edit modified to ignore cases with sequence numbers 60-88.</event>
                <event version="SE11-001-20" user="greend" date="2006-07-19">Changed name from iIR006 to iIR006A.</event>
                <event version="SE11-001-22" user="greend" date="2007-12-30">Records with a Year of Diagnosis [390] equal to 9999 or blank 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 &apos;sort&apos; 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_IR06A_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>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy