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

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

There is a newer version: 024-13
Show newest version
        <rule id="SEER_IR09_3" name="Site and Laterality ICD-O-3 not Consistent for Patient (SEER IR09_3)" tag="S033" java-path="lines" category="inter-record">
            <expression><![CDATA[if (lines.size() < 2)
    return true

for (line in lines)
    if (line.histologicTypeIcdO3 == null)
         return true

//Define the properties we want to report
//We don't always want to report laterality and ignoring properties doesn't work when forcing entity failures
Closure<String[]> getPropertiesToFail = { String site1, String site2 ->
    if (!((List)Context.IR09_PAIRED_ORGAN_Table).contains(Functions.asInt(site1.substring(1,4))) && !((List)Context.IR09_PAIRED_ORGAN_Table).contains(Functions.asInt(site2.substring(1,4))))
        return ['line.histologicTypeIcdO3', 'line.primarySite', 'line.behaviorCodeIcdO3', 'line.overRideSiteLatSeqno'] as String[]
    else
        return ['line.histologicTypeIcdO3', 'line.primarySite', 'line.behaviorCodeIcdO3', 'line.overRideSiteLatSeqno', 'line.laterality'] as String[]
}

int index1 = 0
while ( index1 < lines.size() ) {
    Map line1 = lines.get(index1)
    int index2 = index1 + 1
    String site1 = line1.primarySite
    String hist1 = line1.histologicTypeIcdO3
    String behav1 = line1.behaviorCodeIcdO3
    String lat1 = line1.laterality

    if (line1.overRideSiteLatSeqno != '1' && site1 != null && behav1 != null &&
        site1.length() == 4 && hist1.length() == 4 && hist1 < '9590') {
        while ( index2 < lines.size() ) {
            Map line2 = lines.get(index2)
            String site2 = line2.primarySite
            String hist2 = line2.histologicTypeIcdO3
            String behav2 = line2.behaviorCodeIcdO3
            String lat2 = line2.laterality

            if (line2.overRideSiteLatSeqno != '1' && site2 != null && hist2 != null && behav2 != null &&
               site2.length() == 4 && hist2.length() == 4 && hist2 < '9590') {
                if (     hist2.startsWith(hist1.substring(0,3))
                    && (behav1 == '3' && behav1 == behav2)
                    &&!(((List)Context.IR09_PAIRED_ORGAN_Table).contains(Functions.asInt(site1.substring(1,4)))
                    &&  ((List)Context.IR09_PAIRED_ORGAN_Table).contains(Functions.asInt(site2.substring(1,4)))
                    &&  lat1 != lat2 &&  lat1 != '9' &&  lat2 != '9' && lat1 != '5' && lat2 != '5')) {
                    Integer year1 = Functions.asInt(line1.dateOfDiagnosisYear) ?: 9999
                    Integer month1 = Functions.asInt(line1.dateOfDiagnosisMonth) ?: 99
                    Integer day1 = Functions.asInt(line1.dateOfDiagnosisDay) ?: 99
                    Integer year2 = Functions.asInt(line2.dateOfDiagnosisYear) ?: 9999
                    Integer month2 = Functions.asInt(line2.dateOfDiagnosisMonth) ?: 99
                    Integer day2 = Functions.asInt(line2.dateOfDiagnosisDay) ?: 99
                    boolean fiveYearsApart = !((((Integer)((Closure)Context.compareDate).call(year1 +5, month1, day1, year2, month2, day2)) >= 0) && (((Integer)((Closure)Context.compareDate).call(year1 -5, month1, day1, year2, month2, day2)) <= 0))
                    boolean oneYearApart = !((((Integer)((Closure)Context.compareDate).call(year1 + 1, month1, day1, year2, month2, day2)) >= 0) && (((Integer)((Closure)Context.compareDate).call(year1 - 1, month1, day1, year2, month2, day2)) <= 0))
                    boolean siteExceptionBreast = (site1 ==~ /^C50\d$/ && site2 ==~ /^C50\d$/ && fiveYearsApart)
                    boolean siteExceptionColon = (site1 ==~ /^C18[0-8]$/ && site2 ==~ /^C18[0-8]$/ && oneYearApart)
                    boolean siteExceptionHeadNeck = (site1 ==~ /^C(0\d\d|1[0-3]\d|14[0-8]|3[012]\d)$/ && site2 ==~ /^C(0\d\d|1[0-3]\d|14[0-8]|3[012]\d)$/ && fiveYearsApart)

                    if (!((siteExceptionBreast || siteExceptionColon || siteExceptionHeadNeck) && (year1 > 2006 || year2 > 2006))) {
                        if ((  site1 ==~ /^C\d\d(8)$/ || site2 ==~ /^C\d\d(8)$/)
                            && !(site1 ==~ /^C(168|538|718)$/) && !(site2 ==~ /^C(16|53|71)\d$/)
                            && !(site2 ==~ /^C(168|538|718)$/) && !(site1 ==~ /^C(16|53|71)\d$/)
                            && site2.startsWith(site1.substring(0,3))) {
                                Functions.forceFailureOnEntity(binding, line1, getPropertiesToFail(site1, site2))
                                Functions.forceFailureOnEntity(binding, line2, getPropertiesToFail(site1, site2))
                                return false
                        }
                        if ((  site1 ==~ /^C\d\d9$/ || site2 ==~ /^C\d\d9$/)
                            && site2.startsWith(site1.substring(0,3))) {
                                Functions.forceFailureOnEntity(binding, line1, getPropertiesToFail(site1, site2))
                                Functions.forceFailureOnEntity(binding, line2, getPropertiesToFail(site1, site2))
                                return false
                        }
                        if (((Map)Context.IR09_NOS_SPEC_Table).containsKey(site1)
                            && ((List)((Map)Context.IR09_NOS_SPEC_Table).getOrDefault(site1, [])).contains(Functions.asInt(site2.substring(1,4)))) {
                                Functions.forceFailureOnEntity(binding, line1, getPropertiesToFail(site1, site2))
                                Functions.forceFailureOnEntity(binding, line2, getPropertiesToFail(site1, site2))
                                return false
                        }
                        if (((Map)Context.IR09_NOS_SPEC_Table).containsKey(site2)
                            && ((List)((Map)Context.IR09_NOS_SPEC_Table).getOrDefault(site2, [])).contains(Functions.asInt(site1.substring(1,4)))) {
                                Functions.forceFailureOnEntity(binding, line1, getPropertiesToFail(site1, site2))
                                Functions.forceFailureOnEntity(binding, line2, getPropertiesToFail(site1, site2))
                                return false
                        }
                    }
                }
            }
            index2++
        }
    }
    index1++
}
return true]]></expression>
            <message>Site and Laterality ICD-O-3 Inter-Record Error</message>
            <description><![CDATA[IR09 is performed only for invasive diagnoses (Behavior Code ICD-O-3 = 3) and histologies (Histologic Type ICD-O-3) less than 9590.

This edit compares records for a patient that have the same three-digit histology code. The records are not compared if both are paired organs (see Table 2), their lateralities are not the same, and neither has a Laterality of 5 (paired site, midline) or 9 (paired site, but no information concerning laterality).

For the records that are compared, there must be no ambiguity of primary site between specified and NOS. That is, if the site code in one of the records appears in the left column of Table 1 below then the site in the other record must not occur in the same line on the right side of the table.

The 2007 Multiple Primary Rules that incorporate extended timing rules apply only to tumors diagnosed in 2007 and later. Therefore a date test for exemption should only be applied to tumors diagnosed on or after 2007, and only for breast, colon, and head and neck cancers. (See Table 3 for site-specific groups and timing rules.) If there were multiple tumors with diagnosis dates prior to 2007, they should be reviewed.

If there were multiple tumors with diagnosis in 2007 or later, review should be based on the site-specific timing rules. For example: 2 breast cancers diagnosed 2 years apart (2007 and 2009) should be reviewed because breast cancers diagnosed less than 5 years apart are to be abstracted only once, whereas 2 colon cancers diagnosed 2 years apart should not be reviewed because colon cancers diagnosed more than one year apart are abstracted separately.

If there were multiple tumors that span January 1, 2007: If the absolute value of any of the time differences is within the site-specific timing rule, the tumors should be reviewed. For example: two breast cancers diagnosed in 2001 and 2007 should not be reviewed. Two colon cancers diagnosed in December 2006 and March 2007 should be reviewed. If there were breast cancers diagnosed in 2001, 2003, and 2007, they should all be reviewed because 2001 and 2003 will have to be reviewed and if 2003 is determined to be a primary, then 2003 and 2007 will have to be reviewed.

To calculate time differences when one or both records have a partial diagnosis date:

If the diagnosis date in one record has more information than the diagnosis date in the other record, set the missing portion of the partial date to the known portion of the other date. For example, if the first diagnosis date is 200605__ and the second date is 20071020, set the first diagnosis date to 20060520 before calculating whether the second tumor was diagnosed more than 1 year (or 5 years) after the first. If the first date is 200512__ and the second is 2008____, set the value of the second date to 200812__.
For patients whose records have been previously reviewed (Over-ride Site/Lat/SeqNo = 1), no further checking is done.


If one record contains an NOS site code, the records require review as follows: if the site code in one of the records appears in the left column of Table 1 then the site in the other record must not occur in the same line on the right side of the table.

Table 1

NOS       Specified
CAA8*       CAAx
CBB9**       CBBx
C260       C150-C259, C480-C488
C268       C150-C259, C480-C488
C269       C150-C259, C480-C488
C390       C300-C349, C384
C398       C300-C349, C380-C388
C399       C300-C349, C384
C579       C510-C578, C589
C639       C600-C638
C689       C649-C688
C758       C379, C739-C749
C759       C379, C739-C749

* AA represents any two-digit number except 16, 53, 71 (that is, site exceptions = C168, C538, C718)

** BB represents any two-digit number and x represents any one-digit number

Table 2

C079     C080     C081     C090     C091     C099     C301     C310     C312     C341     C342     C343
C344     C345     C346     C347     C348     C349     C384     C400     C401     C402     C403     C441
C442     C443     C445     C446     C447     C471     C472     C491     C492     C500     C501     C502
C503     C504     C505     C506     C507     C508     C509     C569     C570     C620     C621     C622
C623     C624     C625     C626     C627     C628     C629     C630     C631     C649     C659     C669
C690     C691     C692     C693     C694     C695     C696     C697     C698     C699     C740     C741
C742     C743     C744     C745     C746     C747     C748     C749     C754

Table 3

Group Primary Site Review Not Required
Breast C500-C509 Diagnosed more than 5 years apart
Colon C180-C188 Diagnosed more than 1 years apart
Head and Neck C000-C148, C300-C329 Diagnosed more than 5 years apart]]></description>
            <history>
                <event version="SE12-002-04" user="murphyr" date="2010-07-29">Fixed an issue where edit compared laterality to an int when it&apos;s a character.</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="kirbyk" date="2015-06-25" ref="67202">Changed the error reporting to not always report laterality.</event>
                <event version="SE15-014-03" user="kirbyk" date="2015-09-17" ref="67211">Fixed the reported properties to include the entity prefix.</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-020-01" user="depryf" date="2020-02-04" ref="68281">Changed property names to align with NAACCR XML IDs.</event>
                <event version="SE21-021-04" user="kirbyk" date="2021-05-20" ref="68647">Updating edit to match the NPCR logic.</event>
                <event version="SE21-021-08" user="beverung" date="2021-08-06" ref="68700">Fix date exemption logic.</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