diff --git a/backend/audit/intakelib/checks/check_finding_reference_pattern.py b/backend/audit/intakelib/checks/check_finding_reference_pattern.py index e33c2350a3..092117b3c8 100644 --- a/backend/audit/intakelib/checks/check_finding_reference_pattern.py +++ b/backend/audit/intakelib/checks/check_finding_reference_pattern.py @@ -9,6 +9,7 @@ build_cell_error_tuple, appears_empty, ) +from django.conf import settings logger = logging.getLogger(__name__) @@ -21,12 +22,14 @@ # digits are a year >= 1900. # TESTED BY # has_bad_references.xlsx -def finding_reference_pattern(ir): +def finding_reference_pattern(ir, is_gsa_migration=False): references = get_range_by_name(ir, "reference_number") errors = [] for index, reference in enumerate(references["values"]): - if not appears_empty(reference) and ( - not re.match(FINDING_REFERENCE_REGEX, str(reference)) + if ( + not appears_empty(reference) + and (reference == settings.GSA_MIGRATION and not is_gsa_migration) + and (not re.match(FINDING_REFERENCE_REGEX, str(reference))) ): errors.append( build_cell_error_tuple( diff --git a/backend/audit/intakelib/checks/check_gsa_migration_keyword.py b/backend/audit/intakelib/checks/check_gsa_migration_keyword.py index 2a4a5e4140..70502c1c4c 100644 --- a/backend/audit/intakelib/checks/check_gsa_migration_keyword.py +++ b/backend/audit/intakelib/checks/check_gsa_migration_keyword.py @@ -44,6 +44,7 @@ def check_for_gsa_migration_keyword(ir): "material_weakness", "significant_deficiency", "repeat_prior_reference", + "reference_number", "is_guaranteed", ] diff --git a/backend/audit/intakelib/checks/runners.py b/backend/audit/intakelib/checks/runners.py index 03f5cdd626..2bf9fd2906 100644 --- a/backend/audit/intakelib/checks/runners.py +++ b/backend/audit/intakelib/checks/runners.py @@ -153,7 +153,7 @@ "federal_program_total_is_correct": federal_program_total_is_correct, } -require_gsa_migration_flag = [findings_grid_validation] +require_gsa_migration_flag = [findings_grid_validation, finding_reference_pattern] def run_all_checks( diff --git a/backend/census_historical_migration/test_findings_xforms.py b/backend/census_historical_migration/test_findings_xforms.py index 62b300e041..1c03050c91 100644 --- a/backend/census_historical_migration/test_findings_xforms.py +++ b/backend/census_historical_migration/test_findings_xforms.py @@ -266,6 +266,7 @@ def __init__( SIGNIFICANTDEFICIENCY, OTHERFINDINGS, QCOSTS, + FINDINGREFNUMS, ): self.MODIFIEDOPINION = MODIFIEDOPINION self.OTHERNONCOMPLIANCE = OTHERNONCOMPLIANCE @@ -273,6 +274,7 @@ def __init__( self.SIGNIFICANTDEFICIENCY = SIGNIFICANTDEFICIENCY self.OTHERFINDINGS = OTHERFINDINGS self.QCOSTS = QCOSTS + self.FINDINGREFNUMS = FINDINGREFNUMS def test_replace_empty_fields(self): findings = [ @@ -283,6 +285,7 @@ def test_replace_empty_fields(self): SIGNIFICANTDEFICIENCY="", OTHERFINDINGS="Present", QCOSTS="", + FINDINGREFNUMS="", ), self.Finding( MODIFIEDOPINION="Present", @@ -291,6 +294,7 @@ def test_replace_empty_fields(self): SIGNIFICANTDEFICIENCY="", OTHERFINDINGS="Present", QCOSTS="", + FINDINGREFNUMS="Present", ), self.Finding( MODIFIEDOPINION="", @@ -299,6 +303,7 @@ def test_replace_empty_fields(self): SIGNIFICANTDEFICIENCY="", OTHERFINDINGS="", QCOSTS="Present", + FINDINGREFNUMS="", ), ] @@ -310,6 +315,7 @@ def test_replace_empty_fields(self): self.assertEqual(findings[0].SIGNIFICANTDEFICIENCY, settings.GSA_MIGRATION) self.assertEqual(findings[0].OTHERFINDINGS, "Present") self.assertEqual(findings[0].QCOSTS, settings.GSA_MIGRATION) + self.assertEqual(findings[0].FINDINGREFNUMS, settings.GSA_MIGRATION) self.assertEqual(findings[1].MODIFIEDOPINION, "Present") self.assertEqual(findings[1].OTHERNONCOMPLIANCE, "Present") @@ -317,6 +323,7 @@ def test_replace_empty_fields(self): self.assertEqual(findings[1].SIGNIFICANTDEFICIENCY, settings.GSA_MIGRATION) self.assertEqual(findings[1].OTHERFINDINGS, "Present") self.assertEqual(findings[1].QCOSTS, settings.GSA_MIGRATION) + self.assertEqual(findings[1].FINDINGREFNUMS, "Present") self.assertEqual(findings[2].MODIFIEDOPINION, settings.GSA_MIGRATION) self.assertEqual(findings[2].OTHERNONCOMPLIANCE, "Present") @@ -324,6 +331,7 @@ def test_replace_empty_fields(self): self.assertEqual(findings[2].SIGNIFICANTDEFICIENCY, settings.GSA_MIGRATION) self.assertEqual(findings[2].OTHERFINDINGS, settings.GSA_MIGRATION) self.assertEqual(findings[2].QCOSTS, "Present") + self.assertEqual(findings[2].FINDINGREFNUMS, settings.GSA_MIGRATION) class TestXformMissingRepeatPriorReference(SimpleTestCase): diff --git a/backend/census_historical_migration/workbooklib/corrective_action_plan.py b/backend/census_historical_migration/workbooklib/corrective_action_plan.py index 6ef09cef1e..ebb74c8db0 100644 --- a/backend/census_historical_migration/workbooklib/corrective_action_plan.py +++ b/backend/census_historical_migration/workbooklib/corrective_action_plan.py @@ -61,6 +61,8 @@ def xform_add_placeholder_for_missing_references(findings, captexts): missing_references = expected_references - found_references if missing_references: for ref in missing_references: + if not ref: + ref = settings.GSA_MIGRATION captexts.append( CapText( SEQ_NUMBER="0", diff --git a/backend/census_historical_migration/workbooklib/findings.py b/backend/census_historical_migration/workbooklib/findings.py index 903bcc3b36..eb231cd8d1 100644 --- a/backend/census_historical_migration/workbooklib/findings.py +++ b/backend/census_historical_migration/workbooklib/findings.py @@ -268,6 +268,7 @@ def xform_replace_required_fields_with_gsa_migration_when_empty(findings): ("SIGNIFICANTDEFICIENCY", "is_significant_deficiency"), ("OTHERFINDINGS", "is_other_findings"), ("QCOSTS", "is_questioned_costs"), + ("FINDINGREFNUMS", "reference_number"), ] for in_db, in_dissem in fields_to_check: diff --git a/backend/census_historical_migration/workbooklib/findings_text.py b/backend/census_historical_migration/workbooklib/findings_text.py index 2960f1e589..7c1fe33086 100644 --- a/backend/census_historical_migration/workbooklib/findings_text.py +++ b/backend/census_historical_migration/workbooklib/findings_text.py @@ -63,6 +63,8 @@ def xform_add_placeholder_for_missing_references(findings, findings_texts): if missing_references: for ref in missing_references: + if not ref: + ref = settings.GSA_MIGRATION findings_texts.append( FindingsText( SEQ_NUMBER="0", diff --git a/backend/schemas/output/sections/AuditFindingsText.schema.json b/backend/schemas/output/sections/AuditFindingsText.schema.json index 30c2d7ccae..d4dc995fdb 100644 --- a/backend/schemas/output/sections/AuditFindingsText.schema.json +++ b/backend/schemas/output/sections/AuditFindingsText.schema.json @@ -45,10 +45,18 @@ "type": "string" }, "reference_number": { - "description": "Reference Number", - "pattern": "^[1-2][0-9]{3}-[0-9]{3}$", - "title": "ReferenceNumber", - "type": "string" + "oneOf": [ + { + "description": "Reference Number", + "pattern": "^[1-2][0-9]{3}-[0-9]{3}$", + "title": "ReferenceNumber", + "type": "string" + }, + { + "const": "GSA_MIGRATION", + "type": "string" + } + ] }, "text_of_finding": { "type": "string" diff --git a/backend/schemas/output/sections/CorrectiveActionPlan.schema.json b/backend/schemas/output/sections/CorrectiveActionPlan.schema.json index 9378bf2055..9f60738cab 100644 --- a/backend/schemas/output/sections/CorrectiveActionPlan.schema.json +++ b/backend/schemas/output/sections/CorrectiveActionPlan.schema.json @@ -48,10 +48,18 @@ "type": "string" }, "reference_number": { - "description": "Reference Number", - "pattern": "^[1-2][0-9]{3}-[0-9]{3}$", - "title": "ReferenceNumber", - "type": "string" + "oneOf": [ + { + "description": "Reference Number", + "pattern": "^[1-2][0-9]{3}-[0-9]{3}$", + "title": "ReferenceNumber", + "type": "string" + }, + { + "const": "GSA_MIGRATION", + "type": "string" + } + ] } }, "required": [ diff --git a/backend/schemas/output/sections/FederalAwardsAuditFindings.schema.json b/backend/schemas/output/sections/FederalAwardsAuditFindings.schema.json index 5cbc8fe35f..5bd77b9af1 100644 --- a/backend/schemas/output/sections/FederalAwardsAuditFindings.schema.json +++ b/backend/schemas/output/sections/FederalAwardsAuditFindings.schema.json @@ -341,10 +341,18 @@ "type": "string" }, "reference_number": { - "description": "Reference Number", - "pattern": "^[1-2][0-9]{3}-[0-9]{3}$", - "title": "ReferenceNumber", - "type": "string" + "oneOf": [ + { + "description": "Reference Number", + "pattern": "^[1-2][0-9]{3}-[0-9]{3}$", + "title": "ReferenceNumber", + "type": "string" + }, + { + "const": "GSA_MIGRATION", + "type": "string" + } + ] }, "repeat_prior_reference": { "enum": [ diff --git a/backend/schemas/source/sections/AuditFindingsText.schema.jsonnet b/backend/schemas/source/sections/AuditFindingsText.schema.jsonnet index 45aa62d66e..35e0da571b 100644 --- a/backend/schemas/source/sections/AuditFindingsText.schema.jsonnet +++ b/backend/schemas/source/sections/AuditFindingsText.schema.jsonnet @@ -23,7 +23,14 @@ local Meta = Types.object { local FindingsTextEntry = { additionalProperties: false, properties: { - reference_number: Base.Compound.ReferenceNumber, + reference_number: { + oneOf: [ + Base.Compound.ReferenceNumber, + Types.string { + const: Base.Const.GSA_MIGRATION, + }, + ], + }, text_of_finding: Types.string, contains_chart_or_table: Base.Enum.YorNorGsaMigration, }, diff --git a/backend/schemas/source/sections/CorrectiveActionPlan.schema.jsonnet b/backend/schemas/source/sections/CorrectiveActionPlan.schema.jsonnet index 41303f3357..ecc3888460 100644 --- a/backend/schemas/source/sections/CorrectiveActionPlan.schema.jsonnet +++ b/backend/schemas/source/sections/CorrectiveActionPlan.schema.jsonnet @@ -23,7 +23,14 @@ local Meta = Types.object { local CorrectiveActionPlanEntry = { additionalProperties: false, properties: { - reference_number: Base.Compound.ReferenceNumber, + reference_number: { + oneOf: [ + Base.Compound.ReferenceNumber, + Types.string { + const: Base.Const.GSA_MIGRATION, + }, + ], + }, planned_action: Types.string, contains_chart_or_table: Base.Enum.YorNorGsaMigration, }, diff --git a/backend/schemas/source/sections/FederalAwardsAuditFindings.schema.jsonnet b/backend/schemas/source/sections/FederalAwardsAuditFindings.schema.jsonnet index f6c733b7f7..436e9739d2 100644 --- a/backend/schemas/source/sections/FederalAwardsAuditFindings.schema.jsonnet +++ b/backend/schemas/source/sections/FederalAwardsAuditFindings.schema.jsonnet @@ -42,7 +42,14 @@ local Parts = { Findings: Types.object { additionalProperties: false, properties: { - reference_number: Base.Compound.ReferenceNumber, + reference_number: { + oneOf: [ + Base.Compound.ReferenceNumber, + Types.string { + const: Base.Const.GSA_MIGRATION, + }, + ], + }, is_valid: Base.Enum.YorNorGsaMigration, repeat_prior_reference: Base.Enum.YorNorGsaMigration, prior_references: Types.string,