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

com.imsweb.validation.edits.translated.npcr.NpcrTranslatedCompiledRules.groovy Maven / Gradle / Ivy

The newest version!
package com.imsweb.validation.edits.translated.npcr

import com.imsweb.validation.functions.MetafileContextFunctions
import com.imsweb.validation.runtime.CompiledRules
import groovy.transform.CompileStatic

@CompileStatic
class NpcrTranslatedCompiledRules implements CompiledRules {

    @Override
    public String getValidatorId() {
        return 'npcr-translated'
    }

    @Override
    public String getValidatorVersion() {
        return 'NPCR-012-01'
    }

    @Override
    public Map>> getMethodParameters() {
        return [
            'untrimmedlines' : [Binding.class, Map.class, MetafileContextFunctions.class, List.class],
            'untrimmedlines.untrimmedline' : [Binding.class, Map.class, MetafileContextFunctions.class, List.class, Map.class]
        ]
    }

    // ID: NPCR-00003; TAG: N0003; NAME: Diagnostic Confirmation (SEER DXCONF)
    public boolean npcr00003(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        return functions.GEN_INLIST(untrimmedline.diagnosticConfirmation, "1-9")

    }

    // ID: NPCR-00005; TAG: N2889; NAME: HER2 Overall Summary, Breast, Schema ID, Required (NAACCR)
    public boolean npcr00005(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.schemaId))
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0)
            return true
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2018)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "00480", 5) != 0) {
            if (functions.GEN_EMPTY(untrimmedline.her2OverallSummary))
                return false
        }
        return true

    }

    // ID: NPCR-00006; TAG: N0005; NAME: Laterality (SEER LATERAL)
    public boolean npcr00006(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        return functions.GEN_INLIST(untrimmedline.laterality, "0,1,2,3,4,5,9")

    }

    // ID: NPCR-00008; TAG: N0007; NAME: Primary Site (SEER SITE)
    public boolean npcr00008(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        return functions.GEN_LOOKUP(untrimmedline.primarySite, context.NPCR_SITE_TBL, context.NPCR_SITE_TBL_SITECODE, [:])

    }

    // ID: NPCR-00009; TAG: N0653; NAME: Behavior Code ICDO3, Seq Num--Central (SEER IF114)
    public boolean npcr00009(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        if (functions.GEN_EMPTY(untrimmedline.behaviorCodeIcdO3))
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if ((dx_year < 2001) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8442,8451,8462,8472,8473")) {
            if (functions.GEN_INLIST(untrimmedline.sequenceNumberCentral, "00-59,99", "(\\d\\d)")) {
                if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "1"))
                    return true
            }
        }
        if (dx_year > 2000) {
            if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "2,3")) {
                if (functions.GEN_INLIST(untrimmedline.sequenceNumberCentral, "60-88", "(\\d\\d)"))
                    return false
            }
        }
        if (functions.GEN_INLIST(untrimmedline.sequenceNumberCentral, "00-59,98,99", "(\\d\\d)")) {
            if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "2,3"))
                return true
            else
                return false
        }
        if (dx_year > 2000) {
            if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1")) {
                if (functions.GEN_INLIST(untrimmedline.sequenceNumberCentral, "60-88", "(\\d\\d)"))
                    return true
                else
                    return false
            }
        }
        return true

    }

    // ID: NPCR-00010; TAG: N0654; NAME: Behavior ICDO3, Site, Histology ICDO3 (NAACCR)
    public boolean npcr00010(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        if (functions.GEN_EMPTY(untrimmedline.behaviorCodeIcdO3))
            return true
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "2,3"))
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1")) {
            if (dx_year > 2003 && functions.GEN_INLIST(untrimmedline.primarySite, "700-729,751-753", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "1")) {
            if ((dx_year < 2001) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8442,8451,8462,8472,8473"))
                return true
        }
        return false

    }

    // ID: NPCR-00011; TAG: N0655; NAME: CS Tumor Size (CS)
    public boolean npcr00011(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.csTumorSize))
            return true
        return functions.GEN_MATCH(untrimmedline.csTumorSize, "(\\d\\d\\d)")

    }

    // ID: NPCR-00012; TAG: N0011; NAME: Race 1 (SEER RACE)
    public boolean npcr00012(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        return functions.GEN_INLIST(untrimmedline.race1, "01-08, 10-17,20-22,25-28,30-32,96-99", "(\\d\\d)")

    }

    // ID: NPCR-00014; TAG: N0012; NAME: Sex (SEER Sex)
    public boolean npcr00014(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        return functions.GEN_INLIST(untrimmedline.sex, "1-6,9")

    }

    // ID: NPCR-00016; TAG: N0013; NAME: Sex, Primary Site (SEER IF17)
    public boolean npcr00016(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_INLIST(untrimmedline.sex, "1,9") && functions.GEN_INLIST(untrimmedline.primarySite, "510-589", "(C\\d\\d\\d)", 2, 3)) {
            return false
        }
        if (functions.GEN_INLIST(untrimmedline.sex, "2,9") && functions.GEN_INLIST(untrimmedline.primarySite, "600-639", "(C\\d\\d\\d)", 2, 3))
            return false
        return true

    }

    // ID: NPCR-00018; TAG: N0014; NAME: Spanish/Hispanic Origin (SEER SPANORIG)
    public boolean npcr00018(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        return functions.GEN_INLIST(untrimmedline.spanishHispanicOrigin, "0-9")

    }

    // ID: NPCR-00022; TAG: N0017; NAME: Type of Report Srce (AO), Date of Dx (SEER IF02)
    public boolean npcr00022(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year, dx_month, dolc_year, dolc_month
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        dx_month = functions.GEN_DATE_MONTH_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        dolc_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfLastContact)
        
        if (dolc_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dolc_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Last Contact: %DC')
        dolc_month = functions.GEN_DATE_MONTH_IOP(binding, untrimmedline.dateOfLastContact)
        
        if (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "6")) {
            if (dx_year == dolc_year) {
                if (dx_month == dolc_month)
                    return true
                else
                    return false
            }
            else
                return false
        }
        return true

    }

    // ID: NPCR-00023; TAG: N0662; NAME: CS Site-Specific Factor 1 (CS)
    public boolean npcr00023(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor1))
            return true
        return functions.GEN_MATCH(untrimmedline.csSiteSpecificFactor1, "(\\d\\d\\d)")

    }

    // ID: NPCR-00024; TAG: N0018; NAME: Type of Report Srce(DC/AO), Diag Conf (SEER IF05)
    public boolean npcr00024(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "6")) {
            if (!functions.GEN_INLIST(untrimmedline.diagnosticConfirmation, "1,6"))
                return false
        }
        if (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "7")) {
            if (!functions.GEN_INLIST(untrimmedline.diagnosticConfirmation, "9"))
                return false
        }
        return true

    }

    // ID: NPCR-00025; TAG: N0663; NAME: CS Site-Specific Factor 2 (CS)
    public boolean npcr00025(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor2))
            return true
        return functions.GEN_MATCH(untrimmedline.csSiteSpecificFactor2, "(\\d\\d\\d)")

    }

    // ID: NPCR-00026; TAG: N0019; NAME: Type of Reporting Source (SEER RPRTSRC)
    public boolean npcr00026(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        return functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "1-8")

    }

    // ID: NPCR-00030; TAG: N0024; NAME: Date of Last Contact, Date of Diag (NAACCR IF19)
    public boolean npcr00030(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dtcmp
        int dx_year, dx_month, dx_day, last_year, last_month, last_day
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfLastContact) || functions.GEN_EMPTY(untrimmedline.dateOfDiagnosis))
            return true
        if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfDiagnosis))
            return true
        if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfLastContact))
            return true
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.dateOfDiagnosis, untrimmedline.dateOfLastContact, ((Integer)context.NPCR_GEN_DT_EXACT))
        
        if (dtcmp <= 0)
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        dx_month = functions.GEN_DATE_MONTH_IOP(binding, untrimmedline.dateOfDiagnosis)
        dx_day = functions.GEN_DATE_DAY_IOP(binding, untrimmedline.dateOfDiagnosis)
        last_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfLastContact)
        last_month = functions.GEN_DATE_MONTH_IOP(binding, untrimmedline.dateOfLastContact)
        last_day = functions.GEN_DATE_DAY_IOP(binding, untrimmedline.dateOfLastContact)
        
        if (dx_month == ((Integer)context.NPCR_GEN_DT_MONTH_EMPTY) || last_month == ((Integer)context.NPCR_GEN_DT_MONTH_EMPTY)) {
            if (dx_year <= last_year)
                return true
            else
                return false
        }
        else {
            if (dx_day == ((Integer)context.NPCR_GEN_DT_DAY_EMPTY) || last_day == ((Integer)context.NPCR_GEN_DT_DAY_EMPTY)) {
                if (dx_year < last_year)
                    return true
                else {
                    if (dx_year == last_year && dx_month <= last_month)
                        return true
                    else
                        return false
                }
            }
            else
                return false
        }
        return false

    }

    // ID: NPCR-00031; TAG: N0025; NAME: Age, Birth Date, Date of Diagnosis (NAACCR IF13)
    public boolean npcr00031(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int wrk_age, diag_age
        int dx_year, dx_month, dx_day, birth_year, birth_month, birth_day
        
        if (functions.GEN_INLIST(untrimmedline.ageAtDiagnosis, "000")) {
            if (functions.GEN_INLIST(untrimmedline.overRideAgeSiteMorph, "2,3"))
                return true
        }
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        birth_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfBirth)
        
        if (birth_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Birth: %DC')
        diag_age = functions.GEN_VAL(untrimmedline.ageAtDiagnosis)
        
        if (diag_age == 999) {
            if ((dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY)) || (birth_year == ((Integer)context.NPCR_GEN_DT_EMPTY)))
                return true
            else
                return false
        }
        if ((dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY)) || (birth_year == ((Integer)context.NPCR_GEN_DT_EMPTY))) {
            if (diag_age == 999)
                return true
            else
                return false
        }
        dx_month = functions.GEN_DATE_MONTH_IOP(binding, untrimmedline.dateOfDiagnosis)
        birth_month = functions.GEN_DATE_MONTH_IOP(binding, untrimmedline.dateOfBirth)
        
        if ((birth_month == ((Integer)context.NPCR_GEN_DT_MONTH_EMPTY)) || (dx_month == ((Integer)context.NPCR_GEN_DT_MONTH_EMPTY)))
            wrk_age = dx_year - birth_year
        else
            wrk_age = (int)(((dx_year * 12 + dx_month) - (birth_year * 12 + birth_month)) / 12)
        if ((birth_month == ((Integer)context.NPCR_GEN_DT_MONTH_EMPTY)) || (dx_month == ((Integer)context.NPCR_GEN_DT_MONTH_EMPTY))) {
            if (diag_age == wrk_age || diag_age == (wrk_age - 1))
                return true
            else
                return false
        }
        dx_day = functions.GEN_DATE_DAY_IOP(binding, untrimmedline.dateOfDiagnosis)
        birth_day = functions.GEN_DATE_DAY_IOP(binding, untrimmedline.dateOfBirth)
        
        if (dx_month == birth_month) {
            if ((dx_day == ((Integer)context.NPCR_GEN_DT_DAY_EMPTY)) || (birth_day == ((Integer)context.NPCR_GEN_DT_DAY_EMPTY))) {
                if (diag_age == wrk_age || diag_age == (wrk_age - 1))
                    return true
                else
                    return false
            }
            else {
                if (dx_day < birth_day)
                    wrk_age = (wrk_age - 1)
            }
        }
        if (diag_age == wrk_age)
            return true
        else
            return false
        
        return true

    }

    // ID: NPCR-00032; TAG: N0026; NAME: Age at Diagnosis (SEER AGEDX)
    public boolean npcr00032(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        return functions.GEN_INLIST(untrimmedline.ageAtDiagnosis, "000-120,999", "(\\d\\d\\d)")

    }

    // ID: NPCR-00033; TAG: N0027; NAME: Edit Over-rides (SEER REVIEWFL)
    public boolean npcr00033(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_MATCH(untrimmedline.overRideSiteType, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideHistology, "([1-3])|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideAgeSiteMorph, "([1-3])|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideSeqnoDxconf, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideSiteLatSeqno, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideSurgDxconf, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideReportSource, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideIllDefineSite, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideLeukLymphoma, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideSiteBehavior, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideSiteEodDxDt, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideSiteLatEod, "(1)|(\\s)") && functions.GEN_MATCH(untrimmedline.overRideSiteLatMorph, "(1)|(\\s)"))
            return true
        else
            return false
        
        return true

    }

    // ID: NPCR-00035; TAG: N0673; NAME: Derived SS2000 (CS)
    public boolean npcr00035(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.derivedSs2000))
            return true
        if (functions.GEN_INLIST(untrimmedline.derivedSs2000, "0-5, 7-9"))
            return true
        return false

    }

    // ID: NPCR-00036; TAG: N0033; NAME: NAACCR Record Version (NAACCR)
    public boolean npcr00036(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_STRCMP(untrimmedline.naaccrRecordVersion, "240") != 0)
            return false
        return true

    }

    // ID: NPCR-00037; TAG: N2292; NAME: Tumor Size Summary, Primary Site (COC)
    public boolean npcr00037(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int req_flag
        int dx_year
        
        char[] code = new char[5]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2016 || dx_year > 2018)
            return true
        if (functions.GEN_EMPTY(untrimmedline.tumorSizeSummary))
            return true
        if (functions.GEN_INLIST(untrimmedline.tumorSizeSummary, "998")) {
            if (!functions.GEN_INLIST(untrimmedline.primarySite, "199, 209, 180, 182-189,150-155, 158, 159", "(C\\d\\d\\d)", 2, 4) && !functions.GEN_INLIST(untrimmedline.primarySite, "160-166, 168, 169, 340-343, 348, 349, 500-506, 508, 509", "(C\\d\\d\\d)", 2, 4))
                return false
        }
        return true

    }

    // ID: NPCR-00040; TAG: N2924; NAME: Progesterone Receptor Summary, Schema ID, Required (NAACCR)
    public boolean npcr00040(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.schemaId))
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0)
            return true
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2018)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "00480", 5) != 0) {
            if (functions.GEN_EMPTY(untrimmedline.progesteroneRecepSummary))
                return false
        }
        return true

    }

    // ID: NPCR-00041; TAG: N0058; NAME: Patient ID Number (SEER CASENUM)
    public boolean npcr00041(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_MATCH(untrimmedline.patientIdNumber, "(\\d\\d\\d\\d\\d\\d\\d\\d)") && functions.GEN_VAL(untrimmedline.patientIdNumber) > 0)
            return true
        else
            return false
        
        return true

    }

    // ID: NPCR-00044; TAG: N0062; NAME: Record Type (NAACCR)
    public boolean npcr00044(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        return functions.GEN_INLIST(untrimmedline.recordType, "I,C,A,U,M,L")

    }

    // ID: NPCR-00048; TAG: N2938; NAME: Brain Molecular Markers, Date DX (NAACCR)
    public boolean npcr00048(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2018) {
            if (!functions.GEN_EMPTY(untrimmedline.brainMolecularMarkers))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Brain Molecular Markers must be blank for cases diagnosed before 2018')
        }
        if (functions.GEN_EMPTY(untrimmedline.brainMolecularMarkers))
            return true
        if (dx_year < 2024) {
            if (functions.GEN_INLIST(untrimmedline.brainMolecularMarkers, "10-23", "(\\d\\d)"))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Brain Molecular Markers: ${untrimmedline.brainMolecularMarkers} not valid code for Date of Diagnosis: ${untrimmedline.dateOfDiagnosis.formatDate()}')
        }
        if (!functions.GEN_INLIST(untrimmedline.brainMolecularMarkers, "01-23, 85-88, 99", "(\\d\\d)"))
            functions.GEN_SAVE_ERROR_TEXT(binding, '${untrimmedline.brainMolecularMarkers} not valid code for Brain Molecular Markers')
        return true

    }

    // ID: NPCR-00050; TAG: N0713; NAME: ICD Revision, Vital Stat, Date Last Contact (NPCR)
    public boolean npcr00050(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dolc_year
        
        if (functions.GEN_EMPTY(untrimmedline.causeOfDeath))
            functions.GEN_NOOP()
        if (functions.GEN_EMPTY(untrimmedline.icdRevisionNumber))
            return true
        dolc_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfLastContact)
        
        if (dolc_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dolc_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Last Contact: %DC')
        if (functions.GEN_INLIST(untrimmedline.vitalStatus, "0")) {
            if (dolc_year > 1978 && dolc_year < 1999) {
                if (!functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "0,1"))
                    return true
                else
                    return false
            }
            else {
                if (dolc_year == 1999) {
                    if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "9,1"))
                        return true
                    else
                        return false
                }
                else {
                    if (dolc_year > 1999) {
                        if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "1"))
                            return true
                        else
                            return false
                    }
                }
            }
        }
        if (functions.GEN_INLIST(untrimmedline.vitalStatus, "1")) {
            if (!functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "0"))
                return false
        }
        return true

    }

    // ID: NPCR-00051; TAG: N0714; NAME: PIN III ICDO3, Date of Diagnosis (SEER IF110)
    public boolean npcr00051(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 2000) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "C619") && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8148") && functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "2"))
                return false
        }
        return true

    }

    // ID: NPCR-00052; TAG: N0075; NAME: Date Initial RX SEER (NAACCR)
    public boolean npcr00052(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateInitialRxSeer))
            return true
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateInitialRxSeer))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'Date of Initial RX--SEER: %DC')
            return false
        }
        
        return true

    }

    // ID: NPCR-00053; TAG: N0717; NAME: Age, Primary Site, Morph ICDO3--Pediatric (NPCR)
    public boolean npcr00053(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int agetemp
        int dx_year
        
        if (functions.GEN_INLIST(untrimmedline.overRideAgeSiteMorph, "1,3"))
            return true
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year < 2001)
            return true
        agetemp = functions.GEN_VAL(untrimmedline.ageAtDiagnosis)
        
        if (agetemp > 14) {
            return true
        }
        if (agetemp < 3) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9650-9667"))
                return false
        }
        if (agetemp > 9 && agetemp < 15) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9490,9500"))
                return false
        }
        if (agetemp > 5 && agetemp < 15) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9510-9514"))
                return false
        }
        if (agetemp > 8 && agetemp < 15) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8960,8964"))
                return false
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8963") && functions.GEN_INLIST(untrimmedline.primarySite, "649,809", "(C\\d\\d\\d)", 2, 3))
                return false
        }
        if (agetemp < 9) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8010-8041,8050-8075,8082,8120-8122,8130-8141,8143,8155,8190-8201") && functions.GEN_INLIST(untrimmedline.primarySite, "649", "(C\\d\\d\\d)", 2, 3))
                return false
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8210,8211,8221-8231,8240,8241,8244-8246,8260-8263,8290,8310,8320") && functions.GEN_INLIST(untrimmedline.primarySite, "649", "(C\\d\\d\\d)", 2, 3))
                return false
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8323,8401,8430,8440,8480-8490,8504,8510,8550,8560-8573") && functions.GEN_INLIST(untrimmedline.primarySite, "649", "(C\\d\\d\\d)", 2, 3))
                return false
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8312"))
                return false
        }
        if (agetemp > 5 && agetemp < 15) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8970"))
                return false
        }
        if (agetemp < 9) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8010-8041,8050-8075,8082,8120-8122,8140,8141,8143,8155,8190-8201") && functions.GEN_INLIST(untrimmedline.primarySite, "220,221", "(C\\d\\d\\d)", 2, 3))
                return false
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8210,8211,8230,8231,8240,8241,8244-8246,8260-8263,8310,8320") && functions.GEN_INLIST(untrimmedline.primarySite, "220,221", "(C\\d\\d\\d)", 2, 3))
                return false
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8323,8401,8430,8440,8480-8490,8504,8510,8550,8560-8573") && functions.GEN_INLIST(untrimmedline.primarySite, "220,221", "(C\\d\\d\\d)", 2, 3))
                return false
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8160-8180"))
                return false
        }
        if (agetemp < 6) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9180-9200"))
                return false
        }
        if (agetemp < 6) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9220-9230"))
                return false
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9231,9240") && functions.GEN_INLIST(untrimmedline.primarySite, "400-419", "(C\\d\\d\\d)", 2, 3))
                return false
        }
        if (agetemp < 4) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9260") && functions.GEN_INLIST(untrimmedline.primarySite, "400-419,809", "(C\\d\\d\\d)", 2, 3))
                return false
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9363,9364") && functions.GEN_INLIST(untrimmedline.primarySite, "400-419", "(C\\d\\d\\d)", 2, 3))
                return false
        }
        if (agetemp > 7 && agetemp < 15) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9060-9102") && functions.GEN_INLIST(untrimmedline.primarySite, "000-559,570-619,630-699,739-750,754-809", "(C\\d\\d\\d)", 2, 3))
                return false
        }
        if (agetemp < 15) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8010-8041,8050-8075,8082,8120-8122,8130-8141,8143,8155,8190-8201") && functions.GEN_INLIST(untrimmedline.primarySite, "569,620-629", "(C\\d\\d\\d)", 2, 3))
                return false
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8210,8211,8221-8241,8244-8246,8260-8263,8290,8310,8320") && functions.GEN_INLIST(untrimmedline.primarySite, "569,620-629", "(C\\d\\d\\d)", 2, 3))
                return false
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8323,8430,8440,8480-8490,8504,8510,8550,8560-8573") && functions.GEN_INLIST(untrimmedline.primarySite, "569,620-629", "(C\\d\\d\\d)", 2, 3))
                return false
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8380,8381,8441-8473"))
                return false
        }
        if (agetemp < 6) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8010-8041,8050-8075,8082,8120-8122,8130-8141,8155,8190,8200,8201") && functions.GEN_INLIST(untrimmedline.primarySite, "739", "(C\\d\\d\\d)", 2, 3))
                return false
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8211,8230,8231,8244-8246,8260-8263,8290,8310,8320") && functions.GEN_INLIST(untrimmedline.primarySite, "739", "(C\\d\\d\\d)", 2, 3))
                return false
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8323,8430,8440,8480,8481,8500-8573") && functions.GEN_INLIST(untrimmedline.primarySite, "739", "(C\\d\\d\\d)", 2, 3))
                return false
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8330-8350"))
                return false
        }
        if (agetemp < 6) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8010-8041,8050-8075,8082,8120-8122,8130-8141,8155,8190,8200,8201") && functions.GEN_INLIST(untrimmedline.primarySite, "110-119", "(C\\d\\d\\d)", 2, 3))
                return false
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8211,8230,8231,8244-8246,8260-8263,8290,8310,8320") && functions.GEN_INLIST(untrimmedline.primarySite, "110-119", "(C\\d\\d\\d)", 2, 3))
                return false
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8323,8430,8440,8480,8481,8504,8510,8550,8560-8573") && functions.GEN_INLIST(untrimmedline.primarySite, "110-119", "(C\\d\\d\\d)", 2, 3))
                return false
        }
        if (agetemp < 5) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8010-8041,8050-8075,8082,8090-8110,8140,8143,8147,8190,8200") && functions.GEN_INLIST(untrimmedline.primarySite, "440-449", "(C\\d\\d\\d)", 2, 3))
                return false
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8240,8246,8247,8260,8310,8320") && functions.GEN_INLIST(untrimmedline.primarySite, "440-449", "(C\\d\\d\\d)", 2, 3))
                return false
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8323,8390-8420,8430,8480,8542,8560,8570-8573,8940") && functions.GEN_INLIST(untrimmedline.primarySite, "440-449", "(C\\d\\d\\d)", 2, 3))
                return false
        }
        if (agetemp < 5) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8010-8082,8120-8155,8190-8263,8290,8310,8314-8323") && functions.GEN_INLIST(untrimmedline.primarySite, "000-109,129-218,239-399,480-488,500-559,570-619,630-639,659-729,750-809", "(C\\d\\d\\d)", 2, 3))
                return false
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8430-8440,8480-8580,8940,8941") && functions.GEN_INLIST(untrimmedline.primarySite, "000-109,129-218,239-399,480-488,500-559,570-619,630-639,659-729,750-809", "(C\\d\\d\\d)", 2, 3))
                return false
        }
        if (agetemp < 15) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9050-9053"))
                return false
        }
        if (agetemp < 15) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "530-539", "(C\\d\\d\\d)", 2, 3)) {
                if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "2"))
                    return false
            }
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9100") && functions.GEN_INLIST(untrimmedline.primarySite, "589", "(C\\d\\d\\d)", 2, 3))
                return false
            if (functions.GEN_INLIST(untrimmedline.primarySite, "150-159,170-179,199,209,210-218,239", "(C\\d\\d\\d)", 2, 3))
                return false
            if (functions.GEN_INLIST(untrimmedline.primarySite, "240-249,250-259,384,500-509,559,540-549,609", "(C\\d\\d\\d)", 2, 3))
                return false
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8240-8245") && functions.GEN_INLIST(untrimmedline.primarySite, "180-189,339,340-349", "(C\\d\\d\\d)", 2, 3))
                return false
            if (functions.GEN_INLIST(untrimmedline.primarySite, "530-539", "(C\\d\\d\\d)", 2, 3)) {
                if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "3"))
                    return false
            }
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8140") && functions.GEN_INLIST(untrimmedline.primarySite, "619", "(C\\d\\d\\d)", 2, 3))
                return false
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9732,9823,9863,9875,9876,9945"))
                return false
        }
        return true

    }

    // ID: NPCR-00054; TAG: N0718; NAME: Age, Primary Site, Morph ICDO3--Adult (SEER)
    public boolean npcr00054(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int agetemp
        int dx_year
        char[] Morph = new char[6]
        char[] Histo = new char[5]
        
        if (functions.GEN_INLIST(untrimmedline.overRideAgeSiteMorph, "1"))
            return true
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3) || functions.GEN_EMPTY(untrimmedline.behaviorCodeIcdO3))
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year < 2001) {
            return true
        }
        if (functions.GEN_INLIST(untrimmedline.ageAtDiagnosis, "999"))
            return true
        agetemp = functions.GEN_VAL(untrimmedline.ageAtDiagnosis)
        
        if (agetemp < 15)
            return true
        functions.GEN_STRCPY(Histo, untrimmedline.histologicTypeIcdO3)
        
        functions.GEN_STRCPY(Morph, Histo)
        functions.GEN_STRCAT(Morph, untrimmedline.behaviorCodeIcdO3)
        
        if (agetemp < 20) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "150-159,170-179,199,209-218,239,240-249,250-259,384,500-509,559,540-549", "(C\\d\\d\\d)", 2, 3) || (functions.GEN_INLIST(untrimmedline.primarySite, "180-189,339,340-349", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(Morph, "00000-82399,82460-99999")) || (functions.GEN_INLIST(untrimmedline.primarySite, "530-539", "(C\\d\\d\\d)", 2, 3) && functions.GEN_MATCH(Morph, "(\\d\\d\\d\\d3)")))
                return false
        }
        if (agetemp < 30) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "C609") || functions.GEN_INLIST(Histo, "9732, 9823, 9863, 9875, 9876, 9945", "(\\d\\d\\d\\d)"))
                return false
        }
        if (agetemp < 40) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "C619") && functions.GEN_INLIST(Histo, "8140", "(\\d\\d\\d\\d)"))
                return false
        }
        if (agetemp > 5) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "690-699", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(Histo, "9510-9514", "(\\d\\d\\d\\d)"))
                return false
        }
        if (agetemp > 14) {
            if (functions.GEN_INLIST(Histo, "8960,9946", "(\\d\\d\\d\\d)"))
                return false
        }
        if (agetemp > 45) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "C589") && functions.GEN_INLIST(Histo, "9100", "(\\d\\d\\d\\d)"))
                return false
        }
        return true

    }

    // ID: NPCR-00060; TAG: N0090; NAME: Vital Status (COC)
    public boolean npcr00060(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        return functions.GEN_INLIST(untrimmedline.vitalStatus, "0,1")

    }

    // ID: NPCR-00063; TAG: N0091; NAME: Cause of Death (SEER COD)
    public boolean npcr00063(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_MATCH(untrimmedline.causeOfDeath, "(\\d\\d\\d\\d)") || functions.GEN_MATCH(untrimmedline.causeOfDeath, "([A-Z]\\d\\d\\d)") || functions.GEN_MATCH(untrimmedline.causeOfDeath, "([A-Z]\\d\\d\\s)"))
            return true
        else
            return false
        
        return true

    }

    // ID: NPCR-00064; TAG: N0093; NAME: ICD Revision Number, Cause of Death (SEER IF37)
    public boolean npcr00064(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int cod_num
        char[] COD = new char[5]
        
        if (functions.GEN_MATCH(untrimmedline.causeOfDeath, "(\\d\\d\\d\\d)")) {
            cod_num = functions.GEN_VAL(untrimmedline.causeOfDeath)
            if (cod_num == 0) {
                if (!functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "0"))
                    return false
                else
                    return true
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "0"))
                    return false
                else {
                    if (cod_num == 7777 || cod_num == 7797)
                        return true
                }
            }
        }
        else {
            if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "0")) {
                return false
            }
        }
        if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "9")) {
            if (functions.GEN_INLIST(untrimmedline.causeOfDeath, "9599"))
                return true
        }
        if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "1")) {
            if (functions.GEN_MATCH(untrimmedline.causeOfDeath, "([A-Z]\\d\\d\\s)")) {
                functions.GEN_STRCPY(COD, functions.GEN_SUBSTR(untrimmedline.causeOfDeath, 1, 3))
                functions.GEN_STRCAT(COD, "9")
            }
            if (functions.GEN_MATCH(untrimmedline.causeOfDeath, "([A-Z]\\d\\d\\d)"))
                functions.GEN_STRCPY(COD, untrimmedline.causeOfDeath)
            if (!functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_ICD10COD, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_ICD10COD_CODE, COD, [:]))
                return false
        }
        else {
            if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "7")) {
                if (!functions.GEN_ILOOKUP(untrimmedline.causeOfDeath, context.NPCR_ICD7COD, context.NPCR_ICD7COD_CODE, [:]))
                    return false
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "8")) {
                    if (!functions.GEN_ILOOKUP(untrimmedline.causeOfDeath, context.NPCR_ICD8COD, context.NPCR_ICD8COD_CODE, [:]))
                        return false
                }
                else {
                    if (functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "9")) {
                        if (!functions.GEN_ILOOKUP(untrimmedline.causeOfDeath, context.NPCR_ICD9COD, context.NPCR_ICD9COD_CODE, [:]))
                            return false
                    }
                }
            }
        }
        return true

    }

    // ID: NPCR-00065; TAG: N0094; NAME: Type of Report Srce(DC/AO), COD (SEER IF09)
    public boolean npcr00065(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_INLIST(untrimmedline.causeOfDeath, "0000")) {
            if (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "6,7"))
                return false
        }
        if (functions.GEN_INLIST(untrimmedline.causeOfDeath, "7777")) {
            if (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "7"))
                return false
        }
        return true

    }

    // ID: NPCR-00066; TAG: N0096; NAME: Date Initial RX SEER, Date Last Cont (NAACCR IF35)
    public boolean npcr00066(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dtcmp
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (functions.GEN_INLIST(untrimmedline.registryId, "0000001544", "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)")) {
            if (dx_year < 2000)
                return true
        }
        if (functions.GEN_EMPTY(untrimmedline.dateOfLastContact) || functions.GEN_EMPTY(untrimmedline.dateInitialRxSeer))
            return true
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.dateInitialRxSeer, untrimmedline.dateOfLastContact, ((Integer)context.NPCR_GEN_DT_MIN))
        
        if (dtcmp == ((Integer)context.NPCR_GEN_DT_ERROR)) {
            if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateInitialRxSeer)) {
                functions.GEN_ERROR_TEXT(binding, 'Date of Initial RX--SEER is invalid: %DC')
                return false
            }
            else {
                if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfLastContact)) {
                    functions.GEN_ERROR_TEXT(binding, 'Date of Last Contact is invalid: %DC')
                    return false
                }
            }
        }
        else {
            if (dtcmp <= 0)
                return true
            else
                return false
        }
        
        return true

    }

    // ID: NPCR-00067; TAG: N0736; NAME: Non-Reportable Skin ICDO3 (SEER IF117)
    public boolean npcr00067(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        if (functions.GEN_INLIST(untrimmedline.primarySite, "440-449", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-8110"))
            return false
        return true

    }

    // ID: NPCR-00068; TAG: N0739; NAME: NHIA Derived Hisp Origin (NAACCR)
    public boolean npcr00068(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.nhiaDerivedHispOrigin))
            return true
        return functions.GEN_INLIST(untrimmedline.nhiaDerivedHispOrigin, "0-8")

    }

    // ID: NPCR-00069; TAG: N0122; NAME: Addr at DX--State (NAACCR)
    public boolean npcr00069(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        return functions.GEN_LOOKUP(untrimmedline.addrAtDxState, context.NPCR_STATE, context.NPCR_STATE_CODE, [:])

    }

    // ID: NPCR-00070; TAG: N0123; NAME: Addr at DX--Postal Code (NAACCR)
    public boolean npcr00070(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        return functions.GEN_MATCH(untrimmedline.addrAtDxPostalCode, "([A-Za-z0-9](([A-Za-z0-9]))*((\\s))*)")

    }

    // ID: NPCR-00072; TAG: N0750; NAME: Follow-up Source Central (NAACCR)
    public boolean npcr00072(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.followUpSourceCentral))
            return true
        return functions.GEN_INLIST(untrimmedline.followUpSourceCentral, "00-12,29-35,39-43,48-51,59-65,98,99", "(\\d\\d)")

    }

    // ID: NPCR-00073; TAG: N0751; NAME: Follow-up Source Central, Date of DX (NPCR)
    public boolean npcr00073(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 2005) {
            if (functions.GEN_EMPTY(untrimmedline.followUpSourceCentral))
                return false
        }
        return true

    }

    // ID: NPCR-00075; TAG: N0753; NAME: IHS Link (NPCR)
    public boolean npcr00075(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.ihsLink))
            return true
        return functions.GEN_INLIST(untrimmedline.ihsLink, "0,1")

    }

    // ID: NPCR-00082; TAG: N2991; NAME: PSA (Prostatic Specific Antigen) Lab Value, Schema ID, Required (NAACCR)
    public boolean npcr00082(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.schemaId))
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0)
            return true
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2018)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "00580", 5) != 0) {
            if (functions.GEN_EMPTY(untrimmedline.psaLabValue))
                return false
        }
        return true

    }

    // ID: NPCR-00084; TAG: N0157; NAME: Date 1st Crs RX COC (COC)
    public boolean npcr00084(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.date1stCrsRxCoc))
            return true
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.date1stCrsRxCoc))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'Date of 1st Crs RX--COC: %DC')
            return false
        }
        
        return true

    }

    // ID: NPCR-00085; TAG: N3006; NAME: Schema Discriminator 2, Date DX (NAACCR)
    public boolean npcr00085(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2018) {
            if (!functions.GEN_EMPTY(untrimmedline.schemaDiscriminator2))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Schema Discriminator 2 must be blank for cases diagnosed before 2018')
        }
        if (functions.GEN_EMPTY(untrimmedline.schemaDiscriminator2))
            return true
        if (functions.GEN_AT(untrimmedline.schemaDiscriminator2, "1289", 1) == 0)
            functions.GEN_SAVE_ERROR_TEXT(binding, '${untrimmedline.schemaDiscriminator2} is not a valid value for Schema Discriminator 2')
        if (functions.GEN_AT(untrimmedline.schemaDiscriminator2, "8") != 0) {
            if (dx_year >= 2021)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Schema Discriminator 2: ${untrimmedline.schemaDiscriminator2} must not be used for 2021+ diagnoses')
        }
        return true

    }

    // ID: NPCR-00086; TAG: N0811; NAME: Primary Payer at DX (NPCR)
    public boolean npcr00086(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.primaryPayerAtDx))
            return true
        if (functions.GEN_INLIST(untrimmedline.primaryPayerAtDx, "01,02,10,20,21,31,35,60-68,99"))
            return true
        return false

    }

    // ID: NPCR-00087; TAG: N1594; NAME: Summary Stage 2000, Over-ride CS 20 (NPCR)
    public boolean npcr00087(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_INLIST(untrimmedline.overRideCs20, "1")) {
            if (functions.GEN_EMPTY(untrimmedline.seerSummaryStage2000))
                return false
        }
        return true

    }

    // ID: NPCR-00088; TAG: N3007; NAME: Schema ID, Site, Histo, Schema Discriminator 2 (NAACCR)
    public boolean npcr00088(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] SITELOW = new char[5], HISTLOW = new char[5], HISTHIGH = new char[5], GPCODE = new char[6], GPNAME = new char[31], SCDSCR2 = new char[2]
        char[] SITE_LO = new char[5], SITE_HI = new char[5]
        
        int dx_year
        
        char[] SiteGrp = new char[5]
        char[] Site = new char[5]
        char[] Hist = new char[5]
        char[] t_schema_msg = new char[100]
        
        char[] group = new char[5]
        
        char[] flag = new char[2]
        functions.GEN_STRCPY(flag, "00")
        functions.GEN_STRCPY(group, "00000")
        
        char[] Site_Hist = new char[30]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018)
            return true
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        if (functions.GEN_EMPTY(untrimmedline.primarySite))
            return true
        functions.GEN_STRCPY(Site, untrimmedline.primarySite)
        functions.GEN_STRCPY(Hist, untrimmedline.histologicTypeIcdO3)
        
        
        if (functions.GEN_SQLRANGELOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_DISC2SEER_REF, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_DISC2SEER_REF_SITE_LO, Site, ['SITE_LO':SITE_LO, 'SITE_HI':SITE_HI])) {
        
            if (functions.GEN_STRCMP(Site, SITE_LO) >= 0 && functions.GEN_STRCMP(Site, SITE_HI) <= 0) {
                functions.GEN_STRCPY(Site_Hist, SITE_LO)
                functions.GEN_STRCAT(Site_Hist, Hist)
            }
            else {
                if (!functions.GEN_EMPTY(untrimmedline.schemaDiscriminator2))
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Schema Discriminator 2 not required and must be blank for Primary Site: ${untrimmedline.primarySite}')
                return true
            }
        }
        else {
            if (!functions.GEN_EMPTY(untrimmedline.schemaDiscriminator2))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Schema Discriminator 2 not required and must be blank for Primary Site: ${untrimmedline.primarySite}')
            return true
        }
        if (functions.GEN_SQLRANGELOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_DISCRIM2SEER, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_DISCRIM2SEER_SITELOWHISTLOW, Site_Hist, ['GPCODE':GPCODE, 'SITELOW':SITELOW, 'HISTLOW':HISTLOW, 'HISTHIGH':HISTHIGH, 'SCDSCR2':SCDSCR2])) {
            if (functions.GEN_STRCMP(SITE_LO, SITELOW) == 0 && functions.GEN_STRCMP(Hist, HISTLOW) >= 0 && functions.GEN_STRCMP(Hist, HISTHIGH) <= 0) {
                functions.GEN_STRCPY(Site_Hist, SITE_LO)
                functions.GEN_STRCAT(Site_Hist, HISTLOW)
                functions.GEN_STRCAT(Site_Hist, untrimmedline.schemaDiscriminator2)
            }
            else {
                if (!functions.GEN_EMPTY(untrimmedline.schemaDiscriminator2))
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Schema Discriminator 2 not required and must be blank for combination of Primary Site: ${untrimmedline.primarySite} and Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3}')
                return true
            }
        }
        else {
            if (!functions.GEN_EMPTY(untrimmedline.schemaDiscriminator2))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Schema Discriminator 2 not required and must be blank for combination of Primary Site: ${untrimmedline.primarySite} and Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3}')
            return true
        }
        if (functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_DISCRIM2SEER, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_DISCRIM2SEER_SITELOWHISTLOWSCDSCR2, Site_Hist, ['GPCODE':GPCODE, 'SITELOW':SITELOW, 'HISTLOW':HISTLOW, 'HISTHIGH':HISTHIGH, 'SCDSCR2':SCDSCR2]))
            functions.GEN_STRCPY(group, GPCODE)
        else {
            if ((functions.GEN_AT(Site, "C111") != 0 && functions.GEN_AT(untrimmedline.schemaId, "00090") != 0) || (functions.GEN_AT(Site, "C160") != 0 && functions.GEN_AT(untrimmedline.histologicTypeIcdO3, "8020") != 0 && functions.GEN_AT(untrimmedline.schemaId, "00170") != 0)) {
                if (functions.GEN_EMPTY(untrimmedline.schemaDiscriminator2))
                    return true
            }
            else
                functions.GEN_STRCPY(flag, "99")
        }
        if (functions.GEN_AT(flag, "99") != 0) {
            if (functions.GEN_EMPTY(untrimmedline.schemaDiscriminator2))
                functions.GEN_SAVE_TEXT(binding, 'Combination of site, histology requires Schema Disc 2 for correct Schema ID')
            if (!functions.GEN_EMPTY(untrimmedline.schemaDiscriminator2))
                functions.GEN_SAVE_TEXT(binding, 'Reported value Schema Disc 2 incorrect for combination of site, histology')
        }
        if (functions.GEN_AT(flag, "00") != 0 && functions.GEN_AT(group, "00000") == 0) {
        
        
            if (functions.GEN_AT(group, "0010000111", 5) != 0 && functions.GEN_AT(untrimmedline.primarySite, "C111") != 0) {
                if (functions.GEN_AT(untrimmedline.schemaId, "0010000111", 5) != 0)
                    return true
            }
            if (functions.GEN_AT(group, "0016100169", 5) != 0 && functions.GEN_AT(untrimmedline.primarySite, "C160") != 0 && functions.GEN_AT(untrimmedline.histologicTypeIcdO3, "8020") != 0) {
                if (functions.GEN_AT(untrimmedline.schemaId, "0016100169", 5) != 0)
                    return true
            }
            if (functions.GEN_STRCMP(untrimmedline.schemaId, group) != 0) {
                functions.GEN_STRCPY(t_schema_msg, "Schema Discriminator 2 is incorrect for reported Schema ID: ")
                functions.GEN_STRCAT(t_schema_msg, untrimmedline.schemaId)
                functions.GEN_SAVE_TEXT(binding, t_schema_msg)
            }
        }
        return true

    }

    // ID: NPCR-00093; TAG: N6131; NAME: Schema ID, Site, Histo, Schema Discriminator 1 (NPCR)
    public boolean npcr00093(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] SITELOW = new char[5], HISTLOW = new char[5], HISTHIGH = new char[5], GPCODE = new char[6], GPNAME = new char[31], SCDSCR1 = new char[2]
        char[] SITE_LO = new char[5], SITE_HI = new char[5]
        
        int dx_year
        
        char[] SiteGrp = new char[5]
        char[] Site = new char[5]
        char[] Hist = new char[5]
        char[] t_schema_msg = new char[100]
        
        char[] group = new char[5]
        
        char[] flag = new char[2]
        functions.GEN_STRCPY(flag, "00")
        functions.GEN_STRCPY(group, "00000")
        
        char[] Site_Hist = new char[30]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018)
            return true
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        if (functions.GEN_EMPTY(untrimmedline.primarySite)) {
            return true
        }
        if (functions.GEN_AT(untrimmedline.schemaId, "00430007300074000821", 5) != 0) {
            if (functions.GEN_EMPTY(untrimmedline.schemaDiscriminator1))
                return true
        }
        functions.GEN_STRCPY(Site, untrimmedline.primarySite)
        functions.GEN_STRCPY(Hist, untrimmedline.histologicTypeIcdO3)
        
        
        if (functions.GEN_SQLRANGELOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_DISC1SEER_REF, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_DISC1SEER_REF_SITE_LO, Site, ['SITE_LO':SITE_LO, 'SITE_HI':SITE_HI])) {
        
            if (functions.GEN_STRCMP(Site, SITE_LO) >= 0 && functions.GEN_STRCMP(Site, SITE_HI) <= 0) {
                functions.GEN_STRCPY(Site_Hist, SITE_LO)
                functions.GEN_STRCAT(Site_Hist, Hist)
            }
            else {
                if (!functions.GEN_EMPTY(untrimmedline.schemaDiscriminator1))
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Schema Discriminator 1 not required and must be blank for Primary Site: ${untrimmedline.primarySite}')
                return true
            }
        }
        else {
            if (!functions.GEN_EMPTY(untrimmedline.schemaDiscriminator1))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Schema Discriminator 1 not required and must be blank for Primary Site: ${untrimmedline.primarySite}')
            return true
        }
        if (functions.GEN_SQLRANGELOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_DISCRIM1SEER, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_DISCRIM1SEER_SITELOWHISTLOW, Site_Hist, ['GPCODE':GPCODE, 'SITELOW':SITELOW, 'HISTLOW':HISTLOW, 'HISTHIGH':HISTHIGH, 'SCDSCR1':SCDSCR1])) {
            if (functions.GEN_STRCMP(SITE_LO, SITELOW) == 0 && functions.GEN_STRCMP(Hist, HISTLOW) >= 0 && functions.GEN_STRCMP(Hist, HISTHIGH) <= 0) {
                functions.GEN_STRCPY(Site_Hist, SITE_LO)
                functions.GEN_STRCAT(Site_Hist, HISTLOW)
                functions.GEN_STRCAT(Site_Hist, untrimmedline.schemaDiscriminator1)
            }
            else {
                if (!functions.GEN_EMPTY(untrimmedline.schemaDiscriminator1))
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Schema Discriminator 1 not required and must be blank for combination of Primary Site: ${untrimmedline.primarySite} and Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3}')
                return true
            }
        }
        else {
            if (!functions.GEN_EMPTY(untrimmedline.schemaDiscriminator1))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Schema Discriminator 1 not required and must be blank for combination of Primary Site: ${untrimmedline.primarySite} and Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3}')
            return true
        }
        if (functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_DISCRIM1SEER, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_DISCRIM1SEER_SITELOWHISTLOWSCDSCR1, Site_Hist, ['GPCODE':GPCODE, 'SITELOW':SITELOW, 'HISTLOW':HISTLOW, 'HISTHIGH':HISTHIGH, 'SCDSCR1':SCDSCR1]))
            functions.GEN_STRCPY(group, GPCODE)
        else
            functions.GEN_STRCPY(flag, "99")
        if (functions.GEN_AT(flag, "99") != 0) {
            if (functions.GEN_EMPTY(untrimmedline.schemaDiscriminator1))
                functions.GEN_SAVE_TEXT(binding, 'Combination of site, histology requires Schema Disc 1 for correct Schema ID')
            if (!functions.GEN_EMPTY(untrimmedline.schemaDiscriminator1))
                functions.GEN_SAVE_TEXT(binding, 'Reported value Schema Disc 1 incorrect for combination of site and histology')
        }
        if (functions.GEN_AT(flag, "00") != 0 && functions.GEN_AT(group, "00000") == 0) {
        
            if (functions.GEN_AT(group, "0010000111", 5) != 0) {
                if (functions.GEN_AT(untrimmedline.schemaId, "0010000111", 5) != 0)
                    return true
            }
            if (functions.GEN_AT(group, "0016100169", 5) != 0 && functions.GEN_AT(untrimmedline.histologicTypeIcdO3, "8020") != 0) {
                if (functions.GEN_AT(untrimmedline.schemaId, "0016100169", 5) != 0)
                    return true
            }
            if (functions.GEN_STRCMP(untrimmedline.schemaId, group) != 0) {
                functions.GEN_STRCPY(t_schema_msg, "Schema Discriminator 1 is incorrect for Reported Schema ID: ")
                functions.GEN_STRCAT(t_schema_msg, untrimmedline.schemaId)
                functions.GEN_SAVE_TEXT(binding, t_schema_msg)
            }
        }
        return true

    }

    // ID: NPCR-00101; TAG: N1616; NAME: Summ Stg 2000, Site, Hist ICDO3, Rpt Srce (NAACCR)
    public boolean npcr00101(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (functions.GEN_EMPTY(untrimmedline.seerSummaryStage2000) || functions.GEN_EMPTY(untrimmedline.primarySite) || functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3) || functions.GEN_EMPTY(untrimmedline.typeOfReportingSource))
            return true
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1"))
            return true
        if (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "7")) {
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "9"))
                return true
            else {
                return functions.GEN_ERROR_MSG(binding, 'Death Certificate Only; SEER Summary Stage 2000 must = 9')
            }
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9699,9702-9729,9735,9738, 9811-9818,9837") && !functions.GEN_INLIST(untrimmedline.primarySite, "441,690,695-696", "(C\\d\\d\\d)", 2, 3)) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "778", "(C\\d\\d\\d)", 2, 3)) {
                if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "5,7,9"))
                    return true
                else
                    return functions.GEN_ERROR_MSG(binding, 'If Primary Site = ${untrimmedline.primarySite} and Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, SEER Summary Stage 2000 must = 5, 7, or 9')
            }
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "1,5,7,9"))
                return true
            else
                return functions.GEN_ERROR_MSG(binding, 'If Primary Site = ${untrimmedline.primarySite} and Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, SEER Summary Stage 2000 must = 1, 5, 7, or 9')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9823,9827") && !functions.GEN_INLIST(untrimmedline.primarySite, "420,421,424,441,690,695-696", "(C\\d\\d\\d)", 2, 3)) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "778", "(C\\d\\d\\d)", 2, 3)) {
                if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "5,7,9"))
                    return true
                else
                    return functions.GEN_ERROR_MSG(binding, 'If Primary Site = ${untrimmedline.primarySite} and Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, SEER Summary Stage 2000 must = 5, 7, or 9')
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "1,5,7,9"))
                    return true
                else
                    return functions.GEN_ERROR_MSG(binding, 'If Primary Site = ${untrimmedline.primarySite} and Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, SEER Summary Stage 2000 must = 1, 5, 7, or 9')
            }
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9699,9702-9738,9811-9818, 9820-9837") && functions.GEN_INLIST(untrimmedline.primarySite, "441,690,695-696", "(C\\d\\d\\d)", 2, 3)) {
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "1,5,7,9"))
                return true
            else
                return functions.GEN_ERROR_MSG(binding, 'If Primary Site = ${untrimmedline.primarySite} and Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, SEER Summary Stage 2000 must = 1, 5, 7, or 9')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9731")) {
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "1,7,9"))
                return true
            else
                return functions.GEN_ERROR_MSG(binding, 'If Primary Site = ${untrimmedline.primarySite} and Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, SEER Summary Stage 2000 must = 1, 7, or 9')
        }
        else {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9732")) {
                if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "7"))
                    return true
                else
                    return functions.GEN_ERROR_MSG(binding, 'If Primary Site = ${untrimmedline.primarySite} and Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, SEER Summary Stage 2000 must = 7')
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9734")) {
                    if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "1,5,7,9"))
                        return true
                    else
                        return functions.GEN_ERROR_MSG(binding, 'If Primary Site = ${untrimmedline.primarySite} and Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, SEER Summary Stage 2000 must = 1, 5, 7, or 9')
                }
            }
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9740,9750-9752,9755-9758,9930")) {
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "1,7,9"))
                return true
            else
                return functions.GEN_ERROR_MSG(binding, 'If Primary Site = ${untrimmedline.primarySite} and Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, SEER Summary Stage 2000 must = 1, 7, or 9')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9764")) {
            if (dx_year < 2010) {
                if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "1,7,9"))
                    return true
                else
                    return functions.GEN_ERROR_MSG(binding, 'If year of Date of Diagnosis < 2010, Primary Site = ${untrimmedline.primarySite} and Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, SEER Summary Stage 2000 must = 1, 7, or 9')
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "7"))
                    return true
                else
                    return functions.GEN_ERROR_MSG(binding, 'If year of Date of Diagnosis > 2009,Primary Site = ${untrimmedline.primarySite} and Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, SEER Summary Stage 2000 must = 7')
            }
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9731-9992")) {
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "7"))
                return true
            else
                return functions.GEN_ERROR_MSG(binding, 'If Primary Site = ${untrimmedline.primarySite} and Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, SEER Summary Stage 2000 must = 7')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9140")) {
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "1-4,7,9"))
                return true
            else
                return functions.GEN_ERROR_MSG(binding, 'If Primary Site = ${untrimmedline.primarySite} and Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, SEER Summary Stage 2000 must = 1-4, 7, or 9')
        }
        if (functions.GEN_INLIST(untrimmedline.primarySite, "440-449,510-512,518-519,600-601,608-609,632", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9700-9701")) {
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "1-5,7,9"))
                return true
            else
                return functions.GEN_ERROR_MSG(binding, 'If Primary Site = ${untrimmedline.primarySite} and Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, SEER Summary Stage 2000 must = 1-5, 7, or 9')
        }
        if (functions.GEN_INLIST(untrimmedline.primarySite, "692,699", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9510-9514")) {
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "1-5,7,9"))
                return true
            else
                return functions.GEN_ERROR_MSG(binding, 'If Primary Site = ${untrimmedline.primarySite} and Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, SEER Summary Stage 2000 must = 1-5, 7, or 9')
        }
        if (functions.GEN_INLIST(untrimmedline.primarySite, "380-384,388,390-399,470-479,480-488,490-499", "(C\\d\\d\\d)", 2, 3)) {
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "1-5,7,9"))
                return true
            else
                return functions.GEN_ERROR_MSG(binding, 'If Primary Site = ${untrimmedline.primarySite} and Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, SEER Summary Stage 2000 must = 1-5, 7, or 9')
        }
        if (functions.GEN_INLIST(untrimmedline.primarySite, "400-403,408-409,410-414,418-419", "(C\\d\\d\\d)", 2, 3)) {
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "1-5,7,9"))
                return true
            else
                return functions.GEN_ERROR_MSG(binding, 'If Primary Site = ${untrimmedline.primarySite} and Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, SEER Summary Stage 2000 must = 1-5, 7, or 9')
        }
        if (functions.GEN_INLIST(untrimmedline.primarySite, "700-729", "(C\\d\\d\\d)", 2, 3)) {
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "1,5,7,9"))
                return true
            else
                return functions.GEN_ERROR_MSG(binding, 'If Primary Site = ${untrimmedline.primarySite} and Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, SEER Summary Stage 2000 must = 1, 5, 7, or 9')
        }
        if (functions.GEN_INLIST(untrimmedline.primarySite, "751-753", "(C\\d\\d\\d)", 2, 3)) {
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "0-2,5,7,9"))
                return true
            else
                return functions.GEN_ERROR_MSG(binding, 'If Primary Site = ${untrimmedline.primarySite} and Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, SEER Summary Stage 2000 must = 0-2, 5, 7, or 9')
        }
        if (functions.GEN_INLIST(untrimmedline.primarySite, "420-429,760-765,767,768,770-779,809", "(C\\d\\d\\d)", 2, 3)) {
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "9"))
                return true
            else
                return functions.GEN_ERROR_MSG(binding, 'Unknown or Ill-Defined Site; SEER Summary Stage 2000 must = 9')
        }
        if (functions.GEN_INLIST(untrimmedline.primarySite, "50", "(C\\d\\d\\d)", 2, 2) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8530")) {
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "2,4,5,7,9"))
                return true
            else
                return functions.GEN_ERROR_MSG(binding, 'If Primary Site = ${untrimmedline.primarySite} and Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, SEER Summary Stage 2000 must = 2, 4, 5, 7, or 9')
        }
        if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "0-5,7,9"))
            return true
        else
            return functions.GEN_ERROR_MSG(binding, 'If Primary Site = ${untrimmedline.primarySite} and Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, SEER Summary Stage 2000 must = 0-5, 7, or 9')
        return true

    }

    // ID: NPCR-00104; TAG: 1799; NAME: County at DX, Addr at DX--State (Subm)
    public boolean npcr00104(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] cnty_state = new char[6]
        
        if (functions.GEN_EMPTY(untrimmedline.countyAtDx) || functions.GEN_EMPTY(untrimmedline.addrAtDxState))
            return true
        if (functions.GEN_INLIST(untrimmedline.countyAtDx, "000"))
            return true
        if (functions.GEN_INLIST(untrimmedline.addrAtDxState, "CD,US,XX,YY,ZZ"))
            return true
        if (functions.GEN_INLIST(untrimmedline.addrAtDxState, "AB,BC,MB,NB,NL,NT,NS,NU,ON,PE,QC,SK,YT"))
            return true
        if (functions.GEN_INLIST(untrimmedline.addrAtDxState, "AA,AE,AP"))
            return true
        functions.GEN_STRCPY(cnty_state, untrimmedline.countyAtDx)
        functions.GEN_STRCAT(cnty_state, untrimmedline.addrAtDxState)
        
        if (functions.GEN_LOOKUP(cnty_state, context.NPCR_CNTYALL, context.NPCR_CNTYALL_CNTYSTAT, [:]))
            return true
        return false

    }

    // ID: NPCR-00105; TAG: N0176; NAME: Census Tract 2000 (SEER)
    public boolean npcr00105(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.censusTract2000))
            return true
        if (!functions.GEN_INLIST(untrimmedline.censusTract2000, "000000, 000100-999999", "(\\d\\d\\d\\d\\d\\d)"))
            return false
        return true

    }

    // ID: NPCR-00107; TAG: 2104; NAME: CS Items - NPCR Required - SSF 1 (Subm) - 2016+
    public boolean npcr00107(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] schema = new char[100], SSF1_NPCR = new char[100]
        char[] t_site = new char[5], t_hist = new char[5], t_discrim = new char[4], t_schema_name = new char[31], t_schema_msg = new char[79]
        int t_schema_number, t_max_schemas, t_result
        int dx_year
        
        functions.GEN_ALLOW_FUTURE_DATE_IOP(binding, 1)
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2016 || dx_year > 2017)
            return true
        if (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "6,7"))
            return true
        functions.GEN_STRCPY(t_site, untrimmedline.primarySite)
        functions.GEN_STRCPY(t_hist, untrimmedline.histologicTypeIcdO3)
        
        t_max_schemas = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_number_of_schemas")
        
        t_schema_number = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_number", t_site, t_hist, t_discrim)
        
        if (t_schema_number < 0)
            return true
        if (t_schema_number > t_max_schemas) {
            return true
        }
        functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_name", t_schema_number, t_schema_name)
        
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1,")) {
            if (!functions.GEN_INLIST(t_schema_name, "Brain,CNSOther,IntracranialGland"))
                return true
        }
        if (dx_year > 2015) {
            if ((functions.GEN_INLIST(untrimmedline.csSiteSpecificFactor1, "988") || (functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor1))) && (functions.GEN_INLIST(t_schema_name, "Breast,Brain,IntracranialGland,CNSOther")))
                return functions.GEN_ERROR_MSG(binding, 'If year of Date of Diagnosis is 2016 or later, CS Site-Specific Factor 1 cannot be 988 or blank')
        }
        return true

    }

    // ID: NPCR-00108; TAG: N3022; NAME: Brain Molecular Markers, Schema ID, Required (NAACCR)
    public boolean npcr00108(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.schemaId))
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0)
            return true
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2018)
            return true
        char[] ID = new char[14]
        char[] ID2 = new char[25]
        char[] code = new char[7]
        
        
        functions.GEN_STRCPY(ID, "00721 00722 ")
        functions.GEN_STRCPY(ID2, "09721 09722 09724 ")
        
        
        functions.GEN_STRCPY(code, untrimmedline.schemaId)
        functions.GEN_STRCAT(code, " ")
        
        if (functions.GEN_AT(code, ID, 6) != 0) {
            if (functions.GEN_EMPTY(untrimmedline.brainMolecularMarkers) || functions.GEN_AT(untrimmedline.brainMolecularMarkers, "88") != 0)
                return false
        }
        if (functions.GEN_AT(code, ID2, 6) != 0) {
            if (functions.GEN_EMPTY(untrimmedline.brainMolecularMarkers) || functions.GEN_AT(untrimmedline.brainMolecularMarkers, "88") != 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Brain Molecular Markers must not be blank or not applicable for Schema ID: ${untrimmedline.schemaId} cases diagnosed 2023 and later')
        }
        return true

    }

    // ID: NPCR-00109; TAG: 1801; NAME: CS Items - NPCR Required - SSF 1 (Subm) - pre2016
    public boolean npcr00109(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] t_site = new char[5], t_hist = new char[5], t_discrim = new char[4], t_schema_name = new char[31], t_schema_msg = new char[79]
        int t_schema_number, t_max_schemas, t_result
        char[] t_schema_str = new char[4]
        int dx_year, err_flag
        
        err_flag = 0
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2004 || dx_year > 2015)
            return true
        if (functions.GEN_INLIST(untrimmedline.overRideCs20, "1") && (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "3-7")))
            return true
        functions.GEN_STRCPY(t_site, untrimmedline.primarySite)
        functions.GEN_STRCPY(t_hist, untrimmedline.histologicTypeIcdO3)
        
        t_max_schemas = functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_get_number_of_schemas")
        
        t_schema_number = functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_get_schema_number", t_site, t_hist, t_discrim)
        
        if (t_schema_number < 0)
            return true
        if (t_schema_number > t_max_schemas) {
            return true
        }
        functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_get_schema_name", t_schema_number, t_schema_name)
        
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1,")) {
            if (!functions.GEN_INLIST(t_schema_name, "Brain,CNSOther,IntracranialGland"))
                return true
        }
        if (functions.GEN_EMPTY(untrimmedline.overRideCs20)) {
        
            if (dx_year > 2009) {
                if (functions.GEN_INLIST(t_schema_name, "Breast")) {
                    if (functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor1) || functions.GEN_INLIST(untrimmedline.csSiteSpecificFactor1, "988")) {
                        functions.GEN_STRCPY(t_schema_msg, "Schema: ")
                        functions.GEN_STRCAT(t_schema_msg, t_schema_name)
                        functions.GEN_SAVE_TEXT(binding, t_schema_msg)
                        functions.GEN_SAVE_ERROR_TEXT(binding, 'If DX year = 2010-2015, CS Site-Specific Factor 1 cannot be blank or 988 for this schema')
                    }
                }
            }
            if (dx_year > 2010) {
                if (functions.GEN_INLIST(t_schema_name, "Brain,CNSOther,IntracranialGland")) {
                    if (functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor1) || functions.GEN_INLIST(untrimmedline.csSiteSpecificFactor1, "988")) {
                        functions.GEN_STRCPY(t_schema_msg, "Schema: ")
                        functions.GEN_STRCAT(t_schema_msg, t_schema_name)
                        functions.GEN_SAVE_TEXT(binding, t_schema_msg)
                        functions.GEN_SAVE_ERROR_TEXT(binding, 'If DX year = 2011-2015, CS Site-Specific Factor 1 cannot be blank or 988 for this schema')
                    }
                }
            }
        }
        else {
            if ((dx_year > 2011) && (dx_year < 2016) && (functions.GEN_INLIST(untrimmedline.overRideCs20, "1"))) {
                if (functions.GEN_INLIST(t_schema_name, "Breast,Brain,CNSOther,IntracranialGland")) {
                    if (functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor1) || functions.GEN_INLIST(untrimmedline.csSiteSpecificFactor1, "988")) {
                        functions.GEN_STRCPY(t_schema_msg, "Schema: ")
                        functions.GEN_STRCAT(t_schema_msg, t_schema_name)
                        functions.GEN_SAVE_TEXT(binding, t_schema_msg)
                        functions.GEN_SAVE_ERROR_TEXT(binding, 'If Over-ride CS 20 = \'1\' and Type of Reporting Source = ${untrimmedline.typeOfReportingSource}, CS Site-Specific Factor 1 must not be blank or 988 for this schema')
                    }
                }
            }
        }
        return true

    }

    // ID: NPCR-00115; TAG: N0832; NAME: ICD Revision Number (NPCR)
    public boolean npcr00115(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        return functions.GEN_INLIST(untrimmedline.icdRevisionNumber, "0-1,7-9")

    }

    // ID: NPCR-00119; TAG: 2110; NAME: CS Items - NPCR Required - SSF 15 (Subm) - 2016+
    public boolean npcr00119(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] schema = new char[100], SSF15_NPCR = new char[100]
        char[] t_site = new char[5], t_hist = new char[5], t_discrim = new char[4], t_schema_name = new char[31], t_schema_msg = new char[79]
        int t_schema_number, t_max_schemas, t_result
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2016 || dx_year > 2017)
            return true
        if (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "6,7"))
            return true
        functions.GEN_STRCPY(t_site, untrimmedline.primarySite)
        functions.GEN_STRCPY(t_hist, untrimmedline.histologicTypeIcdO3)
        
        t_max_schemas = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_number_of_schemas")
        
        t_schema_number = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_number", t_site, t_hist, t_discrim)
        
        if (t_schema_number < 0)
            return true
        if (t_schema_number > t_max_schemas) {
            return true
        }
        functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_name", t_schema_number, t_schema_name)
        
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1,")) {
            if (!functions.GEN_INLIST(t_schema_name, "Brain,CNSOther,IntracranialGland"))
                return true
        }
        if ((functions.GEN_INLIST(untrimmedline.csSiteSpecificFactor15, "988") || (functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor15))) && (functions.GEN_INLIST(t_schema_name, "Breast")))
            return functions.GEN_ERROR_MSG(binding, 'If year of Date of Diagnosis is 2016 or later, CS Site-Specific Factor15 cannot be 988 or blank')
        
        return true

    }

    // ID: NPCR-00121; TAG: 1802; NAME: CS Items - NPCR Required - SSF 15 (Subm) - pre2016
    public boolean npcr00121(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] t_site = new char[5], t_hist = new char[5], t_discrim = new char[4], t_schema_name = new char[31], t_schema_msg = new char[79]
        int t_schema_number, t_max_schemas, t_result
        char[] t_schema_str = new char[4]
        int dx_year, err_flag
        
        err_flag = 0
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2004 || dx_year > 2015)
            return true
        if (functions.GEN_INLIST(untrimmedline.overRideCs20, "1") && (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "3-7")))
            return true
        functions.GEN_STRCPY(t_site, untrimmedline.primarySite)
        functions.GEN_STRCPY(t_hist, untrimmedline.histologicTypeIcdO3)
        
        t_max_schemas = functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_get_number_of_schemas")
        
        t_schema_number = functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_get_schema_number", t_site, t_hist, t_discrim)
        
        if (t_schema_number < 0)
            return true
        if (t_schema_number > t_max_schemas) {
            return true
        }
        functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_get_schema_name", t_schema_number, t_schema_name)
        
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1,"))
            return true
        if (dx_year > 2010 && functions.GEN_EMPTY(untrimmedline.overRideCs20)) {
            if (functions.GEN_INLIST(t_schema_name, "Breast")) {
                if (functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor15) || functions.GEN_INLIST(untrimmedline.csSiteSpecificFactor15, "988")) {
                    functions.GEN_STRCPY(t_schema_msg, "Schema: ")
                    functions.GEN_STRCAT(t_schema_msg, t_schema_name)
                    functions.GEN_SAVE_TEXT(binding, t_schema_msg)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'If DX year = 2011-2015, CS Site-Specific Factor15 cannot be blank or 988 for this schema')
                }
            }
        }
        else {
            if ((dx_year > 2011) && (dx_year < 2016) && (functions.GEN_INLIST(untrimmedline.overRideCs20, "1"))) {
                if (functions.GEN_INLIST(t_schema_name, "Breast")) {
                    if (functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor15) || functions.GEN_INLIST(untrimmedline.csSiteSpecificFactor15, "988")) {
                        functions.GEN_STRCPY(t_schema_msg, "Schema: ")
                        functions.GEN_STRCAT(t_schema_msg, t_schema_name)
                        functions.GEN_SAVE_TEXT(binding, t_schema_msg)
                        functions.GEN_SAVE_ERROR_TEXT(binding, 'If Over-ride CS 20 = \'1\' and Type of Reporting Source = ${untrimmedline.typeOfReportingSource}, CS Site-Specific Factor15 must not be blank or 988 for this schema')
                    }
                }
            }
        }
        return true

    }

    // ID: NPCR-00122; TAG: N0837; NAME: Behavior ICDO3 Conversion (NAACCR)
    public boolean npcr00122(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        return functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0-3")

    }

    // ID: NPCR-00123; TAG: 2107; NAME: CS Items - NPCR Required - SSF 2 (Subm) - 2016+
    public boolean npcr00123(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] schema = new char[100], SSF1_NPCR = new char[100]
        char[] t_site = new char[5], t_hist = new char[5], t_discrim = new char[4], t_schema_name = new char[31], t_schema_msg = new char[79]
        int t_schema_number, t_max_schemas, t_result
        int dx_year
        
        functions.GEN_ALLOW_FUTURE_DATE_IOP(binding, 1)
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2016 || dx_year > 2017)
            return true
        if (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "6,7"))
            return true
        functions.GEN_STRCPY(t_site, untrimmedline.primarySite)
        functions.GEN_STRCPY(t_hist, untrimmedline.histologicTypeIcdO3)
        
        t_max_schemas = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_number_of_schemas")
        
        t_schema_number = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_number", t_site, t_hist, t_discrim)
        
        if (t_schema_number < 0)
            return true
        if (t_schema_number > t_max_schemas) {
            return true
        }
        functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_name", t_schema_number, t_schema_name)
        
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1,")) {
            if (!functions.GEN_INLIST(t_schema_name, "Brain,CNSOther,IntracranialGland"))
                return true
        }
        if (dx_year > 2015) {
            if ((functions.GEN_INLIST(untrimmedline.csSiteSpecificFactor2, "988") || (functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor2))) && (functions.GEN_INLIST(t_schema_name, "Breast")))
                return functions.GEN_ERROR_MSG(binding, 'If year of Date of Diagnosis is 2016 or later, CS Site-Specific Factor 2 cannot be 988 or blank')
        }
        return true

    }

    // ID: NPCR-00124; TAG: N0838; NAME: Behavior ICDO3, Summary Stage 1977 (NAACCR)
    public boolean npcr00124(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.seerSummaryStage1977))
            return true
        if (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "7"))
            return true
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "2")) {
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage1977, "0"))
                return true
            else
                return false
        }
        else {
            if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "3")) {
                if (!functions.GEN_INLIST(untrimmedline.seerSummaryStage1977, "0"))
                    return true
                else
                    return false
            }
        }
        return true

    }

    // ID: NPCR-00125; TAG: 1803; NAME: CS Items - NPCR Required - SSF 2 (Subm) - pre2016
    public boolean npcr00125(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] t_site = new char[5], t_hist = new char[5], t_discrim = new char[4], t_schema_name = new char[31], t_schema_msg = new char[79]
        int t_schema_number, t_max_schemas, t_result
        char[] t_schema_str = new char[4]
        int dx_year, err_flag
        
        err_flag = 0
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2004 || dx_year > 2015)
            return true
        if (functions.GEN_INLIST(untrimmedline.overRideCs20, "1") && (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "3-7")))
            return true
        functions.GEN_STRCPY(t_site, untrimmedline.primarySite)
        functions.GEN_STRCPY(t_hist, untrimmedline.histologicTypeIcdO3)
        
        t_max_schemas = functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_get_number_of_schemas")
        
        t_schema_number = functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_get_schema_number", t_site, t_hist, t_discrim)
        
        if (t_schema_number < 0)
            return true
        if (t_schema_number > t_max_schemas) {
            return true
        }
        functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_get_schema_name", t_schema_number, t_schema_name)
        
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1,"))
            return true
        if (dx_year > 2009 && functions.GEN_EMPTY(untrimmedline.overRideCs20)) {
            if (functions.GEN_INLIST(t_schema_name, "Breast")) {
                if (functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor2) || functions.GEN_INLIST(untrimmedline.csSiteSpecificFactor2, "988")) {
                    functions.GEN_STRCPY(t_schema_msg, "Schema: ")
                    functions.GEN_STRCAT(t_schema_msg, t_schema_name)
                    functions.GEN_SAVE_TEXT(binding, t_schema_msg)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'If DX year = 2010-2015, CS Site-Specific Factor 2 cannot be blank or 988 for this schema')
                }
            }
        }
        else {
            if ((dx_year > 2011) && (dx_year < 2016) && (functions.GEN_INLIST(untrimmedline.overRideCs20, "1"))) {
                if (functions.GEN_INLIST(t_schema_name, "Breast")) {
                    if (functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor2) || functions.GEN_INLIST(untrimmedline.csSiteSpecificFactor2, "988")) {
                        functions.GEN_STRCPY(t_schema_msg, "Schema: ")
                        functions.GEN_STRCAT(t_schema_msg, t_schema_name)
                        functions.GEN_SAVE_TEXT(binding, t_schema_msg)
                        functions.GEN_SAVE_ERROR_TEXT(binding, 'If Over-ride CS 20 = \'1\' and Type of Reporting Source = ${untrimmedline.typeOfReportingSource}, CS Site-Specific Factor 2 must not be blank or 988 for this schema')
                    }
                }
            }
        }
        return true

    }

    // ID: NPCR-00126; TAG: N0839; NAME: Hemato ICDO3, Summ Stg 1977 (NAACCR)
    public boolean npcr00126(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.seerSummaryStage1977))
            return true
        if (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "7"))
            return true
        if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9731-9989"))
            return true
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9731,9734,9740,9750-9752,9755-9758,9764,9930")) {
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage1977, "1,7,9"))
                return true
            else
                return functions.GEN_ERROR_MSG(binding, 'SEER Summary Stage must = 1, 7, or 9 for this histology')
        }
        else {
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage1977, "7"))
                return true
            else
                return functions.GEN_ERROR_MSG(binding, 'SEER Summary Stage must = 7 for this histology')
        }
        return true

    }

    // ID: NPCR-00127; TAG: N3032; NAME: Brain Molecular Markers, Morphology ICD-O-3 (NAACCR)
    public boolean npcr00127(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        char[] morph = new char[6]
        
        char[] ID = new char[40]
        char[] code = new char[7]
        
        functions.GEN_ALLOW_FUTURE_DATE_IOP(binding, 2)
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018)
            return true
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3) || functions.GEN_EMPTY(untrimmedline.behaviorCodeIcdO3))
            return true
        functions.GEN_STRCPY(morph, untrimmedline.histologicTypeIcdO3)
        functions.GEN_STRCAT(morph, untrimmedline.behaviorCodeIcdO3)
        
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0) {
            return true
        }
        functions.GEN_STRCPY(ID, "00721 00722 09721 09722 09724 ")
        
        
        functions.GEN_STRCPY(code, untrimmedline.schemaId)
        functions.GEN_STRCAT(code, " ")
        
        if (functions.GEN_AT(code, ID, 6) == 0)
            return true
        if (functions.GEN_EMPTY(untrimmedline.brainMolecularMarkers) || functions.GEN_AT(untrimmedline.brainMolecularMarkers, "88") != 0)
            return true
        if (functions.GEN_AT(untrimmedline.brainMolecularMarkers, "0102", 2) != 0) {
            if (functions.GEN_AT(morph, "94003") == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} and Brain Molecular Markers: ${untrimmedline.brainMolecularMarkers}')
        }
        if (functions.GEN_AT(untrimmedline.brainMolecularMarkers, "0304", 2) != 0) {
            if (functions.GEN_AT(morph, "94013") == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} and Brain Molecular Markers: ${untrimmedline.brainMolecularMarkers}')
        }
        if (functions.GEN_AT(untrimmedline.brainMolecularMarkers, "05", 2) != 0) {
            if (functions.GEN_AT(morph, "94403") == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} and Brain Molecular Markers: ${untrimmedline.brainMolecularMarkers}')
        }
        if (functions.GEN_AT(untrimmedline.brainMolecularMarkers, "06", 2) != 0) {
            if (functions.GEN_AT(morph, "94503") == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} and Brain Molecular Markers: ${untrimmedline.brainMolecularMarkers}')
        }
        if (functions.GEN_AT(untrimmedline.brainMolecularMarkers, "07", 2) != 0) {
            if (functions.GEN_AT(morph, "94513") == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} and Brain Molecular Markers: ${untrimmedline.brainMolecularMarkers}')
        }
        if (functions.GEN_AT(untrimmedline.brainMolecularMarkers, "08", 2) != 0) {
            if (functions.GEN_AT(morph, "94713") == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} and Brain Molecular Markers: ${untrimmedline.brainMolecularMarkers}')
        }
        if (functions.GEN_AT(untrimmedline.brainMolecularMarkers, "09", 2) != 0) {
            if (functions.GEN_AT(morph, "94783") == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} and Brain Molecular Markers: ${untrimmedline.brainMolecularMarkers}')
        }
        if (functions.GEN_AT(untrimmedline.brainMolecularMarkers, "85", 2) != 0) {
            if (functions.GEN_INLIST(morph, "94003,94013,94403,94503,94513,94713,94783"))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} and Brain Molecular Markers: ${untrimmedline.brainMolecularMarkers}')
        }
        if (dx_year >= 2024) {
        
            if (functions.GEN_AT(untrimmedline.brainMolecularMarkers, "10111213", 2) != 0) {
                if (functions.GEN_AT(morph, "93853") == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} and Brain Molecular Markers: ${untrimmedline.brainMolecularMarkers}')
            }
            if (functions.GEN_AT(untrimmedline.brainMolecularMarkers, "1415161718", 2) != 0) {
                if (functions.GEN_AT(morph, "93963") == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} and Brain Molecular Markers: ${untrimmedline.brainMolecularMarkers}')
            }
            if (functions.GEN_AT(untrimmedline.brainMolecularMarkers, "1920", 2) != 0) {
                if (functions.GEN_AT(morph, "94211") == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} and Brain Molecular Markers: ${untrimmedline.brainMolecularMarkers}')
            }
            if (functions.GEN_AT(untrimmedline.brainMolecularMarkers, "21", 2) != 0) {
                if (functions.GEN_AT(morph, "94303") == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} and Brain Molecular Markers: ${untrimmedline.brainMolecularMarkers}')
            }
            if (functions.GEN_AT(untrimmedline.brainMolecularMarkers, "2223", 2) != 0) {
                if (functions.GEN_AT(morph, "95003") == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} and Brain Molecular Markers: ${untrimmedline.brainMolecularMarkers}')
            }
            if (functions.GEN_AT(untrimmedline.brainMolecularMarkers, "85", 2) != 0) {
                if (functions.GEN_INLIST(morph, "93853,93963,94211,94303,95003"))
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} and Brain Molecular Markers: ${untrimmedline.brainMolecularMarkers}')
            }
            if (functions.GEN_AT(morph, "94211") != 0) {
                if (functions.GEN_AT(untrimmedline.brainMolecularMarkers, "1920", 2) != 0)
                    return true
            }
        }
        if (functions.GEN_AT(untrimmedline.brainMolecularMarkers, "86") != 0) {
            if (functions.GEN_AT(untrimmedline.behaviorCodeIcdO3, "01", 1) == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between Behavior Code ICD-O-3: ${untrimmedline.behaviorCodeIcdO3} and Brain Molecular Markers: ${untrimmedline.brainMolecularMarkers}')
        }
        if (functions.GEN_AT(untrimmedline.behaviorCodeIcdO3, "01", 1) != 0) {
            if (functions.GEN_AT(untrimmedline.brainMolecularMarkers, "86") == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between Behavior Code ICD-O-3: ${untrimmedline.behaviorCodeIcdO3} and Brain Molecular Markers: ${untrimmedline.brainMolecularMarkers}')
        }
        return true

    }

    // ID: NPCR-00129; TAG: N0840; NAME: Histologic Type ICDO3 Conversion (NAACCR)
    public boolean npcr00129(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (!functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_HISICDO3, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_HISICDO3_HISTOLOGY, untrimmedline.histologicTypeIcdO3, [:]))
            return false
        return true

    }

    // ID: NPCR-00130; TAG: N1672; NAME: Birthplace--Country, Birthplace--State (NAACCR)
    public boolean npcr00130(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] cntry_state = new char[6]
        
        if (functions.GEN_EMPTY(untrimmedline.birthplaceCountry) || functions.GEN_EMPTY(untrimmedline.birthplaceState))
            return true
        if (functions.GEN_INLIST(untrimmedline.birthplaceState, "XX") && functions.GEN_INLIST(untrimmedline.birthplaceCountry, "ZZX"))
            return false
        functions.GEN_STRCPY(cntry_state, untrimmedline.birthplaceCountry)
        functions.GEN_STRCAT(cntry_state, untrimmedline.birthplaceState)
        
        if (!functions.GEN_LOOKUP(cntry_state, context.NPCR_CNTRY_ST, context.NPCR_CNTRY_ST_CNTRY_ST, [:]))
            return false
        
        return true

    }

    // ID: NPCR-00132; TAG: N0841; NAME: Lymphoma ICDO3, Site, Summ Stg 1977 (NAACCR)
    public boolean npcr00132(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.seerSummaryStage1977))
            return true
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9699, 9702-9729")) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "770-779", "(C\\d\\d\\d)", 2, 3)) {
                if (functions.GEN_INLIST(untrimmedline.seerSummaryStage1977, "3,4"))
                    return false
            }
            if (functions.GEN_INLIST(untrimmedline.primarySite, "778", "(C\\d\\d\\d)", 2, 3)) {
                if (functions.GEN_INLIST(untrimmedline.seerSummaryStage1977, "1"))
                    return false
            }
        }
        return true

    }

    // ID: NPCR-00133; TAG: N0842; NAME: Unknown Site, Hist ICDO3, Summ Stg 1977 (NAACCR)
    public boolean npcr00133(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.seerSummaryStage1977)) {
            return true
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9140,9590-9699,9702-9729,9731-9989"))
            return true
        if (functions.GEN_INLIST(untrimmedline.primarySite, "C809")) {
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage1977, "9"))
                return true
            else
                return false
        }
        return true

    }

    // ID: NPCR-00134; TAG: 1944; NAME: CS Over-ride CS 20, Date of Diagnosis (Subm)
    public boolean npcr00134(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR)) {
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        }
        if ((dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY)) || (dx_year < 2004)) {
            if (!functions.GEN_EMPTY(untrimmedline.overRideCs20))
                return functions.GEN_ERROR_MSG(binding, 'If DX Year less than 2004 or blank, Over-ride CS 20 must be blank')
        }
        if (dx_year > 2015) {
            if (!functions.GEN_EMPTY(untrimmedline.overRideCs20)) {
                return functions.GEN_ERROR_MSG(binding, 'If year of Date of Diagnosis is 2016 or later, Over-ride CS 20 must be blank')
            }
        }
        if (functions.GEN_INLIST(untrimmedline.registryId, "0012000000,0012100000,0012300000,0012300001,0012300002,0012300003,0012300004", "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)"))
            return true
        if (functions.GEN_INLIST(untrimmedline.registryId, "0012600000,0012900000,0013100000,0013900000", "(\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d)")) {
            return true
        }
        if (dx_year < 2012) {
            if (!functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "3-7")) {
                if (!functions.GEN_EMPTY(untrimmedline.overRideCs20))
                    return false
            }
        }
        return true

    }

    // ID: NPCR-00135; TAG: 1816; NAME: CS Over-rides (Subm)
    public boolean npcr00135(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.overRideCs20) || functions.GEN_INLIST(untrimmedline.overRideCs20, "1"))
            return true
        else
            return functions.GEN_SAVE_ERROR_TEXT(binding, 'Over-ride CS 20 must be blank or = 1')
        
        return true

    }

    // ID: NPCR-00136; TAG: N0199; NAME: Date 1st Crs RX COC, Date of Diagnosis (COC)
    public boolean npcr00136(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dtcmp
        
        if (functions.GEN_EMPTY(untrimmedline.date1stCrsRxCoc) || functions.GEN_EMPTY(untrimmedline.dateOfDiagnosis))
            return true
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.date1stCrsRxCoc, untrimmedline.dateOfDiagnosis, ((Integer)context.NPCR_GEN_DT_MIN))
        
        if (dtcmp == ((Integer)context.NPCR_GEN_DT_ERROR)) {
            if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.date1stCrsRxCoc))
                functions.GEN_ERROR_TEXT(binding, 'Date of 1st Crs RX--COC is invalid: %DC')
            else {
                if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfDiagnosis))
                    functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis is invalid: %DC')
            }
            return false
        }
        else {
            if (dtcmp >= 0)
                return true
            else
                return false
        }
        
        return true

    }

    // ID: NPCR-00137; TAG: 1805; NAME: CS Site-Specific Factor 1, Schema (Subm)
    public boolean npcr00137(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] t_site = new char[5], t_hist = new char[5], t_discrim = new char[4], t_schema_name = new char[31], t_schema_msg = new char[79]
        char[] CS_code = new char[4]
        int t_schema_number, t_max_schemas, t_result
        
        if (functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor1) || functions.GEN_EMPTY(untrimmedline.primarySite) || functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        functions.GEN_STRCPY(t_site, untrimmedline.primarySite)
        functions.GEN_STRCPY(t_hist, untrimmedline.histologicTypeIcdO3)
        
        t_max_schemas = functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_get_number_of_schemas")
        
        t_schema_number = functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_get_schema_number", t_site, t_hist, t_discrim)
        
        if (t_schema_number < 0)
            return true
        if (t_schema_number > t_max_schemas) {
            return true
        }
        functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_get_schema_name", t_schema_number, t_schema_name)
        
        if (!functions.GEN_INLIST(t_schema_name, "Breast,Prostate,Brain,CNSOther,IntracranialGland,Prostate"))
            return true
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1,")) {
            if (!functions.GEN_INLIST(t_schema_name, "Brain,CNSOther,IntracranialGland")) {
                return true
            }
        }
        functions.GEN_STRCPY(CS_code, untrimmedline.csSiteSpecificFactor1)
        
        t_result = functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_code_is_valid", t_schema_number, 10, 1, CS_code)
        
        if (t_result <= 0) {
            functions.GEN_STRCPY(t_schema_msg, "Schema: ")
            functions.GEN_STRCAT(t_schema_msg, t_schema_name)
            functions.GEN_SAVE_TEXT(binding, t_schema_msg)
            return false
        }
        
        return true

    }

    // ID: NPCR-00138; TAG: 1806; NAME: CS Site-Specific Factor 2, Schema (Subm)
    public boolean npcr00138(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] t_site = new char[5], t_hist = new char[5], t_discrim = new char[4], t_schema_name = new char[31], t_schema_msg = new char[79]
        char[] CS_code = new char[4]
        int t_schema_number, t_max_schemas, t_result
        
        if (functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor2) || functions.GEN_EMPTY(untrimmedline.primarySite) || functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        functions.GEN_STRCPY(t_site, untrimmedline.primarySite)
        functions.GEN_STRCPY(t_hist, untrimmedline.histologicTypeIcdO3)
        
        t_max_schemas = functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_get_number_of_schemas")
        
        t_schema_number = functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_get_schema_number", t_site, t_hist, t_discrim)
        
        if (t_schema_number < 0)
            return true
        if (t_schema_number > t_max_schemas) {
            return true
        }
        functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_get_schema_name", t_schema_number, t_schema_name)
        
        if (!functions.GEN_INLIST(t_schema_name, "Breast"))
            return true
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1,")) {
            if (!functions.GEN_INLIST(t_schema_name, "Brain,CNSOther,IntracranialGland")) {
                return true
            }
        }
        functions.GEN_STRCPY(CS_code, untrimmedline.csSiteSpecificFactor2)
        
        t_result = functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_code_is_valid", t_schema_number, 11, 1, CS_code)
        
        if (t_result <= 0) {
            functions.GEN_STRCPY(t_schema_msg, "Schema: ")
            functions.GEN_STRCAT(t_schema_msg, t_schema_name)
            functions.GEN_SAVE_TEXT(binding, t_schema_msg)
            return false
        }
        
        return true

    }

    // ID: NPCR-00139; TAG: N1678; NAME: Census Tr Poverty Indictr (SEER)
    public boolean npcr00139(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.censusTrPovertyIndictr))
            return true
        if (!functions.GEN_INLIST(untrimmedline.censusTrPovertyIndictr, "1-4,9"))
            return false
        
        return true

    }

    // ID: NPCR-00141; TAG: N2812; NAME: Summary Stage 2018 (NAACCR)
    public boolean npcr00141(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.summaryStage2018))
            return true
        if (functions.GEN_AT(untrimmedline.summaryStage2018, "01234789", 1) != 0)
            return true
        return false

    }

    // ID: NPCR-00142; TAG: 2024; NAME: CS Site-Specific Factor 8, Schema (Subm)
    public boolean npcr00142(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] t_site = new char[5], t_hist = new char[5], t_discrim = new char[4], t_schema_name = new char[31], t_schema_msg = new char[79]
        char[] CS_code = new char[4]
        int t_schema_number, t_max_schemas, t_result
        
        if (functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor8) || functions.GEN_EMPTY(untrimmedline.primarySite) || functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        functions.GEN_STRCPY(t_site, untrimmedline.primarySite)
        functions.GEN_STRCPY(t_hist, untrimmedline.histologicTypeIcdO3)
        
        t_max_schemas = functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_get_number_of_schemas")
        
        t_schema_number = functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_get_schema_number", t_site, t_hist, t_discrim)
        
        if (t_schema_number < 0)
            return true
        if (t_schema_number > t_max_schemas) {
            return true
        }
        functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_get_schema_name", t_schema_number, t_schema_name)
        
        if (!functions.GEN_INLIST(t_schema_name, "Prostate"))
            return true
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1,")) {
            return true
        }
        functions.GEN_STRCPY(CS_code, untrimmedline.csSiteSpecificFactor8)
        
        t_result = functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_code_is_valid", t_schema_number, 17, 1, CS_code)
        
        if (t_result <= 0) {
            functions.GEN_STRCPY(t_schema_msg, "Schema: ")
            functions.GEN_STRCAT(t_schema_msg, t_schema_name)
            functions.GEN_SAVE_TEXT(binding, t_schema_msg)
            return false
        }
        
        return true

    }

    // ID: NPCR-00143; TAG: N2803; NAME: Grade, Schema ID (NAACCR)
    public boolean npcr00143(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        
        char[] SCHEMA_ID = new char[6], SCHEMA_NAME = new char[36], Grade = new char[2]
        
        int dx_year
        
        char[] name = new char[50]
        
        
        char[] group_cgrade = new char[7]
        char[] group_pgrade = new char[7]
        char[] group_ycgrade = new char[7]
        char[] group_ypgrade = new char[7]
        char[] ed = new char[2]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018)
            return true
        if (functions.GEN_EMPTY(untrimmedline.gradeClinical) && functions.GEN_EMPTY(untrimmedline.gradePathological))
            return true
        if (functions.GEN_EMPTY(untrimmedline.schemaId)) {
            return true
        }
        if (functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_SCHEMA_ID_NAMES, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_SCHEMA_ID_NAMES_SCHEMA_ID, untrimmedline.schemaId, ['SCHEMA_ID':SCHEMA_ID, 'SCHEMA_NAME':SCHEMA_NAME]))
            functions.GEN_STRCPY(name, "Schema ")
        functions.GEN_STRCAT(name, untrimmedline.schemaId)
        functions.GEN_STRCAT(name, ": ")
        functions.GEN_STRCAT(name, functions.GEN_TRIM(SCHEMA_NAME, ((Integer)context.NPCR_GEN_RIGHT)))
        
        functions.GEN_STRCPY(ed, functions.GEN_SUBSTR(untrimmedline.schemaId, 1, 2))
        
        if (functions.GEN_AT(ed, "09") != 0) {
            if (!functions.GEN_EMPTY(untrimmedline.gradeClinical)) {
                functions.GEN_STRCPY(group_cgrade, untrimmedline.schemaId)
                functions.GEN_STRCAT(group_cgrade, untrimmedline.gradeClinical)
        
                if (!functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_GRADE09, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_GRADE09_SCHEMA_IDGRADE, group_cgrade, ['SCHEMA_ID':SCHEMA_ID, 'GRADE':Grade])) {
                    functions.GEN_SAVE_TEXT(binding, name)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade Clinical: ${untrimmedline.gradeClinical} is not valid for Schema ID: ${untrimmedline.schemaId}')
                }
            }
            if (!functions.GEN_EMPTY(untrimmedline.gradePathological)) {
                functions.GEN_STRCPY(group_pgrade, untrimmedline.schemaId)
                functions.GEN_STRCAT(group_pgrade, untrimmedline.gradePathological)
        
                if (!functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_GRADE09, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_GRADE09_SCHEMA_IDGRADE, group_pgrade, ['SCHEMA_ID':SCHEMA_ID, 'GRADE':Grade])) {
                    functions.GEN_SAVE_TEXT(binding, name)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade Pathological: ${untrimmedline.gradePathological} is not valid for Schema ID: ${untrimmedline.schemaId}')
                }
            }
            if (!functions.GEN_EMPTY(untrimmedline.gradePostTherapyClin)) {
                functions.GEN_STRCPY(group_ycgrade, untrimmedline.schemaId)
                functions.GEN_STRCAT(group_ycgrade, untrimmedline.gradePostTherapyClin)
        
                if (!functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_GRADE09, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_GRADE09_SCHEMA_IDGRADE, group_ycgrade, ['SCHEMA_ID':SCHEMA_ID, 'GRADE':Grade])) {
        
                    functions.GEN_SAVE_TEXT(binding, name)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade Post Therapy Clin (yc): ${untrimmedline.gradePostTherapyClin} is not valid for Schema ID: ${untrimmedline.schemaId}')
                }
            }
            if (!functions.GEN_EMPTY(untrimmedline.gradePostTherapy)) {
                functions.GEN_STRCPY(group_ypgrade, untrimmedline.schemaId)
                functions.GEN_STRCAT(group_ypgrade, untrimmedline.gradePostTherapy)
        
                if (!functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_GRADE09, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_GRADE09_SCHEMA_IDGRADE, group_ypgrade, ['SCHEMA_ID':SCHEMA_ID, 'GRADE':Grade])) {
        
                    functions.GEN_SAVE_TEXT(binding, name)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade Post Therapy Path (yp): ${untrimmedline.gradePostTherapy} is not valid for Schema ID: ${untrimmedline.schemaId}')
                }
            }
        }
        else {
            if (!functions.GEN_EMPTY(untrimmedline.gradeClinical)) {
                functions.GEN_STRCPY(group_cgrade, untrimmedline.schemaId)
                functions.GEN_STRCAT(group_cgrade, untrimmedline.gradeClinical)
        
                if (!functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_GRADEED8, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_GRADEED8_SCHEMA_IDGRADE, group_cgrade, ['SCHEMA_ID':SCHEMA_ID, 'GRADE':Grade])) {
                    functions.GEN_SAVE_TEXT(binding, name)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade Clinical: ${untrimmedline.gradeClinical} is not valid for Schema ID: ${untrimmedline.schemaId}')
                }
            }
            if (!functions.GEN_EMPTY(untrimmedline.gradePathological)) {
                functions.GEN_STRCPY(group_pgrade, untrimmedline.schemaId)
                functions.GEN_STRCAT(group_pgrade, untrimmedline.gradePathological)
        
                if (!functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_GRADEED8, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_GRADEED8_SCHEMA_IDGRADE, group_pgrade, ['SCHEMA_ID':SCHEMA_ID, 'GRADE':Grade])) {
                    functions.GEN_SAVE_TEXT(binding, name)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade Pathological: ${untrimmedline.gradePathological} is not valid for Schema ID: ${untrimmedline.schemaId}')
                }
            }
            if (!functions.GEN_EMPTY(untrimmedline.gradePostTherapyClin)) {
                functions.GEN_STRCPY(group_ycgrade, untrimmedline.schemaId)
                functions.GEN_STRCAT(group_ycgrade, untrimmedline.gradePostTherapyClin)
        
                if (!functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_GRADEED8, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_GRADEED8_SCHEMA_IDGRADE, group_ycgrade, ['SCHEMA_ID':SCHEMA_ID, 'GRADE':Grade])) {
        
                    functions.GEN_SAVE_TEXT(binding, name)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade Post Therapy Clin (yc): ${untrimmedline.gradePostTherapyClin} is not valid for Schema ID: ${untrimmedline.schemaId}')
                }
            }
            if (!functions.GEN_EMPTY(untrimmedline.gradePostTherapy)) {
                functions.GEN_STRCPY(group_ypgrade, untrimmedline.schemaId)
                functions.GEN_STRCAT(group_ypgrade, untrimmedline.gradePostTherapy)
        
                if (!functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_GRADEED8, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_GRADEED8_SCHEMA_IDGRADE, group_ypgrade, ['SCHEMA_ID':SCHEMA_ID, 'GRADE':Grade])) {
        
                    functions.GEN_SAVE_TEXT(binding, name)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade Post Therapy Path (yp): ${untrimmedline.gradePostTherapy} is not valid for Schema ID: ${untrimmedline.schemaId}')
                }
            }
        }
        return true

    }

    // ID: NPCR-00145; TAG: 2025; NAME: CS Site-Specific Factor10, Schema (Subm)
    public boolean npcr00145(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] t_site = new char[5], t_hist = new char[5], t_discrim = new char[4], t_schema_name = new char[31], t_schema_msg = new char[79]
        char[] CS_code = new char[4]
        int t_schema_number, t_max_schemas, t_result
        
        if (functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor10) || functions.GEN_EMPTY(untrimmedline.primarySite) || functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        functions.GEN_STRCPY(t_site, untrimmedline.primarySite)
        functions.GEN_STRCPY(t_hist, untrimmedline.histologicTypeIcdO3)
        
        t_max_schemas = functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_get_number_of_schemas")
        
        t_schema_number = functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_get_schema_number", t_site, t_hist, t_discrim)
        
        if (t_schema_number < 0)
            return true
        if (t_schema_number > t_max_schemas) {
            return true
        }
        functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_get_schema_name", t_schema_number, t_schema_name)
        
        if (!functions.GEN_INLIST(t_schema_name, "Prostate"))
            return true
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1,")) {
            return true
        }
        functions.GEN_STRCPY(CS_code, untrimmedline.csSiteSpecificFactor10)
        
        t_result = functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_code_is_valid", t_schema_number, 19, 1, CS_code)
        
        if (t_result <= 0) {
            functions.GEN_STRCPY(t_schema_msg, "Schema: ")
            functions.GEN_STRCAT(t_schema_msg, t_schema_name)
            functions.GEN_SAVE_TEXT(binding, t_schema_msg)
            return false
        }
        
        return true

    }

    // ID: NPCR-00150; TAG: 1808; NAME: CS Site-Specific Factor15, Schema (Subm)
    public boolean npcr00150(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] t_site = new char[5], t_hist = new char[5], t_discrim = new char[4], t_schema_name = new char[31], t_schema_msg = new char[79]
        char[] CS_code = new char[4]
        int t_schema_number, t_max_schemas, t_result, dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010)
            return true
        if (functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor15) || functions.GEN_EMPTY(untrimmedline.primarySite) || functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        functions.GEN_STRCPY(t_site, untrimmedline.primarySite)
        functions.GEN_STRCPY(t_hist, untrimmedline.histologicTypeIcdO3)
        
        t_max_schemas = functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_get_number_of_schemas")
        
        t_schema_number = functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_get_schema_number", t_site, t_hist, t_discrim)
        
        if (t_schema_number < 0)
            return true
        if (t_schema_number > t_max_schemas) {
            return true
        }
        functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_get_schema_name", t_schema_number, t_schema_name)
        
        if (!functions.GEN_INLIST(t_schema_name, "Breast"))
            return true
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1,")) {
            if (!functions.GEN_INLIST(t_schema_name, "Brain,CNSOther,IntracranialGland")) {
                return true
            }
        }
        functions.GEN_STRCPY(CS_code, untrimmedline.csSiteSpecificFactor15)
        
        t_result = functions.GEN_EXTERNALDLL("CStage0205.dll", "CStage_code_is_valid", t_schema_number, 24, 1, CS_code)
        
        if (t_result <= 0) {
            functions.GEN_STRCPY(t_schema_msg, "Schema: ")
            functions.GEN_STRCAT(t_schema_msg, t_schema_name)
            functions.GEN_SAVE_TEXT(binding, t_schema_msg)
            return false
        }
        
        return true

    }

    // ID: NPCR-00151; TAG: N1688; NAME: Birthplace--Country (COC)
    public boolean npcr00151(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.birthplaceCountry))
            return true
        if (!functions.GEN_LOOKUP(untrimmedline.birthplaceCountry, context.NPCR_CNTRY_ST, context.NPCR_CNTRY_ST_COUNTRY, [:]))
            return false
        
        return true

    }

    // ID: NPCR-00153; TAG: N0217; NAME: Diagnostic Confirm, Seq Num--Central (SEER IF23)
    public boolean npcr00153(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_INLIST(untrimmedline.overRideSeqnoDxconf, "1") || functions.GEN_INLIST(untrimmedline.primarySite, "760-768, 809", "(C\\d\\d\\d)", 2, 3) || functions.GEN_INLIST(untrimmedline.sequenceNumberCentral, "60-99"))
            return true
        if (functions.GEN_INLIST(untrimmedline.diagnosticConfirmation, "6-9") && !functions.GEN_MATCH(untrimmedline.sequenceNumberCentral, "(00)"))
            return false
        return true

    }

    // ID: NPCR-00154; TAG: 1810; NAME: Date Initial RX SEER, Date of DX (Subm)
    public boolean npcr00154(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dtcmp
        int dx_year, dx_month, dx_day, seer_year, seer_month, seer_day
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (functions.GEN_EMPTY(untrimmedline.dateInitialRxSeer) || functions.GEN_EMPTY(untrimmedline.dateOfDiagnosis))
            return true
        if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfDiagnosis))
            return true
        if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateInitialRxSeer))
            return true
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.dateOfDiagnosis, untrimmedline.dateInitialRxSeer, ((Integer)context.NPCR_GEN_DT_EXACT))
        
        if (dtcmp <= 0)
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        dx_month = functions.GEN_DATE_MONTH_IOP(binding, untrimmedline.dateOfDiagnosis)
        dx_day = functions.GEN_DATE_DAY_IOP(binding, untrimmedline.dateOfDiagnosis)
        seer_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateInitialRxSeer)
        seer_month = functions.GEN_DATE_MONTH_IOP(binding, untrimmedline.dateInitialRxSeer)
        seer_day = functions.GEN_DATE_DAY_IOP(binding, untrimmedline.dateInitialRxSeer)
        
        if (dx_month == ((Integer)context.NPCR_GEN_DT_MONTH_EMPTY) || seer_month == ((Integer)context.NPCR_GEN_DT_MONTH_EMPTY)) {
            if (dx_year <= seer_year)
                return true
            else
                return false
        }
        else {
            if (dx_day == ((Integer)context.NPCR_GEN_DT_DAY_EMPTY) || seer_day == ((Integer)context.NPCR_GEN_DT_DAY_EMPTY)) {
                if (dx_year < seer_year)
                    return true
                else {
                    if (dx_year == seer_year && dx_month <= seer_month)
                        return true
                    else
                        return false
                }
            }
            else
                return false
        }
        return false

    }

    // ID: NPCR-00155; TAG: 2122; NAME: Derived Items, Date of DX (Subm)
    public boolean npcr00155(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] t_site = new char[5], t_hist = new char[5], t_discrim = new char[4], t_schema_name = new char[31], t_schema_msg = new char[79]
        int t_schema_number, t_max_schemas, t_result
        int dx_year
        int err_flag
        err_flag = 0
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 2015)
            return true
        functions.GEN_STRCPY(t_site, untrimmedline.primarySite)
        functions.GEN_STRCPY(t_hist, untrimmedline.histologicTypeIcdO3)
        
        t_max_schemas = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_number_of_schemas")
        
        t_schema_number = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_number", t_site, t_hist, t_discrim)
        
        if (t_schema_number < 0)
            return true
        if (t_schema_number > t_max_schemas) {
            return true
        }
        functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_name", t_schema_number, t_schema_name)
        
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1,")) {
            if (!functions.GEN_INLIST(t_schema_name, "Brain,CNSOther,IntracranialGland"))
                return true
        }
        if ((dx_year > 2003 && dx_year < 2016) && functions.GEN_EMPTY(untrimmedline.overRideCs20)) {
            if (functions.GEN_EMPTY(untrimmedline.derivedSs2000)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2016, Derived SS2000 cannot be blank')
                err_flag = 1
            }
            if (err_flag == 1)
                return false
        }
        if (functions.GEN_INLIST(untrimmedline.overRideCs20, "1")) {
            if (!functions.GEN_EMPTY(untrimmedline.derivedSs2000)) {
                functions.GEN_SAVE_TEXT(binding, 'If Over-ride CS 20 = 1, Derived SS2000 must be blank')
                err_flag = 1
            }
        }
        if (err_flag == 1)
            return false
        return true

    }

    // ID: NPCR-00157; TAG: N1693; NAME: Birthplace--State, Date of Diagnosis (NAACCR)
    public boolean npcr00157(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (functions.GEN_EMPTY(untrimmedline.birthplaceState))
            return true
        if (dx_year > 2012) {
            if (functions.GEN_INLIST(untrimmedline.birthplaceState, "NN,MM,PP,XN"))
                return false
        }
        
        return true

    }

    // ID: NPCR-00159; TAG: N1694; NAME: Birthplace--State (COC)
    public boolean npcr00159(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.birthplaceState))
            return true
        if (!functions.GEN_LOOKUP(untrimmedline.birthplaceState, context.NPCR_CNTRY_ST, context.NPCR_CNTRY_ST_STATE, [:]))
            return false
        
        return true

    }

    // ID: NPCR-00167; TAG: N0228; NAME: Sequence Number--Central (SEER SEQUENC)
    public boolean npcr00167(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        return functions.GEN_INLIST(untrimmedline.sequenceNumberCentral, "00-59,60-88,98,99", "(\\d\\d)")

    }

    // ID: NPCR-00171; TAG: 1815; NAME: Registry ID (Subm)
    public boolean npcr00171(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        return functions.GEN_LOOKUP(untrimmedline.registryId, context.NPCR_REGID10, context.NPCR_REGID10_REGID, [:])

    }

    // ID: NPCR-00172; TAG: 1814; NAME: RX Summ--Radiation (Subm)
    public boolean npcr00172(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010 || dx_year > 2017)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummRadiation))
            return true
        if (dx_year >= 2010 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        return functions.GEN_INLIST(untrimmedline.rxSummRadiation, "0-5,7-9")

    }

    // ID: NPCR-00178; TAG: N3082; NAME: Grade, Lymphoma Ocular Adnexa, Histologic Type ICD-O-3 (NAACCR)
    public boolean npcr00178(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "00710") == 0)
            return true
        if (functions.GEN_EMPTY(untrimmedline.gradeClinical) && functions.GEN_EMPTY(untrimmedline.gradePathological))
            return true
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9690, 9691, 9695, 9698")) {
            if (!functions.GEN_EMPTY(untrimmedline.gradeClinical) && functions.GEN_AT(untrimmedline.gradeClinical, "9", 1) == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade Clinical: ${untrimmedline.gradeClinical} is not valid for Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3}')
            if (!functions.GEN_EMPTY(untrimmedline.gradePathological) && functions.GEN_AT(untrimmedline.gradePathological, "9", 1) == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade Pathological: ${untrimmedline.gradePathological} is not valid for Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3}')
        }
        return true

    }

    // ID: NPCR-00182; TAG: N3094; NAME: Grade, Date of Diagnosis (COC)
    public boolean npcr00182(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year < 2018) {
            if (functions.GEN_EMPTY(untrimmedline.grade))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade must not be blank for cases diagnosed before 2018')
        }
        if (dx_year >= 2018) {
            if (!functions.GEN_EMPTY(untrimmedline.grade))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade must be blank for cases diagnosed 2018 and later')
        }
        return true

    }

    // ID: NPCR-00193; TAG: 1800; NAME: CS Items - NPCR Required - Non-SSF (Subm)
    public boolean npcr00193(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2004 && dx_year > 2015)
            return true
        if (functions.GEN_INLIST(untrimmedline.overRideCs20, "1") && (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "3-7")))
            return true
        if (functions.GEN_EMPTY(untrimmedline.overRideCs20)) {
        
            if (dx_year > 2007 && dx_year < 2016) {
                if (functions.GEN_EMPTY(untrimmedline.csTumorSize))
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'If DX year = 2008-2015, CS Tumor Size cannot be blank')
            }
            if (dx_year > 2011 && dx_year < 2016) {
                if (functions.GEN_EMPTY(untrimmedline.regionalNodesExamined))
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'If DX year > 2011, Regional Nodes Examined cannot be blank')
                if (functions.GEN_EMPTY(untrimmedline.regionalNodesPositive))
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'If DX year > 2011, Regional Nodes Positive cannot be blank')
            }
        }
        if ((dx_year > 2011) && (dx_year < 2016) && (functions.GEN_INLIST(untrimmedline.overRideCs20, "1")) && (!functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "3-7"))) {
            if (functions.GEN_EMPTY(untrimmedline.csTumorSize))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'If DX year > 2011 & Over-ride CS 20=${untrimmedline.overRideCs20} & Type of Reporting Source=${untrimmedline.typeOfReportingSource}, CS Tumor Size cannot be blank')
            if (functions.GEN_EMPTY(untrimmedline.regionalNodesExamined))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'If DX year > 2011 & Over-ride CS 20=${untrimmedline.overRideCs20} & Type of Reporting Source =${untrimmedline.typeOfReportingSource}, Regional Nodes Examined cannot be blank for this schema')
            if (functions.GEN_EMPTY(untrimmedline.regionalNodesPositive))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'If DX year > 2011 & Over-ride CS 20=${untrimmedline.overRideCs20} & Type of Reporting Source=${untrimmedline.typeOfReportingSource}, Regional Nodes Positive cannot be blank for this schema')
        }
        return true

    }

    // ID: NPCR-00197; TAG: 3146; NAME: CS Items, DX Post 2017 (Subm)
    public boolean npcr00197(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        int err_flag
        err_flag = 0
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year > 2017) {
            if (!functions.GEN_EMPTY(untrimmedline.csTumorSize)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX >2017, CS Tumor Size must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor1)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX >2017, CS Site-Specific Factor 1 must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor2)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX >2017, CS Site-Specific Factor 2 must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor8)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX >2017, CS Site-Specific Factor 8 must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor10)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX >2017, CS Site-Specific Factor10 must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor15)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX >2017, CS Site-Specific Factor15 must be blank')
                err_flag = 1
            }
        }
        if (err_flag == 1)
            return false
        return true

    }

    // ID: NPCR-00198; TAG: 3147; NAME: Derived CS Items, DX Post 2017 (Subm)
    public boolean npcr00198(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int err_flag
        err_flag = 0
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year > 2017) {
        
            if (!functions.GEN_EMPTY(untrimmedline.derivedSs2000)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX >2017, Derived SS2000 must be blank')
                err_flag = 1
            }
        }
        if (err_flag == 1)
            return false
        return true

    }

    // ID: NPCR-00199; TAG: N0307; NAME: Type of Report Srce(DC/AO), Vital Stat (SEER IF08)
    public boolean npcr00199(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        
        if (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "6,7")) {
            if (!functions.GEN_INLIST(untrimmedline.vitalStatus, "0"))
                return false
        }
        return true

    }

    // ID: NPCR-00201; TAG: N0958; NAME: Race--NAPIIA(derived API) (NAACCR)
    public boolean npcr00201(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.raceNapiia))
            return true
        return functions.GEN_INLIST(untrimmedline.raceNapiia, "01-08,10-17,20-22,25-28,30-32,96-99", "(\\d\\d)")

    }

    // ID: NPCR-00206; TAG: N1784; NAME: Histologic Type ICD-O-3, Behavior, Grade (SEER)
    public boolean npcr00206(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year > 2017)
            return true
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3) || functions.GEN_EMPTY(untrimmedline.behaviorCodeIcdO3) || functions.GEN_EMPTY(untrimmedline.grade))
            return true
        if (functions.GEN_INLIST(untrimmedline.grade, "5,6,7,8")) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9992"))
                return functions.GEN_ERROR_MSG(binding, 'Grades 5-8 allowed only for histologies 9590-9992')
        }
        if (!functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "3"))
            return true
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8331,9511")) {
            if (!functions.GEN_INLIST(untrimmedline.grade, "1"))
                return functions.GEN_ERROR_MSG(binding, 'This histology (${untrimmedline.histologicTypeIcdO3}) carries an implied grade of 1')
            else
                return true
        }
        else {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8020,8021,9082,9083")) {
                if (functions.GEN_INLIST(untrimmedline.primarySite, "C809") && functions.GEN_INLIST(untrimmedline.grade, "9"))
                    return true
                else {
                    if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9083")) {
                        if (!functions.GEN_INLIST(untrimmedline.grade, "2"))
                            return functions.GEN_ERROR_MSG(binding, 'This histology (${untrimmedline.histologicTypeIcdO3}) carries an implied grade of 2')
                        else
                            return true
                    }
                    else {
                        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8020,8021,9082")) {
                            if (!functions.GEN_INLIST(untrimmedline.grade, "4"))
                                return functions.GEN_ERROR_MSG(binding, 'This histology (${untrimmedline.histologicTypeIcdO3}) carries an implied grade of 4')
                            else
                                return true
                        }
                    }
                }
            }
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9512")) {
            if (!functions.GEN_INLIST(untrimmedline.grade, "4"))
                return functions.GEN_ERROR_MSG(binding, 'This histology (${untrimmedline.histologicTypeIcdO3}) carries an implied grade of 4')
            else
                return true
        }
        return true

    }

    // ID: NPCR-00209; TAG: N0996; NAME: CS Site-Specific Factor 8 (CS)
    public boolean npcr00209(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor8))
            return true
        return functions.GEN_MATCH(untrimmedline.csSiteSpecificFactor8, "(\\d\\d\\d)")

    }

    // ID: NPCR-00212; TAG: N1801; NAME: Census Tr Poverty Indictr, Date of DX (NPCR)
    public boolean npcr00212(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year > 2013) {
            if (functions.GEN_EMPTY(untrimmedline.censusTrPovertyIndictr))
                return false
        }
        
        return true

    }

    // ID: NPCR-00213; TAG: N0998; NAME: CS Site-Specific Factor10 (CS)
    public boolean npcr00213(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor10))
            return true
        return functions.GEN_MATCH(untrimmedline.csSiteSpecificFactor10, "(\\d\\d\\d)")

    }

    // ID: NPCR-00218; TAG: N2610; NAME: Grade Clinical (NAACCR)
    public boolean npcr00218(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.gradeClinical))
            return true
        if (functions.GEN_AT(untrimmedline.gradeClinical, "1234589ABCDEHLMS", 1) != 0)
            return true
        return false

    }

    // ID: NPCR-00223; TAG: N0372; NAME: Follow-Up Source, Vital Status (COC)
    public boolean npcr00223(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.followUpSource) || functions.GEN_EMPTY(untrimmedline.vitalStatus))
            return true
        if (functions.GEN_INLIST(untrimmedline.followUpSource, "7")) {
            if (functions.GEN_INLIST(untrimmedline.vitalStatus, "1"))
                return false
        }
        return true

    }

    // ID: NPCR-00225; TAG: N0373; NAME: Grade (COC)
    public boolean npcr00225(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.grade))
            return true
        if (functions.GEN_INLIST(untrimmedline.grade, "1-9"))
            return true
        return false

    }

    // ID: NPCR-00227; TAG: N1030; NAME: Follow-Up Source Central, Vital Status (NPCR)
    public boolean npcr00227(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.followUpSourceCentral) || functions.GEN_EMPTY(untrimmedline.vitalStatus))
            return true
        if (functions.GEN_INLIST(untrimmedline.followUpSourceCentral, "04, 05, 06, 07, 64", "(\\d\\d)")) {
            if (functions.GEN_INLIST(untrimmedline.vitalStatus, "1"))
                return false
        }
        return true

    }

    // ID: NPCR-00228; TAG: N1033; NAME: Spanish/Hispanic Origin, NHIA Derived (NAACCR)
    public boolean npcr00228(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.nhiaDerivedHispOrigin))
            return true
        if (functions.GEN_INLIST(untrimmedline.spanishHispanicOrigin, "1-5,8")) {
            if (functions.GEN_VAL(untrimmedline.spanishHispanicOrigin) != functions.GEN_VAL(untrimmedline.nhiaDerivedHispOrigin))
                return false
        }
        
        return true

    }

    // ID: NPCR-00232; TAG: N3964; NAME: Regional Nodes Positive, Examined, Primary Site, 2018 (NAACCR)
    public boolean npcr00232(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        int rnp, rne
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018)
            return true
        if (functions.GEN_EMPTY(untrimmedline.primarySite))
            return true
        if (functions.GEN_EMPTY(untrimmedline.regionalNodesExamined) && functions.GEN_EMPTY(untrimmedline.regionalNodesPositive))
            return true
        rnp = functions.GEN_VAL(untrimmedline.regionalNodesPositive)
        rne = functions.GEN_VAL(untrimmedline.regionalNodesExamined)
        
        if ((rne != 99) || (rnp != 99)) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "420,421,423,424,589,700-729,751-753,761-768,770-779,809", "(C\\d\\d\\d)", 2, 3) || functions.GEN_AT(untrimmedline.schemaId, "00790007950083099999", 5) != 0 || (functions.GEN_AT(untrimmedline.schemaId, "00822") && functions.GEN_AT(untrimmedline.histologicTypeIcdO3, "9734") == 0))
                return false
        }
        return true

    }

    // ID: NPCR-00233; TAG: N0390; NAME: Primary Site, Laterality (SEER IF82)
    public boolean npcr00233(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        if (!functions.GEN_INLIST(untrimmedline.primarySite, "342", "(C\\d\\d\\d)", 2, 3))
            return true
        if (functions.GEN_INLIST(untrimmedline.laterality, "2"))
            return functions.GEN_ERROR_MSG(binding, 'C342 (lung, middle lobe), Laterality cannot equal 2 (left)')
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 2006) {
            if (functions.GEN_INLIST(untrimmedline.laterality, "4"))
                return functions.GEN_ERROR_MSG(binding, 'If DX > 2006 and site= C342 (lung, middle lobe), Laterality cannot=4 (bilateral)')
        }
        return true

    }

    // ID: NPCR-00234; TAG: N1048; NAME: Date of Birth, Date of Diagnosis (NAACCR IF47)
    public boolean npcr00234(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int months_diff, err_flag, dtcmp
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfBirth) || functions.GEN_EMPTY(untrimmedline.dateOfDiagnosis))
            return true
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.dateOfBirth, untrimmedline.dateOfDiagnosis, ((Integer)context.NPCR_GEN_DT_MIN))
        
        if (dtcmp == ((Integer)context.NPCR_GEN_DT_ERROR)) {
            if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfBirth))
                functions.GEN_ERROR_TEXT(binding, 'Date of Birth is invalid: %DC')
            else {
                if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfDiagnosis))
                    functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis is invalid: %DC')
            }
            return false
        }
        if (dtcmp <= 0)
            return true
        err_flag = 1
        
        // *** START function call Check_InUtero()
        int dx_year_1, birth_year_1
        
        dx_year_1 = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        birth_year_1 = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfBirth)
        
        months_diff = functions.GEN_MONTHDIFF_IOP(binding, untrimmedline.dateOfDiagnosis, untrimmedline.dateOfBirth, ((Integer)context.NPCR_GEN_DT_MIN))
        
        if (months_diff <= 7) {
            if (functions.GEN_INLIST(untrimmedline.overRideAgeSiteMorph, "2,3"))
                err_flag = 0
            else
                functions.GEN_ERROR_TEXT(binding, 'Please Review: Set over-ride to 2 or 3 if case diagnosed in utero')
        }
        else
            functions.GEN_ERROR_TEXT(binding, 'Please Review: Date of Birth cannot be more than 7 months after Diagnosis')
        null// *** END function call Check_InUtero()
        
        
        if (err_flag == 1)
            return false
        
        return true

    }

    // ID: NPCR-00237; TAG: N0202; NAME: Summary Stage 1977 (NAACCR)
    public boolean npcr00237(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.seerSummaryStage1977))
            return true
        return functions.GEN_INLIST(untrimmedline.seerSummaryStage1977, "0-5,7-9")

    }

    // ID: NPCR-00238; TAG: N0407; NAME: Unknown Site, Laterality (SEER IF138)
    public boolean npcr00238(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_INLIST(untrimmedline.primarySite, "C809")) {
            if (functions.GEN_INLIST(untrimmedline.laterality, "0"))
                return true
            else
                return false
        }
        return true

    }

    // ID: NPCR-00239; TAG: N0409; NAME: Race 2 (NAACCR)
    public boolean npcr00239(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.race2))
            return true
        if (functions.GEN_INLIST(untrimmedline.race2, "01-08, 10-17,20-22,25-28,30-32,88,96-99", "(\\d\\d)"))
            return true
        return false

    }

    // ID: NPCR-00242; TAG: N0413; NAME: Race 2, Date of DX (SEER IF89)
    public boolean npcr00242(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 1999) {
            if (functions.GEN_EMPTY(untrimmedline.race2))
                return false
            else
                return true
        }
        return true

    }

    // ID: NPCR-00247; TAG: N0436; NAME: Summary Stage 1977, Date of Diagnosis (NAACCR)
    public boolean npcr00247(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year < 2001) {
            if (functions.GEN_EMPTY(untrimmedline.seerSummaryStage1977))
                return false
        }
        if (dx_year > 2017) {
            if (!functions.GEN_EMPTY(untrimmedline.seerSummaryStage1977))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'If year of Date of Diagnosis >= 2018, then SEER Summary Stage 1977 must be blank')
        }
        return true

    }

    // ID: NPCR-00251; TAG: N0438; NAME: Summary Stage 2000 (NAACCR)
    public boolean npcr00251(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (functions.GEN_EMPTY(untrimmedline.seerSummaryStage2000))
            return true
        if (dx_year < 2004) {
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "0-5,7,9"))
                return true
            else
                return false
        }
        if (dx_year >= 2004) {
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "0-5, 7-9"))
                return true
            else
                return false
        }
        return true

    }

    // ID: NPCR-00252; TAG: N0439; NAME: Behavior ICDO3, Summary Stage 2000 (NAACCR)
    public boolean npcr00252(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (functions.GEN_EMPTY(untrimmedline.seerSummaryStage2000))
            return true
        if (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "7"))
            return true
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "2")) {
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "0"))
                return true
            else
                return false
        }
        else {
            if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "3")) {
                if (functions.GEN_INLIST(untrimmedline.seerSummaryStage2000, "1-5,7,9"))
                    return true
                else
                    return false
            }
        }
        return true

    }

    // ID: NPCR-00256; TAG: N0444; NAME: Diagnostic Confirmation, Histology ICDO3 (SEER IF48)
    public boolean npcr00256(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        if (functions.GEN_INLIST(untrimmedline.overRideLeukLymphoma, "1"))
            return true
        if ((functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9993", "(\\d\\d\\d\\d)") && functions.GEN_INLIST(untrimmedline.diagnosticConfirmation, "6")))
            return false
        if (functions.GEN_INLIST(untrimmedline.diagnosticConfirmation, "3")) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9993"))
                return false
        }
        return true

    }

    // ID: NPCR-00257; TAG: N0445; NAME: Laterality, Primary Site, Morph ICDO3 (SEER IF42)
    public boolean npcr00257(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        boolean paired_organ
        int dx_year
        
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        if (functions.GEN_MATCH(untrimmedline.overRideSiteLatMorph, "(1)"))
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (functions.GEN_AT(untrimmedline.behaviorCodeIcdO3, "2") == 0)
            return true
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9999", "(\\d\\d\\d\\d)"))
            return true
        if (dx_year > 1987 && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9140,9700,9701,9590-9980", "(\\d\\d\\d\\d)"))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year >= 2021) {
            if (functions.GEN_AT(untrimmedline.primarySite, "C444C443C445", 4) != 0) {
                if (functions.GEN_AT(untrimmedline.laterality, "0") != 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Laterality must not = 0 for Primary Site: ${untrimmedline.primarySite} for Date of Diagnosis >= 2021')
                else
                    return true
            }
        }
        if (dx_year >= 2018) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "090,091", "(C\\d\\d\\d)", 2, 3)) {
                if (functions.GEN_AT(untrimmedline.laterality, "0"))
                    return true
            }
        }
        paired_organ = functions.GEN_ILOOKUP(untrimmedline.primarySite, context.NPCR_PAIRORGN, context.NPCR_PAIRORGN_PAIRSITE, [:]) || (dx_year > 1978 && functions.GEN_INLIST(untrimmedline.primarySite, "081,090,400-403,441,442,446,447,471,472,491,492", "(C\\d\\d\\d)", 2, 3))
        
        if (paired_organ) {
            if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "2")) {
                if (!functions.GEN_INLIST(untrimmedline.laterality, "1-3,5"))
                    return false
            }
        }
        return true

    }

    // ID: NPCR-00259; TAG: N0446; NAME: Primary Site, Morphology-Imposs ICDO3 (SEER IF38)
    public boolean npcr00259(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] site = new char[5], histlo = new char[5], histhi = new char[5]
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year > 2023) {
            return true
        }
        char[] SiteHist = new char[9]
        
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        if (functions.GEN_INLIST(untrimmedline.primarySite, "000-709,728-750,752,754-809", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9440-9442")) {
            return false
        }
        functions.GEN_STRCPY(SiteHist, untrimmedline.primarySite)
        functions.GEN_STRCAT(SiteHist, untrimmedline.histologicTypeIcdO3)
        
        if (functions.GEN_RLOOKUP(SiteHist, context.NPCR_IF38IM01, context.NPCR_IF38IM01_SITEHISTLO, ['SITE':site, 'HISTLO':histlo, 'HISTHI':histhi])) {
            if (functions.GEN_STRCMP(untrimmedline.primarySite, site) == 0 && functions.GEN_STRCMP(untrimmedline.histologicTypeIcdO3, histlo) >= 0 && functions.GEN_STRCMP(untrimmedline.histologicTypeIcdO3, histhi) <= 0)
                return false
        }
        
        return true

    }

    // ID: NPCR-00260; TAG: N0448; NAME: Seq Num--Central, Prim Site, Morph ICDO3 (SEER IF22)
    public boolean npcr00260(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        if (functions.GEN_INLIST(untrimmedline.sequenceNumberCentral, "60-88,98")) {
            return true
        }
        if (!functions.GEN_INLIST(untrimmedline.overRideIllDefineSite, "1") && functions.GEN_INLIST(untrimmedline.sequenceNumberCentral, "01-99")) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "760-768,809", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "0000-9589", "(\\d\\d\\d\\d)"))
                return false
            if (functions.GEN_INLIST(untrimmedline.primarySite, "770-779", "(C\\d\\d\\d)", 2, 3)) {
                if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9729,9735-9738,9811-9819,9823,9826-9827,9837", "(\\d\\d\\d\\d)"))
                    return false
            }
            if (functions.GEN_INLIST(untrimmedline.primarySite, "420-424", "(C\\d\\d\\d)", 2, 3) && !functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9993", "(\\d\\d\\d\\d)"))
                return false
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9740-9759", "(\\d\\d\\d\\d)"))
                return false /* fail edit*/
        }
        return true

    }

    // ID: NPCR-00261; TAG: N0449; NAME: Age, Primary Site, Morphology ICDO3 (SEER IF15)
    public boolean npcr00261(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int agetemp
        int dx_year
        char[] Morph = new char[6]
        char[] Histo = new char[5]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year > 2000)
            return true
        if (functions.GEN_INLIST(untrimmedline.overRideAgeSiteMorph, "1,3"))
            return true
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3) || functions.GEN_EMPTY(untrimmedline.behaviorCodeIcdO3)) {
            return true
        }
        if (functions.GEN_INLIST(untrimmedline.ageAtDiagnosis, "999"))
            return true
        functions.GEN_STRCPY(Histo, untrimmedline.histologicTypeIcdO3)
        
        functions.GEN_STRCPY(Morph, Histo)
        functions.GEN_STRCAT(Morph, untrimmedline.behaviorCodeIcdO3)
        
        agetemp = functions.GEN_VAL(untrimmedline.ageAtDiagnosis)
        
        if (agetemp < 15) {
            if ((functions.GEN_INLIST(untrimmedline.primarySite, "530-539", "(C\\d\\d\\d)", 2, 3) && functions.GEN_MATCH(Morph, "(\\d\\d\\d\\d2)")) || (functions.GEN_INLIST(untrimmedline.primarySite, "C589") && functions.GEN_MATCH(Morph, "(9100\\d)")))
                return false
        }
        if (agetemp < 20) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "150-159,170-179,199,209-218,239,240-249,250-259,384,500-509,559,540-549", "(C\\d\\d\\d)", 2, 3) || (functions.GEN_INLIST(untrimmedline.primarySite, "180-189,339,340-349", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(Morph, "00000-82399,82460-99999")) || (functions.GEN_INLIST(untrimmedline.primarySite, "530-539", "(C\\d\\d\\d)", 2, 3) && functions.GEN_MATCH(Morph, "(\\d\\d\\d\\d3)")))
                return false
        }
        if (agetemp < 30) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "C609") || functions.GEN_INLIST(Histo, "9732, 9823, 9863, 9875, 9876, 9945", "(\\d\\d\\d\\d)"))
                return false
        }
        if (agetemp < 40) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "C619") && functions.GEN_INLIST(Histo, "8140", "(\\d\\d\\d\\d)"))
                return false
        }
        if (agetemp > 5) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "690-699", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(Histo, "9510-9514", "(\\d\\d\\d\\d)"))
                return false
        }
        if (agetemp > 14) {
            if (functions.GEN_INLIST(Histo, "8960,9946", "(\\d\\d\\d\\d)"))
                return false
        }
        if (agetemp > 45) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "C589") && functions.GEN_INLIST(Histo, "9100", "(\\d\\d\\d\\d)"))
                return false
        }
        return true

    }

    // ID: NPCR-00263; TAG: N0457; NAME: Type of Rep Srce(DC),Seq Num--Cent,ICDO3 (SEER IF04)
    public boolean npcr00263(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3)) {
            return true
        }
        if (functions.GEN_INLIST(untrimmedline.overRideReportSource, "1")) {
            return true
        }
        if (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "7") && (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9589", "(\\d\\d\\d\\d)"))) {
            if (!functions.GEN_INLIST(untrimmedline.sequenceNumberCentral, "00,60"))
                return false
        }
        return true

    }

    // ID: NPCR-00264; TAG: N1965; NAME: Histology ICDO3, Grade, Date of DX (SEER)
    public boolean npcr00264(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if ((dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY)) || (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR)))
            return true
        if (dx_year < 2010 || dx_year > 2017)
            return true
        if ((functions.GEN_EMPTY(untrimmedline.grade)) || (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3)))
            return true
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9700-9702,9705,9708,9709,9716-9718,9724-9726")) {
            if (!functions.GEN_INLIST(untrimmedline.grade, "5"))
                return functions.GEN_ERROR_MSG(binding, 'Grade [${untrimmedline.grade}] must be 5 when Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9714")) {
            if (!functions.GEN_INLIST(untrimmedline.grade, "5,6"))
                return functions.GEN_ERROR_MSG(binding, 'Grade [${untrimmedline.grade}] must be 5 or 6 when Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9827,9834,9837")) {
            if (!functions.GEN_INLIST(untrimmedline.grade, "5"))
                return functions.GEN_ERROR_MSG(binding, 'Grade [${untrimmedline.grade}] must be 5 when Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9591,9596,9597,9659,9671,9673,9678-9680,9687-9691")) {
            if (!functions.GEN_INLIST(untrimmedline.grade, "6"))
                return functions.GEN_ERROR_MSG(binding, 'Grade [${untrimmedline.grade}] must be 6 when Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9695,9698,9699,9712,9731,9732,9734,9737,9738,9761,9762,9811-9818")) {
            if (!functions.GEN_INLIST(untrimmedline.grade, "6"))
                return functions.GEN_ERROR_MSG(binding, 'Grade [${untrimmedline.grade}] must be 6 when Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9823,9826,9833,9940")) {
            if (!functions.GEN_INLIST(untrimmedline.grade, "6"))
                return functions.GEN_ERROR_MSG(binding, 'Grade [${untrimmedline.grade}] must be 6 when Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9719,9948")) {
            if (!functions.GEN_INLIST(untrimmedline.grade, "8"))
                return functions.GEN_ERROR_MSG(binding, 'Grade [${untrimmedline.grade}] must be 8 when Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9740-9742,9751,9755-9759,9801,9806-9809,9875,9876,9945,9946")) {
            if (!functions.GEN_INLIST(untrimmedline.grade, "9"))
                return functions.GEN_ERROR_MSG(binding, 'Grade [${untrimmedline.grade}] must be 9 when Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9950,9961-9964,9975,9980,9982,9983,9985,9986,9989,9991,9992")) {
            if (!functions.GEN_INLIST(untrimmedline.grade, "9"))
                return functions.GEN_ERROR_MSG(binding, 'Grade [${untrimmedline.grade}] must be 9 when Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9831")) {
            if (!functions.GEN_INLIST(untrimmedline.grade, "5,8,9"))
                return functions.GEN_ERROR_MSG(binding, 'Grade [${untrimmedline.grade}] must be 5, 8, or 9 when Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590,9650,9651,9652,9653,9655,9663,9727,9735,9800,9820,9832")) {
            if (functions.GEN_INLIST(untrimmedline.grade, "1-4"))
                return functions.GEN_ERROR_MSG(binding, 'Grade [${untrimmedline.grade}] must not = 1-4 when Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9840,9860,9861,9863,9865-9867,9869,9870-9874,9891,9895-9898,9910,9911")) {
            if (functions.GEN_INLIST(untrimmedline.grade, "1-4"))
                return functions.GEN_ERROR_MSG(binding, 'Grade [${untrimmedline.grade}] must not = 1-4 when Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9920,9930,9931,9965,9966,9967,9971")) {
            if (functions.GEN_INLIST(untrimmedline.grade, "1-4"))
                return functions.GEN_ERROR_MSG(binding, 'Grade [${untrimmedline.grade}] must not = 1-4 when Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}')
        }
        
        return true

    }

    // ID: NPCR-00265; TAG: N1966; NAME: Obsolete Histology ICDO3, Date of DX (SEER)
    public boolean npcr00265(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] GROUP = new char[2], OBSYEAR = new char[5], HISTOBS = new char[5], HISTUSE = new char[5]
        int dx_year
        char[] compare_year = new char[10]
        char[] message = new char[100]
        char[] histo = new char[40]
        char[] code = new char[7]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR)) {
            return true
        }
        functions.GEN_STRCPY(histo, "8444 8462 8463 8473 8965 ")
        
        
        functions.GEN_STRCPY(code, untrimmedline.histologicTypeIcdO3)
        functions.GEN_STRCAT(code, " ")
        
        if (dx_year >= 2021) {
            if (functions.GEN_AT(code, histo, 5) != 0)
                functions.GEN_SAVE_TEXT(binding, 'Check ICD-O-3.2 and Solid Tumor Rules for reportability and histology coding.')
        }
        if (!functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_OBSHISTO, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_OBSHISTO_HISTOBS, untrimmedline.histologicTypeIcdO3, ['GROUP':GROUP, 'OBSYEAR':OBSYEAR, 'HISTUSE':HISTUSE, 'HISTOBS':HISTOBS]))
            return true
        if (functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_OBSHISTO, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_OBSHISTO_HISTOBS, untrimmedline.histologicTypeIcdO3, ['GROUP':GROUP, 'OBSYEAR':OBSYEAR, 'HISTUSE':HISTUSE, 'HISTOBS':HISTOBS])) {
            functions.GEN_STRCPY(compare_year, OBSYEAR)
        
            if (dx_year >= functions.GEN_VAL(compare_year)) {
                functions.GEN_STRCPY(message, HISTUSE)
                functions.GEN_STRCAT(message, " replaces ")
                functions.GEN_STRCAT(message, HISTOBS)
                functions.GEN_STRCAT(message, " for diagnosis year")
                if (functions.GEN_AT(GROUP, "1") != 0)
                    functions.GEN_SAVE_TEXT(binding, message)
                else {
                    if (functions.GEN_AT(GROUP, "2") != 0)
                        return false
                }
            }
        }
        return true

    }

    // ID: NPCR-00266; TAG: N1975; NAME: EDP MDE Link Date (NPCR)
    public boolean npcr00266(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.edpMdeLinkDate))
            return true
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.edpMdeLinkDate))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'EDP MDE Link Date: %DC')
            return false
        }
        
        return true

    }

    // ID: NPCR-00267; TAG: N1976; NAME: EDP MDE Link (NPCR)
    public boolean npcr00267(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.edpMdeLink))
            return true
        return functions.GEN_INLIST(untrimmedline.edpMdeLink, "0,1")

    }

    // ID: NPCR-00268; TAG: N1977; NAME: EDP MDE Link, Date, Primary Site (NPCR)
    public boolean npcr00268(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_INLIST(untrimmedline.primarySite, "180-209, 260", "(C\\d\\d\\d)", 2, 3))
            return true
        if (functions.GEN_INLIST(untrimmedline.primarySite, "500-509,530-539", "(C\\d\\d\\d)", 2, 3)) {
            if (functions.GEN_INLIST(untrimmedline.edpMdeLink, "1")) {
                if (functions.GEN_EMPTY(untrimmedline.edpMdeLinkDate))
                    return functions.GEN_ERROR_MSG(binding, 'If MDELink = 1, then MDEDate must not be blank')
            }
            if (functions.GEN_INLIST(untrimmedline.edpMdeLink, "0") || functions.GEN_EMPTY(untrimmedline.edpMdeLink)) {
                if (!functions.GEN_EMPTY(untrimmedline.edpMdeLinkDate))
                    return functions.GEN_ERROR_MSG(binding, 'If MDELink = 0 or blank, then MDEDate must be blank')
            }
        }
        if (!functions.GEN_INLIST(untrimmedline.primarySite, "500-509,530-539", "(C\\d\\d\\d)", 2, 3)) {
            if (!functions.GEN_EMPTY(untrimmedline.edpMdeLink))
                return false
            if (!functions.GEN_EMPTY(untrimmedline.edpMdeLinkDate))
                return false
        }
        return true

    }

    // ID: NPCR-00269; TAG: N0471; NAME: Diagnostic Confirmation, Behavior ICDO3 (SEER IF31)
    public boolean npcr00269(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (functions.GEN_EMPTY(untrimmedline.behaviorCodeIcdO3))
            return true
        if (functions.GEN_MATCH(untrimmedline.overRideHistology, "(2)|(3)"))
            return true
        if (dx_year >= 2024) {
            if (functions.GEN_AT(untrimmedline.histologicTypeIcdO3, "8453") != 0 && functions.GEN_AT(untrimmedline.behaviorCodeIcdO3, "2") != 0)
                return true
        }
        if (functions.GEN_MATCH(untrimmedline.behaviorCodeIcdO3, "(2)")) {
            if (!functions.GEN_INLIST(untrimmedline.diagnosticConfirmation, "1,2,4"))
                return false
        }
        return true

    }

    // ID: NPCR-00270; TAG: N0473; NAME: Age, Histologic Type, COD, ICDO3 (SEER IF43)
    public boolean npcr00270(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        if (functions.GEN_VAL(untrimmedline.histologicTypeIcdO3) == 9800 && functions.GEN_VAL(untrimmedline.ageAtDiagnosis) < 30 && functions.GEN_INLIST(untrimmedline.causeOfDeath, "2040,C910"))
            return false
        return true

    }

    // ID: NPCR-00271; TAG: N0476; NAME: Primary Site, Behavior Code ICDO3 (SEER IF39)
    public boolean npcr00271(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.behaviorCodeIcdO3))
            return true
        if (functions.GEN_MATCH(untrimmedline.overRideSiteBehavior, "(1)"))
            return true
        if (functions.GEN_STRCMP(untrimmedline.behaviorCodeIcdO3, "2") == 0) {
            if (functions.GEN_MATCH(untrimmedline.primarySite, "(C269)|(C399)|(C559)|(C579)|(C639)|(C689)|(C729)|(C759)|(C76[0-8])|(C809)"))
                return false
        }
        return true

    }

    // ID: NPCR-00272; TAG: N2021; NAME: Primary Site, Heme Morph, DateDX, NoOverride (SEER)
    public boolean npcr00272(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3) || functions.GEN_EMPTY(untrimmedline.behaviorCodeIcdO3))
            return true
        if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9993"))
            return true
        if (!functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "3"))
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR)) {
            return true
        }
        if (dx_year < 2010) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9823") && functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "3")) {
                if (!functions.GEN_INLIST(untrimmedline.primarySite, "420,421,424", "(C\\d\\d\\d)", 2, 3))
                    return functions.GEN_ERROR_MSG(binding, 'Hemato case diagnosed prior to 2010, 9823 is valid only for C420, C421, C424')
            }
        }
        if (dx_year >= 2010) {
        
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9732,9741,9742,9800,9801,9806-9809,9820,9826,9831-9834,9840") || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9860,9861,9863,9865-9867,9869-9879,9891,9895-9898,9910-9912,9920,9931,9940") || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9945,9946,9948,9950,9961-9968,9975,9980,9982,9983,9985,9986,9989,9991-9993")) {
                if (!functions.GEN_INLIST(untrimmedline.primarySite, "421", "(C\\d\\d\\d)", 2, 3))
                    return functions.GEN_ERROR_MSG(binding, 'Hemato case diagnosed 2010 or later, if Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, Primary Site must = C421')
            }
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590,9591,9596,9597,9650-9653,9655,9659,9663,9671,9673,9678,9680,9687,9688,9690") || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9691,9695,9698,9700-9702,9705,9708,9709,9712,9714,9717-9719,9724-9727") || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9735,9737,9738,9740,9751,9755-9759,9762,9811-9818,9823,9827,9837,9971")) {
                if (functions.GEN_INLIST(untrimmedline.primarySite, "420,423,424", "(C\\d\\d\\d)", 2, 3))
                    return functions.GEN_ERROR_MSG(binding, 'Hemato case diagnosed 2010 or later, if Histologic Type ICD-O-3=${untrimmedline.histologicTypeIcdO3}, Primary Site must not = C420, C423, C424')
            }
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9679")) {
                if (!functions.GEN_INLIST(untrimmedline.primarySite, "379,381-383", "(C\\d\\d\\d)", 2, 3))
                    return functions.GEN_ERROR_MSG(binding, 'Hemato case diagnosed 2010 or later, if Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, Primary Site must = C379, C381-C383')
            }
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9689")) {
                if (!functions.GEN_INLIST(untrimmedline.primarySite, "422", "(C\\d\\d\\d)", 2, 3))
                    return functions.GEN_ERROR_MSG(binding, 'Hemato case diagnosed 2010 or later, if Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, Primary Site must = C422')
            }
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9699")) {
                if (functions.GEN_INLIST(untrimmedline.primarySite, "420,422,423,424", "(C\\d\\d\\d)", 2, 3))
                    return functions.GEN_ERROR_MSG(binding, 'Hemato diag 2010 or later, if Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, Primary Site must not = C420, C422, C423, C424')
            }
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9716")) {
                if (!functions.GEN_INLIST(untrimmedline.primarySite, "422", "(C\\d\\d\\d)", 2, 3))
                    return functions.GEN_ERROR_MSG(binding, 'Hemato case diagnosed 2010 or later, if Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, Primary Site must = C422')
            }
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9731")) {
                if (!functions.GEN_INLIST(untrimmedline.primarySite, "400-419", "(C\\d\\d\\d)", 2, 3))
                    return functions.GEN_ERROR_MSG(binding, 'Hemato case diagnosed 2010 or later, if Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, Primary Site must = C400-C419')
            }
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9734")) {
                if (functions.GEN_INLIST(untrimmedline.primarySite, "400-419,420,423,424", "(C\\d\\d\\d)", 2, 3))
                    return functions.GEN_ERROR_MSG(binding, 'Hemato diag 2010 or later, if Histologic Type ICD-O-3=${untrimmedline.histologicTypeIcdO3}, Primary Site must not=C400-C419, C420, C423, C424')
            }
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9930")) {
                if (functions.GEN_INLIST(untrimmedline.primarySite, "420,421,423,424", "(C\\d\\d\\d)", 2, 3))
                    return functions.GEN_ERROR_MSG(binding, 'Hemato diag 2010 or later, if Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, Primary Site must not = C420, C421, C423, C424')
            }
        }
        if (dx_year > 2009 && dx_year < 2018) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9761")) {
                if (!functions.GEN_INLIST(untrimmedline.primarySite, "420", "(C\\d\\d\\d)", 2, 3))
                    return functions.GEN_ERROR_MSG(binding, 'Hemato case diagnosed 2010-2017, if Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, Primary Site must = C420')
            }
            if (functions.GEN_INLIST(untrimmedline.primarySite, "420", "(C\\d\\d\\d)", 2, 3)) {
                if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9761"))
                    return functions.GEN_ERROR_MSG(binding, 'Hemato case diagnosed 2010-2017, if Primary Site=${untrimmedline.primarySite}, Histologic Type ICD-O-3 must = 9761')
            }
        }
        if (dx_year > 2017) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9761")) {
                if (!functions.GEN_INLIST(untrimmedline.primarySite, "421", "(C\\d\\d\\d)", 2, 3))
                    return functions.GEN_ERROR_MSG(binding, 'Hemato case diagnosed 2018 and later, 9761 coded to C421, no histology coded to C420')
            }
            if (functions.GEN_INLIST(untrimmedline.primarySite, "420", "(C\\d\\d\\d)", 2, 3))
                return functions.GEN_ERROR_MSG(binding, 'Hemato case diagnosed 2018 and later, 9761 coded to C421, no histology coded to C420')
        }
        return true

    }

    // ID: NPCR-00273; TAG: N2022; NAME: Primary Site, Heme Morph, DateDX, Override (SEER)
    public boolean npcr00273(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3) || functions.GEN_EMPTY(untrimmedline.behaviorCodeIcdO3))
            return true
        if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9993"))
            return true
        if (!functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "3"))
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (functions.GEN_INLIST(untrimmedline.overRideSiteType, "1"))
            return true
        if (dx_year < 2010)
            return true
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9650,9651,9652,9653,9655,9659,9663,9688")) {
            if (!functions.GEN_INLIST(untrimmedline.primarySite, "770-779", "(C\\d\\d\\d)", 2, 3))
                return functions.GEN_ERROR_MSG(binding, 'Hemato case diagnosed 2010 or later, Histologic Type ICD-O-3=${untrimmedline.histologicTypeIcdO3},Primary Site not=C770-C779; review required')
        }
        else {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9597,9700,9701,9709,9718,9725")) {
                if (!functions.GEN_INLIST(untrimmedline.primarySite, "440-449,510-512,518-519,600-602,608-609,632", "(C\\d\\d\\d)", 2, 3))
                    return functions.GEN_ERROR_MSG(binding, 'Hemato diag 2010 or later, Histologic Type ICD-O-3=${untrimmedline.histologicTypeIcdO3},Primary Site not skin lymphoma; review required')
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9708,9726")) {
                    if (!functions.GEN_INLIST(untrimmedline.primarySite, "440-449,490-499,510-512,518-519,600-602,608-609,632", "(C\\d\\d\\d)", 2, 3))
                        return functions.GEN_ERROR_MSG(binding, 'Hemato diag 2010+, Histologic Type ICD-O-3=${untrimmedline.histologicTypeIcdO3},Primary Site not skin or soft tissue lymphoma; review required')
                }
            }
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9719")) {
            if (!functions.GEN_INLIST(untrimmedline.primarySite, "050-059,110-119,300-301,310-319", "(C\\d\\d\\d)", 2, 3))
                return functions.GEN_ERROR_MSG(binding, 'Hemato case diagnosed 2010 or later, Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, Primary Site = ${untrimmedline.primarySite}: review required')
        }
        else {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9751")) {
                if (!functions.GEN_INLIST(untrimmedline.primarySite, "340-349,400-419,421,440-449,490-499,770-779", "(C\\d\\d\\d)", 2, 3))
                    return functions.GEN_ERROR_MSG(binding, 'Hemato case diagnosed 2010 or later, Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, Primary Site = ${untrimmedline.primarySite}: review required')
            }
        }
        
        return true

    }

    // ID: NPCR-00274; TAG: N0472; NAME: Morphology--Type/Behavior ICDO3 (SEER MORPH)
    public boolean npcr00274(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int morphflg, i, benign_ok
        int dx_year
        char[] histbeh = new char[6]
        
        morphflg = 0
        
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3) || functions.GEN_EMPTY(untrimmedline.behaviorCodeIcdO3))
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year >= 2018 && functions.GEN_AT(untrimmedline.primarySite, "C723") != 0 && functions.GEN_AT(untrimmedline.histologicTypeIcdO3, "9421") != 0 && functions.GEN_AT(untrimmedline.behaviorCodeIcdO3, "1") != 0) {
            return true
        }
        if (!functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_HISICDO3, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_HISICDO3_HISTOLOGY, untrimmedline.histologicTypeIcdO3, [:]))
            return functions.GEN_ERROR_MSG(binding, 'Histologic Type not valid - ICDO3')
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9597,9688,9712,9724,9725,9726,9735,9737,9738,9759,9806") || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9807,9808,9809,9811,9812,9813,9814,9815,9816,9817,9818") || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9865,9869,9898,9911,9965,9966,9967,9971,9991,9992")) {
            if (dx_year < 2010)
                return functions.GEN_ERROR_MSG(binding, 'Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} is not allowed if DX year < 2010')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8343") && functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "2")) {
            if (dx_year < 2017) {
                if (!functions.GEN_INLIST(untrimmedline.overRideHistology, "1,3"))
                    return functions.GEN_ERROR_MSG(binding, 'Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} with Behavior Code ICD-O-3: ${untrimmedline.behaviorCodeIcdO3} not allowed for diagnosis year < 2017')
            }
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8023,8054,8085,8086,8158,8163,8256,8257,8265,8339") || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8474,8509,8519,8552,8594,8714,8975,9045,9086,9137,9385") || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9395, 9396,9425, 9431, 9432, 9445, 9475, 9476, 9477") || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9478, 9509, 9542")) {
            if (dx_year < 2018)
                return functions.GEN_ERROR_MSG(binding, 'Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} not allowed if diagnosis year < 2018')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8104,8273,8348,8349,8483,8484,8563,8643,8816,8817,8818,8828") || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8992,9126,9138,9211,9212,9213,9222,9563,9715,9749") || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9819,9877,9878,9879,9912,9968,9993")) {
            if (dx_year < 2021)
                return functions.GEN_ERROR_MSG(binding, 'Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} not allowed if diagnosis year < 2021')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8455,8859,8976,9111,9366,9367,9368")) {
            if (dx_year < 2022)
                return functions.GEN_ERROR_MSG(binding, 'Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} not allowed if diagnosis year < 2022')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9751,9831,9975") && functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "3")) {
            if (dx_year < 2010) {
                if (!functions.GEN_INLIST(untrimmedline.overRideHistology, "1,3"))
                    return functions.GEN_ERROR_MSG(binding, 'If DX year < 2010, Behavior Code ICD-O-3: ${untrimmedline.behaviorCodeIcdO3} is not allowed for Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3}')
            }
            if (dx_year >= 2010) {
                if (functions.GEN_INLIST(untrimmedline.overRideHistology, "1,3"))
                    return functions.GEN_ERROR_MSG(binding, 'Over-ride Histology is not required for Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3}/${untrimmedline.behaviorCodeIcdO3} for Date of Diagnosis: ${untrimmedline.dateOfDiagnosis.formatDate()} and should not be used')
            }
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8213,8311,8825,8842,8983,9302,9341") && functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "3")) {
            if (dx_year < 2018) {
                if (!functions.GEN_INLIST(untrimmedline.overRideHistology, "1,3"))
                    return functions.GEN_ERROR_MSG(binding, 'if DX year < 2018 Behavior Code ICD-O-3: ${untrimmedline.behaviorCodeIcdO3} not allowed for Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3}')
            }
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8158,8681,8682,8690,9766") && functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "3")) {
            if (dx_year < 2021) {
                if (!functions.GEN_INLIST(untrimmedline.overRideHistology, "1,3") && !functions.GEN_INLIST(untrimmedline.overRideSiteType, "1"))
                    return functions.GEN_ERROR_MSG(binding, 'if DX year < 2021 Behavior Code ICD-O-3: ${untrimmedline.behaviorCodeIcdO3} not allowed for Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3}')
            }
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9222") && functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "3")) {
            if (dx_year < 2022) {
                if (!functions.GEN_INLIST(untrimmedline.overRideSiteType, "1") && !functions.GEN_INLIST(untrimmedline.overRideHistology, "1,3"))
                    return functions.GEN_ERROR_MSG(binding, 'if DX year < 2022 Behavior Code ICD-O-3: ${untrimmedline.behaviorCodeIcdO3} not allowed for Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3}')
            }
        }
        if ((functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9174,9509") && functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "3")) || (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9509") && functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0")) || (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9749") && functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "1"))) {
            if (dx_year < 2023) {
                if (!functions.GEN_INLIST(untrimmedline.overRideHistology, "1,3") && !functions.GEN_INLIST(untrimmedline.overRideSiteType, "1"))
                    return functions.GEN_ERROR_MSG(binding, 'If DX year < 2023 Behavior Code ICD-O-3: ${untrimmedline.behaviorCodeIcdO3} not allowed for Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3}')
            }
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9421")) {
            if (dx_year >= 2023) {
                if (functions.GEN_AT(untrimmedline.behaviorCodeIcdO3, "1") != 0)
                    return true
            }
            else {
                if (!functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "3"))
                    return functions.GEN_ERROR_MSG(binding, 'Behavior must be 3 for this histology')
            }
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8077")) {
            if (!functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "2"))
                return functions.GEN_ERROR_MSG(binding, 'Behavior must be 2 for this histology')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8833, 9260, 9725, 9971") && functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "3")) {
            if (dx_year > 2020) {
                if (!functions.GEN_INLIST(untrimmedline.overRideHistology, "1,3"))
                    return functions.GEN_ERROR_MSG(binding, 'Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} not allowed if diagnosis year > 2020')
            }
        }
        if (dx_year >= 2023) {
            if (functions.GEN_AT(untrimmedline.behaviorCodeIcdO3, "2") != 0 && functions.GEN_AT(untrimmedline.histologicTypeIcdO3, "9050") != 0)
                return true
        }
        if (functions.GEN_STRCMP(untrimmedline.behaviorCodeIcdO3, "2") == 0 && !functions.GEN_INLIST(untrimmedline.overRideHistology, "1,3")) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-8005,8020-8021,8331-8332") || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8800-9055,9062-9062,9082-9083") || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9110-9493,9501-9989"))
                return functions.GEN_ERROR_MSG(binding, 'Invalid Histology for In Situ - ICDO3')
        }
        if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8519") && !functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "2"))
            return functions.GEN_ERROR_MSG(binding, 'Behavior must be 2 for this histology')
        if (dx_year >= 2018) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9540") && functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "1"))
                return functions.GEN_ERROR_MSG(binding, 'Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3} with Behavior Code ICD-O-3: ${untrimmedline.behaviorCodeIcdO3} not allowed for 2018+ diagnosis')
        }
        return true

    }

    // ID: NPCR-00276; TAG: N2733; NAME: Estrogen Receptor Summary, Date DX (NAACCR)
    public boolean npcr00276(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2018) {
            if (!functions.GEN_EMPTY(untrimmedline.estrogenReceptorSummary))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Estrogen Receptor Summary must be blank for cases diagnosed before 2018')
        }
        if (functions.GEN_EMPTY(untrimmedline.estrogenReceptorSummary))
            return true
        if (functions.GEN_AT(untrimmedline.estrogenReceptorSummary, "0179", 1) == 0)
            functions.GEN_SAVE_ERROR_TEXT(binding, '${untrimmedline.estrogenReceptorSummary} not valid code for Estrogen Receptor Summary')
        return true

    }

    // ID: NPCR-00277; TAG: N2734; NAME: Progesterone Receptor Summary, Date DX (NAACCR)
    public boolean npcr00277(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2018) {
            if (!functions.GEN_EMPTY(untrimmedline.progesteroneRecepSummary))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Progesterone Receptor Summary must be blank for cases diagnosed before 2018')
        }
        if (functions.GEN_EMPTY(untrimmedline.progesteroneRecepSummary))
            return true
        if (functions.GEN_AT(untrimmedline.progesteroneRecepSummary, "0179", 1) == 0)
            functions.GEN_SAVE_ERROR_TEXT(binding, '${untrimmedline.progesteroneRecepSummary} not valid code for Progesterone Receptor Summary')
        return true

    }

    // ID: NPCR-00281; TAG: N2737; NAME: PSA (Prostatic Specific Antigen) Lab Value, Date DX (NAACCR)
    public boolean npcr00281(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year, len
        
        char[] PSA = new char[6]
        char[] decimal = new char[2]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2018) {
            if (!functions.GEN_EMPTY(untrimmedline.psaLabValue))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'PSA (Prostatic Specific Antigen) Lab Value must be blank for cases diagnosed before 2018')
        }
        if (functions.GEN_EMPTY(untrimmedline.psaLabValue))
            return true
        functions.GEN_STRCPY(PSA, functions.GEN_TRIM(untrimmedline.psaLabValue, ((Integer)context.NPCR_GEN_BOTH)))
        
        len = (functions.GEN_STRLEN(PSA))
        
        if (len == 1 || len == 2)
            return false
        if (len == 3) {
            functions.GEN_STRCPY(decimal, functions.GEN_SUBSTR(PSA, 2, 1))
        
            if (functions.GEN_AT(decimal, ".") == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'PSA (Prostatic Specific Antigen) Lab Value must have at least 1 digit followed by decimal followed by digit')
            if (functions.GEN_MATCH(PSA, "(\\d\\.\\d)"))
                return true
            else
                functions.GEN_SAVE_ERROR_TEXT(binding, '${untrimmedline.psaLabValue} not valid code for PSA (Prostatic Specific Antigen) Lab Value')
        }
        if (len == 4) {
        
            functions.GEN_STRCPY(decimal, functions.GEN_SUBSTR(PSA, 3, 1))
        
            if (functions.GEN_AT(decimal, ".") == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'PSA (Prostatic Specific Antigen) Lab Value must have at least 1 digit followed by decimal followed by digit')
            if (functions.GEN_MATCH(PSA, "((([1-9]))\\d\\.\\d)"))
                return true
            else
                return false
        }
        if (len == 5) {
        
            functions.GEN_STRCPY(decimal, functions.GEN_SUBSTR(PSA, 4, 1))
        
            if (functions.GEN_AT(decimal, ".") == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'PSA (Prostatic Specific Antigen) Lab Value must have at least 1 digit followed by decimal followed by digit')
            if (functions.GEN_MATCH(PSA, "((([1-9]))\\d\\d\\.\\d)") || functions.GEN_AT(PSA, "XXX.1XXX.2XXX.3XXX.7XXX.9", 5) != 0)
                return true
            else
                return false
        }
        return true

    }

    // ID: NPCR-00283; TAG: N2060; NAME: County at DX Geocode2000 (NAACCR)
    public boolean npcr00283(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.countyAtDxGeocode2000))
            return true
        return functions.GEN_INLIST(untrimmedline.countyAtDxGeocode2000, "001-999", "(\\d\\d\\d)")

    }

    // ID: NPCR-00284; TAG: N2061; NAME: County at DX Geocode2010 (NAACCR)
    public boolean npcr00284(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.countyAtDxGeocode2010))
            return true
        return functions.GEN_INLIST(untrimmedline.countyAtDxGeocode2010, "001-999", "(\\d\\d\\d)")

    }

    // ID: NPCR-00288; TAG: N4914; NAME: Grade Path, Grade Post Therapy (NAACCR)
    public boolean npcr00288(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year < 2018)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "00790007950081100812008210082200830", 5) != 0)
            return true
        if (!functions.GEN_EMPTY(untrimmedline.gradePostTherapy)) {
            if (functions.GEN_AT(untrimmedline.gradePathological, "9") == 0)
                return false
        }
        return true

    }

    // ID: NPCR-00291; TAG: N2751; NAME: Grade Pathological (NAACCR)
    public boolean npcr00291(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.gradePathological))
            return true
        if (functions.GEN_AT(untrimmedline.gradePathological, "1234589ABCDEHLMS", 1) != 0)
            return true
        return false

    }

    // ID: NPCR-00292; TAG: N0530; NAME: Summary Stage 1977, Type of Report Source (NAACCR)
    public boolean npcr00292(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.seerSummaryStage1977))
            return true
        if (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "7")) {
            if (functions.GEN_INLIST(untrimmedline.seerSummaryStage1977, "9"))
                return true
            else
                return false
        }
        return true

    }

    // ID: NPCR-00294; TAG: N2760; NAME: Schema Discriminator 1, Date DX (NAACCR)
    public boolean npcr00294(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2018) {
            if (!functions.GEN_EMPTY(untrimmedline.schemaDiscriminator1))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Schema Discriminator 1 must be blank for cases diagnosed before 2018')
        }
        if (functions.GEN_EMPTY(untrimmedline.schemaDiscriminator1))
            return true
        if (functions.GEN_AT(untrimmedline.schemaDiscriminator1, "012345679", 1) == 0)
            functions.GEN_SAVE_ERROR_TEXT(binding, '${untrimmedline.schemaDiscriminator1} is not a valid value for Schema Discriminator 1')
        return true

    }

    // ID: NPCR-00295; TAG: N0540; NAME: Census Tr Certainty 2000 (SEER)
    public boolean npcr00295(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.censusTrCertainty2000))
            return true
        return functions.GEN_INLIST(untrimmedline.censusTrCertainty2000, "1-6, 9")

    }

    // ID: NPCR-00296; TAG: N2801; NAME: Grade Post Therapy Path (yp) (NAACCR)
    public boolean npcr00296(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.gradePostTherapy))
            return true
        if (functions.GEN_AT(untrimmedline.gradePostTherapy, "1234589ABCDEHLMS", 1) != 0)
            return true
        return false

    }

    // ID: NPCR-00300; TAG: N2810; NAME: CoC Accredited Flag (NPCR)
    public boolean npcr00300(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.cocAccreditedFlag))
            return true
        if (functions.GEN_AT(untrimmedline.cocAccreditedFlag, "012", 1) == 0)
            return false
        return true

    }

    // ID: NPCR-00303; TAG: N1254; NAME: Primary Site, Morphology-Type, Beh ICDO3 (SEER IF25)
    public boolean npcr00303(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year > 2023) {
            return true
        }
        char[] SITE_LO = new char[5], SITE_HI = new char[5], SITE = new char[5], HIST = new char[5], BEH = new char[2]
        
        char[] SiteHistBeh = new char[11]
        
        char[] SiteGrp = new char[5]
        
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        if (functions.GEN_MATCH(untrimmedline.overRideSiteType, "(1)")) {
            return true
        }
        if (functions.GEN_SQLRANGELOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_IF25_REF, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_IF25_REF_SITE_LO, untrimmedline.primarySite, ['SITE_LO':SITE_LO, 'SITE_HI':SITE_HI])) {
            if (functions.GEN_STRCMP(untrimmedline.primarySite, SITE_LO) >= 0 && functions.GEN_STRCMP(untrimmedline.primarySite, SITE_HI) <= 0)
                functions.GEN_STRCPY(SiteGrp, SITE_LO)
            else {
                return false
            }
        }
        functions.GEN_STRCPY(SiteHistBeh, SiteGrp)
        functions.GEN_STRCAT(SiteHistBeh, untrimmedline.histologicTypeIcdO3, 4)
        functions.GEN_STRCAT(SiteHistBeh, untrimmedline.behaviorCodeIcdO3, 1)
        
        if (functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_IF25_3, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_IF25_3_SITEHISTBEH, SiteHistBeh, ['SITE':SITE, 'HIST':HIST, 'BEH':BEH]))
            return true
        else
            return false
        
        return true

    }

    // ID: NPCR-00304; TAG: N2830; NAME: Summary Stage 2018, Date of DX (NAACCR)
    public boolean npcr00304(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        int err_flag
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2018) {
            if (!functions.GEN_EMPTY(untrimmedline.summaryStage2018))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Summary Stage 2018 must be blank for cases diagnosed before 2018')
        }
        if (dx_year >= 2018) {
            if (functions.GEN_EMPTY(untrimmedline.summaryStage2018))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Summary Stage 2018 must not be blank for cases diagnosed 2018 and later')
        }
        return true

    }

    // ID: NPCR-00309; TAG: N2148; NAME: Tumor Size Summary, Date of Diagnosis (NPCR)
    public boolean npcr00309(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 2015) {
            if (functions.GEN_EMPTY(untrimmedline.tumorSizeSummary))
                return false
        }
        return true

    }

    // ID: NPCR-00317; TAG: N1374; NAME: Census Tr Certainty 2010 (SEER)
    public boolean npcr00317(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.censusTrCertainty2010))
            return true
        return functions.GEN_INLIST(untrimmedline.censusTrCertainty2010, "1-6, 9")

    }

    // ID: NPCR-00318; TAG: N1375; NAME: Census Tract 2010 (SEER)
    public boolean npcr00318(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.censusTract2010))
            return true
        if (!functions.GEN_INLIST(untrimmedline.censusTract2010, "000000, 000100-999999", "(\\d\\d\\d\\d\\d\\d)"))
            return false
        return true

    }

    // ID: NPCR-00323; TAG: N2877; NAME: Estrogen Receptor Summary, Schema ID, Required (NAACCR)
    public boolean npcr00323(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.schemaId))
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0)
            return true
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2018)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "00480", 5) != 0) {
            if (functions.GEN_EMPTY(untrimmedline.estrogenReceptorSummary))
                return false
        }
        return true

    }

    // ID: NPCR-00328; TAG: 3148; NAME: CS Items, DX Pre-2004 (Subm)
    public boolean npcr00328(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        int err_flag
        err_flag = 0
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year < 2004) {
            if (!functions.GEN_EMPTY(untrimmedline.csTumorSize)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2004, CS Tumor Size must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor1)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2004, CS Site-Specific Factor 1 must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor2)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2004, CS Site-Specific Factor 2 must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor8)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2004, CS Site-Specific Factor 8 must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor10)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2004, CS Site-Specific Factor10 must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor15)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2004, CS Site-Specific Factor15 must be blank')
                err_flag = 1
            }
        }
        if (err_flag == 1)
            return false
        return true

    }

    // ID: NPCR-00329; TAG: 3151; NAME: Derived CS Items, DX Pre-2004 (Subm)
    public boolean npcr00329(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int err_flag
        err_flag = 0
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year < 2004) {
        
            if (!functions.GEN_EMPTY(untrimmedline.derivedSs2000)) {
                functions.GEN_SAVE_TEXT(binding, 'If DX < 2004, Derived SS2000 must be blank')
                err_flag = 1
            }
        }
        if (err_flag == 1)
            return false
        return true

    }

    // ID: NPCR-00330; TAG: 3149; NAME: CS Items, Type Reporting Source-DCO (Subm)
    public boolean npcr00330(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] t_site = new char[5], t_hist = new char[5], t_discrim = new char[4], t_schema_name = new char[31], t_schema_msg = new char[79]
        int t_schema_number, t_max_schemas, t_result
        int dx_year, err_flag
        
        err_flag = 0
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2004 || dx_year > 2017)
            return true
        if (!functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "7"))
            return true
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "2"))
            return true
        functions.GEN_STRCPY(t_site, untrimmedline.primarySite)
        functions.GEN_STRCPY(t_hist, untrimmedline.histologicTypeIcdO3)
        
        t_max_schemas = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_number_of_schemas")
        
        t_schema_number = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_number", t_site, t_hist, t_discrim)
        
        if (t_schema_number < 0)
            return true
        if (t_schema_number > t_max_schemas) {
            return true
        }
        functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_name", t_schema_number, t_schema_name)
        
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1,")) {
            if (!functions.GEN_INLIST(t_schema_name, "Brain,CNSOther,IntracranialGland"))
                return true
        }
        if (!functions.GEN_EMPTY(untrimmedline.csTumorSize) && !functions.GEN_INLIST(untrimmedline.csTumorSize, "988,999"))
            functions.GEN_SAVE_ERROR_TEXT(binding, 'DCO: CS Tumor Size (${untrimmedline.csTumorSize}) must = 988, 999 or blank')
        if (!functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor1)) {
            if (!functions.GEN_INLIST(untrimmedline.csSiteSpecificFactor1, "988,999"))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'DCO: CS Site-Specific Factor 1 (${untrimmedline.csSiteSpecificFactor1}) must = 988, 999 or blank')
        }
        if (!functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor2)) {
            if (!functions.GEN_INLIST(untrimmedline.csSiteSpecificFactor2, "988,999"))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'DCO: CS Site-Specific Factor 2 (${untrimmedline.csSiteSpecificFactor2}) must = 988, 999 or blank')
        }
        if (!functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor8) && !functions.GEN_INLIST(untrimmedline.csSiteSpecificFactor8, "988,999"))
            functions.GEN_SAVE_ERROR_TEXT(binding, 'DCO: CS Site-Specific Factor 8 (${untrimmedline.csSiteSpecificFactor8}) must = 988, 999 or blank')
        if (!functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor10) && !functions.GEN_INLIST(untrimmedline.csSiteSpecificFactor10, "988,999"))
            functions.GEN_SAVE_ERROR_TEXT(binding, 'DCO: CS Site-Specific Factor10 (${untrimmedline.csSiteSpecificFactor10}) must = 988, 999 or blank')
        if (!functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor15) && !functions.GEN_INLIST(untrimmedline.csSiteSpecificFactor15, "988,999"))
            functions.GEN_SAVE_ERROR_TEXT(binding, 'DCO: CS Site-Specific Factor15 (${untrimmedline.csSiteSpecificFactor15}) must = 988, 999 or blank')
        
        return true

    }

    // ID: NPCR-00332; TAG: N0410; NAME: Race 3 (NAACCR)
    public boolean npcr00332(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.race3))
            return true
        if (functions.GEN_INLIST(untrimmedline.race3, "01-08, 10-17,20-22,25-28,30-32,88,96-99", "(\\d\\d)"))
            return true
        return false

    }

    // ID: NPCR-00333; TAG: N0414; NAME: Race 3, Date of DX (SEER IF90)
    public boolean npcr00333(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 1999) {
            if (functions.GEN_EMPTY(untrimmedline.race3))
                return false
            else
                return true
        }
        return true

    }

    // ID: NPCR-00334; TAG: N0411; NAME: Race 4 (NAACCR)
    public boolean npcr00334(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.race4))
            return true
        if (functions.GEN_INLIST(untrimmedline.race4, "01-08, 10-17,20-22,25-28,30-32,88,96-99", "(\\d\\d)"))
            return true
        return false

    }

    // ID: NPCR-00335; TAG: N0415; NAME: Race 4, Date of DX (SEER IF91)
    public boolean npcr00335(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 1999) {
            if (functions.GEN_EMPTY(untrimmedline.race4))
                return false
            else
                return true
        }
        return true

    }

    // ID: NPCR-00336; TAG: N0412; NAME: Race 5 (NAACCR)
    public boolean npcr00336(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.race5))
            return true
        if (functions.GEN_INLIST(untrimmedline.race5, "01-08, 10-17,20-22,25-28,30-32,88,96-99", "(\\d\\d)"))
            return true
        return false

    }

    // ID: NPCR-00337; TAG: N0416; NAME: Race 5, Date of DX (SEER IF92)
    public boolean npcr00337(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year > 1999) {
            if (functions.GEN_EMPTY(untrimmedline.race5))
                return false
            else
                return true
        }
        return true

    }

    // ID: NPCR-00360; TAG: N2030; NAME: RX Date Mst Defn Srg, Date Last Contact (NPCR)
    public boolean npcr00360(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dtcmp
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2015)
            return true
        if (functions.GEN_EMPTY(untrimmedline.dateOfLastContact) || functions.GEN_EMPTY(untrimmedline.rxDateMostDefinSurg))
            return true
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.rxDateMostDefinSurg, untrimmedline.dateOfLastContact, ((Integer)context.NPCR_GEN_DT_MIN))
        
        if (dtcmp == ((Integer)context.NPCR_GEN_DT_ERROR)) {
            if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.rxDateMostDefinSurg)) {
                functions.GEN_ERROR_TEXT(binding, 'RX Date Most Defin Surg is invalid: %DC')
                return false
            }
            else {
                if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfLastContact)) {
                    functions.GEN_ERROR_TEXT(binding, 'Date of Last Contact is invalid: %DC')
                    return false
                }
            }
        }
        else {
            if (dtcmp <= 0)
                return true
            else
                return false
        }
        
        return true

    }

    // ID: NPCR-00373; TAG: N3968; NAME: RX Date Radiation, PhI Radiation Treatment Modality (NAACCR)
    public boolean npcr00373(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018)
            return true
        if (functions.GEN_INLIST(untrimmedline.phase1RadiationTreatmentModality, "00,99")) {
            if (!functions.GEN_EMPTY(untrimmedline.rxDateRadiation))
                return false
        }
        if (!functions.GEN_EMPTY(untrimmedline.rxDateRadiation)) {
            if (!functions.GEN_INLIST(untrimmedline.phase1RadiationTreatmentModality, "01-16,98"))
                return false
        }
        return true

    }

    // ID: NPCR-00380; TAG: 3152; NAME: Derived SS2000, Behavior ICDO3 (Subm)
    public boolean npcr00380(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] t_site = new char[5], t_hist = new char[5], t_discrim = new char[4], t_schema_name = new char[31], t_schema_msg = new char[79]
        char[] CS_code = new char[4]
        int t_schema_number, t_max_schemas, t_result
        
        if (functions.GEN_EMPTY(untrimmedline.derivedSs2000))
            return true
        if (functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "7"))
            return true
        functions.GEN_STRCPY(t_site, untrimmedline.primarySite)
        functions.GEN_STRCPY(t_hist, untrimmedline.histologicTypeIcdO3)
        
        t_max_schemas = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_number_of_schemas")
        
        t_schema_number = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_number", t_site, t_hist, t_discrim)
        
        if (t_schema_number < 0)
            return true
        if (t_schema_number > t_max_schemas) {
            return true
        }
        functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_name", t_schema_number, t_schema_name)
        
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1,")) {
            if (!functions.GEN_INLIST(t_schema_name, "Brain,CNSOther,IntracranialGland"))
                return true
        }
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1")) {
            if (functions.GEN_INLIST(untrimmedline.derivedSs2000, "8"))
                return true
            else {
                functions.GEN_STRCPY(t_schema_msg, "Schema: ")
                functions.GEN_STRCAT(t_schema_msg, t_schema_name)
                functions.GEN_SAVE_TEXT(binding, t_schema_msg)
                return false
            }
        }
        else {
            if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "2") && functions.GEN_INLIST(t_schema_name, "Bladder")) {
                if (!functions.GEN_INLIST(untrimmedline.derivedSs2000, "8"))
                    return true
                else {
                    functions.GEN_STRCPY(t_schema_msg, "Schema: ")
                    functions.GEN_STRCAT(t_schema_msg, t_schema_name)
                    functions.GEN_SAVE_TEXT(binding, t_schema_msg)
                    return false
                }
            }
            else {
                if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "2")) {
                    if (functions.GEN_INLIST(untrimmedline.derivedSs2000, "0"))
                        return true
                    else {
                        functions.GEN_STRCPY(t_schema_msg, "Schema: ")
                        functions.GEN_STRCAT(t_schema_msg, t_schema_name)
                        functions.GEN_SAVE_TEXT(binding, t_schema_msg)
                        return false
                    }
                }
                else {
                    if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "3") && functions.GEN_INLIST(t_schema_name, "Prostate")) {
                        if (!functions.GEN_INLIST(untrimmedline.derivedSs2000, "8"))
                            return true
                        else {
                            functions.GEN_STRCPY(t_schema_msg, "Schema: ")
                            functions.GEN_STRCAT(t_schema_msg, t_schema_name)
                            functions.GEN_SAVE_TEXT(binding, t_schema_msg)
                            return false
                        }
                    }
                    else {
                        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "3")) {
                            if (!functions.GEN_INLIST(untrimmedline.derivedSs2000, "0,8"))
                                return true
                            else {
                                functions.GEN_STRCPY(t_schema_msg, "Schema: ")
                                functions.GEN_STRCAT(t_schema_msg, t_schema_name)
                                functions.GEN_SAVE_TEXT(binding, t_schema_msg)
                                return false
                            }
                        }
                    }
                }
            }
        }
        return true

    }

    // ID: NPCR-00383; TAG: N5020; NAME: Autopsy Only, RX 03-2022, Primary Site, 2018 (NPCR)
    public boolean npcr00383(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year, err_flag
        err_flag = 0
        char[] nodenine = new char[2]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018 || dx_year > 2022)
            return true
        if (!functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "6"))
            return true
        functions.GEN_STRCPY(nodenine, "0")
        
        if (functions.GEN_INLIST(untrimmedline.primarySite, "420, 421, 423, 424, 589, 700-729,751-753,761-768,770-779,809", "(C\\d\\d\\d)", 2, 3)) {
            functions.GEN_STRCPY(nodenine, "1")
        }
        if (functions.GEN_AT(untrimmedline.rxSummSurgPrimSite, "0098", 2) == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Surg Prim Site 03-2022')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.primarySite, "C760") != 0) {
            functions.GEN_STRCPY(nodenine, "2")
            if (functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "09", 1) == 0) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only and RX Summ--Scope Re LN Sur')
                err_flag = 1
            }
        }
        if (functions.GEN_AT(nodenine, "1") != 0) {
            if (functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "9") == 0) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Scope Reg LN Sur')
                err_flag = 1
            }
        }
        if (functions.GEN_AT(nodenine, "0") != 0) {
            if (functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "0") == 0) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Scope Reg LN Sur')
                err_flag = 1
            }
        }
        if (functions.GEN_AT(untrimmedline.rxSummSurgOthRegDis, "0") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Surg Oth Reg/Dis')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.reasonForNoSurgery, "19", 1) == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & Reason for No Surgery')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.rxSummBrm, "00") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--BRM')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.rxSummChemo, "00") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Chemo')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.rxSummHormone, "00") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Hormone')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.rxSummOther, "0") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Other')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.rxSummTransplntEndocr, "00") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Transplnt/Endocr')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.phase1RadiationTreatmentModality, "00") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & Phase I Radiation Treatment Modality')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.rxSummSurgRadSeq, "0") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Surg/Rad Seq')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.rxSummSystemicSurSeq, "0") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Systemic/Sur Seq')
            err_flag = 1
        }
        if (err_flag == 1)
            return false
        return true

    }

    // ID: NPCR-00384; TAG: N5041; NAME: Brain Molecular Markers, Summary Stage 2018 (NAACCR)
    public boolean npcr00384(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        char[] ID = new char[40]
        char[] code = new char[7]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2019)
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0) {
            return true
        }
        functions.GEN_STRCPY(ID, "00721 00722 09721 09722 09724 ")
        
        
        functions.GEN_STRCPY(code, untrimmedline.schemaId)
        functions.GEN_STRCAT(code, " ")
        
        if (functions.GEN_AT(code, ID, 6) == 0)
            return true
        if (functions.GEN_EMPTY(untrimmedline.brainMolecularMarkers) || functions.GEN_AT(untrimmedline.brainMolecularMarkers, "88") != 0)
            return true
        if (functions.GEN_EMPTY(untrimmedline.summaryStage2018))
            return true
        if (functions.GEN_AT(untrimmedline.brainMolecularMarkers, "86", 2) != 0) {
            if (functions.GEN_AT(untrimmedline.summaryStage2018, "8") == 0)
                return false
        }
        if (functions.GEN_AT(untrimmedline.summaryStage2018, "8", 1) != 0) {
            if (functions.GEN_AT(untrimmedline.brainMolecularMarkers, "8699", 2) == 0)
                return false
        }
        return true

    }

    // ID: NPCR-00385; TAG: N5000; NAME: Behavior Code ICDO3, Summary Stage 2018, Schema ID (NAACCR)
    public boolean npcr00385(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018)
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0)
            return true
        if (functions.GEN_EMPTY(untrimmedline.schemaId) || functions.GEN_AT(untrimmedline.schemaId, "99999") != 0)
            return true
        if (functions.GEN_EMPTY(untrimmedline.summaryStage2018))
            return true
        if (functions.GEN_EMPTY(untrimmedline.behaviorCodeIcdO3))
            return true
        if (functions.GEN_AT(untrimmedline.behaviorCodeIcdO3, "01", 1) != 0) {
            if (functions.GEN_AT(untrimmedline.schemaId, "00721007220072309721097220972309724", 5) != 0) {
                if (functions.GEN_AT(untrimmedline.summaryStage2018, "8") == 0)
                    return false
            }
        }
        if (functions.GEN_AT(untrimmedline.schemaId, "00721007220072309721097220972309724", 5) != 0) {
            if (functions.GEN_AT(untrimmedline.summaryStage2018, "8") != 0) {
                if (functions.GEN_AT(untrimmedline.behaviorCodeIcdO3, "01", 1) == 0)
                    return false
            }
        }
        if (functions.GEN_AT(untrimmedline.behaviorCodeIcdO3, "2") != 0) {
            if (functions.GEN_AT(untrimmedline.summaryStage2018, "0") == 0)
                return false
        }
        if (functions.GEN_AT(untrimmedline.behaviorCodeIcdO3, "3") != 0) {
            if (functions.GEN_AT(untrimmedline.summaryStage2018, "08", 1) != 0)
                return false
        }
        return true

    }

    // ID: NPCR-00386; TAG: N0628; NAME: Race 1, Race 2, Race 3, Race 4, Race 5 (SEER IF93)
    public boolean npcr00386(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int race1, race2, race3, race4, race5
        
        if (functions.GEN_EMPTY(untrimmedline.race2)) {
            if (!functions.GEN_EMPTY(untrimmedline.race3))
                return functions.GEN_ERROR_MSG(binding, 'If a race code = spaces, all subsequent race codes must = spaces')
        }
        if (functions.GEN_EMPTY(untrimmedline.race3)) {
            if (!functions.GEN_EMPTY(untrimmedline.race4))
                return functions.GEN_ERROR_MSG(binding, 'If a race code = spaces, all subsequent race codes must = spaces')
        }
        if (functions.GEN_EMPTY(untrimmedline.race4)) {
            if (!functions.GEN_EMPTY(untrimmedline.race5))
                return functions.GEN_ERROR_MSG(binding, 'If a race code = spaces, all subsequent race codes must = spaces')
        }
        if (functions.GEN_EMPTY(untrimmedline.race2))
            return true
        race1 = functions.GEN_VAL(untrimmedline.race1)
        race2 = functions.GEN_VAL(untrimmedline.race2)
        race3 = functions.GEN_VAL(untrimmedline.race3)
        race4 = functions.GEN_VAL(untrimmedline.race4)
        race5 = functions.GEN_VAL(untrimmedline.race5)
        
        if ((race1 == 99) || (race2 == 99) || (race3 == 99) || (race4 == 99) || (race5 == 99)) {
            if ((race1 != 99) || (race2 != 99) || (race3 != 99) || (race4 != 99) || (race5 != 99))
                return functions.GEN_ERROR_MSG(binding, 'If a race code = 99, all race codes must = 99')
        }
        if (race2 == 88) {
            if (race3 != 88)
                return functions.GEN_ERROR_MSG(binding, 'If a race code = 88, all subsequent race codes must = 88')
        }
        if (race3 == 88) {
            if (race4 != 88)
                return functions.GEN_ERROR_MSG(binding, 'If a race code = 88, all subsequent race codes must = 88')
        }
        if (race4 == 88) {
            if (race5 != 88)
                return functions.GEN_ERROR_MSG(binding, 'If a race code = 88, all subsequent race codes must = 88')
        }
        if (functions.GEN_EMPTY(untrimmedline.race1) || functions.GEN_INLIST(untrimmedline.race1, "88,99"))
            return true
        if ((race1 == race2) || (race1 == race3) || (race1 == race4) || (race1 == race5))
            return functions.GEN_ERROR_MSG(binding, 'A race code (other than spaces, 88, or 99) must not be entered more than once')
        if (functions.GEN_EMPTY(untrimmedline.race2) || race2 == 88) {
            return true
        }
        if (functions.GEN_INLIST(untrimmedline.race1, "01"))
            return functions.GEN_ERROR_MSG(binding, 'A race code of 01 (white) must be the last recorded race')
        if ((race2 == race3) || (race2 == race4) || (race2 == race5))
            return functions.GEN_ERROR_MSG(binding, 'A race code (other than spaces, 88, or 99) must not be entered more than once')
        if (functions.GEN_EMPTY(untrimmedline.race3) || race3 == 88) {
            return true
        }
        if (functions.GEN_INLIST(untrimmedline.race2, "01"))
            return functions.GEN_ERROR_MSG(binding, 'A race code of 01 (white) must be the last recorded race')
        if ((race3 == race4) || (race3 == race5))
            return functions.GEN_ERROR_MSG(binding, 'A race code (other than spaces, 88, or 99) must not be entered more than once')
        if (functions.GEN_EMPTY(untrimmedline.race4) || race4 == 88) {
            return true
        }
        if (functions.GEN_INLIST(untrimmedline.race3, "01"))
            return functions.GEN_ERROR_MSG(binding, 'A race code of 01 (white) must be the last recorded race')
        if ((race4 == race5))
            return functions.GEN_ERROR_MSG(binding, 'A race code (other than spaces, 88, or 99) must not be entered more than once')
        if (functions.GEN_EMPTY(untrimmedline.race5) || race5 == 88) {
            return true
        }
        if (functions.GEN_INLIST(untrimmedline.race4, "01"))
            return functions.GEN_ERROR_MSG(binding, 'A race code of 01 (white) must be the last recorded race')
        return true

    }

    // ID: NPCR-00387; TAG: N2031; NAME: RX Date Mst Defn Srg, RX Date Surgery (NPCR)
    public boolean npcr00387(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dtcmp
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2015)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxDateSurgery) || functions.GEN_EMPTY(untrimmedline.rxDateMostDefinSurg))
            return true
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.rxDateMostDefinSurg, untrimmedline.rxDateSurgery, ((Integer)context.NPCR_GEN_DT_MIN))
        
        if (dtcmp == ((Integer)context.NPCR_GEN_DT_ERROR)) {
            if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.rxDateMostDefinSurg)) {
                functions.GEN_ERROR_TEXT(binding, 'RX Date Most Defin Surg is invalid: %DC')
                return false
            }
            else {
                if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.rxDateSurgery)) {
                    functions.GEN_ERROR_TEXT(binding, 'RX Date Surgery is invalid: %DC')
                    return false
                }
            }
        }
        else {
            if (dtcmp >= 0)
                return true
            else
                return false
        }
        
        return true

    }

    // ID: NPCR-00393; TAG: N5019; NAME: RX Summ--Scope Reg LN Sur, Primary Site, 2018 (NAACCR)
    public boolean npcr00393(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018)
            return true
        if (functions.GEN_EMPTY(untrimmedline.primarySite))
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummScopeRegLnSur))
            return true
        if (functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "9") == 0) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "420,421,423,424,589,700-729,751-753,761-768,770-779,809", "(C\\d\\d\\d)", 2, 3))
                return false
        }
        return true

    }

    // ID: NPCR-00395; TAG: 3140; NAME: Laterality, Primary Site (Subm)
    public boolean npcr00395(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        if ((functions.GEN_INLIST(untrimmedline.primarySite, "079,080,081,098,099,301,310,312", "(C\\d\\d\\d)", 2, 3) || functions.GEN_INLIST(untrimmedline.primarySite, "341-349,384,400-403,441-443,445-447,471", "(C\\d\\d\\d)", 2, 3) || functions.GEN_INLIST(untrimmedline.primarySite, "472,491,492,500-509,569,570,620-629,630", "(C\\d\\d\\d)", 2, 3) || functions.GEN_INLIST(untrimmedline.primarySite, "631,649,659,669,690-699,740-749,754", "(C\\d\\d\\d)", 2, 3))) {
            if (functions.GEN_INLIST(untrimmedline.laterality, "0"))
                return false
            else
                return true
        }
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year < 2018) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "090,091", "(C\\d\\d\\d)", 2, 3)) {
                if (functions.GEN_AT(untrimmedline.laterality, "0") != 0)
                    return false
                else
                    return true
            }
        }
        if (dx_year > 2003) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "700,710-714,722-725", "(C\\d\\d\\d)", 2, 3)) {
                if (functions.GEN_INLIST(untrimmedline.laterality, "0"))
                    return false
                else
                    return true
            }
        }
        if (dx_year >= 2021) {
            if (functions.GEN_AT(untrimmedline.primarySite, "C444") != 0) {
                if (functions.GEN_AT(untrimmedline.laterality, "0") != 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Laterality must not = 0 for Primary Site: ${untrimmedline.primarySite} for Date of Diagnosis >= 2021')
                else
                    return true
            }
        }
        return true

    }

    // ID: NPCR-00398; TAG: 3184; NAME: RX Summ--Surg/Rad Seq, Date of DX (Subm)
    public boolean npcr00398(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year < 2010)
            return true
        if (dx_year >= 2010 && dx_year < 2015) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "180-189,199,209,500-509", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044,9060-9136,9141-9582")) {
                if (functions.GEN_EMPTY(untrimmedline.rxSummSurgRadSeq))
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'If DX year - 2010-2014, Primary Site = ${untrimmedline.primarySite} and Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, RX Summ--Surg/Rad Seq cannot be blank')
            }
        }
        if (dx_year > 2014) {
            if (functions.GEN_EMPTY(untrimmedline.rxSummSurgRadSeq))
                return false
        }
        return true

    }

    // ID: NPCR-00399; TAG: 3175; NAME: CS Tumor Size, Site, Histol ICDO3 (Subm)
    public boolean npcr00399(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] t_site = new char[5], t_hist = new char[5], t_discrim = new char[4], t_schema_name = new char[31], t_schema_msg = new char[79]
        int t_schema_number, t_max_schemas, t_result
        char[] t_schema_str = new char[4]
        
        if (functions.GEN_EMPTY(untrimmedline.csTumorSize))
            return true
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1"))
            return true
        functions.GEN_STRCPY(t_site, untrimmedline.primarySite)
        functions.GEN_STRCPY(t_hist, untrimmedline.histologicTypeIcdO3)
        
        t_max_schemas = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_number_of_schemas")
        
        t_schema_number = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_number", t_site, t_hist, t_discrim)
        
        if (t_schema_number < 0)
            return true
        if (t_schema_number > t_max_schemas) {
            return true
        }
        functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_name", t_schema_number, t_schema_name)
        
        if (functions.GEN_INLIST(t_schema_name, "Colon,Rectum")) {
            if (functions.GEN_INLIST(untrimmedline.csTumorSize, "998")) {
                if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8220,8221"))
                    return true
                else {
                    functions.GEN_STRCPY(t_schema_msg, "Schema: ")
                    functions.GEN_STRCAT(t_schema_msg, t_schema_name)
                    functions.GEN_SAVE_TEXT(binding, t_schema_msg)
                    return false
                }
            }
        }
        if (functions.GEN_INLIST(t_schema_name, "Colon,Rectum")) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8220,8221")) {
                if (functions.GEN_INLIST(untrimmedline.csTumorSize, "998"))
                    return true
                else {
                    functions.GEN_STRCPY(t_schema_msg, "Schema: ")
                    functions.GEN_STRCAT(t_schema_msg, t_schema_name)
                    functions.GEN_SAVE_TEXT(binding, t_schema_msg)
                    return false
                }
            }
        }
        if (functions.GEN_INLIST(t_schema_name, "IllDefinedOther")) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "809", "(C\\d\\d\\d)", 2, 3)) {
                if (functions.GEN_INLIST(untrimmedline.csTumorSize, "999"))
                    return true
                else {
                    functions.GEN_STRCPY(t_schema_msg, "Schema: ")
                    functions.GEN_STRCAT(t_schema_msg, t_schema_name)
                    functions.GEN_SAVE_TEXT(binding, t_schema_msg)
                    return functions.GEN_ERROR_MSG(binding, 'For Primary Site of ${untrimmedline.primarySite}, CS Tumor Size must = 999')
                }
            }
        }
        return true

    }

    // ID: NPCR-00400; TAG: 3248; NAME: RX Summ--Surg Prim Site, 03-2022, Date of DX (Subm)
    public boolean npcr00400(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010 || dx_year > 2022)
            return true
        if (dx_year >= 2010) {
            if (functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite))
                return false
        }
        return true

    }

    // ID: NPCR-00401; TAG: 3243; NAME: RX Summ--Scope Reg LN Sur, Date of DX (Subm)
    public boolean npcr00401(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010)
            return true
        if (dx_year >= 2010) {
            if (functions.GEN_EMPTY(untrimmedline.rxSummScopeRegLnSur))
                return false
        }
        return true

    }

    // ID: NPCR-00402; TAG: 3246; NAME: RX Summ--Surg Oth Reg/Dis, Date of DX (Subm)
    public boolean npcr00402(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010)
            return true
        if (dx_year >= 2010) {
            if (functions.GEN_EMPTY(untrimmedline.rxSummSurgOthRegDis))
                return false
        }
        return true

    }

    // ID: NPCR-00403; TAG: 3263; NAME: Casefinding Source (Subm)
    public boolean npcr00403(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2012)
            return true
        if (functions.GEN_EMPTY(untrimmedline.casefindingSource))
            return true
        return functions.GEN_INLIST(untrimmedline.casefindingSource, "10,20-30,40,50,60,70,75,80,85,90,95,99", "(\\d\\d)")

    }

    // ID: NPCR-00404; TAG: 3252; NAME: RX Summ--Systemic/Sur Seq (Subm)
    public boolean npcr00404(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummSystemicSurSeq))
            return true
        if (dx_year >= 2010 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        return functions.GEN_INLIST(untrimmedline.rxSummSystemicSurSeq, "0,2-7,9")

    }

    // ID: NPCR-00405; TAG: 3262; NAME: Reason for No Surgery, Date of DX (Subm)
    public boolean npcr00405(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010)
            return true
        if (dx_year >= 2010) {
            if (functions.GEN_EMPTY(untrimmedline.reasonForNoSurgery))
                return false
        }
        return true

    }

    // ID: NPCR-00406; TAG: 3261; NAME: Reason for No Surgery (Subm)
    public boolean npcr00406(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010)
            return true
        if (functions.GEN_EMPTY(untrimmedline.reasonForNoSurgery))
            return true
        return functions.GEN_INLIST(untrimmedline.reasonForNoSurgery, "0,1,2,5,6,7,8,9")

    }

    // ID: NPCR-00407; TAG: 3251; NAME: RX Summ--Surg/Rad Seq (Subm)
    public boolean npcr00407(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummSurgRadSeq))
            return true
        if (dx_year >= 2012 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        return functions.GEN_INLIST(untrimmedline.rxSummSurgRadSeq, "0,2-7,9")

    }

    // ID: NPCR-00408; TAG: 3181; NAME: RX Summ--Chemo, Date of DX (Subm)
    public boolean npcr00408(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year < 2010) {
            return true
        }
        if (dx_year >= 2010 && dx_year < 2015) {
            if (!(functions.GEN_INLIST(untrimmedline.primarySite, "180-189,199,209,500-509", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044,9060-9136,9141-9582")))
                return true
            if (functions.GEN_EMPTY(untrimmedline.rxSummChemo))
                return false
        }
        if (dx_year > 2014) {
            if (functions.GEN_EMPTY(untrimmedline.rxSummChemo))
                return functions.GEN_ERROR_MSG(binding, 'If DX year = 2015 or later, RX Summ--Chemo cannot be blank')
        }
        return true

    }

    // ID: NPCR-00409; TAG: 3182; NAME: RX Summ--Hormone, Date of DX (Subm)
    public boolean npcr00409(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year < 2010) {
            return true
        }
        if (dx_year >= 2010 && dx_year < 2015) {
            if (!(functions.GEN_INLIST(untrimmedline.primarySite, "180-189,199,209,500-509", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044,9060-9136,9141-9582")))
                return true
            if (functions.GEN_EMPTY(untrimmedline.rxSummHormone))
                return false
        }
        else {
            if (functions.GEN_EMPTY(untrimmedline.rxSummHormone))
                return functions.GEN_ERROR_MSG(binding, 'If DX year = 2015 or later, RX Summ--Hormone cannot be blank')
        }
        return true

    }

    // ID: NPCR-00410; TAG: 3185; NAME: RX Summ--Systemic/Sur Seq, Date of DX (Subm)
    public boolean npcr00410(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year < 2010)
            return true
        if (dx_year >= 2010 && dx_year < 2015) {
            if (((functions.GEN_INLIST(untrimmedline.primarySite, "180-189,199,209,500-509", "(C\\d\\d\\d)", 2, 3))) && (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044,9060-9136,9141-9582")) && (functions.GEN_EMPTY(untrimmedline.rxSummSystemicSurSeq)))
                return false
        }
        if (dx_year > 2014) {
            if (functions.GEN_EMPTY(untrimmedline.rxSummSystemicSurSeq))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'If DX year = 2015 or later, RX Summ--Systemic/Sur Seq cannot be blank')
        }
        return true

    }

    // ID: NPCR-00411; TAG: 3180; NAME: RX Summ--BRM, Date of DX (Subm)
    public boolean npcr00411(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year < 2010) {
            return true
        }
        if (dx_year >= 2010 && dx_year < 2015) {
            if (!(functions.GEN_INLIST(untrimmedline.primarySite, "180-189,199,209,500-509", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044,9060-9136,9141-9582")))
                return true
            if (functions.GEN_EMPTY(untrimmedline.rxSummBrm))
                return false
        }
        if (dx_year > 2014) {
            if (functions.GEN_EMPTY(untrimmedline.rxSummBrm))
                return functions.GEN_ERROR_MSG(binding, 'If DX year = 2015 or later, RX Summ--BRM cannot be blank')
        }
        return true

    }

    // ID: NPCR-00412; TAG: 3257; NAME: RX Summ--Treatment Status, Date of DX (Subm)
    public boolean npcr00412(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year < 2010)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummTreatmentStatus))
            return false
        return true

    }

    // ID: NPCR-00413; TAG: 3183; NAME: RX Summ--Other, Date of DX (Subm)
    public boolean npcr00413(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year < 2010) {
            return true
        }
        if (dx_year >= 2010 && dx_year < 2015) {
            if (!(functions.GEN_INLIST(untrimmedline.primarySite, "180-189,199,209,500-509", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044,9060-9136,9141-9582")))
                return true
            if (functions.GEN_EMPTY(untrimmedline.rxSummOther))
                return false
        }
        if (dx_year > 2014) {
            if (functions.GEN_EMPTY(untrimmedline.rxSummOther))
                return functions.GEN_ERROR_MSG(binding, 'If DX year = 2015 or later, RX Summ--Other cannot be blank')
        }
        return true

    }

    // ID: NPCR-00414; TAG: 3231; NAME: RX Summ--BRM (Subm)
    public boolean npcr00414(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummBrm))
            return true
        if (dx_year >= 2010 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        return functions.GEN_INLIST(untrimmedline.rxSummBrm, "00,01,82,85-88,99", "(\\d\\d)")

    }

    // ID: NPCR-00415; TAG: 3234; NAME: RX Summ--Chemo (Subm)
    public boolean npcr00415(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummChemo))
            return true
        if (dx_year >= 2010 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        functions.GEN_NOOP()
        
        return functions.GEN_INLIST(untrimmedline.rxSummChemo, "00-03,82,85-88,99", "(\\d\\d)")

    }

    // ID: NPCR-00416; TAG: 3237; NAME: RX Summ--Hormone (Subm)
    public boolean npcr00416(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummHormone))
            return true
        if (dx_year >= 2010 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        return functions.GEN_INLIST(untrimmedline.rxSummHormone, "00,01,82,85-88,99", "(\\d\\d)")

    }

    // ID: NPCR-00417; TAG: 3240; NAME: RX Summ--Other (Subm)
    public boolean npcr00417(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummOther))
            return true
        if (dx_year >= 2010 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        return functions.GEN_INLIST(untrimmedline.rxSummOther, "0-3,6-9")

    }

    // ID: NPCR-00418; TAG: 3188; NAME: Rad--Regional RX Modality (Subm)
    public boolean npcr00418(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010 || dx_year > 2017)
            return true
        if (functions.GEN_EMPTY(untrimmedline.radRegionalRxModality))
            return true
        if (dx_year >= 2010 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        if (functions.GEN_INLIST(untrimmedline.radRegionalRxModality, "00,20-32,40-43,50-55,60-62,80,85,98,99", "(\\d\\d)") && functions.GEN_MATCH(untrimmedline.radRegionalRxModality, "(\\d\\d)"))
            return true
        return false

    }

    // ID: NPCR-00419; TAG: 3167; NAME: Death Certificate Only, RX (2010-2022) (Subm)
    public boolean npcr00419(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int err_flag
        err_flag = 0
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010 || dx_year > 2022)
            return true
        if (!functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "7"))
            return true
        if (!functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "98,99", "(\\d\\d)")) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Surg Prim Site 03-2022')
            err_flag = 1
        }
        if (!functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "9")) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Scope Reg LN Sur')
            err_flag = 1
        }
        if (!functions.GEN_INLIST(untrimmedline.rxSummSurgOthRegDis, "9")) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Surg Oth Reg/Dis')
            err_flag = 1
        }
        if (!functions.GEN_INLIST(untrimmedline.reasonForNoSurgery, "9")) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & Reason for No Surgery')
            err_flag = 1
        }
        if (dx_year >= 2010 && dx_year <= 2014 && (functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582"))) {
            if (!functions.GEN_INLIST(untrimmedline.rxSummBrm, "99")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--BRM')
                err_flag = 1
            }
            if (!functions.GEN_INLIST(untrimmedline.rxSummChemo, "99")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Chemo')
                err_flag = 1
            }
            if (!functions.GEN_INLIST(untrimmedline.rxSummHormone, "99")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Hormone')
                err_flag = 1
            }
            if (!functions.GEN_INLIST(untrimmedline.rxSummOther, "9")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Other')
                err_flag = 1
            }
            if (!functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "99")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Transplnt/Endocr')
                err_flag = 1
            }
            if (dx_year < 2018) {
                if (!functions.GEN_INLIST(untrimmedline.radRegionalRxModality, "99")) {
                    functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & Rad--Regional RX Modality')
                    err_flag = 1
                }
            }
            if (!functions.GEN_INLIST(untrimmedline.rxSummSurgRadSeq, "0")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Surg/Rad Seq')
                err_flag = 1
            }
            if (!functions.GEN_INLIST(untrimmedline.rxSummSystemicSurSeq, "0")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Systemic/Sur Seq ')
                err_flag = 1
            }
        }
        if (dx_year >= 2015) {
            if (!functions.GEN_INLIST(untrimmedline.rxSummBrm, "99")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--BRM')
                err_flag = 1
            }
            if (!functions.GEN_INLIST(untrimmedline.rxSummChemo, "99")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Chemo')
                err_flag = 1
            }
            if (!functions.GEN_INLIST(untrimmedline.rxSummHormone, "99")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Hormone')
                err_flag = 1
            }
            if (!functions.GEN_INLIST(untrimmedline.rxSummOther, "9")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Other')
                err_flag = 1
            }
            if (!functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "99")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Transplnt/Endocr')
                err_flag = 1
            }
            if (dx_year < 2018) {
                if (!functions.GEN_INLIST(untrimmedline.radRegionalRxModality, "99")) {
                    functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & Rad--Regional RX Modality')
                    err_flag = 1
                }
            }
            if (dx_year >= 2018) {
                if (!functions.GEN_INLIST(untrimmedline.phase1RadiationTreatmentModality, "99")) {
                    functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & Phase I Radiation Treatment Modality')
                    err_flag = 1
                }
            }
            if (!functions.GEN_INLIST(untrimmedline.rxSummSurgRadSeq, "0")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Surg/Rad Seq')
                err_flag = 1
            }
            if (!functions.GEN_INLIST(untrimmedline.rxSummSystemicSurSeq, "0")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Systemic/Sur Seq ')
                err_flag = 1
            }
        }
        if (err_flag == 1)
            return false
        return true

    }

    // ID: NPCR-00420; TAG: 3166; NAME: Autopsy Only, RX 2010-2018 (Subm)
    public boolean npcr00420(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year, err_flag
        err_flag = 0
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010 || dx_year > 2017)
            return true
        if (!functions.GEN_INLIST(untrimmedline.typeOfReportingSource, "6")) {
            return true
        }
        if (!functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "00,98", "(\\d\\d)")) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Surg Prim Site 03-2022')
            err_flag = 1
        }
        if (functions.GEN_INLIST(untrimmedline.primarySite, "420,421,423,424,700-729,751-753,760-768,809", "(C\\d\\d\\d)", 2, 3) || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9992", "(\\d\\d\\d\\d)")) {
            if (!functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "0,9")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Scope Reg LN Sur')
                err_flag = 1
            }
            if (!functions.GEN_INLIST(untrimmedline.rxSummSurgOthRegDis, "0,9")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Surg Oth Reg/Dis')
                err_flag = 1
            }
        }
        else {
            if (!functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "0")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Scope Reg LN Sur')
                err_flag = 1
            }
            if (!functions.GEN_INLIST(untrimmedline.rxSummSurgOthRegDis, "0")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Surg Oth Reg/Dis')
                err_flag = 1
            }
        }
        if (!functions.GEN_INLIST(untrimmedline.reasonForNoSurgery, "1,9")) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & Reason for No Surgery')
            err_flag = 1
        }
        if (dx_year >= 2010 && dx_year <= 2014 && (functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582"))) {
        
            if (!functions.GEN_INLIST(untrimmedline.rxSummBrm, "00")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--BRM')
                err_flag = 1
            }
            if (!functions.GEN_INLIST(untrimmedline.rxSummChemo, "00")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Chemo')
                err_flag = 1
            }
            if (!functions.GEN_INLIST(untrimmedline.rxSummHormone, "00")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Hormone')
                err_flag = 1
            }
            if (!functions.GEN_INLIST(untrimmedline.rxSummOther, "0")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Other')
                err_flag = 1
            }
            if (!functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "00")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Transplnt/Endocr')
                err_flag = 1
            }
            if (!functions.GEN_INLIST(untrimmedline.radRegionalRxModality, "00")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & Rad--Regional RX Modality')
                err_flag = 1
            }
            if (!functions.GEN_INLIST(untrimmedline.rxSummSurgRadSeq, "0")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Surg/Rad Seq')
                err_flag = 1
            }
            if (!functions.GEN_INLIST(untrimmedline.rxSummSystemicSurSeq, "0")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Systemic/Sur Seq')
                err_flag = 1
            }
        }
        if (dx_year >= 2015 && dx_year <= 2018) {
        
            if (!functions.GEN_INLIST(untrimmedline.rxSummBrm, "00")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--BRM')
                err_flag = 1
            }
            if (!functions.GEN_INLIST(untrimmedline.rxSummChemo, "00")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Chemo')
                err_flag = 1
            }
            if (!functions.GEN_INLIST(untrimmedline.rxSummHormone, "00")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Hormone')
                err_flag = 1
            }
            if (!functions.GEN_INLIST(untrimmedline.rxSummOther, "0")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Other')
                err_flag = 1
            }
            if (!functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "00")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Transplnt/Endocr')
                err_flag = 1
            }
            if (dx_year < 2018) {
                if (!functions.GEN_INLIST(untrimmedline.radRegionalRxModality, "00")) {
                    functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & Rad--Regional RX Modality')
                    err_flag = 1
                }
            }
            if (dx_year == 2018) {
                if (!functions.GEN_INLIST(untrimmedline.phase1RadiationTreatmentModality, "00")) {
                    functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & Phase I Radiation Treatment Modality')
                    err_flag = 1
                }
            }
            if (!functions.GEN_INLIST(untrimmedline.rxSummSurgRadSeq, "0")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Surg/Rad Seq')
                err_flag = 1
            }
            if (!functions.GEN_INLIST(untrimmedline.rxSummSystemicSurSeq, "0")) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Systemic/Sur Seq')
                err_flag = 1
            }
        }
        if (err_flag == 1)
            return false
        return true

    }

    // ID: NPCR-00421; TAG: 3253; NAME: RX Summ--Transplnt/Endocr (Subm)
    public boolean npcr00421(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummTransplntEndocr))
            return true
        if (dx_year >= 2010 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        if (functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "00, 10-12, 20, 30, 40, 82, 85-88, 99", "(\\d\\d)"))
            return true
        else
            return false
        
        return true

    }

    // ID: NPCR-00422; TAG: 3186; NAME: RX Summ--Transplnt/Endocr, Date of DX (Subm)
    public boolean npcr00422(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year < 2010) {
            return true
        }
        if (dx_year >= 2010 && dx_year < 2015) {
            if (!(functions.GEN_INLIST(untrimmedline.primarySite, "180-189,199,209,500-509", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044,9060-9136,9141-9582")))
                return true
            if (functions.GEN_EMPTY(untrimmedline.rxSummTransplntEndocr))
                return false
        }
        if (dx_year > 2014) {
            if (functions.GEN_EMPTY(untrimmedline.rxSummTransplntEndocr))
                return functions.GEN_ERROR_MSG(binding, 'If DX year = 2015 or later, RX Summ--Transplnt/Endocr cannot be blank')
        }
        return true

    }

    // ID: NPCR-00423; TAG: 3264; NAME: Follow-Up Source (Subm)
    public boolean npcr00423(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year >= 2007)
            return true
        if (functions.GEN_EMPTY(untrimmedline.followUpSource))
            return true
        return functions.GEN_INLIST(untrimmedline.followUpSource, "0-5,7-9")

    }

    // ID: NPCR-00424; TAG: 3197; NAME: PhI Radiation Treatment Modality (Subm
    public boolean npcr00424(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018)
            return true
        if (functions.GEN_EMPTY(untrimmedline.phase1RadiationTreatmentModality))
            return true
        if (functions.GEN_INLIST(untrimmedline.phase1RadiationTreatmentModality, "00-16,98,99", "(\\d\\d)"))
            return true
        return false

    }

    // ID: NPCR-00426; TAG: 3242; NAME: RX Summ--Scope Reg LN Sur (Subm)
    public boolean npcr00426(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummScopeRegLnSur))
            return true
        if (functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "0-7,9"))
            return true
        return false

    }

    // ID: NPCR-00427; TAG: 3245; NAME: RX Summ--Surg Oth Reg/Dis (Subm)
    public boolean npcr00427(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummSurgOthRegDis))
            return true
        if (functions.GEN_INLIST(untrimmedline.rxSummSurgOthRegDis, "0-5,9"))
            return true
        return false

    }

    // ID: NPCR-00428; TAG: 3247; NAME: RX Summ--Surg Prim Site (Subm)
    public boolean npcr00428(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite))
            return true
        if (functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "00,10-90, 98, 99"))
            return true
        return false

    }

    // ID: NPCR-00429; TAG: 3249; NAME: RX Summ--Surg Prim Site, 03-2022, Diag Conf (Subm)
    public boolean npcr00429(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010 || dx_year > 2022)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite))
            return true
        if (functions.GEN_AT(untrimmedline.overRideSurgDxconf, "1") != 0)
            return true
        if (functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "20-90")) {
            if (functions.GEN_AT(untrimmedline.diagnosticConfirmation, "1234", 1) == 0)
                return false
        }
        return true

    }

    // ID: NPCR-00430; TAG: 3199; NAME: RX Date BRM (Subm)
    public boolean npcr00430(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2011)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxDateBrm))
            return true
        if (dx_year >= 2011 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.rxDateBrm))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'RX Date BRM: %DC')
            return false
        }
        
        return true

    }

    // ID: NPCR-00434; TAG: 3158; NAME: RX Date BRM, Date Last Contact (Subm)
    public boolean npcr00434(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dtcmp, dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2011)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxDateBrm) || functions.GEN_EMPTY(untrimmedline.dateOfLastContact))
            return true
        if (dx_year >= 2011 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.rxDateBrm, untrimmedline.dateOfLastContact, ((Integer)context.NPCR_GEN_DT_MIN))
        
        if (dtcmp == ((Integer)context.NPCR_GEN_DT_ERROR)) {
            if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.rxDateBrm)) {
                functions.GEN_ERROR_TEXT(binding, 'RX Date BRM is invalid: %DC')
                return false
            }
            else {
                if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfLastContact)) {
                    functions.GEN_ERROR_TEXT(binding, 'Date of Last Contact is invalid: %DC')
                    return false
                }
            }
        }
        else {
            if (dtcmp <= 0)
                return true
            else
                return false
        }
        
        return true

    }

    // ID: NPCR-00435; TAG: 3202; NAME: RX Date BRM, Date of Diagnosis (Subm)
    public boolean npcr00435(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dtcmp
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2011)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxDateBrm) || functions.GEN_EMPTY(untrimmedline.dateOfDiagnosis))
            return true
        if (dx_year >= 2011 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.rxDateBrm, untrimmedline.dateOfDiagnosis, ((Integer)context.NPCR_GEN_DT_MIN))
        
        if (dtcmp == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        else {
            if (dtcmp >= 0)
                return true
            else
                return false
        }
        
        return true

    }

    // ID: NPCR-00436; TAG: 3203; NAME: RX Date Chemo (Subm)
    public boolean npcr00436(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2011)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxDateChemo))
            return true
        if (dx_year >= 2011 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.rxDateChemo))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'RX Date Chemo: %DC')
            return false
        }
        
        return true

    }

    // ID: NPCR-00440; TAG: 3256; NAME: RX Summ--Treatment Status (Subm)
    public boolean npcr00440(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummTreatmentStatus))
            return true
        if (!functions.GEN_INLIST(untrimmedline.rxSummTreatmentStatus, "0-2, 9"))
            return false
        
        return true

    }

    // ID: NPCR-00441; TAG: 3159; NAME: RX Date Chemo, Date Last Contact (Subm)
    public boolean npcr00441(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dtcmp, dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2011)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxDateChemo) || functions.GEN_EMPTY(untrimmedline.dateOfLastContact))
            return true
        if (dx_year >= 2011 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.rxDateChemo, untrimmedline.dateOfLastContact, ((Integer)context.NPCR_GEN_DT_MIN))
        
        if (dtcmp == ((Integer)context.NPCR_GEN_DT_ERROR)) {
            if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.rxDateChemo)) {
                functions.GEN_ERROR_TEXT(binding, 'RX Date Chemo is invalid: %DC')
                return false
            }
            else {
                if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfLastContact)) {
                    functions.GEN_ERROR_TEXT(binding, 'Date of Last Contact is invalid: %DC')
                    return false
                }
            }
        }
        else {
            if (dtcmp <= 0)
                return true
            else
                return false
        }
        
        return true

    }

    // ID: NPCR-00442; TAG: 3208; NAME: RX Date Chemo, Date of Diagnosis (Subm)
    public boolean npcr00442(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dtcmp
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2011)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxDateChemo) || functions.GEN_EMPTY(untrimmedline.dateOfDiagnosis))
            return true
        if (dx_year >= 2011 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.rxDateChemo, untrimmedline.dateOfDiagnosis, ((Integer)context.NPCR_GEN_DT_MIN))
        
        if (dtcmp == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        else {
            if (dtcmp >= 0)
                return true
            else
                return false
        }
        
        return true

    }

    // ID: NPCR-00443; TAG: 3209; NAME: RX Date Hormone (Subm)
    public boolean npcr00443(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2011)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxDateHormone))
            return true
        if (dx_year >= 2011 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.rxDateHormone))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'RX Date Hormone: %DC')
            return false
        }
        
        return true

    }

    // ID: NPCR-00447; TAG: 3160; NAME: RX Date Hormone, Date Last Contact (Subm)
    public boolean npcr00447(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dtcmp, dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2011)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxDateHormone) || functions.GEN_EMPTY(untrimmedline.dateOfLastContact))
            return true
        if (dx_year >= 2011 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.rxDateHormone, untrimmedline.dateOfLastContact, ((Integer)context.NPCR_GEN_DT_MIN))
        
        if (dtcmp == ((Integer)context.NPCR_GEN_DT_ERROR)) {
            if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.rxDateHormone)) {
                functions.GEN_ERROR_TEXT(binding, 'RX Date Hormone is invalid: %DC')
                return false
            }
            else {
                if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfLastContact)) {
                    functions.GEN_ERROR_TEXT(binding, 'Date of Last Contact is invalid: %DC')
                    return false
                }
            }
        }
        else {
            if (dtcmp <= 0)
                return true
            else
                return false
        }
        
        return true

    }

    // ID: NPCR-00448; TAG: 3214; NAME: RX Date Hormone, Date of Diagnosis (Subm)
    public boolean npcr00448(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2011)
            return true
        int dtcmp
        
        if (functions.GEN_EMPTY(untrimmedline.rxDateHormone) || functions.GEN_EMPTY(untrimmedline.dateOfDiagnosis))
            return true
        if (dx_year >= 2011 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.rxDateHormone, untrimmedline.dateOfDiagnosis, ((Integer)context.NPCR_GEN_DT_MIN))
        
        if (dtcmp == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        else {
            if (dtcmp >= 0)
                return true
            else
                return false
        }
        
        return true

    }

    // ID: NPCR-00449; TAG: 3213; NAME: RX Date Mst Defn Srg (Subm)
    public boolean npcr00449(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2015)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxDateMostDefinSurg))
            return true
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.rxDateMostDefinSurg))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'RX Date Most Defin Surg: %DC')
            return false
        }
        
        return true

    }

    // ID: NPCR-00453; TAG: 3165; NAME: CS Site-Specific Factor15 (Subm)
    public boolean npcr00453(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010)
            return true
        if (functions.GEN_EMPTY(untrimmedline.csSiteSpecificFactor15))
            return true
        return functions.GEN_MATCH(untrimmedline.csSiteSpecificFactor15, "(\\d\\d\\d)")

    }

    // ID: NPCR-00454; TAG: 3217; NAME: RX Date Other (Subm)
    public boolean npcr00454(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2011)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxDateOther))
            return true
        if (dx_year >= 2011 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.rxDateOther))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'RX Date Other: %DC')
            return false
        }
        
        return true

    }

    // ID: NPCR-00458; TAG: 3161; NAME: RX Date Other, Date Last Contact (Subm)
    public boolean npcr00458(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dtcmp, dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2011)
            return true
        if (functions.GEN_EMPTY(untrimmedline.dateOfLastContact) || functions.GEN_EMPTY(untrimmedline.rxDateOther))
            return true
        if (dx_year >= 2011 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.rxDateOther, untrimmedline.dateOfLastContact, ((Integer)context.NPCR_GEN_DT_MIN))
        
        if (dtcmp == ((Integer)context.NPCR_GEN_DT_ERROR)) {
            if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.rxDateOther)) {
                functions.GEN_ERROR_TEXT(binding, 'RX Date Other is invalid: %DC')
                return false
            }
            else {
                if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfLastContact)) {
                    functions.GEN_ERROR_TEXT(binding, 'Date of Last Contact is invalid: %DC')
                    return false
                }
            }
        }
        else {
            if (dtcmp <= 0)
                return true
            else
                return false
        }
        
        return true

    }

    // ID: NPCR-00459; TAG: 3221; NAME: RX Date Other, Date of Diagnosis (Subm)
    public boolean npcr00459(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dtcmp
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2011)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxDateOther) || functions.GEN_EMPTY(untrimmedline.dateOfDiagnosis))
            return true
        if (dx_year >= 2011 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.rxDateOther, untrimmedline.dateOfDiagnosis, ((Integer)context.NPCR_GEN_DT_MIN))
        
        if (dtcmp == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        else {
            if (dtcmp >= 0)
                return true
            else
                return false
        }
        
        return true

    }

    // ID: NPCR-00460; TAG: 3222; NAME: RX Date Radiation (Subm)
    public boolean npcr00460(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2011)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxDateRadiation))
            return true
        if (dx_year >= 2011 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.rxDateRadiation))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'RX Date Radiation: %DC')
            return false
        }
        
        return true

    }

    // ID: NPCR-00463; TAG: 3162; NAME: RX Date Radiation, Date Last Contact (Subm)
    public boolean npcr00463(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dtcmp, dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2011)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxDateRadiation) || functions.GEN_EMPTY(untrimmedline.dateOfLastContact))
            return true
        if (dx_year >= 2011 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.rxDateRadiation, untrimmedline.dateOfLastContact, ((Integer)context.NPCR_GEN_DT_MIN))
        
        if (dtcmp == ((Integer)context.NPCR_GEN_DT_ERROR)) {
            if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.rxDateRadiation)) {
                functions.GEN_ERROR_TEXT(binding, 'RX Date Radiation is invalid: %DC')
                return false
            }
            else {
                if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfLastContact)) {
                    functions.GEN_ERROR_TEXT(binding, 'Date of Last Contact is invalid: %DC')
                    return false
                }
            }
        }
        else {
            if (dtcmp <= 0)
                return true
            else
                return false
        }
        
        return true

    }

    // ID: NPCR-00464; TAG: 3225; NAME: RX Date Radiation, Date of Diagnosis (Subm)
    public boolean npcr00464(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dtcmp
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2011)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxDateRadiation) || functions.GEN_EMPTY(untrimmedline.dateOfDiagnosis))
            return true
        if (dx_year >= 2011 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.rxDateRadiation, untrimmedline.dateOfDiagnosis, ((Integer)context.NPCR_GEN_DT_MIN))
        
        if (dtcmp == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        else {
            if (dtcmp >= 0)
                return true
            else
                return false
        }
        
        return true

    }

    // ID: NPCR-00465; TAG: 3227; NAME: RX Date Surgery (Subm)
    public boolean npcr00465(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2011)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxDateSurgery))
            return true
        if (functions.GEN_VALID_DATE_IOP(binding, untrimmedline.rxDateSurgery))
            return true
        else {
            functions.GEN_ERROR_TEXT(binding, 'RX Date Surgery: %DC')
            return false
        }
        
        return true

    }

    // ID: NPCR-00468; TAG: 3178; NAME: RX Date Surgery, Date Last Contact (Subm)
    public boolean npcr00468(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dtcmp, dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2011)
            return true
        if (functions.GEN_EMPTY(untrimmedline.dateOfLastContact) || functions.GEN_EMPTY(untrimmedline.rxDateSurgery))
            return true
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.rxDateSurgery, untrimmedline.dateOfLastContact, ((Integer)context.NPCR_GEN_DT_MIN))
        
        if (dtcmp == ((Integer)context.NPCR_GEN_DT_ERROR)) {
            if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.rxDateSurgery)) {
                functions.GEN_ERROR_TEXT(binding, 'RX Date Surgery is invalid: %DC')
                return false
            }
            else {
                if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfLastContact)) {
                    functions.GEN_ERROR_TEXT(binding, 'Date of Last Contact is invalid: %DC')
                    return false
                }
            }
        }
        else {
            if (dtcmp <= 0)
                return true
            else
                return false
        }
        
        return true

    }

    // ID: NPCR-00469; TAG: 3230; NAME: RX Date Surgery, Date of Diagnosis (Subm)
    public boolean npcr00469(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dtcmp
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2011)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxDateSurgery) || functions.GEN_EMPTY(untrimmedline.dateOfDiagnosis))
            return true
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.rxDateSurgery, untrimmedline.dateOfDiagnosis, ((Integer)context.NPCR_GEN_DT_MIN))
        
        if (dtcmp == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        else {
            if (dtcmp >= 0)
                return true
            else
                return false
        }
        
        return true

    }

    // ID: NPCR-00470; TAG: 3169; NAME: Surgery 03-2022, RX Date Surgery, ICDO3 (Subm)
    public boolean npcr00470(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int exception
        int dx_year
        
        exception = 0
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2011 || dx_year > 2018)
            return true
        if (dx_year == 2018 && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9702-9992"))
            return true
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        if (dx_year > 2009 && dx_year < 2018) {
            if ((functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9726,9728-9732,9734-9740,9750-9762,9811-9831,9940,9948,9971") && functions.GEN_INLIST(untrimmedline.primarySite, "770-779", "(C\\d\\d\\d)", 2, 3)) || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9727,9733,9741-9742,9764-9809,9832,9840-9931,9945-9946,9950-9967,9975-9992") || functions.GEN_INLIST(untrimmedline.primarySite, "420,421,423,424,700-729,760-768,809", "(C\\d\\d\\d)", 2, 3))
                exception = 1
        }
        if (dx_year == 2018) {
            if ((functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9726,9728-9732,9734-9740,9750-9762,9811-9831,9940,9948,9971") && functions.GEN_INLIST(untrimmedline.primarySite, "770-779", "(C\\d\\d\\d)", 2, 3)) || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9727,9733,9741-9742,9764-9809,9832,9840-9931,9945-9946,9950-9967,9975-9992") || functions.GEN_INLIST(untrimmedline.primarySite, "420,421,423,424,700-729,761-768,809", "(C\\d\\d\\d)", 2, 3) || (functions.GEN_INLIST(untrimmedline.primarySite, "C760") && functions.GEN_INLIST(untrimmedline.schemaId, "99999")))
                exception = 1
        }
        if (functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "00,98") && (functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "0") || ((exception == 1 && functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "9")) || (functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "2") && functions.GEN_INLIST(untrimmedline.regionalNodesExamined, "00,99") && dx_year >= 2012 && dx_year <= 2017))) && functions.GEN_INLIST(untrimmedline.rxSummSurgOthRegDis, "0")) {
            if (!functions.GEN_EMPTY(untrimmedline.rxDateSurgery))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'If surgery fields indicate no treatment, date of surgery must be blank')
        }
        if (!functions.GEN_EMPTY(untrimmedline.rxDateSurgery)) {
            if (functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "10-90") || (functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "1-7") && dx_year < 2012) || (functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "1,3-7") && dx_year >= 2012 && dx_year <= 2017) || (functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "1,3-7") && dx_year == 2018) || (functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "2") && functions.GEN_INLIST(untrimmedline.regionalNodesExamined, "01-98") && dx_year > 2011) || functions.GEN_INLIST(untrimmedline.rxSummSurgOthRegDis, "1-5"))
                return true
            else
                functions.GEN_SAVE_ERROR_TEXT(binding, 'If date of surgery is not blank, at least one surgery field must indicate treatment.')
        }
        return true

    }

    // ID: NPCR-00471; TAG: 3232; NAME: RX Summ--BRM, RX Date BRM (Subm)
    public boolean npcr00471(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2011)
            return true
        if (dx_year >= 2011 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        if (functions.GEN_INLIST(untrimmedline.rxSummBrm, "00,82,85-88, 99")) {
            if (functions.GEN_EMPTY(untrimmedline.rxDateBrm))
                return true
            else
                return false
        }
        if (!functions.GEN_EMPTY(untrimmedline.rxDateBrm)) {
            if (functions.GEN_INLIST(untrimmedline.rxSummBrm, "01"))
                return true
            else
                return false
        }
        return true

    }

    // ID: NPCR-00472; TAG: 3235; NAME: RX Summ--Chemo, RX Date Chemo (Subm)
    public boolean npcr00472(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2011)
            return true
        if (dx_year >= 2011 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        if (functions.GEN_INLIST(untrimmedline.rxSummChemo, "00,82,85-88, 99")) {
            if (functions.GEN_EMPTY(untrimmedline.rxDateChemo))
                return true
            else
                return false
        }
        if (!functions.GEN_EMPTY(untrimmedline.rxDateChemo)) {
            if (functions.GEN_INLIST(untrimmedline.rxSummChemo, "01,02,03"))
                return true
            else
                return false
        }
        return true

    }

    // ID: NPCR-00473; TAG: 3238; NAME: RX Summ--Hormone, RX Date Hormone (Subm)
    public boolean npcr00473(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2011)
            return true
        if (dx_year >= 2011 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        if (functions.GEN_INLIST(untrimmedline.rxSummHormone, "00,82,85-88,99")) {
            if (functions.GEN_EMPTY(untrimmedline.rxDateHormone))
                return true
            else
                return false
        }
        if (!functions.GEN_EMPTY(untrimmedline.rxDateHormone)) {
            if (functions.GEN_INLIST(untrimmedline.rxSummHormone, "01"))
                return true
            else
                return false
        }
        return true

    }

    // ID: NPCR-00474; TAG: 3241; NAME: RX Summ--Other, RX Date Other (Subm
    public boolean npcr00474(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2011)
            return true
        if (dx_year >= 2011 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        if (functions.GEN_INLIST(untrimmedline.rxSummOther, "0,7,8,9")) {
            if (functions.GEN_EMPTY(untrimmedline.rxDateOther))
                return true
            else
                return false
        }
        if (!functions.GEN_EMPTY(untrimmedline.rxDateOther)) {
            if (functions.GEN_INLIST(untrimmedline.rxSummOther, "1-6"))
                return true
            else
                return false
        }
        return true

    }

    // ID: NPCR-00475; TAG: 3260; NAME: Reason for No Radiation, Date of DX (Subm)
    public boolean npcr00475(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return functions.GEN_ERROR_TEXT(binding, 'Date of Diagnosis: %DC')
        if (dx_year < 2011) {
            return true
        }
        if (dx_year >= 2011 && dx_year < 2015) {
            if (!(functions.GEN_INLIST(untrimmedline.primarySite, "180-189,199,209,500-509", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044,9060-9136,9141-9582")))
                return true
            if (functions.GEN_EMPTY(untrimmedline.reasonForNoRadiation))
                return functions.GEN_ERROR_MSG(binding, 'If DX year = 2011-2014, Reason for No Radiation cannot be blank')
        }
        else {
            if (dx_year >= 2015) {
                if (functions.GEN_EMPTY(untrimmedline.reasonForNoRadiation))
                    return functions.GEN_ERROR_MSG(binding, 'If DX year 2015 or later, Reason for No Radiation cannot be blank')
            }
        }
        return true

    }

    // ID: NPCR-00476; TAG: 3259; NAME: Reason for No Radiation (Subm)
    public boolean npcr00476(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2011)
            return true
        if (functions.GEN_EMPTY(untrimmedline.reasonForNoRadiation))
            return true
        if (dx_year >= 2011 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        if (functions.GEN_INLIST(untrimmedline.reasonForNoRadiation, "0-2,5-9"))
            return true
        return false

    }

    // ID: NPCR-00477; TAG: N2655; NAME: Breslow Tumor Thickness, Date DX (NAACCR)
    public boolean npcr00477(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year, len
        
        char[] Breslow = new char[5]
        char[] decimal = new char[2]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2018) {
            if (!functions.GEN_EMPTY(untrimmedline.breslowTumorThickness))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Breslow Tumor Thickness must be blank for cases diagnosed before 2018')
        }
        if (functions.GEN_EMPTY(untrimmedline.breslowTumorThickness))
            return true
        functions.GEN_STRCPY(Breslow, functions.GEN_TRIM(untrimmedline.breslowTumorThickness, ((Integer)context.NPCR_GEN_BOTH)))
        
        len = (functions.GEN_STRLEN(Breslow))
        
        if (len == 1 || len == 2)
            return false
        if (len == 3) {
            functions.GEN_STRCPY(decimal, functions.GEN_SUBSTR(Breslow, 2, 1))
        
            if (functions.GEN_AT(decimal, ".") == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Breslow Tumor Thickness must have at least 1 digit followed by decimal followed by digit')
            if (functions.GEN_MATCH(Breslow, "(\\d\\.\\d)"))
                return true
            else
                functions.GEN_SAVE_ERROR_TEXT(binding, '${untrimmedline.breslowTumorThickness} not valid code for Breslow Tumor Thickness')
        }
        if (len == 4) {
        
            functions.GEN_STRCPY(decimal, functions.GEN_SUBSTR(Breslow, 3, 1))
        
            if (functions.GEN_AT(decimal, ".") == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Breslow Tumor Thickness must have at least 1 digit followed by decimal followed by digit')
            if (functions.GEN_MATCH(Breslow, "((([1-9]))\\d\\.\\d)") || functions.GEN_MATCH(Breslow, "(((A))\\d\\.\\d)") || functions.GEN_AT(Breslow, "AX.0XX.1XX.8XX.9", 4) != 0)
                return true
            else
                return false
        }
        return true

    }

    // ID: NPCR-00478; TAG: N3033; NAME: Breslow Tumor Thickness, Melanoma, Behavior (NAACCR)
    public boolean npcr00478(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        char[] Breslow = new char[4]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "00470", 5) == 0)
            return true
        if (functions.GEN_EMPTY(untrimmedline.breslowTumorThickness) || functions.GEN_AT(untrimmedline.breslowTumorThickness, "XX.8") != 0)
            return true
        if (functions.GEN_AT(untrimmedline.behaviorCodeIcdO3, "2") != 0) {
            if (functions.GEN_AT(untrimmedline.breslowTumorThickness, "XX.9", 4) == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Breslow Tumor Thickness: ${untrimmedline.breslowTumorThickness} not valid for Behavior Code ICD-O-3: ${untrimmedline.behaviorCodeIcdO3}')
        }
        return true

    }

    // ID: NPCR-00479; TAG: N5042; NAME: Breslow Tumor Thickness, Melanoma, Summary Stage 2018 (NAACCR)
    public boolean npcr00479(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2019)
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "00470") == 0)
            return true
        if (functions.GEN_EMPTY(untrimmedline.breslowTumorThickness) || functions.GEN_AT(untrimmedline.breslowTumorThickness, "XX.8") != 0)
            return true
        if (functions.GEN_EMPTY(untrimmedline.summaryStage2018))
            return true
        if (functions.GEN_AT(untrimmedline.summaryStage2018, "0", 1) != 0) {
            if (functions.GEN_AT(untrimmedline.breslowTumorThickness, "XX.9") == 0)
                return false
        }
        return true

    }

    // ID: NPCR-00480; TAG: N2855; NAME: Breslow Tumor Thickness, Schema ID, Required (NAACCR)
    public boolean npcr00480(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.schemaId))
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0)
            return true
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2018)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "00470", 5) != 0) {
            if (functions.GEN_EMPTY(untrimmedline.breslowTumorThickness) || functions.GEN_AT(untrimmedline.breslowTumorThickness, "XX.8") != 0)
                return false
        }
        return true

    }

    // ID: NPCR-00481; TAG: N0250; NAME: Vital Status, Cause of Death (SEER IF36)
    public boolean npcr00481(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int cod_num
        
        
        if (functions.GEN_INLIST(untrimmedline.vitalStatus, "1")) {
            if (!functions.GEN_INLIST(untrimmedline.causeOfDeath, "0000"))
                return false
        }
        if (functions.GEN_INLIST(untrimmedline.vitalStatus, "0")) {
            if (functions.GEN_INLIST(untrimmedline.causeOfDeath, "0000"))
                return false
        }
        return true

    }

    // ID: NPCR-00482; TAG: 3170; NAME: SSDI for Brain, CNS, Blank for Other Schemas (Subm)
    public boolean npcr00482(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        int err_flag
        
        char[] code = new char[7]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018)
            return true
        if (functions.GEN_EMPTY(untrimmedline.schemaId)) {
            return true
        }
        functions.GEN_STRCPY(code, untrimmedline.schemaId)
        functions.GEN_STRCAT(code, " ")
        
        if (functions.GEN_AT(code, "09721 09722 00721 00722 09724", 6) == 0) {
            if (!functions.GEN_EMPTY(untrimmedline.brainMolecularMarkers)) {
                functions.GEN_SAVE_TEXT(binding, 'If Schema is not Brain,CNS,Brain,Medulloblastoma;Molecular Markers must=blank')
                err_flag = 1
            }
        }
        if (err_flag == 1)
            return false
        return true

    }

    // ID: NPCR-00483; TAG: 3171; NAME: SSDI for Breast, Blank for Other Schemas (Subm)
    public boolean npcr00483(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        int err_flag
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "001610016900170", 5) != 0)
            return true
        if (functions.GEN_EMPTY(untrimmedline.schemaId) || functions.GEN_AT(untrimmedline.schemaId, "00480", 5) != 0)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "00480", 5) == 0) {
            if (!functions.GEN_EMPTY(untrimmedline.estrogenReceptorSummary)) {
                functions.GEN_SAVE_TEXT(binding, 'Estrogen Receptor Summary must be blank for this schema')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.progesteroneRecepSummary)) {
                functions.GEN_SAVE_TEXT(binding, 'Progesterone Receptor Summary must be blank for this schema')
                err_flag = 1
            }
        }
        if (functions.GEN_AT(untrimmedline.schemaId, "00480", 5) == 0) {
            if (!functions.GEN_EMPTY(untrimmedline.her2OverallSummary)) {
                functions.GEN_SAVE_TEXT(binding, 'HER2 Overall Summary must be blank for this schema')
                err_flag = 1
            }
        }
        if (err_flag == 1)
            return false
        return true

    }

    // ID: NPCR-00484; TAG: 3172; NAME: SSDI for Skin, Blank for Other Schemas (Subm)
    public boolean npcr00484(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        int err_flag
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018)
            return true
        if (functions.GEN_EMPTY(untrimmedline.schemaId))
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "00470") == 0) {
            if (!functions.GEN_EMPTY(untrimmedline.breslowTumorThickness)) {
                functions.GEN_SAVE_TEXT(binding, 'If Schema is not Melanoma of Skin, Breslow Tumor Thickness must be blank')
                err_flag = 1
            }
        }
        if (err_flag == 1)
            return false
        return true

    }

    // ID: NPCR-00485; TAG: 3173; NAME: SSDI, DCO (Subm)
    public boolean npcr00485(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") == 0)
            return true
        if (functions.GEN_EMPTY(untrimmedline.schemaId))
            return true
        int dx_year
        int err_flag
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018)
            return true
        if (!functions.GEN_EMPTY(untrimmedline.brainMolecularMarkers) && functions.GEN_AT(untrimmedline.brainMolecularMarkers, "8899", 2) == 0) {
            functions.GEN_SAVE_TEXT(binding, 'DCO: Brain Molecular Markers must be blank, unknown, or NA')
            err_flag = 1
        }
        if (!functions.GEN_EMPTY(untrimmedline.breslowTumorThickness) && functions.GEN_AT(untrimmedline.breslowTumorThickness, "XX.8XX.9", 4) == 0) {
            functions.GEN_SAVE_TEXT(binding, 'DCO: Breslow Tumor Thickness must be blank, unknown, or NA')
            err_flag = 1
        }
        if (!functions.GEN_EMPTY(untrimmedline.estrogenReceptorSummary) && functions.GEN_AT(untrimmedline.estrogenReceptorSummary, "9") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'DCO: Estrogen Receptor Summary must be blank or unknown')
            err_flag = 1
        }
        if (!functions.GEN_EMPTY(untrimmedline.gleasonPatternsClinical) && functions.GEN_AT(untrimmedline.gleasonPatternsClinical, "X9") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'DCO: Gleason Patterns Clinical must be blank or unknown')
            err_flag = 1
        }
        if (!functions.GEN_EMPTY(untrimmedline.gleasonPatternsPathological) && functions.GEN_AT(untrimmedline.gleasonPatternsPathological, "X9") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'DCO: Gleason Patterns Pathological must be blank or unknown')
            err_flag = 1
        }
        if (!functions.GEN_EMPTY(untrimmedline.gleasonScoreClinical) && functions.GEN_AT(untrimmedline.gleasonScoreClinical, "X9") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'DCO: Gleason Score Clinical must be blank or unknown')
            err_flag = 1
        }
        if (!functions.GEN_EMPTY(untrimmedline.gleasonScorePathological) && functions.GEN_AT(untrimmedline.gleasonScorePathological, "X9") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'DCO: Gleason Score Pathological must be blank or unknown')
            err_flag = 1
        }
        if (!functions.GEN_EMPTY(untrimmedline.gleasonTertiaryPattern) && functions.GEN_AT(untrimmedline.gleasonTertiaryPattern, "X9") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'DCO: Gleason Tertiary Pattern must be blank or unknown')
            err_flag = 1
        }
        if (!functions.GEN_EMPTY(untrimmedline.her2OverallSummary) && functions.GEN_AT(untrimmedline.her2OverallSummary, "9") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'DCO: HER2 Overall Summary must be blank or unknown')
            err_flag = 1
        }
        if (!functions.GEN_EMPTY(untrimmedline.microsatelliteInstability) && functions.GEN_AT(untrimmedline.microsatelliteInstability, "9") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'DCO: Microsatellite Instability (MSI) must be blank or unknown')
            err_flag = 1
        }
        if (!functions.GEN_EMPTY(untrimmedline.esophagusAndEgjTumorEpicenter) && functions.GEN_AT(untrimmedline.esophagusAndEgjTumorEpicenter, "9") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'DCO: Esophagus and EGJ Tumor Epicenter must be blank or unknown')
            err_flag = 1
        }
        if (!functions.GEN_EMPTY(untrimmedline.p16) && functions.GEN_AT(untrimmedline.p16, "9") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'DCO: p16 must be blank or unknown')
            err_flag = 1
        }
        if (!functions.GEN_EMPTY(untrimmedline.progesteroneRecepSummary) && functions.GEN_AT(untrimmedline.progesteroneRecepSummary, "9") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'DCO: Progesterone Receptor Summary must be blank or unknown')
            err_flag = 1
        }
        if (!functions.GEN_EMPTY(untrimmedline.psaLabValue) && functions.GEN_AT(untrimmedline.psaLabValue, "XXX.9") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'DCO: PSA (Prostatic Specific Antigen) Lab Value must be blank or unknown')
            err_flag = 1
        }
        if (err_flag == 1)
            return false
        return true

    }

    // ID: NPCR-00486; TAG: 3226; NAME: RX Date Radiation, Rad--Regional RX Modality (Subm)
    public boolean npcr00486(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2011 || dx_year > 2017)
            return true
        if (dx_year >= 2011 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        if (functions.GEN_INLIST(untrimmedline.radRegionalRxModality, "00, 99")) {
            if (!functions.GEN_EMPTY(untrimmedline.rxDateRadiation))
                return false
        }
        if (!functions.GEN_EMPTY(untrimmedline.rxDateRadiation)) {
            if (!functions.GEN_INLIST(untrimmedline.radRegionalRxModality, "20-32,40-43,50-55,60-62,80,85,98"))
                return false
        }
        return true

    }

    // ID: NPCR-00487; TAG: N2811; NAME: CoC Accredited Flag, Date DX, Type Report Source (NAACCR)
    public boolean npcr00487(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018)
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") == 0) {
            if (functions.GEN_EMPTY(untrimmedline.cocAccreditedFlag))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'CoC Accredited Flag must not be blank for cases diagnosed 2018 and later')
        }
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0) {
            if (!functions.GEN_EMPTY(untrimmedline.cocAccreditedFlag))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'CoC Accredited Flag must be blank for Type of Reporting Source = 7, DCO')
        }
        return true

    }

    // ID: NPCR-00488; TAG: N5027; NAME: Grade Clin, Grade Path 03-2022 (NAACCR)
    public boolean npcr00488(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int clin, path, dx_year
        
        clin = functions.GEN_VAL(untrimmedline.gradeClinical)
        path = functions.GEN_VAL(untrimmedline.gradePathological)
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year < 2019 || dx_year > 2022)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "007210072200723", 5) != 0)
            return true
        if (functions.GEN_AT(untrimmedline.gradePathological, "9") != 0 || functions.GEN_EMPTY(untrimmedline.gradePathological))
            return true
        if (functions.GEN_AT(untrimmedline.gradeClinical, "89", 1) != 0 || functions.GEN_EMPTY(untrimmedline.gradeClinical))
            return true
        if (functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "30-90")) {
            if (functions.GEN_EMPTY(untrimmedline.gradePostTherapy)) {
                if (clin >= 1 && path >= 1) {
                    if (path < clin || path == 8)
                        return false
                }
            }
        }
        return true

    }

    // ID: NPCR-00489; TAG: 3163; NAME: Summary Stage 2000, Date of Diagnosis (Subm)
    public boolean npcr00489(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year > 2000 && dx_year < 2004) {
            if (functions.GEN_EMPTY(untrimmedline.seerSummaryStage2000))
                return false
        }
        if (dx_year > 2015 && dx_year < 2018) {
            if (functions.GEN_EMPTY(untrimmedline.seerSummaryStage2000))
                return functions.GEN_ERROR_MSG(binding, 'If year of Date of Diagnosis = ${untrimmedline.dateOfDiagnosis.formatDate()} then SEER Summary Stage 2000 cannot be blank')
        }
        if (dx_year >= 2018) {
            if (!functions.GEN_EMPTY(untrimmedline.seerSummaryStage2000))
                return functions.GEN_ERROR_MSG(binding, 'If year of Date of Diagnosis >= 2018, then SEER Summary Stage 2000 must be blank')
        }
        return true

    }

    // ID: NPCR-00490; TAG: N6104; NAME: Summary Stage 2018, Regional Nodes Positive (NAACCR)
    public boolean npcr00490(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018)
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0)
            return true
        if (functions.GEN_EMPTY(untrimmedline.summaryStage2018))
            return true
        if (functions.GEN_EMPTY(untrimmedline.regionalNodesPositive))
            return true
        if (functions.GEN_INLIST(untrimmedline.regionalNodesPositive, "01-97", "(\\d\\d)")) {
            if (functions.GEN_AT(untrimmedline.summaryStage2018, "0129", 1) != 0)
                return false
        }
        return true

    }

    // ID: NPCR-00491; TAG: N4900; NAME: Summary Stage 2018, Schema ID (NAACCR)
    public boolean npcr00491(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        
        char[] SCHEMA_ID = new char[6], SCHEMA_NAME = new char[36], SS2018 = new char[2]
        
        int dx_year
        
        
        char[] group_SS2018 = new char[10]
        char[] name = new char[100]
        char[] ed = new char[2]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018)
            return true
        if (functions.GEN_EMPTY(untrimmedline.schemaId))
            return true
        if (functions.GEN_EMPTY(untrimmedline.summaryStage2018)) {
            return true
        }
        if (functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_SCHEMA_ID_NAMES, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_SCHEMA_ID_NAMES_SCHEMA_ID, untrimmedline.schemaId, ['SCHEMA_ID':SCHEMA_ID, 'SCHEMA_NAME':SCHEMA_NAME]))
            functions.GEN_STRCPY(name, "Schema ID ")
        functions.GEN_STRCAT(name, untrimmedline.schemaId)
        functions.GEN_STRCAT(name, ": ")
        functions.GEN_STRCAT(name, functions.GEN_TRIM(SCHEMA_NAME, ((Integer)context.NPCR_GEN_RIGHT)))
        
        functions.GEN_STRCPY(group_SS2018, untrimmedline.schemaId)
        functions.GEN_STRCAT(group_SS2018, untrimmedline.summaryStage2018)
        
        functions.GEN_STRCPY(ed, functions.GEN_SUBSTR(untrimmedline.schemaId, 1, 2))
        
        if (functions.GEN_AT(ed, "09") != 0) {
        
            if (!functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_SUMST1809, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_SUMST1809_SCHEMA_IDSS2018, group_SS2018, ['SCHEMA_ID':SCHEMA_ID, 'SS2018':SS2018])) {
                functions.GEN_SAVE_TEXT(binding, name)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Summary Stage 2018: ${untrimmedline.summaryStage2018} not valid for Schema ID: ${untrimmedline.schemaId}')
            }
        }
        else {
            if (!functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_SUMST2018, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_SUMST2018_SCHEMA_IDSS2018, group_SS2018, ['SCHEMA_ID':SCHEMA_ID, 'SS2018':SS2018])) {
                functions.GEN_SAVE_TEXT(binding, name)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Summary Stage 2018: ${untrimmedline.summaryStage2018} not valid for Schema ID: ${untrimmedline.schemaId}')
            }
        }
        return true

    }

    // ID: NPCR-00492; TAG: 3187; NAME: Systemic RX, Surgery 03-2022, Systemic/Sur Seq (Subm)
    public boolean npcr00492(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010 || dx_year > 2022)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite) || functions.GEN_EMPTY(untrimmedline.rxSummScopeRegLnSur) || functions.GEN_EMPTY(untrimmedline.rxSummSurgOthRegDis) || functions.GEN_EMPTY(untrimmedline.rxSummBrm) || functions.GEN_EMPTY(untrimmedline.rxSummChemo) || functions.GEN_EMPTY(untrimmedline.rxSummHormone) || functions.GEN_EMPTY(untrimmedline.rxSummTransplntEndocr) || functions.GEN_EMPTY(untrimmedline.rxSummSystemicSurSeq))
            return true
        if (dx_year >= 2010 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        if ((functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "10-90", "(\\d\\d)") || ((functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "1-7") && dx_year < 2012) || (functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "1,3-7") && dx_year >= 2012 && dx_year <= 2017) || (functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "3-7") && dx_year >= 2018) || (functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "2") && functions.GEN_INLIST(untrimmedline.regionalNodesExamined, "01-98", "(\\d\\d)") && dx_year > 2011 && dx_year <= 2020) || (functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "2") && dx_year >= 2021)) || functions.GEN_INLIST(untrimmedline.rxSummSurgOthRegDis, "1-5")) && (functions.GEN_INLIST(untrimmedline.rxSummBrm, "01", "(\\d\\d)") || functions.GEN_INLIST(untrimmedline.rxSummChemo, "01-03", "(\\d\\d)") || functions.GEN_INLIST(untrimmedline.rxSummHormone, "01", "(\\d\\d)") || functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "10-40", "(\\d\\d)"))) {
            if (functions.GEN_INLIST(untrimmedline.rxSummSystemicSurSeq, "2-7,9"))
                return true
            else
                return false
        }
        else {
            if ((functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "00", "(\\d\\d)") && (functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "0") || (functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "2") && functions.GEN_INLIST(untrimmedline.regionalNodesExamined, "00,99", "(\\d\\d)") && dx_year >= 2012 && dx_year <= 2017) || (functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "1") && dx_year >= 2021)) && functions.GEN_INLIST(untrimmedline.rxSummSurgOthRegDis, "0")) || (functions.GEN_INLIST(untrimmedline.rxSummBrm, "00,82-88", "(\\d\\d)") && functions.GEN_INLIST(untrimmedline.rxSummChemo, "00,82-88", "(\\d\\d)") && functions.GEN_INLIST(untrimmedline.rxSummHormone, "00,82-88", "(\\d\\d)") && functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "00,82-88", "(\\d\\d)"))) {
                if (functions.GEN_INLIST(untrimmedline.rxSummSystemicSurSeq, "0"))
                    return true
                else
                    return false
            }
            else {
                if ((functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "98") && functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "9") && functions.GEN_INLIST(untrimmedline.rxSummSurgOthRegDis, "0")) || (functions.GEN_INLIST(untrimmedline.rxSummBrm, "00,82-88", "(\\d\\d)") && functions.GEN_INLIST(untrimmedline.rxSummChemo, "00,82-88", "(\\d\\d)") && functions.GEN_INLIST(untrimmedline.rxSummHormone, "00,82-88", "(\\d\\d)") && functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "00,82-88", "(\\d\\d)"))) {
                    if (functions.GEN_INLIST(untrimmedline.rxSummSystemicSurSeq, "0"))
                        return true
                    else
                        return false
                }
            }
        }
        return true

    }

    // ID: NPCR-00493; TAG: N6636; NAME: Tumor Size 998, Schema ID (NAACCR)
    public boolean npcr00493(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        char[] ID = new char[100]
        char[] code = new char[6]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2019)
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0) {
            return true
        }
        functions.GEN_STRCPY(ID, "00161 00169 00170 00200 00290 00330 00360 00370 00400 00410 00421 00430 00450 00470 00480 00459 ")
        
        
        functions.GEN_STRCPY(code, untrimmedline.schemaId)
        functions.GEN_STRCAT(code, " ")
        
        if (functions.GEN_AT(code, ID, 6) == 0) {
            if (functions.GEN_AT(untrimmedline.tumorSizeSummary, "998") != 0)
                return false
        }
        return true

    }

    // ID: NPCR-00494; TAG: N6638; NAME: Tumor Size 999, Schema ID, Primary Site (NAACCR)
    public boolean npcr00494(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        char[] ID = new char[90]
        char[] code = new char[6]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2019)
            return true
        if (functions.GEN_EMPTY(untrimmedline.schemaId))
            return true
        if (functions.GEN_EMPTY(untrimmedline.primarySite) || functions.GEN_AT(untrimmedline.primarySite, "C422") != 0) {
            return true
        }
        functions.GEN_STRCPY(ID, "00458 00671 00672 00790 00795 00821 00822 00830 ") /* add blank to coded Schema ID to match edit string*/
        
        functions.GEN_STRCPY(code, untrimmedline.schemaId)
        functions.GEN_STRCAT(code, " ")
        
        if (functions.GEN_AT(code, ID, 6) != 0 || functions.GEN_INLIST(untrimmedline.primarySite, "420,421,423,424,770-779,809", "(C\\d\\d\\d)", 2, 3)) {
            if (functions.GEN_AT(untrimmedline.tumorSizeSummary, "999") == 0 && !functions.GEN_EMPTY(untrimmedline.tumorSizeSummary))
                return false
        }
        return true

    }

    // ID: NPCR-00495; TAG: 3174; NAME: SSDI for Prostate, Blank for Other Schemas (Subm)
    public boolean npcr00495(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        int err_flag
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018)
            return true
        if (functions.GEN_EMPTY(untrimmedline.schemaId) || functions.GEN_AT(untrimmedline.schemaId, "00580") != 0)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "00580") == 0) {
        
            if (!functions.GEN_EMPTY(untrimmedline.psaLabValue)) {
                functions.GEN_SAVE_TEXT(binding, 'If Schema is not Prostate, PSA Lab Value must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.gleasonPatternsClinical)) {
                functions.GEN_SAVE_TEXT(binding, 'If Schema is not Prostate, Gleason Patterns Clinical must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.gleasonPatternsPathological)) {
                functions.GEN_SAVE_TEXT(binding, 'If Schema is not Prostate, Gleason Patterns Pathological must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.gleasonScoreClinical)) {
                functions.GEN_SAVE_TEXT(binding, 'If Schema is not Prostate, Gleason Score Clinical must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.gleasonScorePathological)) {
                functions.GEN_SAVE_TEXT(binding, 'If Schema is not Prostate, Gleason Score Pathological must be blank')
                err_flag = 1
            }
            if (!functions.GEN_EMPTY(untrimmedline.gleasonTertiaryPattern)) {
                functions.GEN_SAVE_TEXT(binding, 'If Schema is not Prostate, Gleason Tertiary Pattern must be blank')
                err_flag = 1
            }
        }
        if (err_flag == 1)
            return false
        return true

    }

    // ID: NPCR-00496; TAG: N0605; NAME: Regional Nodes Examined (SEER)
    public boolean npcr00496(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.regionalNodesExamined))
            return true
        return functions.GEN_INLIST(untrimmedline.regionalNodesExamined, "00-99", "(\\d\\d)")

    }

    // ID: NPCR-00497; TAG: N0606; NAME: Regional Nodes Positive (SEER)
    public boolean npcr00497(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.regionalNodesPositive))
            return true
        return functions.GEN_INLIST(untrimmedline.regionalNodesPositive, "00-99", "(\\d\\d)")

    }

    // ID: NPCR-00498; TAG: N4929; NAME: Surgery 03-2022, Phase I Rad, Surg/Rad Seq (SEER)
    public boolean npcr00498(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int result
        int dx_year
        int seer_init_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018 || dx_year > 2022)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite) || functions.GEN_EMPTY(untrimmedline.rxSummScopeRegLnSur) || functions.GEN_EMPTY(untrimmedline.rxSummSurgOthRegDis))
            return true
        if ((functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "10-90", "(\\d\\d)") || (functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "34567", 1) != 0 || (functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "2") != 0 && functions.GEN_INLIST(untrimmedline.regionalNodesExamined, "01-98", "(\\d\\d)") && dx_year >= 2018 && dx_year <= 2020) || (functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "2") != 0 && dx_year >= 2021)) || functions.GEN_AT(untrimmedline.rxSummSurgOthRegDis, "12345", 1) != 0) && functions.GEN_INLIST(untrimmedline.phase1RadiationTreatmentModality, "01-16,98", "(\\d\\d)")) {
            if (functions.GEN_AT(untrimmedline.rxSummSurgRadSeq, "2345679", 1) != 0)
                return true
            else
                return false
        }
        else {
            if ((functions.GEN_AT(untrimmedline.rxSummSurgPrimSite, "009899", 2) != 0 && (functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "0") != 0 || (functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "1") != 0 && dx_year >= 2021)) && functions.GEN_AT(untrimmedline.rxSummSurgOthRegDis, "0") != 0) || functions.GEN_AT(untrimmedline.phase1RadiationTreatmentModality, "0099", 2) != 0) {
                if (functions.GEN_AT(untrimmedline.rxSummSurgRadSeq, "0") != 0)
                    return true
                else
                    return false
            }
            else
                return true
        }
        return true

    }

    // ID: NPCR-00499; TAG: 3168; NAME: Surgery, 03-2022, Rad, Surg/Rad Seq (Subm)
    public boolean npcr00499(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int result
        int dx_year
        int seer_init_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year >= 2018 || dx_year < 2010)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite) || functions.GEN_EMPTY(untrimmedline.rxSummScopeRegLnSur) || functions.GEN_EMPTY(untrimmedline.rxSummSurgOthRegDis))
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummRadiation) && functions.GEN_EMPTY(untrimmedline.radRegionalRxModality))
            return true
        if (dx_year >= 2010 && dx_year <= 2014) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") && !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        if (((functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "10-90")) || (functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "1-7") && dx_year < 2012) || (functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "1,3-7") && dx_year > 2011) || (functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "2") && functions.GEN_INLIST(untrimmedline.regionalNodesExamined, "01-98") && dx_year > 2011) || (functions.GEN_INLIST(untrimmedline.rxSummSurgOthRegDis, "1-5"))) && (functions.GEN_INLIST(untrimmedline.rxSummRadiation, "1-6") || functions.GEN_INLIST(untrimmedline.radRegionalRxModality, "20-98"))) {
            if (functions.GEN_INLIST(untrimmedline.rxSummSurgRadSeq, "2-7,9"))
                return true
            else
                return false
        }
        else {
            if ((functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "00") && ((functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "0") || (functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "2") && functions.GEN_INLIST(untrimmedline.regionalNodesExamined, "00,99") && dx_year > 2011))) && functions.GEN_INLIST(untrimmedline.rxSummSurgOthRegDis, "0")) || (functions.GEN_INLIST(untrimmedline.rxSummRadiation, "0") || functions.GEN_INLIST(untrimmedline.radRegionalRxModality, "00"))) {
                if (functions.GEN_INLIST(untrimmedline.rxSummSurgRadSeq, "0"))
                    return true
                else
                    return false
            }
            else
                return true
        }
        return true

    }

    // ID: NPCR-00500; TAG: N0200; NAME: Date 1st Crs RX COC, Date of Last Contact (COC)
    public boolean npcr00500(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dtcmp
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfLastContact) || functions.GEN_EMPTY(untrimmedline.date1stCrsRxCoc))
            return true
        dtcmp = functions.GEN_DATECMP_IOP(binding, untrimmedline.dateOfLastContact, untrimmedline.date1stCrsRxCoc, ((Integer)context.NPCR_GEN_DT_MIN))
        
        if (dtcmp == ((Integer)context.NPCR_GEN_DT_ERROR)) {
            if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.date1stCrsRxCoc)) {
                functions.GEN_ERROR_TEXT(binding, 'Date of 1st Crs RX--COC is invalid: %DC')
                return false
            }
            else {
                if (!functions.GEN_VALID_DATE_IOP(binding, untrimmedline.dateOfLastContact)) {
                    functions.GEN_ERROR_TEXT(binding, 'Date of Last Contact is invalid: %DC')
                    return false
                }
            }
        }
        else {
            if (dtcmp >= 0)
                return true
            else
                return false
        }
        
        return true

    }

    // ID: NPCR-00502; TAG: 3179; NAME: Rad--Regional RX Modality, Date of Diagnosis (Subm)
    public boolean npcr00502(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2010) {
            return true
        }
        if (dx_year >= 2010 && dx_year < 2015) {
            if (!(functions.GEN_INLIST(untrimmedline.primarySite, "180-189,199,209,500-509", "(C\\d\\d\\d)", 2, 3) && functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044,9060-9136,9141-9582")))
                return true
            if (functions.GEN_EMPTY(untrimmedline.radRegionalRxModality))
                return functions.GEN_ERROR_MSG(binding, 'If DX year - 2010-2014, Primary Site = ${untrimmedline.primarySite} and Histologic Type ICD-O-3 = ${untrimmedline.histologicTypeIcdO3}, Rad--Regional RX Modality cannot be blank')
        }
        else {
            if (dx_year >= 2015 && dx_year <= 2017) {
                if (functions.GEN_EMPTY(untrimmedline.radRegionalRxModality))
                    return functions.GEN_ERROR_MSG(binding, 'If DX year = 2015-2017, Rad--Regional RX Modality must be reported')
            }
        }
        if (dx_year >= 2018) {
            if (!functions.GEN_EMPTY(untrimmedline.radRegionalRxModality))
                return functions.GEN_ERROR_MSG(binding, 'If DX year = 2018 or later, Rad--Regional RX Modality must be blank')
        }
        return true

    }

    // ID: NPCR-00503; TAG: 3157; NAME: CS Tumor Size, Schema (Subm)
    public boolean npcr00503(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] t_site = new char[5], t_hist = new char[5], t_discrim = new char[4], t_schema_name = new char[31], t_schema_msg = new char[79]
        char[] CS_code = new char[4]
        int t_schema_number, t_max_schemas, t_result
        
        if (functions.GEN_EMPTY(untrimmedline.csTumorSize) || functions.GEN_EMPTY(untrimmedline.primarySite) || functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        functions.GEN_STRCPY(t_site, untrimmedline.primarySite)
        functions.GEN_STRCPY(t_hist, untrimmedline.histologicTypeIcdO3)
        
        t_max_schemas = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_number_of_schemas")
        
        t_schema_number = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_number", t_site, t_hist, t_discrim)
        
        if (t_schema_number < 0)
            return true
        if (t_schema_number > t_max_schemas) {
            return true
        }
        functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_get_schema_name", t_schema_number, t_schema_name)
        
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1,")) {
            if (!functions.GEN_INLIST(t_schema_name, "Brain,CNSOther,IntracranialGland")) {
                return true
            }
        }
        functions.GEN_STRCPY(CS_code, untrimmedline.csTumorSize)
        
        t_result = functions.GEN_EXTERNALDLL("cstage0205.dll", "CStage_code_is_valid", t_schema_number, 1, 1, CS_code)
        
        if (t_result <= 0) {
            functions.GEN_STRCPY(t_schema_msg, "Schema: ")
            functions.GEN_STRCAT(t_schema_msg, t_schema_name)
            functions.GEN_SAVE_TEXT(binding, t_schema_msg)
            return false
        }
        
        return true

    }

    // ID: NPCR-00505; TAG: 3258; NAME: Tumor Size Summary (Subm)
    public boolean npcr00505(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2016)
            return true
        if (functions.GEN_EMPTY(untrimmedline.tumorSizeSummary))
            return true
        return functions.GEN_INLIST(untrimmedline.tumorSizeSummary, "000-990, 998, 999", "(\\d\\d\\d)")

    }

    // ID: NPCR-00507; TAG: 3250; NAME: RX Summ--Surg Prim Site 03-2022, Site, ICDO3 (Subm)
    public boolean npcr00507(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] Gpcode = new char[3], Sitelow = new char[5], Sitehigh = new char[5]
        char[] Sitegrp = new char[5]
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010 || dx_year > 2017)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite)) {
            return true
        }
        if (functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "99")) {
            return true
        }
        if (dx_year > 2009 && dx_year < 2018) {
            if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9727,9733,9741-9742,9764-9809,9832,9840-9931,9945-9946,9950-9967,9975-9992")) {
                if (functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "98,99"))
                    return true
                else
                    return false
            }
        }
        if (functions.GEN_RLOOKUP(untrimmedline.primarySite, context.NPCR_SITGRP03, context.NPCR_SITGRP03_SITELOW, ['GPCODE':Gpcode, 'SITELOW':Sitelow, 'SITEHIGH':Sitehigh])) {
            if (functions.GEN_STRCMP(untrimmedline.primarySite, Sitelow) >= 0 && functions.GEN_STRCMP(untrimmedline.primarySite, Sitehigh) <= 0)
                functions.GEN_STRCPY(Sitegrp, Gpcode)
            else
                functions.GEN_STRCPY(Sitegrp, "30")
        }
        else {
            functions.GEN_STRCPY(Sitegrp, "30")
        }
        if (functions.GEN_INLIST(Sitegrp, "30") && functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "41")) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "690-699", "(C\\d\\d\\d)", 2, 3))
                return true
            else
                return false
        }
        functions.GEN_STRCAT(Sitegrp, untrimmedline.rxSummSurgPrimSite)
        
        if (functions.GEN_LOOKUP(Sitegrp, context.NPCR_SURG03, context.NPCR_SURG03_GROUPCODE, [:]))
            return true
        return false

    }

    // ID: NPCR-00508; TAG: 3244; NAME: RX Summ--Scope Reg LN Sur, Site, ICDO3 (Subm)
    public boolean npcr00508(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year > 2017 || dx_year < 2010)
            return true
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3) || functions.GEN_EMPTY(untrimmedline.rxSummScopeRegLnSur))
            return true
        if (functions.GEN_INLIST(untrimmedline.primarySite, "700-729,751-753", "(C\\d\\d\\d)", 2, 3)) {
            if (functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "9"))
                return true
            else
                return false
        }
        if (dx_year > 2009 && dx_year < 2018) {
            if ((functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9590-9726,9728-9732,9734-9740,9750-9762,9811-9831,9940,9948,9971") && functions.GEN_INLIST(untrimmedline.primarySite, "770-779", "(C\\d\\d\\d)", 2, 3)) || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9727,9733,9741-9742,9764-9809,9832,9840-9931,9945-9946,9950-9967,9975-9992") || functions.GEN_INLIST(untrimmedline.primarySite, "420,421,423,424,700-729,751-753,760-768,809", "(C\\d\\d\\d)", 2, 3)) {
                if (functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "9"))
                    return true
                else
                    return false
            }
        }
        if (dx_year < 2018) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "760-768,809", "(C\\d\\d\\d)", 2, 3)) {
                if (functions.GEN_INLIST(untrimmedline.rxSummScopeRegLnSur, "9"))
                    return true
                else
                    return false
            }
        }
        return true

    }

    // ID: NPCR-00509; TAG: 3233; NAME: RX Summ--BRM, Vital Status (Subm)
    public boolean npcr00509(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummBrm))
            return true
        if (dx_year >= 2010 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        if (functions.GEN_VAL(untrimmedline.rxSummBrm) == 85 && functions.GEN_VAL(untrimmedline.vitalStatus) == 1)
            return false
        return true

    }

    // ID: NPCR-00510; TAG: 3236; NAME: RX Summ--Chemo, Vital Status (Subm)
    public boolean npcr00510(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummChemo))
            return true
        if (dx_year >= 2010 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        if (functions.GEN_VAL(untrimmedline.rxSummChemo) == 85 && functions.GEN_VAL(untrimmedline.vitalStatus) == 1)
            return false
        return true

    }

    // ID: NPCR-00511; TAG: 3239; NAME: RX Summ--Hormone, Vital Status (Subm)
    public boolean npcr00511(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummHormone))
            return true
        if (dx_year >= 2010 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        if (functions.GEN_VAL(untrimmedline.rxSummHormone) == 85 && functions.GEN_VAL(untrimmedline.vitalStatus) == 1)
            return false
        return true

    }

    // ID: NPCR-00512; TAG: 3255; NAME: RX Summ--Transplnt/Endocr, Vital Status (Subm)
    public boolean npcr00512(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummTransplntEndocr))
            return true
        if (dx_year >= 2010 && dx_year <= 2014) {
            if (!functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-9044, 9060-9136, 9141-9582") || !functions.GEN_INLIST(untrimmedline.primarySite, "500-509, 180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        if (functions.GEN_VAL(untrimmedline.rxSummTransplntEndocr) == 85 && functions.GEN_VAL(untrimmedline.vitalStatus) == 1)
            return false
        return true

    }

    // ID: NPCR-00513; TAG: 3269; NAME: RX Date Mst Defn Srg, Surg Prim Site (Subm)
    public boolean npcr00513(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2015 || dx_year > 2022)
            return true
        if (functions.GEN_AT(untrimmedline.rxSummSurgPrimSite, "009899", 2) != 0) {
            if (functions.GEN_EMPTY(untrimmedline.rxDateMostDefinSurg))
                return true
            else
                return false
        }
        if (!functions.GEN_EMPTY(untrimmedline.rxDateMostDefinSurg)) {
            if (functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "10-90"))
                return true
            else
                return false
        }
        return true

    }

    // ID: NPCR-00514; TAG: 3268; NAME: Surgery, 03-2022, RX Date Surgery, Primary Site (Subm)
    public boolean npcr00514(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int exception
        int dx_year
        
        exception = 0
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2019 || dx_year > 2022)
            return true
        if (functions.GEN_EMPTY(untrimmedline.schemaId))
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite) || functions.GEN_EMPTY(untrimmedline.rxSummScopeRegLnSur) || functions.GEN_EMPTY(untrimmedline.rxSummSurgOthRegDis))
            return true
        char[] ID = new char[15]
        char[] code = new char[7]
        
        
        functions.GEN_STRCPY(ID, "00790 00795 ")
        
        
        functions.GEN_STRCPY(code, untrimmedline.schemaId)
        functions.GEN_STRCAT(code, " ")
        
        if (functions.GEN_INLIST(untrimmedline.primarySite, "420, 421, 423, 424, 589,700-729,751-753,761-768,770-779,809", "(C\\d\\d\\d)", 2, 3))
            exception = 1
        else {
            if (dx_year >= 2019 && dx_year <= 2021) {
                if (functions.GEN_AT(code, ID, 6) != 0 || (functions.GEN_AT(untrimmedline.schemaId, "00822") != 0 && functions.GEN_AT(untrimmedline.histologicTypeIcdO3, "9734") == 0) || (functions.GEN_AT(untrimmedline.schemaId, "99999") != 0 && functions.GEN_AT(untrimmedline.primarySite, "C422") == 0))
                    return true
            }
        }
        if (functions.GEN_AT(untrimmedline.rxSummSurgPrimSite, "0098", 2) != 0 && (functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "0") != 0 || (exception == 1 && functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "9") != 0) || (functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "1") != 0 && dx_year >= 2021)) && functions.GEN_AT(untrimmedline.rxSummSurgOthRegDis, "0") != 0) {
            if (!functions.GEN_EMPTY(untrimmedline.rxDateSurgery))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'If surgery fields indicate no treatment, date of surgery must be blank')
        }
        if (!functions.GEN_EMPTY(untrimmedline.rxDateSurgery)) {
            if (functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "10-90") || ((functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "2") != 0 && dx_year >= 2021) || functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "34567", 1) != 0 || (functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "2") != 0 && functions.GEN_INLIST(untrimmedline.regionalNodesExamined, "01-98") && dx_year >= 2019 && dx_year <= 2020) || (functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "1") != 0 && dx_year < 2021)) || functions.GEN_AT(untrimmedline.rxSummSurgOthRegDis, "12345", 1) != 0)
                return true
            else
                functions.GEN_SAVE_ERROR_TEXT(binding, 'If date of surgery is not blank, at least one surgery field must indicate treatment.')
        }
        return true

    }

    // ID: NPCR-00515; TAG: 3266; NAME: Cancer Items, Type Reporting Source-DCO (Subm)
    public boolean npcr00515(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018)
            return true
        if (functions.GEN_EMPTY(untrimmedline.schemaId))
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") == 0)
            return true
        if (functions.GEN_AT(untrimmedline.behaviorCodeIcdO3, "2") != 0) {
            return true
        }
        if (functions.GEN_INLIST(untrimmedline.behaviorCodeIcdO3, "0,1,")) {
            if (functions.GEN_AT(untrimmedline.schemaId, "00721007220072309721097220972309724", 5) == 0)
                return true
        }
        if (!functions.GEN_EMPTY(untrimmedline.diagnosticConfirmation) && functions.GEN_AT(untrimmedline.diagnosticConfirmation, "39", 1) == 0)
            functions.GEN_SAVE_ERROR_TEXT(binding, 'DCO: Diagnostic Confirmation must = 3, 9 or blank')
        if (!functions.GEN_EMPTY(untrimmedline.icdO3ConversionFlag) && functions.GEN_AT(untrimmedline.icdO3ConversionFlag, "0") == 0)
            functions.GEN_SAVE_ERROR_TEXT(binding, 'DCO: ICD-O-3 Conversion Flag must = 0 or blank')
        if (!functions.GEN_EMPTY(untrimmedline.gradeClinical) && functions.GEN_AT(untrimmedline.gradeClinical, "89", 1) == 0)
            functions.GEN_SAVE_ERROR_TEXT(binding, 'DCO: Grade Clinical must =9 or blank')
        if (!functions.GEN_EMPTY(untrimmedline.gradePathological) && functions.GEN_AT(untrimmedline.gradePathological, "89", 1) == 0)
            functions.GEN_SAVE_ERROR_TEXT(binding, 'DCO: Grade Pathological must =9 or blank')
        if (!functions.GEN_EMPTY(untrimmedline.gradePostTherapyClin))
            functions.GEN_SAVE_ERROR_TEXT(binding, 'DCO: Grade Post Therapy Clin (yc) must = blank')
        if (!functions.GEN_EMPTY(untrimmedline.gradePostTherapy))
            functions.GEN_SAVE_ERROR_TEXT(binding, 'DCO: Grade Post Therapy Path (yp) must = blank')
        if (!functions.GEN_EMPTY(untrimmedline.lymphVascularInvasion) && functions.GEN_AT(untrimmedline.lymphVascularInvasion, "89", 1) == 0)
            functions.GEN_SAVE_ERROR_TEXT(binding, 'DCO: Lymphovascular Invasion must = 8, 9, or blank')
        if (!functions.GEN_EMPTY(untrimmedline.regionalNodesPositive) && functions.GEN_AT(untrimmedline.regionalNodesPositive, "99") == 0)
            functions.GEN_SAVE_ERROR_TEXT(binding, 'DCO: Regional Nodes Positive must = 99 or blank')
        if (!functions.GEN_EMPTY(untrimmedline.regionalNodesExamined) && functions.GEN_AT(untrimmedline.regionalNodesExamined, "99") == 0)
            functions.GEN_SAVE_ERROR_TEXT(binding, 'DCO: Regional Nodes Examined must = 99 or blank')
        if (!functions.GEN_EMPTY(untrimmedline.tumorSizeSummary) && functions.GEN_AT(untrimmedline.tumorSizeSummary, "999") == 0)
            functions.GEN_SAVE_ERROR_TEXT(binding, 'DCO: Tumor Size Summary must = 999 or blank')
        if (functions.GEN_AT(untrimmedline.vitalStatus, "0") == 0) {
            functions.GEN_SAVE_ERROR_TEXT(binding, 'DCO: Vital Status must = 0')
        }
        if (functions.GEN_AT(untrimmedline.icdRevisionNumber, "1") == 0)
            functions.GEN_SAVE_ERROR_TEXT(binding, 'DCO: ICD Revision Number must = 1 or blank')
        if (functions.GEN_EMPTY(untrimmedline.icdRevisionNumber)) {
            return true
        }
        if (dx_year >= 2023) {
            if (functions.GEN_AT(untrimmedline.summaryStage2018, "9") == 0 && !functions.GEN_EMPTY(untrimmedline.summaryStage2018))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'DCO: Summary Stage 2018 must = 9 or blank')
        }
        return true

    }

    // ID: NPCR-00516; TAG: N6583; NAME: Gleason Patterns Clinical, Date DX (NPCR)
    public boolean npcr00516(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if ((dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year >= 2018) && dx_year <= 2020)
            return true
        if (dx_year < 2018) {
            if (!functions.GEN_EMPTY(untrimmedline.gleasonPatternsClinical))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Gleason Patterns Clinical must be blank for cases diagnosed before 2018')
        }
        if (functions.GEN_EMPTY(untrimmedline.gleasonPatternsClinical))
            return true
        if (functions.GEN_AT(untrimmedline.gleasonPatternsClinical, "X6X7X8X9", 2) == 0 && !functions.GEN_INLIST(untrimmedline.gleasonPatternsClinical, "11-15,19,21-25,29,31-35,39,41-45,49,51-55,59", "(\\d\\d)"))
            functions.GEN_SAVE_ERROR_TEXT(binding, '${untrimmedline.gleasonPatternsClinical} not valid code for Gleason Patterns Clinical')
        return true

    }

    // ID: NPCR-00517; TAG: N6576; NAME: Gleason Patterns Clinical, Grade Clinical (NPCR)
    public boolean npcr00517(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        char[] GPC = new char[3]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2021)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "00580", 5) == 0)
            return true
        functions.GEN_STRCPY(GPC, untrimmedline.gleasonPatternsClinical)
        
        if ((functions.GEN_EMPTY(GPC) || functions.GEN_AT(GPC, "X8") != 0))
            return true
        if (functions.GEN_EMPTY(untrimmedline.gradeClinical))
            return true
        if (functions.GEN_AT(GPC, "111213212223313233", 2) != 0) {
            if (functions.GEN_AT(untrimmedline.gradeClinical, "1") == 0)
                return false
        }
        if (functions.GEN_AT(GPC, "34", 2) != 0) {
            if (functions.GEN_AT(untrimmedline.gradeClinical, "2") == 0)
                return false
        }
        if (functions.GEN_AT(GPC, "43", 2) != 0) {
            if (functions.GEN_AT(untrimmedline.gradeClinical, "3") == 0)
                return false
        }
        if (functions.GEN_AT(GPC, "443553", 2) != 0) {
            if (functions.GEN_AT(untrimmedline.gradeClinical, "4") == 0)
                return false
        }
        if (functions.GEN_AT(GPC, "455455", 2) != 0) {
            if (functions.GEN_AT(untrimmedline.gradeClinical, "5") == 0)
                return false
        }
        
        return true

    }

    // ID: NPCR-00518; TAG: N6422; NAME: Gleason Patterns Clinical, Schema ID, Required (NPCR)
    public boolean npcr00518(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.schemaId))
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0)
            return true
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2021)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "00580", 5) != 0) {
            if (functions.GEN_EMPTY(untrimmedline.gleasonPatternsClinical) || functions.GEN_AT(untrimmedline.gleasonPatternsClinical, "X8") != 0)
                return false
        }
        return true

    }

    // ID: NPCR-00519; TAG: N6596; NAME: Gleason Patterns Pathological, Date DX (NPCR)
    public boolean npcr00519(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if ((dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year >= 2018) && dx_year <= 2020)
            return true
        if (dx_year < 2018) {
            if (!functions.GEN_EMPTY(untrimmedline.gleasonPatternsPathological))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Gleason Patterns Pathological must be blank for cases diagnosed before 2018')
        }
        if (functions.GEN_EMPTY(untrimmedline.gleasonPatternsPathological))
            return true
        if (functions.GEN_AT(untrimmedline.gleasonPatternsPathological, "X6X7X8X9", 2) == 0 && !functions.GEN_INLIST(untrimmedline.gleasonPatternsPathological, "11-15,19,21-25,29,31-35,39,41-45,49,51-55,59", "(\\d\\d)"))
            functions.GEN_SAVE_ERROR_TEXT(binding, '${untrimmedline.gleasonPatternsPathological} not valid code for Gleason Patterns Pathological')
        return true

    }

    // ID: NPCR-00520; TAG: N6577; NAME: Gleason Patterns Pathological, Grade Pathological (NPCR)
    public boolean npcr00520(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year, clin, path
        
        char[] GPP = new char[3]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2021)
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "00580", 5) == 0)
            return true
        functions.GEN_STRCPY(GPP, untrimmedline.gleasonPatternsPathological)
        
        clin = functions.GEN_VAL(untrimmedline.gradeClinical)
        path = functions.GEN_VAL(untrimmedline.gradePathological)
        
        if ((functions.GEN_EMPTY(GPP) || functions.GEN_AT(GPP, "X8") != 0))
            return true
        if (functions.GEN_EMPTY(untrimmedline.gradePathological))
            return true
        if (clin >= path && clin != 9)
            return true
        if (functions.GEN_AT(untrimmedline.gradeClinical, "E") != 0 && functions.GEN_AT(untrimmedline.gradePathological, "123E", 1) != 0)
            return true
        if (functions.GEN_AT(GPP, "111213212223313233", 2) != 0) {
            if (functions.GEN_AT(untrimmedline.gradePathological, "01") == 0)
                return false
        }
        if (functions.GEN_AT(GPP, "34", 2) != 0) {
            if (functions.GEN_AT(untrimmedline.gradePathological, "2") == 0)
                return false
        }
        if (functions.GEN_AT(GPP, "43", 2) != 0) {
            if (functions.GEN_AT(untrimmedline.gradePathological, "3") == 0)
                return false
        }
        if (functions.GEN_AT(GPP, "443553", 2) != 0) {
            if (functions.GEN_AT(untrimmedline.gradePathological, "4") == 0)
                return false
        }
        if (functions.GEN_AT(GPP, "455455", 2) != 0) {
            if (functions.GEN_AT(untrimmedline.gradePathological, "5") == 0)
                return false
        }
        return true

    }

    // ID: NPCR-00521; TAG: N6423; NAME: Gleason Patterns Pathological, Schema ID, Required (NPCR)
    public boolean npcr00521(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.schemaId))
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0)
            return true
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2021)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "00580", 5) != 0) {
            if (functions.GEN_EMPTY(untrimmedline.gleasonPatternsPathological) || functions.GEN_AT(untrimmedline.gleasonPatternsPathological, "X8") != 0)
                return false
        }
        return true

    }

    // ID: NPCR-00522; TAG: N6578; NAME: Gleason Patterns/Score, Clin/Path (NPCR)
    public boolean npcr00522(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        char[] GPC = new char[3]
        char[] GSC = new char[3]
        char[] GPP = new char[3]
        char[] GSP = new char[3]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2021)
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "00580", 5) == 0)
            return true
        functions.GEN_STRCPY(GPC, untrimmedline.gleasonPatternsClinical)
        functions.GEN_STRCPY(GSC, untrimmedline.gleasonScoreClinical)
        functions.GEN_STRCPY(GPP, untrimmedline.gleasonPatternsPathological)
        functions.GEN_STRCPY(GSP, untrimmedline.gleasonScorePathological)
        
        if ((functions.GEN_EMPTY(GPC) || functions.GEN_AT(GPC, "X8") != 0) && (functions.GEN_EMPTY(GSC) || functions.GEN_AT(GSC, "X8") != 0) && (functions.GEN_EMPTY(GPP) || functions.GEN_AT(GPP, "X8") != 0) && (functions.GEN_EMPTY(GSP) || functions.GEN_AT(GSP, "X8") != 0))
            return true
        if (!functions.GEN_EMPTY(GSC) && functions.GEN_AT(GSC, "X8") == 0) {
            if (functions.GEN_AT(GPC, "11", 2) != 0) {
                if (functions.GEN_AT(GSC, "02", 2) == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Gleason Patterns Clinical: ${untrimmedline.gleasonPatternsClinical} is not valid for Gleason Score Clinical: ${untrimmedline.gleasonScoreClinical}')
            }
            if (functions.GEN_AT(GPC, "1221", 2) != 0) {
                if (functions.GEN_AT(GSC, "03", 2) == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Gleason Patterns Clinical: ${untrimmedline.gleasonPatternsClinical} is not valid for Gleason Score Clinical: ${untrimmedline.gleasonScoreClinical}')
            }
            if (functions.GEN_AT(GPC, "132231", 2) != 0) {
                if (functions.GEN_AT(GSC, "04", 2) == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Gleason Patterns Clinical: ${untrimmedline.gleasonPatternsClinical} is not valid for Gleason Score Clinical: ${untrimmedline.gleasonScoreClinical}')
            }
            if (functions.GEN_AT(GPC, "14233241", 2) != 0) {
                if (functions.GEN_AT(GSC, "05", 2) == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Gleason Patterns Clinical: ${untrimmedline.gleasonPatternsClinical} is not valid for Gleason Score Clinical: ${untrimmedline.gleasonScoreClinical}')
            }
            if (functions.GEN_AT(GPC, "1524334251", 2) != 0) {
                if (functions.GEN_AT(GSC, "06", 2) == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Gleason Patterns Clinical: ${untrimmedline.gleasonPatternsClinical} is not valid for Gleason Score Clinical: ${untrimmedline.gleasonScoreClinical}')
            }
            if (functions.GEN_AT(GPC, "25344352", 2) != 0) {
                if (functions.GEN_AT(GSC, "07", 2) == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Gleason Patterns Clinical: ${untrimmedline.gleasonPatternsClinical} is not valid for Gleason Score Clinical: ${untrimmedline.gleasonScoreClinical}')
            }
            if (functions.GEN_AT(GPC, "354453", 2) != 0) {
                if (functions.GEN_AT(GSC, "08", 2) == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Gleason Patterns Clinical: ${untrimmedline.gleasonPatternsClinical} is not valid for Gleason Score Clinical: ${untrimmedline.gleasonScoreClinical}')
            }
            if (functions.GEN_AT(GPC, "4554", 2) != 0) {
                if (functions.GEN_AT(GSC, "09", 2) == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Gleason Patterns Clinical: ${untrimmedline.gleasonPatternsClinical} is not valid for Gleason Score Clinical: ${untrimmedline.gleasonScoreClinical}')
            }
            if (functions.GEN_AT(GPC, "55", 2) != 0) {
                if (functions.GEN_AT(GSC, "10", 2) == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Gleason Patterns Clinical: ${untrimmedline.gleasonPatternsClinical} is not valid for Gleason Score Clinical: ${untrimmedline.gleasonScoreClinical}')
            }
            if (functions.GEN_AT(GPC, "X7", 2) != 0) {
                if (functions.GEN_AT(GSC, "X7", 2) == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Gleason Patterns Clinical: ${untrimmedline.gleasonPatternsClinical} is not valid for Gleason Score Clinical: ${untrimmedline.gleasonScoreClinical}')
            }
        }
        if (!functions.GEN_EMPTY(GSP) && functions.GEN_AT(GSP, "X8") == 0) {
            if (functions.GEN_AT(GPP, "11", 2) != 0) {
                if (functions.GEN_AT(GSP, "02", 2) == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Gleason Patterns Pathological: ${untrimmedline.gleasonPatternsPathological} is not valid for Gleason Score Pathological ${untrimmedline.gleasonScorePathological}')
            }
            if (functions.GEN_AT(GPP, "1221", 2) != 0) {
                if (functions.GEN_AT(GSP, "03", 2) == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Gleason Patterns Pathological: ${untrimmedline.gleasonPatternsPathological} is not valid for Gleason Score Pathological ${untrimmedline.gleasonScorePathological}')
            }
            if (functions.GEN_AT(GPP, "132231", 2) != 0) {
                if (functions.GEN_AT(GSP, "04", 2) == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Gleason Patterns Pathological: ${untrimmedline.gleasonPatternsPathological} is not valid for Gleason Score Pathological ${untrimmedline.gleasonScorePathological}')
            }
            if (functions.GEN_AT(GPP, "14233241", 2) != 0) {
                if (functions.GEN_AT(GSP, "05", 2) == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Gleason Patterns Pathological: ${untrimmedline.gleasonPatternsPathological} is not valid for Gleason Score Pathological ${untrimmedline.gleasonScorePathological}')
            }
            if (functions.GEN_AT(GPP, "1524334251", 2) != 0) {
                if (functions.GEN_AT(GSP, "06", 2) == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Gleason Patterns Pathological: ${untrimmedline.gleasonPatternsPathological} is not valid for Gleason Score Pathological ${untrimmedline.gleasonScorePathological}')
            }
            if (functions.GEN_AT(GPP, "25344352", 2) != 0) {
                if (functions.GEN_AT(GSP, "07", 2) == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Gleason Patterns Pathological: ${untrimmedline.gleasonPatternsPathological} is not valid for Gleason Score Pathological ${untrimmedline.gleasonScorePathological}')
            }
            if (functions.GEN_AT(GPP, "354453", 2) != 0) {
                if (functions.GEN_AT(GSP, "08", 2) == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Gleason Patterns Pathological: ${untrimmedline.gleasonPatternsPathological} is not valid for Gleason Score Pathological ${untrimmedline.gleasonScorePathological}')
            }
            if (functions.GEN_AT(GPP, "4554", 2) != 0) {
                if (functions.GEN_AT(GSP, "09", 2) == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Gleason Patterns Pathological: ${untrimmedline.gleasonPatternsPathological} is not valid for Gleason Score Pathological ${untrimmedline.gleasonScorePathological}')
            }
            if (functions.GEN_AT(GPP, "55", 2) != 0) {
                if (functions.GEN_AT(GSP, "10", 2) == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Gleason Patterns Pathological: ${untrimmedline.gleasonPatternsPathological} is not valid for Gleason Score Pathological ${untrimmedline.gleasonScorePathological}')
            }
            if (functions.GEN_AT(GPP, "X7", 2) != 0) {
                if (functions.GEN_AT(GSP, "X7", 2) == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Gleason Patterns Pathological: ${untrimmedline.gleasonPatternsPathological} is not valid for Gleason Score Pathological ${untrimmedline.gleasonScorePathological}')
            }
        }
        return true

    }

    // ID: NPCR-00523; TAG: N6597; NAME: Gleason Score Clinical, Date DX (NPCR)
    public boolean npcr00523(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if ((dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year >= 2018) && dx_year <= 2020)
            return true
        if (dx_year < 2018) {
            if (!functions.GEN_EMPTY(untrimmedline.gleasonScoreClinical))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Gleason Score Clinical must be blank for cases diagnosed before 2018')
        }
        if (functions.GEN_EMPTY(untrimmedline.gleasonScoreClinical))
            return true
        if (functions.GEN_AT(untrimmedline.gleasonScoreClinical, "020304050607080910X7X8X9", 2) == 0)
            functions.GEN_SAVE_ERROR_TEXT(binding, '${untrimmedline.gleasonScoreClinical} not valid code for Gleason Score Clinical')
        return true

    }

    // ID: NPCR-00524; TAG: N6579; NAME: Gleason Score Clinical, Grade Clinical (NPCR)
    public boolean npcr00524(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        char[] GSC = new char[3]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2021)
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "00580", 5) == 0)
            return true
        functions.GEN_STRCPY(GSC, untrimmedline.gleasonScoreClinical)
        
        if (functions.GEN_EMPTY(GSC) || functions.GEN_AT(GSC, "X8") != 0 || functions.GEN_AT(GSC, "X9") != 0)
            return true
        if (functions.GEN_EMPTY(untrimmedline.gradeClinical))
            return true
        if (functions.GEN_AT(GSC, "010203040506", 2) != 0) {
            if (functions.GEN_AT(untrimmedline.gradeClinical, "1") == 0)
                return false
        }
        if (functions.GEN_AT(GSC, "07", 2) != 0) {
            if (functions.GEN_AT(untrimmedline.gradeClinical, "23E", 1) == 0)
                return false
        }
        if (functions.GEN_AT(GSC, "08", 2) != 0) {
            if (functions.GEN_AT(untrimmedline.gradeClinical, "4") == 0)
                return false
        }
        if (functions.GEN_AT(GSC, "0910", 2) != 0) {
            if (functions.GEN_AT(untrimmedline.gradeClinical, "5") == 0)
                return false
        }
        return true

    }

    // ID: NPCR-00525; TAG: N6424; NAME: Gleason Score Clinical, Schema ID, Required (NPCR)
    public boolean npcr00525(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.schemaId))
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0)
            return true
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2021)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "00580", 5) != 0) {
            if (functions.GEN_EMPTY(untrimmedline.gleasonScoreClinical) || functions.GEN_AT(untrimmedline.gleasonScoreClinical, "X8") != 0)
                return false
        }
        return true

    }

    // ID: NPCR-00526; TAG: N6598; NAME: Gleason Score Pathological, Date DX (NPCR)
    public boolean npcr00526(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if ((dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year >= 2018) && dx_year <= 2020)
            return true
        if (dx_year < 2018) {
            if (!functions.GEN_EMPTY(untrimmedline.gleasonScorePathological))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Gleason Score Pathological must be blank for cases diagnosed before 2018')
        }
        if (functions.GEN_EMPTY(untrimmedline.gleasonScorePathological))
            return true
        if (functions.GEN_AT(untrimmedline.gleasonScorePathological, "020304050607080910X7X8X9", 2) == 0)
            functions.GEN_SAVE_ERROR_TEXT(binding, '${untrimmedline.gleasonScorePathological} not valid code for Gleason Score Pathological')
        return true

    }

    // ID: NPCR-00527; TAG: N6580; NAME: Gleason Score Pathological, Grade Pathological (NPCR)
    public boolean npcr00527(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year, clin, path
        
        char[] GSP = new char[3]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2021)
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "00580", 5) == 0)
            return true
        functions.GEN_STRCPY(GSP, untrimmedline.gleasonScorePathological)
        
        clin = functions.GEN_VAL(untrimmedline.gradeClinical)
        path = functions.GEN_VAL(untrimmedline.gradePathological)
        
        if (functions.GEN_EMPTY(GSP) || functions.GEN_AT(GSP, "X8") != 0 || functions.GEN_AT(GSP, "X9") != 0)
            return true
        if (functions.GEN_EMPTY(untrimmedline.gradePathological))
            return true
        if (clin >= path && clin != 9)
            return true
        if (functions.GEN_AT(untrimmedline.gradeClinical, "E") != 0 && functions.GEN_AT(untrimmedline.gradePathological, "123E", 1) != 0)
            return true
        if (functions.GEN_AT(GSP, "010203040506", 2) != 0) {
            if (functions.GEN_AT(untrimmedline.gradePathological, "1") == 0)
                return false
        }
        if (functions.GEN_AT(GSP, "07", 2) != 0) {
            if (functions.GEN_AT(untrimmedline.gradePathological, "23E", 1) == 0)
                return false
        }
        if (functions.GEN_AT(GSP, "08", 2) != 0) {
            if (functions.GEN_AT(untrimmedline.gradePathological, "4") == 0)
                return false
        }
        if (functions.GEN_AT(GSP, "0910", 2) != 0) {
            if (functions.GEN_AT(untrimmedline.gradePathological, "5") == 0)
                return false
        }
        return true

    }

    // ID: NPCR-00528; TAG: N6425; NAME: Gleason Score Pathological, Schema ID, Required (NPCR)
    public boolean npcr00528(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.schemaId))
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0)
            return true
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2021)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "00580", 5) != 0) {
            if (functions.GEN_EMPTY(untrimmedline.gleasonScorePathological) || functions.GEN_AT(untrimmedline.gleasonScorePathological, "X8") != 0)
                return false
        }
        return true

    }

    // ID: NPCR-00529; TAG: N6599; NAME: Gleason Tertiary Pattern, Date DX (NPCR)
    public boolean npcr00529(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if ((dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year >= 2018) && dx_year <= 2020)
            return true
        if (dx_year < 2018) {
            if (!functions.GEN_EMPTY(untrimmedline.gleasonTertiaryPattern))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Gleason Tertiary Pattern must be blank for cases diagnosed before 2018')
        }
        if (functions.GEN_EMPTY(untrimmedline.gleasonTertiaryPattern))
            return true
        if (functions.GEN_AT(untrimmedline.gleasonTertiaryPattern, "1020304050X7X8X9", 2) == 0)
            functions.GEN_SAVE_ERROR_TEXT(binding, '${untrimmedline.gleasonTertiaryPattern} not valid code for Gleason Tertiary Pattern')
        return true

    }

    // ID: NPCR-00530; TAG: N2802; NAME: Grade Clin,Path,PostTX, Date of Diagnosis (NAACCR)
    public boolean npcr00530(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year < 2018) {
            if (!functions.GEN_EMPTY(untrimmedline.gradeClinical) || !functions.GEN_EMPTY(untrimmedline.gradePathological) || !functions.GEN_EMPTY(untrimmedline.gradePostTherapy) || !functions.GEN_EMPTY(untrimmedline.gradePostTherapyClin))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade Clinical, Grade Pathological, Grade Post Therapy Clin (yc), and Grade Post Therapy Path (yp) must be blank for cases diagnosed before 2018')
        }
        if (dx_year >= 2018) {
            if (functions.GEN_EMPTY(untrimmedline.gradeClinical))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade Clinical must be reported for diagnosis date 2018+')
            if (functions.GEN_EMPTY(untrimmedline.gradePathological))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade Pathological must be reported for diagnosis date 2018+')
        }
        return true

    }

    // ID: NPCR-00531; TAG: N6332; NAME: Grade Post Therapy Clin (yc) (NAACCR)
    public boolean npcr00531(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.gradePostTherapyClin))
            return true
        if (functions.GEN_AT(untrimmedline.gradePostTherapyClin, "1234589ABCDEHLMS", 1) != 0)
            return true
        return false

    }

    // ID: NPCR-00532; TAG: N6581; NAME: Grade Post Therapy, Gleason Patterns Pathological (NPCR)
    public boolean npcr00532(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        char[] GPP = new char[3]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2021)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "00580", 5) == 0)
            return true
        functions.GEN_STRCPY(GPP, untrimmedline.gleasonPatternsPathological)
        
        if (functions.GEN_EMPTY(GPP) || functions.GEN_AT(GPP, "X8") != 0)
            return true
        if (functions.GEN_EMPTY(untrimmedline.gradePostTherapy))
            return true
        if (functions.GEN_AT(untrimmedline.gradePostTherapy, "9", 1) == 0) {
            if (functions.GEN_AT(GPP, "X9", 2) == 0)
                return false
        }
        return true

    }

    // ID: NPCR-00533; TAG: N6582; NAME: Grade Post Therapy, Gleason Score Pathological, Tertiary Pattern (NPCR)
    public boolean npcr00533(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        char[] GSP = new char[3]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2021)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "00580", 5) == 0)
            return true
        functions.GEN_STRCPY(GSP, untrimmedline.gleasonScorePathological)
        
        if ((functions.GEN_EMPTY(GSP) || functions.GEN_AT(GSP, "X8") != 0) && (functions.GEN_EMPTY(untrimmedline.gleasonTertiaryPattern) || functions.GEN_AT(untrimmedline.gleasonTertiaryPattern, "X8") != 0))
            return true
        if (functions.GEN_AT(untrimmedline.gradePostTherapy, "9", 1) == 0 && !functions.GEN_EMPTY(untrimmedline.gradePostTherapy)) {
            if ((functions.GEN_AT(GSP, "X9", 2) == 0 && functions.GEN_AT(GSP, "X8", 2) == 0 && !functions.GEN_EMPTY(GSP)) || (functions.GEN_AT(untrimmedline.gleasonTertiaryPattern, "X9", 2) == 0 && functions.GEN_AT(untrimmedline.gleasonTertiaryPattern, "X8", 2) == 0 && !functions.GEN_EMPTY(untrimmedline.gleasonTertiaryPattern)))
                return false
        }
        return true

    }

    // ID: NPCR-00534; TAG: N6361; NAME: Grade Post Therapy, Primary Site, Schema ID (NAACCR)
    public boolean npcr00534(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2021)
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0)
            return true
        if (functions.GEN_EMPTY(untrimmedline.schemaId))
            return true
        if (functions.GEN_EMPTY(untrimmedline.primarySite))
            return true
        if (functions.GEN_EMPTY(untrimmedline.gradePostTherapyClin) && functions.GEN_EMPTY(untrimmedline.gradePostTherapy))
            return true
        char[] ID = new char[55]
        char[] code = new char[7]
        
        
        functions.GEN_STRCPY(ID, "00790 00795 00811 00812 00821 00822 00830 99999 ")
        
        
        functions.GEN_STRCPY(code, untrimmedline.schemaId)
        functions.GEN_STRCAT(code, " ")
        
        if (functions.GEN_AT(code, ID, 6) != 0 || functions.GEN_INLIST(untrimmedline.primarySite, "420,421,423,424,809", "(C\\d\\d\\d)", 2, 4)) {
            if (!functions.GEN_EMPTY(untrimmedline.gradePostTherapyClin))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade Post Therapy Clin (yc) must be blank for Primary Site: ${untrimmedline.primarySite} and/or Schema ID: ${untrimmedline.schemaId}')
            if (!functions.GEN_EMPTY(untrimmedline.gradePostTherapy))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade Post Therapy Path (yp) must be blank for Primary Site: ${untrimmedline.primarySite} and/or Schema ID: ${untrimmedline.schemaId}')
        }
        return true

    }

    // ID: NPCR-00535; TAG: N6639; NAME: Grade Post Therapy, Treatment Status (NAACCR)
    public boolean npcr00535(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year < 2022)
            return true
        if (functions.GEN_EMPTY(untrimmedline.gradePostTherapyClin) && functions.GEN_EMPTY(untrimmedline.gradePostTherapy))
            return true
        if (functions.GEN_AT(untrimmedline.rxSummTreatmentStatus, "029", 1) != 0) {
            if (!functions.GEN_EMPTY(untrimmedline.gradePostTherapyClin) || !functions.GEN_EMPTY(untrimmedline.gradePostTherapy))
                return false
        }
        return true

    }

    // ID: NPCR-00536; TAG: N3966; NAME: Lymphovascular Invasion (COC)
    public boolean npcr00536(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if ((dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY)) || (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR)) || (dx_year < 2018))
            return true
        if (functions.GEN_EMPTY(untrimmedline.lymphVascularInvasion))
            return true
        if (functions.GEN_AT(untrimmedline.lymphVascularInvasion, "0123489", 1) == 0)
            return false
        return true

    }

    // ID: NPCR-00537; TAG: N4019; NAME: Lymphovascular Invasion, Schema ID (NAACCR)
    public boolean npcr00537(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        
        char[] SCHEMA_ID = new char[6], SCHEMA_NAME = new char[36]
        
        int dx_year
        char[] ID1 = new char[395]
        char[] ID2 = new char[200]
        char[] code = new char[7]
        char[] name = new char[50]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018)
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0)
            return true
        if (functions.GEN_EMPTY(untrimmedline.lymphVascularInvasion))
            return true
        if (functions.GEN_EMPTY(untrimmedline.schemaId)) {
            return true
        }
        if (functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_SCHEMA_ID_NAMES, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_SCHEMA_ID_NAMES_SCHEMA_ID, untrimmedline.schemaId, ['SCHEMA_ID':SCHEMA_ID, 'SCHEMA_NAME':SCHEMA_NAME]))
            functions.GEN_STRCPY(name, "Schema ")
        functions.GEN_STRCAT(name, untrimmedline.schemaId)
        functions.GEN_STRCAT(name, ": ")
        functions.GEN_STRCAT(name, functions.GEN_TRIM(SCHEMA_NAME, ((Integer)context.NPCR_GEN_RIGHT)))
        
        
        functions.GEN_STRCPY(ID1, "00071 00072 00073 00074 00075 00076 00077 00080 00111 00112 ")
        functions.GEN_STRCAT(ID1, "00121 00122 00130 00131 00132 00133 00161 00169 00170 00180 ")
        functions.GEN_STRCAT(ID1, "00190 00200 00301 00302 00320 00340 00460 00470 00530 00541 ")
        functions.GEN_STRCAT(ID1, "00542 00570 00590 00620 00500 00510 00520 00560 ")
        functions.GEN_STRCAT(ID1, "00100 00230 00250 00260 00270 00280 00290 00330 00350 00360 ")
        functions.GEN_STRCAT(ID1, "09520 00528 09190 09290 09301 09302 09320 09330 09340 09500 ")
        
        
        functions.GEN_STRCPY(ID2, "00710 00790 00795 00811 00812 00821 00822 00830 ")
        
        functions.GEN_STRCPY(code, untrimmedline.schemaId)
        functions.GEN_STRCAT(code, " ")
        
        if (functions.GEN_AT(code, ID1, 6) != 0) {
            if (functions.GEN_AT(untrimmedline.lymphVascularInvasion, "012349", 1) == 0) {
                functions.GEN_SAVE_TEXT(binding, name)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'If Schema ID = ${untrimmedline.schemaId}, Lymphovascular Invasion must not = 8')
            }
        }
        if (dx_year >= 2018 && dx_year <= 2021) {
            if (functions.GEN_AT(code, "00730 00740 ") != 0) {
                if (functions.GEN_AT(untrimmedline.lymphVascularInvasion, "012349", 1) == 0) {
                    functions.GEN_SAVE_TEXT(binding, name)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'If Schema ID = ${untrimmedline.schemaId}, Lymphovascular Invasion must not = 8')
                }
            }
            if (functions.GEN_AT(code, "00760 ") != 0) {
                if (functions.GEN_AT(untrimmedline.lymphVascularInvasion, "0123489", 1) == 0) {
                    functions.GEN_SAVE_TEXT(binding, name)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Lymphovascular Invasion: ${untrimmedline.lymphVascularInvasion} not valid for Schema ID: ${untrimmedline.schemaId}')
                }
            }
        }
        if (dx_year >= 2022) {
            if (functions.GEN_AT(code, "00730 00740 00760 ", 6) != 0) {
                if (functions.GEN_AT(untrimmedline.lymphVascularInvasion, "02349", 1) == 0) {
                    functions.GEN_SAVE_TEXT(binding, name)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'If Schema ID = ${untrimmedline.schemaId}, Lymphovascular Invasion must not = 1 or 8')
                }
            }
        }
        if (functions.GEN_AT(code, ID2, 6) != 0) {
            if (functions.GEN_AT(untrimmedline.lymphVascularInvasion, "8", 1) == 0) {
                functions.GEN_SAVE_TEXT(binding, name)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'If Schema ID = ${untrimmedline.schemaId}, Lymphovascular Invasion must = 8')
            }
        }
        if (functions.GEN_AT(untrimmedline.schemaId, "00430") != 0) {
            if (dx_year <= 2020) {
                if (functions.GEN_AT(untrimmedline.lymphVascularInvasion, "0123489", 1) != 0)
                    return true
                else
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Lymphovascular Invasion: ${untrimmedline.lymphVascularInvasion} not valid for Schema ID: ${untrimmedline.schemaId}')
            }
            else {
                if (dx_year >= 2018) {
                    if (functions.GEN_AT(untrimmedline.lymphVascularInvasion, "8") != 0)
                        return true
                    else
                        functions.GEN_SAVE_ERROR_TEXT(binding, 'Lymphovascular Invasion: ${untrimmedline.lymphVascularInvasion} not valid for Schema ID: ${untrimmedline.schemaId}')
                }
            }
        }
        if (functions.GEN_AT(code, ID2, 6) == 0 && functions.GEN_AT(code, ID1, 6) == 0) {
            if (functions.GEN_AT(untrimmedline.lymphVascularInvasion, "0123489", 1) == 0) {
                functions.GEN_SAVE_TEXT(binding, name)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Lymphovascular Invasion: ${untrimmedline.lymphVascularInvasion} not valid for Schema ID: ${untrimmedline.schemaId}')
            }
        }
        return true

    }

    // ID: NPCR-00538; TAG: N5060; NAME: Lymphovascular Invasion, Testis, Summary Stage 2018 (NAACCR)
    public boolean npcr00538(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2019)
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "00590") == 0)
            return true
        if (functions.GEN_EMPTY(untrimmedline.lymphVascularInvasion) || functions.GEN_AT(untrimmedline.lymphVascularInvasion, "8") != 0)
            return true
        if (functions.GEN_EMPTY(untrimmedline.summaryStage2018))
            return true
        if (functions.GEN_AT(untrimmedline.lymphVascularInvasion, "1234", 1) != 0) {
            if (functions.GEN_AT(untrimmedline.summaryStage2018, "0", 1) != 0)
                return false
        }
        return true

    }

    // ID: NPCR-00539; TAG: N2694; NAME: Microsatellite Instability (MSI), Date DX (NAACCR)
    public boolean npcr00539(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2018) {
            if (!functions.GEN_EMPTY(untrimmedline.microsatelliteInstability))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Microsatellite Instability (MSI) must be blank for cases diagnosed before 2018')
        }
        if (functions.GEN_EMPTY(untrimmedline.microsatelliteInstability))
            return true
        if (functions.GEN_AT(untrimmedline.microsatelliteInstability, "01289", 1) == 0)
            functions.GEN_SAVE_ERROR_TEXT(binding, '${untrimmedline.microsatelliteInstability} not valid code for Microsatellite Instability (MSI)')
        return true

    }

    // ID: NPCR-00541; TAG: 3265; NAME: SSDI for Colorectal, Blank for Other Schemas (Subm)
    public boolean npcr00541(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        int err_flag
        
        char[] code = new char[7]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018)
            return true
        if (functions.GEN_EMPTY(untrimmedline.schemaId)) {
            return true
        }
        functions.GEN_STRCPY(code, untrimmedline.schemaId)
        functions.GEN_STRCAT(code, " ")
        
        if (functions.GEN_AT(code, "00200 ", 6) == 0) {
            if (!functions.GEN_EMPTY(untrimmedline.microsatelliteInstability)) {
                functions.GEN_SAVE_TEXT(binding, 'If Schema is not Colorectal, Microsatellite Instability (MSI) must be blank')
                err_flag = 1
            }
        }
        if (err_flag == 1)
            return false
        return true

    }

    // ID: NPCR-00544; TAG: N6071; NAME: Date of Diagnosis, Required (NAACCR)
    public boolean npcr00544(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.dateOfDiagnosis))
            return false
        return true

    }

    // ID: NPCR-00545; TAG: N6744; NAME: Date of Last Contact, Required (NPCR)
    public boolean npcr00545(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2001)
            return true
        if (functions.GEN_AT(untrimmedline.vitalStatus, "0") != 0) {
            if (functions.GEN_EMPTY(untrimmedline.dateOfLastContact))
                return false
        }
        return true

    }

    // ID: NPCR-00546; TAG: 3267; NAME: HER2 Overall Summary, Date DX (Subm)
    public boolean npcr00546(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2018) {
            if (!functions.GEN_EMPTY(untrimmedline.her2OverallSummary))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'HER2 Overall Summary must be blank for cases diagnosed before 2018')
        }
        if (functions.GEN_EMPTY(untrimmedline.her2OverallSummary))
            return true
        if (functions.GEN_AT(untrimmedline.her2OverallSummary, "0179", 1) == 0)
            functions.GEN_SAVE_ERROR_TEXT(binding, '${untrimmedline.her2OverallSummary} not valid code for HER2 Overall Summary')
        return true

    }

    // ID: NPCR-00547; TAG: N6595; NAME: Tobacco Use Smoking Status, Date DX (NPCR)
    public boolean npcr00547(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2022) {
            if (!functions.GEN_EMPTY(untrimmedline.tobaccoUseSmokingStatus))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Tobacco Use Smoking Status must be blank for cases diagnosed before 2022')
        }
        if (functions.GEN_EMPTY(untrimmedline.tobaccoUseSmokingStatus))
            return true
        if (functions.GEN_AT(untrimmedline.tobaccoUseSmokingStatus, "01239", 1) != 0)
            return true
        else
            return false
        return true

    }

    // ID: NPCR-00548; TAG: N6663; NAME: p16, Schema ID, Required (NPCR)
    public boolean npcr00548(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.schemaId))
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0)
            return true
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2022)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "09520", 5) != 0) {
            if (functions.GEN_EMPTY(untrimmedline.p16) || functions.GEN_AT(untrimmedline.p16, "8") != 0)
                return false
        }
        if (functions.GEN_AT(untrimmedline.schemaId, "09210", 5) != 0) {
            if (functions.GEN_EMPTY(untrimmedline.p16) || functions.GEN_AT(untrimmedline.p16, "8") != 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'p16 must not be blank or not applicable for cases diagnosed 2023+')
        }
        if (functions.GEN_AT(untrimmedline.schemaId, "09500", 5) != 0) {
            if (functions.GEN_EMPTY(untrimmedline.p16) || functions.GEN_AT(untrimmedline.p16, "8") != 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'p16 must not be blank or not applicable for Schema ID: ${untrimmedline.schemaId} cases diagnosed 2024 and later')
        }
        return true

    }

    // ID: NPCR-00549; TAG: N6672; NAME: Esophagus and EGJ Tumor Epicenter, Schema ID, Required (NPCR)
    public boolean npcr00549(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.schemaId))
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0)
            return true
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2022)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "00161", 5) != 0) {
            if (functions.GEN_EMPTY(untrimmedline.esophagusAndEgjTumorEpicenter))
                return false
        }
        return true

    }

    // ID: NPCR-00550; TAG: N6731; NAME: Esophagus and EGJ Tumor Epicenter, Esophagus, Primary Site (NPCR)
    public boolean npcr00550(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2022)
            return true
        if (functions.GEN_EMPTY(untrimmedline.schemaId) || functions.GEN_AT(untrimmedline.schemaId, "00161", 5) == 0)
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0)
            return true
        if (functions.GEN_EMPTY(untrimmedline.esophagusAndEgjTumorEpicenter))
            return true
        if (functions.GEN_AT(untrimmedline.primarySite, "C159") != 0) {
            if (functions.GEN_AT(untrimmedline.esophagusAndEgjTumorEpicenter, "9") == 0)
                return false
        }
        return true

    }

    // ID: NPCR-00551; TAG: N6675; NAME: p16, Date DX (NPCR)
    public boolean npcr00551(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year == 2021)
            return true
        if (dx_year < 2021) {
            if (!functions.GEN_EMPTY(untrimmedline.p16))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'p16 must be blank for cases diagnosed before 2021')
        }
        if (dx_year < 2023 && functions.GEN_AT(untrimmedline.schemaId, "00210", 5) != 0) {
            if (!functions.GEN_EMPTY(untrimmedline.p16))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'p16 must be blank for Schema ID: ${untrimmedline.schemaId} cases diagnosed before 2023')
        }
        if (dx_year < 2024 && functions.GEN_AT(untrimmedline.schemaId, "00500", 5) != 0) {
            if (!functions.GEN_EMPTY(untrimmedline.p16))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'p16 must be blank for Schema ID: ${untrimmedline.schemaId} cases diagnosed before 2024')
        }
        if (functions.GEN_EMPTY(untrimmedline.p16))
            return true
        if (functions.GEN_AT(untrimmedline.p16, "0189", 1) == 0)
            functions.GEN_SAVE_ERROR_TEXT(binding, '${untrimmedline.p16} not valid code for p16')
        return true

    }

    // ID: NPCR-00552; TAG: N6674; NAME: Esophagus and EGJ Tumor Epicenter, Date DX (NPCR)
    public boolean npcr00552(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if ((dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year >= 2018) && dx_year <= 2021)
            return true
        if (dx_year < 2018) {
            if (!functions.GEN_EMPTY(untrimmedline.esophagusAndEgjTumorEpicenter))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Esophagus and EGJ Tumor Epicenter must be blank for cases diagnosed before 2018')
        }
        if (functions.GEN_EMPTY(untrimmedline.esophagusAndEgjTumorEpicenter))
            return true
        if (functions.GEN_AT(untrimmedline.esophagusAndEgjTumorEpicenter, "0129", 1) == 0)
            functions.GEN_SAVE_ERROR_TEXT(binding, '${untrimmedline.esophagusAndEgjTumorEpicenter} not valid code for Esophagus and EGJ Tumor Epicenter')
        return true

    }

    // ID: NPCR-00554; TAG: N3901; NAME: PhI Radiation Treatment Modality, Date DX (NPCR)
    public boolean npcr00554(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0)
            return true
        if (dx_year > 2017) {
            if (functions.GEN_EMPTY(untrimmedline.phase1RadiationTreatmentModality))
                return false
        }
        return true

    }

    // ID: NPCR-00555; TAG: N6356; NAME: Grade, Ovary/PPC/FT, Morphology (NAACCR)
    public boolean npcr00555(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        char[] ID = new char[20]
        char[] code = new char[7]
        char[] Morph = new char[6]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2021)
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0) {
            return true
        }
        functions.GEN_STRCPY(ID, "00551 00552 00553 ")
        
        
        functions.GEN_STRCPY(code, untrimmedline.schemaId)
        functions.GEN_STRCAT(code, " ")
        
        if (functions.GEN_AT(code, ID, 6) == 0)
            return true
        if (functions.GEN_EMPTY(untrimmedline.gradeClinical) && functions.GEN_EMPTY(untrimmedline.gradePathological))
            return true
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        if (functions.GEN_EMPTY(untrimmedline.behaviorCodeIcdO3) || functions.GEN_AT(untrimmedline.behaviorCodeIcdO3, "01", 1) != 0)
            return true
        functions.GEN_STRCPY(Morph, untrimmedline.histologicTypeIcdO3)
        functions.GEN_STRCAT(Morph, untrimmedline.behaviorCodeIcdO3)
        
        if (functions.GEN_AT(Morph, "844128441384603846138474390803", 5) != 0) {
            if (!functions.GEN_EMPTY(untrimmedline.gradeClinical) && functions.GEN_AT(untrimmedline.gradeClinical, "LH9", 1) == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade Clinical: ${untrimmedline.gradeClinical} is not valid for Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3}')
            if (!functions.GEN_EMPTY(untrimmedline.gradePathological) && functions.GEN_AT(untrimmedline.gradePathological, "LH9", 1) == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade Pathological: ${untrimmedline.gradePathological} is not valid for Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3}')
        }
        else {
            if (functions.GEN_AT(Morph, "844128441384603846138474390803", 5) == 0) {
                if (!functions.GEN_EMPTY(untrimmedline.gradeClinical) && functions.GEN_AT(untrimmedline.gradeClinical, "1239", 1) == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade Clinical: ${untrimmedline.gradeClinical} is not valid for Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3}')
                if (!functions.GEN_EMPTY(untrimmedline.gradePathological) && functions.GEN_AT(untrimmedline.gradePathological, "1239", 1) == 0)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Grade Pathological: ${untrimmedline.gradePathological} is not valid for Histologic Type ICD-O-3: ${untrimmedline.histologicTypeIcdO3}')
            }
        }
        return true

    }

    // ID: NPCR-00556; TAG: N6368; NAME: Reason for No Surgery, Surg Prim Site 03-2022, Primary Site, 2018 (NAACCR)
    public boolean npcr00556(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018 || dx_year > 2022)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite))
            return true
        if (functions.GEN_EMPTY(untrimmedline.reasonForNoSurgery))
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "67", 1) != 0)
            return true
        if (functions.GEN_INLIST(untrimmedline.primarySite, "420,421,423,424,760-768, 809", "(C\\d\\d\\d)", 2, 3)) {
            if (functions.GEN_AT(untrimmedline.reasonForNoSurgery, "1", 1) == 0)
                return false
        }
        if (functions.GEN_AT(untrimmedline.rxSummSurgPrimSite, "00") != 0) {
            if (functions.GEN_AT(untrimmedline.reasonForNoSurgery, "123456789", 1) == 0)
                return false
        }
        if (functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "10-90", "(\\d\\d)")) {
            if (functions.GEN_AT(untrimmedline.reasonForNoSurgery, "0", 1) == 0)
                return false
        }
        if (functions.GEN_AT(untrimmedline.rxSummSurgPrimSite, "98") != 0) {
            if (functions.GEN_AT(untrimmedline.reasonForNoSurgery, "1", 1) == 0)
                return false
        }
        if (functions.GEN_AT(untrimmedline.rxSummSurgPrimSite, "99") != 0) {
            if (functions.GEN_AT(untrimmedline.reasonForNoSurgery, "89", 1) == 0)
                return false
        }
        return true

    }

    // ID: NPCR-00557; TAG: 3271; NAME: Surgery 03-2022, Reason No Surg (Subm)
    public boolean npcr00557(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2010 || dx_year > 2017)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite) || functions.GEN_EMPTY(untrimmedline.reasonForNoSurgery))
            return true
        if (functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "10-90")) {
            if (functions.GEN_AT(untrimmedline.reasonForNoSurgery, "0") != 0)
                return true
            else
                return false
        }
        if (functions.GEN_AT(untrimmedline.rxSummSurgPrimSite, "0098", 2) != 0) {
            if (functions.GEN_AT(untrimmedline.reasonForNoSurgery, "0") != 0)
                return false
            else
                return true
        }
        if (functions.GEN_AT(untrimmedline.rxSummSurgPrimSite, "99") != 0) {
            if (functions.GEN_AT(untrimmedline.reasonForNoSurgery, "0") != 0)
                return false
        }
        return true

    }

    // ID: NPCR-00558; TAG: N2062; NAME: County at DX Geocode2020 (NAACCR)
    public boolean npcr00558(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.countyAtDxGeocode2020))
            return true
        return functions.GEN_INLIST(untrimmedline.countyAtDxGeocode2020, "001-999", "(\\d\\d\\d)")

    }

    // ID: NPCR-00560; TAG: 3270; NAME: RX Summ--Surg Prim Site 03-2022, Primary Site, 2018 (Subm)
    public boolean npcr00560(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] Grpcode = new char[3], Schema = new char[6], Sitelow = new char[5], Sitehigh = new char[5]
        char[] Sitegrp = new char[10]
        char[] Schema_SITE = new char[15]
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2010 || dx_year > 2022)
            return true
        if (functions.GEN_EMPTY(untrimmedline.primarySite))
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite))
            return false
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0 && functions.GEN_AT(untrimmedline.rxSummSurgPrimSite, "99") != 0)
            return true
        if (functions.GEN_INLIST(untrimmedline.primarySite, "420,421,423,424,760-768,809", "(C\\d\\d\\d)", 2, 3)) {
            if (functions.GEN_AT(untrimmedline.rxSummSurgPrimSite, "98") != 0)
                return true
            else
                functions.GEN_SAVE_ERROR_TEXT(binding, 'RX Summ--Surg Prim Site 03-2022: ${untrimmedline.rxSummSurgPrimSite} conflicts with Primary Site: ${untrimmedline.primarySite}')
        }
        if (dx_year >= 2010 && dx_year <= 2022) {
            if (!functions.GEN_INLIST(untrimmedline.primarySite, "420, 421, 423, 424, 760-768, 809", "(C\\d\\d\\d)", 2, 3)) {
                if (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9727, 9732, 9741-9742, 9749, 9761-9809,         9820, 9826, 9831-9834, 9840-9993"))
                    return true
            }
        }
        if (functions.GEN_SQLRANGELOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_SCHEMASURG19, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_SCHEMASURG19_SITELOW, untrimmedline.primarySite, ['GRPCODE':Grpcode, 'SCHEMA':Schema, 'SITELOW':Sitelow, 'SITEHIGH':Sitehigh])) {
            if (functions.GEN_STRCMP(untrimmedline.primarySite, Sitelow) >= 0 && functions.GEN_STRCMP(untrimmedline.primarySite, Sitehigh) <= 0)
                functions.GEN_STRCPY(Sitegrp, Grpcode)
            else
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Primary Site is invalid code')
        }
        if (functions.GEN_AT(Sitegrp, "30") != 0 && functions.GEN_AT(untrimmedline.rxSummSurgPrimSite, "41") != 0) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "690-699", "(C\\d\\d\\d)", 2, 3))
                return true
            else
                functions.GEN_SAVE_ERROR_TEXT(binding, 'RX Summ--Surg Prim Site 03-2022: ${untrimmedline.rxSummSurgPrimSite} conflicts with Primary Site: ${untrimmedline.primarySite}')
        }
        functions.GEN_STRCAT(Sitegrp, untrimmedline.rxSummSurgPrimSite)
        
        if (dx_year >= 2010 && dx_year <= 2021) {
            if (functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_SURG03, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_SURG03_GROUPCODE, Sitegrp, [:]))
                return true
            else
                functions.GEN_SAVE_ERROR_TEXT(binding, 'RX Summ--Surg Prim Site 03-2022: ${untrimmedline.rxSummSurgPrimSite} conflicts with Primary Site: ${untrimmedline.primarySite}')
        }
        if (dx_year >= 2022) {
            if (functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_SURG22, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_SURG22_GROUPCODE, Sitegrp, [:]))
                return true
            else
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict among RX Summ--Surg Prim Site 03-2022: ${untrimmedline.rxSummSurgPrimSite}, Primary Site: ${untrimmedline.primarySite}, and Date of Diagnosis: ${untrimmedline.dateOfDiagnosis.formatDate()}')
        }
        return true

    }

    // ID: NPCR-00561; TAG: N6065; NAME: RX Summ--Treatm Stat, Treatment 03-2022, Blanks (NAACCR)
    public boolean npcr00561(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018 || dx_year > 2022)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummTreatmentStatus))
            return true
        if (functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "10-90") || functions.GEN_AT(untrimmedline.rxSummSurgOthRegDis, "12345", 1) != 0 || functions.GEN_AT(untrimmedline.rxSummBrm, "01") != 0 || functions.GEN_AT(untrimmedline.rxSummChemo, "010203", 2) != 0 || functions.GEN_AT(untrimmedline.rxSummHormone, "01") != 0 || functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "10-12,20,30,40") || functions.GEN_AT(untrimmedline.rxSummOther, "1236", 1) != 0 || functions.GEN_AT(untrimmedline.reasonForNoRadiation, "0") != 0) {
            if (functions.GEN_AT(untrimmedline.rxSummTreatmentStatus, "1") == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between RX Summ--Treatment Status and treatment codes')
        }
        else {
            if (functions.GEN_AT(untrimmedline.rxSummTreatmentStatus, "1") != 0) {
                if (functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite, "10-90") || (functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "1234567", 1) != 0 && dx_year <= 2020) || (functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "234567", 1) != 0 && dx_year >= 2021) || functions.GEN_AT(untrimmedline.rxSummSurgOthRegDis, "12345", 1) != 0 || functions.GEN_AT(untrimmedline.rxSummBrm, "01") != 0 || functions.GEN_AT(untrimmedline.rxSummChemo, "010203", 2) != 0 || functions.GEN_AT(untrimmedline.rxSummHormone, "01") != 0 || functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "10-12,20,30,40") || functions.GEN_AT(untrimmedline.rxSummOther, "1236", 1) != 0 || functions.GEN_AT(untrimmedline.reasonForNoRadiation, "0") != 0)
                    return true
                else
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between RX Summ--Treatment Status and treatment codes')
            }
            else {
                if (functions.GEN_AT(untrimmedline.rxSummTreatmentStatus, "02", 1) != 0) {
                    if ((functions.GEN_AT(untrimmedline.rxSummSurgPrimSite, "0098", 2) != 0 || functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite)) && (functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "012345679", 1) != 0 || functions.GEN_EMPTY(untrimmedline.rxSummScopeRegLnSur)) && (functions.GEN_AT(untrimmedline.rxSummSurgOthRegDis, "0") != 0 || functions.GEN_EMPTY(untrimmedline.rxSummSurgOthRegDis)) && (functions.GEN_INLIST(untrimmedline.rxSummBrm, "00,80-88") || functions.GEN_EMPTY(untrimmedline.rxSummSurgOthRegDis)) && (functions.GEN_INLIST(untrimmedline.rxSummChemo, "00,80-88") || functions.GEN_EMPTY(untrimmedline.rxSummChemo)) && (functions.GEN_INLIST(untrimmedline.rxSummHormone, "00,80-88") || functions.GEN_EMPTY(untrimmedline.rxSummHormone)) && (functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "00,80-88") || functions.GEN_EMPTY(untrimmedline.rxSummTransplntEndocr)) && (functions.GEN_AT(untrimmedline.rxSummOther, "078", 1) != 0 || functions.GEN_EMPTY(untrimmedline.rxSummOther)) && (functions.GEN_AT(untrimmedline.reasonForNoRadiation, "1256789", 1) != 0 || functions.GEN_AT(untrimmedline.phase1RadiationTreatmentModality, "00") != 0 || (functions.GEN_EMPTY(untrimmedline.phase1RadiationTreatmentModality) && functions.GEN_EMPTY(untrimmedline.reasonForNoRadiation))))
                        return true
                    else
                        functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between RX Summ--Treatment Status and treatment codes')
                }
            }
        }
        if (functions.GEN_AT(untrimmedline.rxSummTreatmentStatus, "9") != 0) {
            if (functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite) && functions.GEN_EMPTY(untrimmedline.rxSummSurgOthRegDis) && functions.GEN_EMPTY(untrimmedline.rxSummBrm) && functions.GEN_EMPTY(untrimmedline.rxSummChemo) && functions.GEN_EMPTY(untrimmedline.rxSummHormone) && functions.GEN_EMPTY(untrimmedline.rxSummTransplntEndocr) && functions.GEN_EMPTY(untrimmedline.rxSummOther) && functions.GEN_EMPTY(untrimmedline.phase1RadiationTreatmentModality))
                return true
            else {
                if (functions.GEN_AT(untrimmedline.rxSummSurgPrimSite, "99") != 0 || functions.GEN_AT(untrimmedline.rxSummSurgOthRegDis, "9") != 0 || functions.GEN_AT(untrimmedline.rxSummBrm, "99") != 0 || functions.GEN_AT(untrimmedline.rxSummChemo, "99") != 0 || functions.GEN_AT(untrimmedline.rxSummHormone, "99") != 0 || functions.GEN_AT(untrimmedline.rxSummTransplntEndocr, "99") != 0 || functions.GEN_AT(untrimmedline.rxSummOther, "9") != 0 || (functions.GEN_AT(untrimmedline.phase1RadiationTreatmentModality, "99") != 0 || functions.GEN_AT(untrimmedline.reasonForNoRadiation, "89", 1) != 0)) {
                    if ((functions.GEN_AT(untrimmedline.rxSummSurgPrimSite, "009899", 2) != 0 || functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite)) && (functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "012345679", 1) != 0 || functions.GEN_EMPTY(untrimmedline.rxSummScopeRegLnSur)) && (functions.GEN_AT(untrimmedline.rxSummSurgOthRegDis, "09", 1) != 0 || functions.GEN_EMPTY(untrimmedline.rxSummSurgOthRegDis)) && (functions.GEN_INLIST(untrimmedline.rxSummBrm, "00,80-88,99") || functions.GEN_EMPTY(untrimmedline.rxSummBrm)) && (functions.GEN_INLIST(untrimmedline.rxSummChemo, "00,80-88,99") || functions.GEN_EMPTY(untrimmedline.rxSummChemo)) && (functions.GEN_INLIST(untrimmedline.rxSummHormone, "00,80-88,99") || functions.GEN_EMPTY(untrimmedline.rxSummHormone)) && (functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "00,80-88,99") || functions.GEN_EMPTY(untrimmedline.rxSummTransplntEndocr)) && (functions.GEN_AT(untrimmedline.rxSummOther, "0789", 1) != 0 || functions.GEN_EMPTY(untrimmedline.rxSummOther)) && (functions.GEN_AT(untrimmedline.phase1RadiationTreatmentModality, "0099", 2) != 0 || functions.GEN_AT(untrimmedline.reasonForNoRadiation, "89", 1) != 0 || (functions.GEN_EMPTY(untrimmedline.phase1RadiationTreatmentModality) && functions.GEN_EMPTY(untrimmedline.reasonForNoRadiation))))
                        return true
                    else
                        functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between RX Summ--Treatment Status and treatment codes')
                }
                else
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between RX Summ--Treatment Status and treatment codes')
            }
        }
        
        return true

    }

    // ID: NPCR-00562; TAG: 3272; NAME: County at DX Reported (Subm)
    public boolean npcr00562(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_INLIST(untrimmedline.countyAtDx, "998")) {
            return false
        }
        if (functions.GEN_AT(untrimmedline.registryId, "0000006500") != 0) {
            if (functions.GEN_MATCH(untrimmedline.countyAtDx, "(\\d\\d\\d)"))
                return true
            else
                return false
        }
        else {
            if (functions.GEN_MATCH(untrimmedline.countyAtDx, "(\\d\\d\\d)") && functions.GEN_AT(untrimmedline.countyAtDx, "000") == 0)
                return true
            else
                return false
        }
        return true

    }

    // ID: NPCR-00563; TAG: 3118; NAME: Regional Nodes Ex, Reg Nodes Pos (Subm)
    public boolean npcr00563(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int ex, pos, dx_year
        
        if (functions.GEN_EMPTY(untrimmedline.regionalNodesExamined) || functions.GEN_EMPTY(untrimmedline.regionalNodesPositive))
            return true
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY))
            return true
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2012) {
            if (!functions.GEN_INLIST(untrimmedline.primarySite, "180-209", "(C\\d\\d\\d)", 2, 3))
                return true
        }
        if (dx_year > 2011) {
            if (functions.GEN_EMPTY(untrimmedline.regionalNodesExamined) || functions.GEN_EMPTY(untrimmedline.regionalNodesPositive))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Regional Nodes Examined and/or Regional Nodes Positive must not be blank if Date of Diagnosis > 2015')
        }
        ex = functions.GEN_VAL(untrimmedline.regionalNodesExamined)
        pos = functions.GEN_VAL(untrimmedline.regionalNodesPositive)
        
        if (dx_year > 2009) {
            if (ex == 0 && pos != 98)
                return false
            else {
                if (ex >= 1 && ex <= 90) {
                    if (pos == 95 || pos == 97 || pos == 99 || pos <= ex)
                        return true
                    else
                        return false
                }
                else {
                    if (ex == 95) {
                        if (pos == 0 || pos == 95 || pos == 99)
                            return true
                        else
                            return false
                    }
                }
            }
            if (ex == 96 || ex == 97 || ex == 98) {
                if ((pos >= 0 && pos <= 90) || (pos == 95) || (pos == 97) || (pos == 99))
                    return true
                else
                    return false
            }
            else {
                if (ex == 99) {
                    if (pos == 99)
                        return true
                    else
                        return false
                }
            }
        }
        return true

    }

    // ID: NPCR-00564; TAG: N2823; NAME: _SYS Schema ID, Date of Diagnosis (NAACCR)
    public boolean npcr00564(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        char[] ID = new char[6]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        functions.GEN_STRCPY(ID, untrimmedline.schemaId)
        functions.GEN_STRCAT(ID, " ")
        
        if (dx_year < 2018) {
            if (!functions.GEN_EMPTY(untrimmedline.schemaId))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Schema ID must be blank for cases diagnosed before 2018')
        }
        if (dx_year >= 2018) {
            if (functions.GEN_EMPTY(untrimmedline.schemaId))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Schema ID must not be blank for cases diagnosed 2018 and later')
        }
        if (dx_year >= 2021) {
            if (functions.GEN_AT(untrimmedline.schemaId, "00520") != 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Schema ID: ${untrimmedline.schemaId} valid only for Date of Diagnosis 2018-2020')
        }
        if (dx_year < 2021) {
            if (functions.GEN_AT(ID, "00528 09520 ", 6) != 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Schema ID: ${untrimmedline.schemaId} is valid only for Date of Diagnosis: 2021 and later')
        }
        if (dx_year >= 2023) {
            if (functions.GEN_AT(ID, "00721 00722 00723 00190 00210 ", 6) != 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Schema ID: ${untrimmedline.schemaId} is valid only for Date of Diagnosis 2018-2022')
        }
        if (dx_year < 2023) {
            if (functions.GEN_AT(ID, "09721 09722 09723 09724 09190 09210 ", 6) != 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Schema ID: ${untrimmedline.schemaId} is valid only for Date of Diagnosis 2023+')
        }
        if (dx_year >= 2024) {
            if (functions.GEN_AT(ID, "00290 00301 00302 00310 00320 00330 00340 00500 ", 6) != 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Schema ID: ${untrimmedline.schemaId} is valid only for Date of Diagnosis 2018-2023')
        }
        if (dx_year < 2024) {
            if (functions.GEN_AT(ID, "09290 09301 09302 09310 09320 09330 09340 09500 ", 6) != 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Schema ID: ${untrimmedline.schemaId} is valid only for Date of Diagnosis 2024+')
        }
        return true

    }

    // ID: NPCR-00565; TAG: N2824; NAME: _SYS Schema ID, Primary Site, Histology (NAACCR)
    public boolean npcr00565(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] SITE_LO = new char[5], SITE_HI = new char[5], SITE = new char[5], HISTLOW = new char[5], HISTHIGH = new char[5], GPCODE = new char[6], GPNAME = new char[31], SCDSCR1 = new char[2], SCDSCR2 = new char[2], YEAR = new char[5]
        char[] HIST_LO = new char[100], HIST_HI = new char[100]
        
        int dx_year
        
        char[] SiteGrp = new char[5]
        char[] Histcode = new char[5]
        char[] Sitecode = new char[5]
        char[] t_schema_msg = new char[100]
        char[] group = new char[5]
        char[] name = new char[35]
        char[] msgname = new char[100]
        
        char[] SD1 = new char[1]
        char[] SD2 = new char[1]
        
        char[] change_year = new char[1]
        char[] changed = new char[4]
        
        char[] nyear = new char[5]
        int ninth
        
        char[] Site_HistLo = new char[20]
        
        char[] Site_Hist = new char[25]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018)
            return true
        if (functions.GEN_EMPTY(untrimmedline.primarySite))
            return true
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        if (functions.GEN_AT(untrimmedline.behaviorCodeIcdO3, "01", 1) != 0)
            return true
        if (functions.GEN_INLIST(untrimmedline.primarySite, "751-753", "(C\\d\\d\\d)", 2, 3) && functions.GEN_AT(untrimmedline.behaviorCodeIcdO3, "2") != 0) {
            return true
        }
        if (functions.GEN_EMPTY(untrimmedline.schemaDiscriminator1))
            functions.GEN_STRCPY(SD1, "X")
        if (!functions.GEN_EMPTY(untrimmedline.schemaDiscriminator1))
            functions.GEN_STRCPY(SD1, untrimmedline.schemaDiscriminator1)
        if (functions.GEN_EMPTY(untrimmedline.schemaDiscriminator2))
            functions.GEN_STRCPY(SD2, "X")
        if (!functions.GEN_EMPTY(untrimmedline.schemaDiscriminator2)) {
            functions.GEN_STRCPY(SD2, untrimmedline.schemaDiscriminator2)
        }
        if (functions.GEN_INLIST(untrimmedline.primarySite, "481-482, 488", "(C\\d\\d\\d)", 2, 3) && (functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "8000-8700,8720-8790,8806,8822,8930-8931,8933,8950,8960,8980,9000,9050") || functions.GEN_INLIST(untrimmedline.histologicTypeIcdO3, "9052,9060,9070-9071,9073,9080,9085,9090-9091,9100,9110,9700-9701"))) {
            functions.GEN_STRCPY(SD1, untrimmedline.sex)
        }
        if (functions.GEN_AT(untrimmedline.histologicTypeIcdO3, "9732", 4) != 0) {
            functions.GEN_STRCPY(SD1, "X")
        }
        if (functions.GEN_AT(untrimmedline.primarySite, "C739", 4) != 0 && functions.GEN_AT(untrimmedline.histologicTypeIcdO3, "9591", 4) == 0) {
            functions.GEN_STRCPY(SD1, "X")
        }
        if (functions.GEN_AT(untrimmedline.histologicTypeIcdO3, "89358936", 4) != 0)
            functions.GEN_STRCPY(SD1, "X")
        functions.GEN_STRCPY(Sitecode, untrimmedline.primarySite)
        functions.GEN_STRCPY(Histcode, untrimmedline.histologicTypeIcdO3)
        
        
        if (functions.GEN_SQLRANGELOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_SCHEMAV9_SITE_REF, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_SCHEMAV9_SITE_REF_SITE_LO, Sitecode, ['SITE_LO':SITE_LO, 'SITE_HI':SITE_HI, 'YEAR':YEAR])) {
        
            if (functions.GEN_STRCMP(Sitecode, SITE_LO) >= 0 && functions.GEN_STRCMP(Sitecode, SITE_HI) <= 0) {
                functions.GEN_STRCPY(Site_Hist, SITE_LO)
                functions.GEN_STRCAT(Site_Hist, Histcode)
        
                ninth = 1
            }
        }
        if (ninth == 1) {
        
        
            if (functions.GEN_SQLRANGELOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_SCHEMAV9STGP, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_SCHEMAV9STGP_SITEHISTLOW, Site_Hist, ['GPCODE':GPCODE, 'GPNAME':GPNAME, 'SITE':SITE, 'HISTLOW':HISTLOW, 'HISTHIGH':HISTHIGH, 'SCDSCR1':SCDSCR1, 'SCDSCR2':SCDSCR2, 'YEAR':YEAR])) {
                if (functions.GEN_STRCMP(SITE_LO, SITE) == 0 && functions.GEN_STRCMP(Histcode, HISTLOW) >= 0 && functions.GEN_STRCMP(Histcode, HISTHIGH) <= 0) {
                    functions.GEN_STRCPY(Site_Hist, SITE_LO)
                    functions.GEN_STRCAT(Site_Hist, HISTLOW)
                    functions.GEN_STRCAT(Site_Hist, SD1)
                    functions.GEN_STRCAT(Site_Hist, SD2)
        
                    functions.GEN_STRCPY(nyear, YEAR)
        
                    if (functions.GEN_VAL(nyear) > dx_year)
                        ninth = 0
                }
                else
                    ninth = 0
            }
            else
                ninth = 0
            if (functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_SCHEMAV9STGP, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_SCHEMAV9STGP_SITEHISTLOWSCDSCR1SCDSCR2, Site_Hist, ['GPCODE':GPCODE, 'GPNAME':GPNAME, 'SITE':SITE, 'HISTLOW':HISTLOW, 'HISTHIGH':HISTHIGH, 'SCDSCR1':SCDSCR1, 'SCDSCR2':SCDSCR2, 'YEAR':YEAR])) {
        
                functions.GEN_STRCPY(group, GPCODE)
                functions.GEN_STRCPY(name, GPNAME)
            }
            else {
                functions.GEN_STRCPY(group, "88888")
                functions.GEN_STRCPY(name, "Unknown Schema ID")
            }
        }
        if (ninth == 0) {
        
        
            functions.GEN_STRCPY(change_year, "0")
        
            if (functions.GEN_AT(Sitecode, "C530C531C538C539", 4) != 0) {
                if (functions.GEN_SQLRANGELOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_CHANGESCHEMAID, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_CHANGESCHEMAID_HISTLOW, untrimmedline.histologicTypeIcdO3, ['GPCODE':GPCODE, 'GPNAME':GPNAME, 'SITE':SITE, 'HISTLOW':HISTLOW, 'HISTHIGH':HISTHIGH, 'YEAR':YEAR])) {
                    if (functions.GEN_STRCMP(untrimmedline.histologicTypeIcdO3, HISTLOW) >= 0 && functions.GEN_STRCMP(untrimmedline.histologicTypeIcdO3, HISTHIGH) <= 0) {
                        functions.GEN_STRCPY(change_year, "1")
                        if (dx_year >= 2018 && dx_year <= 2020)
                            functions.GEN_STRCPY(changed, "2018")
                        else {
                            if (dx_year >= 2021)
                                functions.GEN_STRCPY(changed, "2021")
                        }
                    }
                }
            }
            if (functions.GEN_SQLRANGELOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_SCHEMA_SITE_REF, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_SCHEMA_SITE_REF_SITE_LO, Sitecode, ['SITE_LO':SITE_LO, 'SITE_HI':SITE_HI])) {
                if (functions.GEN_STRCMP(Sitecode, SITE_LO) >= 0 && functions.GEN_STRCMP(Sitecode, SITE_HI) <= 0) {
                    functions.GEN_STRCPY(Site_Hist, SITE_LO)
                    functions.GEN_STRCAT(Site_Hist, Histcode)
                }
                else {
                    functions.GEN_STRCPY(group, "88888")
                    functions.GEN_STRCPY(name, "Unknown Schema ID")
                }
            }
            else {
                functions.GEN_STRCPY(group, "88888")
                functions.GEN_STRCPY(name, "Unknown Schema ID")
            }
            if (functions.GEN_SQLRANGELOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_SCHEMAID2018STGP, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_SCHEMAID2018STGP_SITEHISTLOW, Site_Hist, ['GPCODE':GPCODE, 'GPNAME':GPNAME, 'SITE':SITE, 'HISTLOW':HISTLOW, 'HISTHIGH':HISTHIGH, 'SCDSCR1':SCDSCR1, 'SCDSCR2':SCDSCR2, 'YEAR':YEAR])) {
                if (functions.GEN_STRCMP(SITE_LO, SITE) == 0 && functions.GEN_STRCMP(Histcode, HISTLOW) >= 0 && functions.GEN_STRCMP(Histcode, HISTHIGH) <= 0) {
                    functions.GEN_STRCPY(Site_Hist, SITE_LO)
                    functions.GEN_STRCAT(Site_Hist, HISTLOW)
                }
                else {
                    functions.GEN_STRCPY(group, "88888")
                    functions.GEN_STRCPY(name, "Unknown Schema ID")
                }
            }
            else {
                functions.GEN_STRCPY(group, "88888")
                functions.GEN_STRCPY(name, "Unknown Schema ID")
            }
            if (functions.GEN_AT(change_year, "1") != 0) {
        
                if (functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_SCHEMAID2018STGP, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_SCHEMAID2018STGP_SITEHISTLOW, Site_Hist, ['GPCODE':GPCODE, 'GPNAME':GPNAME, 'SITE':SITE, 'HISTLOW':HISTLOW, 'HISTHIGH':HISTHIGH, 'SCDSCR1':SCDSCR1, 'SCDSCR2':SCDSCR2, 'YEAR':YEAR])) {
        
                    functions.GEN_STRCAT(Site_Hist, SD1)
                    functions.GEN_STRCAT(Site_Hist, SD2)
                    functions.GEN_STRCAT(Site_Hist, changed)
                }
                else {
                    functions.GEN_STRCPY(group, "88888")
                    functions.GEN_STRCPY(name, "Unknown Schema ID")
                }
                if (functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_SCHEMAID2018STGP, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_SCHEMAID2018STGP_SITEHISTLOWSCDSCR1SCDSCR2YEAR, Site_Hist, ['GPCODE':GPCODE, 'GPNAME':GPNAME, 'SITE':SITE, 'HISTLOW':HISTLOW, 'HISTHIGH':HISTHIGH, 'SCDSCR1':SCDSCR1, 'SCDSCR2':SCDSCR2, 'YEAR':YEAR])) {
                    functions.GEN_STRCPY(group, GPCODE)
                    functions.GEN_STRCPY(name, GPNAME)
                }
                else {
                    functions.GEN_STRCPY(group, "88888")
                    functions.GEN_STRCPY(name, "Unknown Schema ID")
                }
            }
            else {
                if (functions.GEN_AT(change_year, "1") == 0) {
        
                    if (functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_SCHEMAID2018STGP, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_SCHEMAID2018STGP_SITEHISTLOW, Site_Hist, ['GPCODE':GPCODE, 'GPNAME':GPNAME, 'SITE':SITE, 'HISTLOW':HISTLOW, 'HISTHIGH':HISTHIGH, 'SCDSCR1':SCDSCR1, 'SCDSCR2':SCDSCR2, 'YEAR':YEAR])) {
                        functions.GEN_STRCAT(Site_Hist, SD1)
                        functions.GEN_STRCAT(Site_Hist, SD2)
                    }
                    else {
                        functions.GEN_STRCPY(group, "88888")
                        functions.GEN_STRCPY(name, "Unknown Schema ID")
                    }
                    if (functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_SCHEMAID2018STGP, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_SCHEMAID2018STGP_SITEHISTLOWSCDSCR1SCDSCR2, Site_Hist, ['GPCODE':GPCODE, 'GPNAME':GPNAME, 'SITE':SITE, 'HISTLOW':HISTLOW, 'HISTHIGH':HISTHIGH, 'SCDSCR1':SCDSCR1, 'SCDSCR2':SCDSCR2, 'YEAR':YEAR])) {
                        functions.GEN_STRCPY(group, GPCODE)
                        functions.GEN_STRCPY(name, GPNAME)
                    }
                    else {
                        functions.GEN_STRCPY(group, "88888")
                        functions.GEN_STRCPY(name, "Unknown Schema ID")
                    }
                }
            }
        }
        if (functions.GEN_STRCMP(untrimmedline.schemaId, group) != 0) {
        
        
            functions.GEN_STRCPY(msgname, name)
        
            functions.GEN_STRCPY(t_schema_msg, "Calculated Schema ID: ")
            functions.GEN_STRCAT(t_schema_msg, group)
            functions.GEN_STRCAT(t_schema_msg, ", ")
            functions.GEN_STRCAT(t_schema_msg, msgname)
            functions.GEN_SAVE_TEXT(binding, t_schema_msg)
            functions.GEN_SAVE_ERROR_TEXT(binding, 'Reported Schema ID: ${untrimmedline.schemaId} not valid for ${untrimmedline.primarySite}, ${untrimmedline.histologicTypeIcdO3}, SD1: ${untrimmedline.schemaDiscriminator1}, SD2: ${untrimmedline.schemaDiscriminator2}, Sex: ${untrimmedline.sex}, DxDate: ${untrimmedline.dateOfDiagnosis.formatDate()}')
        }
        return true

    }

    // ID: NPCR-00566; TAG: N6746; NAME: Autopsy Only, RX 2023, Primary Site (NPCR)
    public boolean npcr00566(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year, err_flag
        err_flag = 0
        char[] code = new char[7]
        char[] nodenine = new char[2]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2023)
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "6") == 0)
            return true
        functions.GEN_STRCPY(nodenine, "0")
        
        if (functions.GEN_INLIST(untrimmedline.primarySite, "420, 421, 423, 424, 589, 700-729,751-753,761-768,770-779,809", "(C\\d\\d\\d)", 2, 3)) {
            functions.GEN_STRCPY(nodenine, "1")
        }
        if (functions.GEN_AT(untrimmedline.rxSummSurgPrimSite2023, "A000A980B000", 4) == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Surg Prim Site 2023')
            err_flag = 1
        }
        if (functions.GEN_AT(nodenine, "1") != 0) {
            if (functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "9") == 0) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Scope Reg LN Sur')
                err_flag = 1
            }
        }
        if (functions.GEN_AT(nodenine, "0") != 0) {
            if (functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "0") == 0) {
                functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Scope Reg LN Sur')
                err_flag = 1
            }
        }
        if (functions.GEN_AT(untrimmedline.rxSummSurgOthRegDis, "0") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Surg Oth Reg/Dis')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.reasonForNoSurgery, "19", 1) == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & Reason for No Surgery')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.rxSummBrm, "00") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--BRM')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.rxSummChemo, "00") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Chemo')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.rxSummHormone, "00") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Hormone')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.rxSummOther, "0") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Other')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.rxSummTransplntEndocr, "00") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Transplnt/Endocr')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.phase1RadiationTreatmentModality, "00") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & Phase I Radiation Treatment Modality')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.rxSummSurgRadSeq, "0") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Surg/Rad Seq')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.rxSummSystemicSurSeq, "0") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Autopsy Only & RX Summ--Systemic/Sur Seq')
            err_flag = 1
        }
        if (err_flag == 1)
            return false
        return true

    }

    // ID: NPCR-00567; TAG: N2853; NAME: Census Tr Certainty 2020 (NAACCR)
    public boolean npcr00567(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.censusTractCertainty2020))
            return true
        return functions.GEN_INLIST(untrimmedline.censusTractCertainty2020, "1-6, 9")

    }

    // ID: NPCR-00568; TAG: N2575; NAME: Census Tract 2020 (NAACCR)
    public boolean npcr00568(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        if (functions.GEN_EMPTY(untrimmedline.censusTract2020))
            return true
        return functions.GEN_INLIST(untrimmedline.censusTract2020, "000000,000100-999999", "(\\d\\d\\d\\d\\d\\d)")

    }

    // ID: NPCR-00569; TAG: N6750; NAME: Death Certificate Only, RX 2023 (NPCR)
    public boolean npcr00569(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int err_flag
        err_flag = 0
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2023)
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") == 0)
            return true
        if (functions.GEN_AT(untrimmedline.rxSummSurgPrimSite2023, "A980A990B990", 4) == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Surg Prim Site 2023')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "9") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Scope Reg LN Sur')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.rxSummSurgOthRegDis, "9") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Surg Oth Reg/Dis')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.reasonForNoSurgery, "9") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & Reason for No Surgery')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.rxSummBrm, "99") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--BRM')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.rxSummChemo, "99") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Chemo')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.rxSummHormone, "99") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Hormone')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.rxSummOther, "9") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Other')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.rxSummTransplntEndocr, "99") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Transplnt/Endocr')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.phase1RadiationTreatmentModality, "99") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & Phase I Radiation Treatment Modality')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.rxSummSurgRadSeq, "0") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Surg/Rad Seq')
            err_flag = 1
        }
        if (functions.GEN_AT(untrimmedline.rxSummSystemicSurSeq, "0") == 0) {
            functions.GEN_SAVE_TEXT(binding, 'Conflict between Death Certificate Only & RX Summ--Systemic/Sur Seq ')
            err_flag = 1
        }
        if (err_flag == 1)
            return false
        return true

    }

    // ID: NPCR-00570; TAG: N6902; NAME: Grade Clin, Grade Path 2023 (NAACCR)
    public boolean npcr00570(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int clin, path, dx_year
        
        clin = functions.GEN_VAL(untrimmedline.gradeClinical)
        path = functions.GEN_VAL(untrimmedline.gradePathological)
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year < 2023)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "00721007220072309721097220972309724", 5) != 0)
            return true
        if (functions.GEN_AT(untrimmedline.gradePathological, "9") != 0 || functions.GEN_EMPTY(untrimmedline.gradePathological))
            return true
        if (functions.GEN_AT(untrimmedline.gradeClinical, "89", 1) != 0 || functions.GEN_EMPTY(untrimmedline.gradeClinical))
            return true
        if (functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite2023, "300-900", "(A\\d\\d\\d)", 2, 3) || functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite2023, "300-900", "(B\\d\\d\\d)", 2, 3)) {
            if (functions.GEN_EMPTY(untrimmedline.gradePostTherapy)) {
                if (clin >= 1 && path >= 1) {
                    if (path < clin || path == 8)
                        return false
                }
            }
        }
        return true

    }

    // ID: NPCR-00571; TAG: N6792; NAME: Histologic Subtype, Morphology ICDO3 (NAACCR)
    public boolean npcr00571(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        char[] Morph = new char[6]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2023)
            return true
        if (functions.GEN_AT(untrimmedline.schemaId, "09190") == 0)
            return true
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3) || functions.GEN_EMPTY(untrimmedline.behaviorCodeIcdO3))
            return true
        if (functions.GEN_EMPTY(untrimmedline.histologicSubtype))
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0)
            return true
        functions.GEN_STRCPY(Morph, untrimmedline.histologicTypeIcdO3)
        functions.GEN_STRCAT(Morph, untrimmedline.behaviorCodeIcdO3)
        
        if (functions.GEN_AT(Morph, "8480284803", 5) == 0) {
            if (functions.GEN_AT(untrimmedline.histologicSubtype, "0") == 0)
                return false
        }
        if (functions.GEN_AT(Morph, "8480284803", 5) != 0) {
            if (functions.GEN_AT(untrimmedline.histologicSubtype, "1234", 1) == 0)
                return false
        }
        return true

    }

    // ID: NPCR-00572; TAG: N6772; NAME: RX Summ--Surg Prim Site 2023, Diag Conf (SEER)
    public boolean npcr00572(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || (dx_year < 2023))
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite2023))
            return true
        if (functions.GEN_AT(untrimmedline.overRideSurgDxconf, "1") != 0)
            return true
        if (functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite2023, "200-900", "(A\\d\\d\\d)", 2, 3) || functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite2023, "200-900", "(B\\d\\d\\d)", 2, 3)) {
            if (functions.GEN_AT(untrimmedline.diagnosticConfirmation, "1234", 1) == 0)
                return false
        }
        return true

    }

    // ID: NPCR-00573; TAG: N6775; NAME: RX Summ--Surg Prim Site 2023, Primary Site (SEER)
    public boolean npcr00573(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] Grpcode = new char[3], Schema = new char[100], Sitelow = new char[5], Sitehigh = new char[5], Alpha = new char[2], END = new char[5], Year = new char[5]
        char[] Sitegrp = new char[10]
        char[] Schema_SITE = new char[15]
        int dx_year
        char[] nyear = new char[5]
        char[] eyear = new char[5]
        char[] ab = new char[2]
        char[] surggroup = new char[30]
        char[] Sitecode = new char[5]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2023)
            return true
        if (functions.GEN_EMPTY(untrimmedline.primarySite))
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite2023))
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0 && ((functions.GEN_AT(untrimmedline.rxSummSurgPrimSite2023, "B990") != 0 && functions.GEN_INLIST(untrimmedline.primarySite, "440-449", "(C\\d\\d\\d)", 2, 3)) || (functions.GEN_AT(untrimmedline.rxSummSurgPrimSite2023, "A990") != 0 && !functions.GEN_INLIST(untrimmedline.primarySite, "440-449", "(C\\d\\d\\d)", 2, 3))))
            return true
        if (functions.GEN_INLIST(untrimmedline.primarySite, "420,421,423,424,760-768,809", "(C\\d\\d\\d)", 2, 3)) {
            if (functions.GEN_AT(untrimmedline.rxSummSurgPrimSite2023, "A980") == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between Primary Site: ${untrimmedline.primarySite} and RX Summ--Surg Prim Site 2023: ${untrimmedline.rxSummSurgPrimSite2023}')
            return true
        }
        functions.GEN_STRCPY(ab, functions.GEN_SUBSTR(untrimmedline.rxSummSurgPrimSite2023, 1, 1))
        
        functions.GEN_STRCPY(Sitecode, untrimmedline.primarySite)
        
        
        if (functions.GEN_SQLRANGELOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_SURGSITEGROUP23, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_SURGSITEGROUP23_SITELOW, Sitecode, ['GRPCODE':Grpcode, 'SITELOW':Sitelow, 'SITEHIGH':Sitehigh, 'ALPHA':Alpha, 'YEAR':Year, 'END':END])) {
            if (functions.GEN_STRCMP(untrimmedline.primarySite, Sitelow) >= 0 && functions.GEN_STRCMP(untrimmedline.primarySite, Sitehigh) <= 0) {
                functions.GEN_STRCPY(Sitegrp, Sitelow)
                functions.GEN_STRCAT(Sitegrp, Grpcode)
                functions.GEN_STRCAT(Sitegrp, ab)
                functions.GEN_STRCPY(surggroup, Grpcode)
            }
            else
                return false
        }
        if (functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_SURGSITEGROUP23, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_SURGSITEGROUP23_SITELOWGRPCODEALPHA, Sitegrp, ['GRPCODE':Grpcode, 'SITELOW':Sitelow, 'SITEHIGH':Sitehigh, 'ALPHA':Alpha, 'YEAR':Year, 'END':END])) {
            functions.GEN_STRCPY(nyear, Year)
            functions.GEN_STRCPY(eyear, END)
        }
        else {
            return false
        }
        if (functions.GEN_AT(surggroup, "30") != 0 && functions.GEN_AT(untrimmedline.rxSummSurgPrimSite2023, "A410") != 0) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "690-699", "(C\\d\\d\\d)", 2, 3))
                return true
            else
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between Primary Site: ${untrimmedline.primarySite} and RX Summ--Surg Prim Site 2023: ${untrimmedline.rxSummSurgPrimSite2023}')
        }
        if (functions.GEN_AT(surggroup, "06") != 0 && functions.GEN_AT(untrimmedline.rxSummSurgPrimSite2023, "B330") != 0 && dx_year >= 2024) {
            if (functions.GEN_INLIST(untrimmedline.primarySite, "181", "(C\\d\\d\\d)", 2, 3))
                return true
            else
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Primary Site must = C181 if RX Summ--Surg Prim Site 2023: ${untrimmedline.rxSummSurgPrimSite2023}')
        }
        functions.GEN_STRCAT(surggroup, untrimmedline.rxSummSurgPrimSite2023)
        
        
        if (functions.GEN_AT(ab, "B") != 0) {
            if (functions.GEN_VAL(nyear) <= dx_year) {
                if (functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_SURG23B, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_SURG23B_GROUPCODE, surggroup, ['YEAR':Year]))
                    return true
                else
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between Primary Site: ${untrimmedline.primarySite} and RX Summ--Surg Prim Site 2023: ${untrimmedline.rxSummSurgPrimSite2023}')
            }
            else {
                if (functions.GEN_VAL(nyear) > dx_year)
                    functions.GEN_SAVE_ERROR_TEXT(binding, 'RX Summ--Surg Prim Site 2023: ${untrimmedline.rxSummSurgPrimSite2023} not valid for Primary Site: ${untrimmedline.primarySite} for DX year ${untrimmedline.dateOfDiagnosis.formatDate()}')
            }
        }
        else {
            if (functions.GEN_AT(ab, "A") != 0) {
                if (dx_year <= functions.GEN_VAL(eyear) || functions.GEN_EMPTY(eyear)) {
                    if (functions.GEN_SQLLOOKUP((com.imsweb.validation.entities.ContextTable)context.NPCR_SURG23A, (com.imsweb.validation.entities.ContextTableIndex)context.NPCR_SURG23A_GROUPCODE, surggroup, ['YEAR':Year]))
                        return true
                    else
                        functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between Primary Site: ${untrimmedline.primarySite} and RX Summ--Surg Prim Site 2023: ${untrimmedline.rxSummSurgPrimSite2023}')
                }
                else {
                    if (!functions.GEN_EMPTY(eyear))
                        functions.GEN_SAVE_ERROR_TEXT(binding, 'RX Summ--Surg Prim Site 2023: ${untrimmedline.rxSummSurgPrimSite2023} not valid for Primary Site: ${untrimmedline.primarySite} for DX year ${untrimmedline.dateOfDiagnosis.formatDate()}')
                }
            }
        }
        return true

    }

    // ID: NPCR-00574; TAG: N6769; NAME: RX Summ--Surg Prim Site 2023 (COC)
    public boolean npcr00574(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        char[] CODE = new char[100], YEAR = new char[100]
        int dx_year
        int Bcode
        char[] nyear = new char[4]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR))
            return true
        if (dx_year < 2023) {
            if (!functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite2023))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'If DX year 2015 or later, Date of Diagnosis cannot be blank')
        }
        if (dx_year >= 2023) {
        
            if (functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite2023))
                return false
            if (functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite2023, "000, 100-900, 980, 990", "(A\\d\\d\\d)", 2, 3) || functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite2023, "000, 100-900, 990", "(B\\d\\d\\d)", 2, 3))
                return true
            else
                return false
        }
        return true

    }

    // ID: NPCR-00575; TAG: N6784; NAME: Surgery 2023, RX Date Surgery, Primary Site (NAACCR)
    public boolean npcr00575(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int exception
        int dx_year
        
        exception = 0
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2023)
            return true
        if (functions.GEN_EMPTY(untrimmedline.schemaId))
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite2023) || functions.GEN_EMPTY(untrimmedline.rxSummScopeRegLnSur) || functions.GEN_EMPTY(untrimmedline.rxSummSurgOthRegDis))
            return true
        if (functions.GEN_INLIST(untrimmedline.primarySite, "420, 421, 423, 424, 589,700-729,751-753,761-768,770-779,809", "(C\\d\\d\\d)", 2, 3))
            exception = 1
        if (functions.GEN_AT(untrimmedline.rxSummSurgPrimSite2023, "A000A980B000", 4) != 0 && (functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "01", 1) != 0 || (exception == 1 && functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "9") != 0)) && functions.GEN_AT(untrimmedline.rxSummSurgOthRegDis, "0") != 0) {
            if (!functions.GEN_EMPTY(untrimmedline.rxDateSurgery))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'If surgery fields indicate no treatment, date of surgery must be blank')
        }
        if (!functions.GEN_EMPTY(untrimmedline.rxDateSurgery)) {
            if ((!functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite2023, "100-900", "(A\\d\\d\\d)", 2, 3) && !functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite2023, "100-900", "(B\\d\\d\\d)", 2, 3)) && functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "234567", 1) == 0 && functions.GEN_AT(untrimmedline.rxSummSurgOthRegDis, "12345", 1) == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'If date of surgery is not blank, at least one surgery field must indicate treatment.')
        }
        return true

    }

    // ID: NPCR-00576; TAG: N6779; NAME: RX Summ--Treatm Stat, Treatment 2023, Blanks (NAACCR)
    public boolean npcr00576(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2023)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummTreatmentStatus))
            return true
        if ((functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite2023, "100-900", "(A\\d\\d\\d)", 2, 3) || functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite2023, "100-900", "(B\\d\\d\\d)", 2, 3)) || functions.GEN_AT(untrimmedline.rxSummSurgOthRegDis, "12345", 1) != 0 || functions.GEN_AT(untrimmedline.rxSummBrm, "01") != 0 || functions.GEN_AT(untrimmedline.rxSummChemo, "010203", 2) != 0 || functions.GEN_AT(untrimmedline.rxSummHormone, "01") != 0 || functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "10-12,20,30,40") || functions.GEN_AT(untrimmedline.rxSummOther, "1236", 1) != 0 || functions.GEN_AT(untrimmedline.reasonForNoRadiation, "0") != 0) {
            if (functions.GEN_AT(untrimmedline.rxSummTreatmentStatus, "1") == 0)
                return false
        }
        else {
            if (functions.GEN_AT(untrimmedline.rxSummTreatmentStatus, "1") != 0) {
                if ((functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite2023, "100-900", "(A\\d\\d\\d)", 2, 3) || functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite2023, "100-900", "(B\\d\\d\\d)", 2, 3)) || functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "234567", 1) != 0 || functions.GEN_AT(untrimmedline.rxSummSurgOthRegDis, "12345", 1) != 0 || functions.GEN_AT(untrimmedline.rxSummBrm, "01") != 0 || functions.GEN_AT(untrimmedline.rxSummChemo, "010203", 2) != 0 || functions.GEN_AT(untrimmedline.rxSummHormone, "01") != 0 || functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "10-12,20,30,40") || functions.GEN_AT(untrimmedline.rxSummOther, "1236", 1) != 0 || functions.GEN_AT(untrimmedline.reasonForNoRadiation, "0") != 0)
                    return true
                else
                    return false
            }
            else {
                if (functions.GEN_AT(untrimmedline.rxSummTreatmentStatus, "02", 1) != 0) {
                    if ((functions.GEN_AT(untrimmedline.rxSummSurgPrimSite2023, "A000A980B000", 4) != 0 || functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite2023)) && (functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "012345679", 1) != 0 || functions.GEN_EMPTY(untrimmedline.rxSummScopeRegLnSur)) && (functions.GEN_AT(untrimmedline.rxSummSurgOthRegDis, "0") != 0 || functions.GEN_EMPTY(untrimmedline.rxSummSurgOthRegDis)) && (functions.GEN_INLIST(untrimmedline.rxSummBrm, "00,80-88") || functions.GEN_EMPTY(untrimmedline.rxSummSurgOthRegDis)) && (functions.GEN_INLIST(untrimmedline.rxSummChemo, "00,80-88") || functions.GEN_EMPTY(untrimmedline.rxSummChemo)) && (functions.GEN_INLIST(untrimmedline.rxSummHormone, "00,80-88") || functions.GEN_EMPTY(untrimmedline.rxSummHormone)) && (functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "00,80-88") || functions.GEN_EMPTY(untrimmedline.rxSummTransplntEndocr)) && (functions.GEN_AT(untrimmedline.rxSummOther, "078", 1) != 0 || functions.GEN_EMPTY(untrimmedline.rxSummOther)) && (functions.GEN_AT(untrimmedline.phase1RadiationTreatmentModality, "00") != 0 || functions.GEN_AT(untrimmedline.reasonForNoRadiation, "1256789", 1) != 0 || (functions.GEN_EMPTY(untrimmedline.phase1RadiationTreatmentModality) && functions.GEN_EMPTY(untrimmedline.reasonForNoRadiation))))
                        return true
                    else
                        return false
                }
            }
        }
        if (functions.GEN_AT(untrimmedline.rxSummTreatmentStatus, "9") != 0) {
            if (functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite2023) && functions.GEN_EMPTY(untrimmedline.rxSummSurgOthRegDis) && functions.GEN_EMPTY(untrimmedline.rxSummBrm) && functions.GEN_EMPTY(untrimmedline.rxSummChemo) && functions.GEN_EMPTY(untrimmedline.rxSummHormone) && functions.GEN_EMPTY(untrimmedline.rxSummTransplntEndocr) && functions.GEN_EMPTY(untrimmedline.rxSummOther) && functions.GEN_EMPTY(untrimmedline.phase1RadiationTreatmentModality))
                return true
            else {
                if (functions.GEN_AT(untrimmedline.rxSummSurgPrimSite2023, "A990B990", 4) != 0 || functions.GEN_AT(untrimmedline.rxSummSurgOthRegDis, "9") != 0 || functions.GEN_AT(untrimmedline.rxSummBrm, "99") != 0 || functions.GEN_AT(untrimmedline.rxSummChemo, "99") != 0 || functions.GEN_AT(untrimmedline.rxSummHormone, "99") != 0 || functions.GEN_AT(untrimmedline.rxSummTransplntEndocr, "99") != 0 || functions.GEN_AT(untrimmedline.rxSummOther, "9") != 0 || (functions.GEN_AT(untrimmedline.phase1RadiationTreatmentModality, "99") != 0 || functions.GEN_AT(untrimmedline.reasonForNoRadiation, "89", 1) != 0)) {
                    if ((functions.GEN_AT(untrimmedline.rxSummSurgPrimSite2023, "A000A980A990B000B990", 4) != 0 || functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite2023)) && (functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "012345679", 1) != 0 || functions.GEN_EMPTY(untrimmedline.rxSummScopeRegLnSur)) && (functions.GEN_AT(untrimmedline.rxSummSurgOthRegDis, "09", 1) != 0 || functions.GEN_EMPTY(untrimmedline.rxSummSurgOthRegDis)) && (functions.GEN_INLIST(untrimmedline.rxSummBrm, "00,80-88,99") || functions.GEN_EMPTY(untrimmedline.rxSummBrm)) && (functions.GEN_INLIST(untrimmedline.rxSummChemo, "00,80-88,99") || functions.GEN_EMPTY(untrimmedline.rxSummChemo)) && (functions.GEN_INLIST(untrimmedline.rxSummHormone, "00,80-88,99") || functions.GEN_EMPTY(untrimmedline.rxSummHormone)) && (functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "00,80-88,99") || functions.GEN_EMPTY(untrimmedline.rxSummTransplntEndocr)) && (functions.GEN_AT(untrimmedline.rxSummOther, "0789", 1) != 0 || functions.GEN_EMPTY(untrimmedline.rxSummOther)) && (functions.GEN_AT(untrimmedline.phase1RadiationTreatmentModality, "0099", 2) != 0 || functions.GEN_AT(untrimmedline.reasonForNoRadiation, "89", 1) != 0 || (functions.GEN_EMPTY(untrimmedline.phase1RadiationTreatmentModality) && functions.GEN_EMPTY(untrimmedline.reasonForNoRadiation))))
                        return true
                    else
                        return false
                }
                else
                    return false
            }
        }
        return true

    }

    // ID: NPCR-00577; TAG: N6318; NAME: Summary Stage 2018, HemeRetic, Histology (NAACCR)
    public boolean npcr00577(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        char[] histo = new char[5]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018)
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "7") != 0)
            return true
        if (functions.GEN_EMPTY(untrimmedline.schemaId) || functions.GEN_AT(untrimmedline.schemaId, "00830", 5) == 0)
            return true
        if (functions.GEN_EMPTY(untrimmedline.summaryStage2018))
            return true
        if (functions.GEN_EMPTY(untrimmedline.histologicTypeIcdO3))
            return true
        functions.GEN_STRCPY(histo, untrimmedline.histologicTypeIcdO3)
        functions.GEN_STRCAT(histo, " ")
        
        if (functions.GEN_AT(histo, "9740 9749 9751 9755 9756 9757 9758 9759 9766 9930 9971 ", 5) != 0) {
            if (functions.GEN_AT(untrimmedline.summaryStage2018, "179", 1) != 0)
                return true
            else
                return false
        }
        else {
            if (functions.GEN_AT(untrimmedline.summaryStage2018, "7") != 0)
                return true
            else
                return false
        }
        return true

    }

    // ID: NPCR-00578; TAG: N6780; NAME: Surgery 2023, Phase I Rad, Surg/Rad Seq (SEER)
    public boolean npcr00578(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int result
        int dx_year
        int seer_init_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2023)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite2023) || functions.GEN_EMPTY(untrimmedline.rxSummScopeRegLnSur) || functions.GEN_EMPTY(untrimmedline.rxSummSurgOthRegDis))
            return true
        if (((functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite2023, "100-900", "(A\\d\\d\\d)", 2, 3) || functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite2023, "100-900", "(B\\d\\d\\d)", 2, 3)) || functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "234567", 1) != 0 || functions.GEN_AT(untrimmedline.rxSummSurgOthRegDis, "12345", 1) != 0) && functions.GEN_INLIST(untrimmedline.phase1RadiationTreatmentModality, "01-16,98", "(\\d\\d)")) {
            if (functions.GEN_AT(untrimmedline.rxSummSurgRadSeq, "2345679", 1) != 0)
                return true
            else
                return false
        }
        else {
            if ((functions.GEN_AT(untrimmedline.rxSummSurgPrimSite2023, "A000A980A990B000B990", 4) != 0 && ((functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "01", 1) != 0 || (functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "9") != 0 && (functions.GEN_INLIST(untrimmedline.primarySite, "420-421,423-424,589,700-729,751-753,761-809", "(C\\d\\d\\d)", 2, 3)))) && functions.GEN_AT(untrimmedline.rxSummSurgOthRegDis, "0") != 0)) || functions.GEN_AT(untrimmedline.phase1RadiationTreatmentModality, "0099", 2) != 0) {
                if (functions.GEN_AT(untrimmedline.rxSummSurgRadSeq, "0") != 0)
                    return true
                else
                    return false
            }
        }
        return true

    }

    // ID: NPCR-00579; TAG: N6783; NAME: Surgery 2023, Reason No Surg (COC)
    public boolean npcr00579(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2023)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite2023) || functions.GEN_EMPTY(untrimmedline.reasonForNoSurgery))
            return true
        if (functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite2023, "100-900", "(A\\d\\d\\d)", 2, 3) || functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite2023, "100-900", "(B\\d\\d\\d)", 2, 3)) {
            if (functions.GEN_AT(untrimmedline.reasonForNoSurgery, "0") != 0)
                return true
            else
                return false
        }
        if (functions.GEN_AT(untrimmedline.rxSummSurgPrimSite2023, "A000A980B000", 4) != 0) {
            if (functions.GEN_AT(untrimmedline.reasonForNoSurgery, "0") != 0)
                return false
            else
                return true
        }
        if (functions.GEN_AT(untrimmedline.rxSummSurgPrimSite2023, "A990B990", 4) != 0) {
            if (functions.GEN_AT(untrimmedline.reasonForNoSurgery, "0") != 0)
                return false
        }
        return true

    }

    // ID: NPCR-00580; TAG: N6785; NAME: Systemic RX, Surgery 2023, Systemic/Sur Seq (COC)
    public boolean npcr00580(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2023)
            return true
        if (functions.GEN_EMPTY(untrimmedline.schemaId) || functions.GEN_EMPTY(untrimmedline.primarySite))
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite2023) || functions.GEN_EMPTY(untrimmedline.rxSummScopeRegLnSur) || functions.GEN_EMPTY(untrimmedline.rxSummSurgOthRegDis) || functions.GEN_EMPTY(untrimmedline.rxSummBrm) || functions.GEN_EMPTY(untrimmedline.rxSummChemo) || functions.GEN_EMPTY(untrimmedline.rxSummHormone) || functions.GEN_EMPTY(untrimmedline.rxSummTransplntEndocr) || functions.GEN_EMPTY(untrimmedline.rxSummSystemicSurSeq))
            return true
        if (((functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite2023, "100-900", "(A\\d\\d\\d)", 2, 3) || functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite2023, "100-900", "(B\\d\\d\\d)", 2, 3)) || functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "234567", 1) != 0 || functions.GEN_AT(untrimmedline.rxSummSurgOthRegDis, "12345", 1) != 0) && (functions.GEN_AT(untrimmedline.rxSummBrm, "01") != 0 || functions.GEN_AT(untrimmedline.rxSummChemo, "010203", 2) != 0 || functions.GEN_AT(untrimmedline.rxSummHormone, "01") != 0 || functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "10-40", "(\\d\\d)"))) {
            if (functions.GEN_AT(untrimmedline.rxSummSystemicSurSeq, "2345679", 1) != 0)
                return true
            else
                return false
        }
        else {
            if ((functions.GEN_AT(untrimmedline.rxSummSurgPrimSite2023, "A000A990B000B990", 4) != 0 && ((functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "01", 1) != 0 || (functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "9") != 0 && (functions.GEN_INLIST(untrimmedline.primarySite, "420-421,423-424,589,700-729,751-753,761-809", "(C\\d\\d\\d)", 2, 3)))) && functions.GEN_AT(untrimmedline.rxSummSurgOthRegDis, "0") != 0)) || (functions.GEN_INLIST(untrimmedline.rxSummBrm, "00,82-88,99", "(\\d\\d)") && functions.GEN_INLIST(untrimmedline.rxSummChemo, "00,82-88,99", "(\\d\\d)") && functions.GEN_INLIST(untrimmedline.rxSummHormone, "00,82-88,99", "(\\d\\d)") && functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "00,82-88,99", "(\\d\\d)"))) {
                if (functions.GEN_AT(untrimmedline.rxSummSystemicSurSeq, "0") != 0)
                    return true
                else
                    return false
            }
            else {
                if ((functions.GEN_AT(untrimmedline.rxSummSurgPrimSite2023, "98") != 0 && functions.GEN_AT(untrimmedline.rxSummScopeRegLnSur, "9") != 0 && functions.GEN_AT(untrimmedline.rxSummSurgOthRegDis, "0") != 0) || (functions.GEN_INLIST(untrimmedline.rxSummBrm, "00,82-88,99", "(\\d\\d)") && functions.GEN_INLIST(untrimmedline.rxSummChemo, "00,82-88,99", "(\\d\\d)") && functions.GEN_INLIST(untrimmedline.rxSummHormone, "00,82-88,99", "(\\d\\d)") && functions.GEN_INLIST(untrimmedline.rxSummTransplntEndocr, "00,82-88,99", "(\\d\\d)"))) {
                    if (functions.GEN_AT(untrimmedline.rxSummSystemicSurSeq, "0") != 0)
                        return true
                    else
                        return false
                }
            }
        }
        return true

    }

    // ID: NPCR-00581; TAG: N0087; NAME: Tumor Record Number (NAACCR)
    public boolean npcr00581(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        return functions.GEN_INLIST(untrimmedline.tumorRecordNumber, "01-99", "(\\d\\d)")

    }

    // ID: NPCR-00582; TAG: N4022; NAME: RX Summ--Radiation, Date of Diagnosis (NPCR)
    public boolean npcr00582(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR)) {
            return true
        }
        if (dx_year < 2010)
            return true
        if (dx_year >= 2018) {
            if (!functions.GEN_EMPTY(untrimmedline.rxSummRadiation))
                functions.GEN_SAVE_ERROR_TEXT(binding, 'RX Summ--Radiation must be blank for cases diagnosed 2018 and later')
        }
        return true

    }

    // ID: NPCR-00583; TAG: N6765; NAME: RX Date Mst Defn Srg, Surg Prim Site 2023 (COC)
    public boolean npcr00583(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2023)
            return true
        if (functions.GEN_AT(untrimmedline.rxSummSurgPrimSite2023, "A000A980A990B000B990", 4) != 0) {
            if (!functions.GEN_EMPTY(untrimmedline.rxDateMostDefinSurg))
                return false
        }
        if (!functions.GEN_EMPTY(untrimmedline.rxDateMostDefinSurg)) {
            if (functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite2023, "100-900", "(A\\d\\d\\d)", 2, 3) || functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite2023, "100-900", "(B\\d\\d\\d)", 2, 3))
                return true
            else
                return false
        }
        return true

    }

    // ID: NPCR-00584; TAG: 3273; NAME: SSDI for Appendix, Blank for Other Schemas (Subm)
    public boolean npcr00584(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        int err_flag
        
        char[] code = new char[7]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018)
            return true
        if (functions.GEN_EMPTY(untrimmedline.schemaId)) {
            return true
        }
        functions.GEN_STRCPY(code, untrimmedline.schemaId)
        functions.GEN_STRCAT(code, " ")
        
        if (functions.GEN_AT(code, "09190 00190 ") == 0) {
            if (!functions.GEN_EMPTY(untrimmedline.histologicSubtype)) {
                functions.GEN_SAVE_TEXT(binding, 'If Schema is not Appendix, Histologic Subtype must be blank')
                err_flag = 1
            }
        }
        if (err_flag == 1)
            return false
        return true

    }

    // ID: NPCR-00585; TAG: N6763; NAME: Reason for No Surgery, Surg Prim Site 2023, Primary Site (NAACCR)
    public boolean npcr00585(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2023)
            return true
        if (functions.GEN_EMPTY(untrimmedline.rxSummSurgPrimSite2023))
            return true
        if (functions.GEN_EMPTY(untrimmedline.reasonForNoSurgery))
            return true
        if (functions.GEN_AT(untrimmedline.typeOfReportingSource, "67") != 0)
            return true
        if (functions.GEN_INLIST(untrimmedline.primarySite, "420,421,423,424,760-768, 809", "(C\\d\\d\\d)", 2, 3)) {
            if (functions.GEN_AT(untrimmedline.reasonForNoSurgery, "1", 1) == 0)
                return false
        }
        if (functions.GEN_AT(untrimmedline.rxSummSurgPrimSite2023, "A000B000", 4) != 0) {
            if (functions.GEN_AT(untrimmedline.reasonForNoSurgery, "123456789", 1) == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between RX Summ--Surg Prim Site 2023: ${untrimmedline.rxSummSurgPrimSite2023} and Reason for No Surgery: ${untrimmedline.reasonForNoSurgery}')
        }
        if (functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite2023, "100-900", "(A\\d\\d\\d)", 2, 3) || functions.GEN_INLIST(untrimmedline.rxSummSurgPrimSite2023, "100-900", "(B\\d\\d\\d)", 2, 3)) {
            if (functions.GEN_AT(untrimmedline.reasonForNoSurgery, "0", 1) == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between RX Summ--Surg Prim Site 2023: ${untrimmedline.rxSummSurgPrimSite2023} and Reason for No Surgery: ${untrimmedline.reasonForNoSurgery}')
        }
        if (functions.GEN_AT(untrimmedline.rxSummSurgPrimSite2023, "A980") != 0) {
            if (functions.GEN_AT(untrimmedline.reasonForNoSurgery, "1", 1) == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between RX Summ--Surg Prim Site 2023: ${untrimmedline.rxSummSurgPrimSite2023} and Reason for No Surgery: ${untrimmedline.reasonForNoSurgery}')
        }
        if (functions.GEN_AT(untrimmedline.rxSummSurgPrimSite2023, "A990B990", 4) != 0) {
            if (functions.GEN_AT(untrimmedline.reasonForNoSurgery, "89", 1) == 0)
                functions.GEN_SAVE_ERROR_TEXT(binding, 'Conflict between RX Summ--Surg Prim Site 2023: ${untrimmedline.rxSummSurgPrimSite2023} and Reason for No Surgery: ${untrimmedline.reasonForNoSurgery}')
        }
        return true

    }

    // ID: NPCR-00586; TAG: N6801; NAME: SSDI p16, Blank for Other Schemas (NAACCR)
    public boolean npcr00586(Binding binding, Map context, MetafileContextFunctions functions, List> untrimmedlines, Map untrimmedline) throws Exception {
        functions.GEN_RESET_LOCAL_CONTEXT(binding)
        
        int dx_year
        int err_flag
        
        char[] code = new char[7]
        
        dx_year = functions.GEN_DATE_YEAR_IOP(binding, untrimmedline.dateOfDiagnosis)
        
        if (dx_year == ((Integer)context.NPCR_GEN_DT_EMPTY) || dx_year == ((Integer)context.NPCR_GEN_DT_ERROR) || dx_year < 2018) {
            return true
        }
        functions.GEN_STRCPY(code, untrimmedline.schemaId)
        functions.GEN_STRCAT(code, " ")
        
        if (functions.GEN_EMPTY(untrimmedline.schemaId) || functions.GEN_AT(code, "09210 09520 09500 ", 6) != 0)
            return true
        if (!functions.GEN_EMPTY(untrimmedline.p16)) {
            functions.GEN_SAVE_TEXT(binding, 'If Schema is not Anus, Vulva, or Cervix, p16 must be blank')
            err_flag = 1
        }
        if (err_flag == 1)
            return false
        return true

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy