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

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

        <rule id="SEER_IR09" name="Site and Laterality not Consistent ICD-O-2 for Patient (SEER IR09)" tag="S032" java-path="lines" category="inter-record">
            <expression><![CDATA[if (lines.size() < 2)
     return true

 for (line in lines)
     if (!(Functions.matches(line.dateOfDiagnosisYear, /\d\d\d\d/)) || line.dateOfDiagnosisYear >= '2001' || line.dateOfDiagnosisYear == 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.histologyIcdO2
     String lat1 = line1.laterality
     String behav1 = line1.behaviorIcdO2
     //String yeardx1 = line1.dateOfDiagnosisYear
     if (line1.overRideSiteLatSeqno != '1' && site1 != null && hist1 != null && behav1 != null &&
        (site1.length() == 4) && (hist1.length() == 4)) {
         while ( index2 < lines.size() ) {
             Map line2 = lines.get(index2)
             String site2 = line2.primarySite
             String hist2 = line2.histologyIcdO2
             String lat2 = line2.laterality
             String behav2 = line2.behaviorIcdO2
             //String yeardx2 = line2.dateOfDiagnosisYear
             if (line2.overRideSiteLatSeqno != '1' && site2 != null && hist2 != null && behav2 != null &&
                site2.length() == 4 && hist2.length() == 4) {
                 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'*/)) {
                     if ((   site1 ==~ /^C\d\d(8)$/ || site2 ==~ /^C\d\d(8)$/)
                         &&  !(site1 ==~ /^C(168|538|718)$/) && !(site2 ==~ /^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\d[9]$/ || site2 ==~ /^C\d\d[9]$/)
                             && 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
                     }
                     /*
                     if (   yeardx1 >= '2007' && yeardx2 >= '2007') {
                         String site1Num = site1.substring(1,3)
                         String site2Num = site2.substring(1,3)
                         int yearDif = yeardx1 - yeardx2;
                         if (yearDif < 0)
                             yearDif = yearDif * (-1)

                         //Breast
                         if((site1Num >= '500' && site1Num >= '509') &&
                            (site2Num >= '500' && site2Num >= '509')) {
                             if (yearDif < 6) {
                                Functions.forceFailureOnEntity(binding, line1)
                                Functions.forceFailureOnEntity(binding, line2)
                                return false
                             }
                         }
                         //Colon
                         else if ((site1Num >= '180' && site1Num <= '189') &&
                                  (site2Num >= '180' && site2Num <= '189')) {
                             if (yearDif < 2) {
                                Functions.forceFailureOnEntity(binding, line1)
                                Functions.forceFailureOnEntity(binding, line2)
                                return false
                             }
                         }
                         //Head and Neck
                         else if((site1Num < '149' || (site1Num >= '300' && site1Num <= '329')) &&
                                 (site2Num < '149' || (site2Num >= '300' && site2Num <= '329'))) {
                             if (yearDif < 6) {
                                Functions.forceFailureOnEntity(binding, line1)
                                Functions.forceFailureOnEntity(binding, line2)
                                return false
                             }
                         }
                     }
                     */
                 }
             }
             index2++
         }
     }
     index1++
 }
 return true]]></expression>
            <message>Site and Laterality Inter-Record Error</message>
            <description><![CDATA[This edit is only executed if all records for the patient have a Year of Diagnosis [390] prior to 2001 and not blank.

This edit compares records for a patient that have the same three-digit malignant Histology (92-00) ICD-O-2 [420] 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 [410] of '9' (Paired site, but no information concerning laterality; midline tumor).

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.

For patients whose records have been previously reviewed (Site/Histology/Laterality/Sequence Number Interrecord Review = 1), no further checking is done.

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

(Where AA represents any two-digit number except 16, 53, 71; BB represents any two-digit number and x represents any one-digit number.)

Table 2

     Paired organs:

     C079      Parotid gland
     C080      Submandibular gland
     C081      Sublingual gland
     C090      Tonsillar fossa
     C091      Tonsillar pillar
     C099      Tonsil, NOS
     C301      Middle ear
     C310      Maxillary sinus
     C312      Frontal sinus
     C341-C349 Lung
     C384      Pleura
     C400      Long bones of upper limb, scapula
     C401      Short bones of upper limb
     C402      Long bones of lower limb
     C403      Short bones of lower limb
     C441      Skin of eyelid
     C442      Skin of external ear
     C443      Skin of other and unpecified parts of the face
                 (midline code '9')
     C445      Skin of trunk (midline code '9')
     C446      Skin of arm and shoulder
     C447      Skin of lower limb and hip
     C471      Upper limb and shoulder
     C472      Lower limb and shoulder
     C491      Connective, subcutaneous, and other soft tissues of upper
                 limb and shoulder
     C492      Connective, subcutaneous, and other soft tissues of lower
                 limb and hip
     C500-C509 Breast
     C569      Ovary
     C570      Fallopian tube
     C620-C629 Testis
     C630      Epididymis
     C631      Spermatic cord
     C649      Kidney, NOS
     C659      Renal pelvis
     C669      Ureter
     C690-C699 Eye
     C740-C749 Adrenal glands
     C754      Carotid body]]></description>
            <history>
                <event version="SE11-001-01" user="greend" date="1985-12-29">The site field is now a three digit field.  The override switch, SITE-LAT-OVERRIDE-SW, is used to specify reviewed cases.  The check on laterality is now done only for paired sites.</event>
                <event version="SE11-001-04" user="greend" date="1988-05-25">The list of paired organs was updated.  The list of exclusion sites was updated.</event>
                <event version="SE11-001-07" user="greend" date="1991-09-15">Conversion of morphology and topography codes from ICD-O-1 to ICD-O-2.</event>
                <event version="SE11-001-17" user="greend" date="2003-04-14">Edit modified to only compare cases for a person where all records occur before 2001.</event>
                <event version="SE12-002-01" user="murphyr" date="2009-12-22">Edit now skipped if year of diagnosis is blank.</event>
                <event version="SE12-002-04" user="murphyr" date="2010-07-29">Fixed issue where we 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-03" user="kirbyk" date="2015-09-17" ref="67213">Changed the error reporting to not always report laterality.</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>
            </history>
        </rule>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy