Skip to content

Commit

Permalink
Adding workbook version to sac records (#4377)
Browse files Browse the repository at this point in the history
* Added version to sac meta

* #4376 Updated logic to capture schema version in SAC record

* #4376 Updated schema for backwards compatibility
  • Loading branch information
sambodeme authored Oct 18, 2024
1 parent a34ce8b commit dc4958d
Show file tree
Hide file tree
Showing 20 changed files with 146 additions and 30 deletions.
1 change: 1 addition & 0 deletions backend/audit/intakelib/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
FEDERAL_AGENCY_PREFIX = "federal_agency_prefix"
THREE_DIGIT_EXTENSION = "three_digit_extension"
SECTION_NAME = "section_name"
VERSION = "version"
XLSX_TEMPLATE_DEFINITION_DIR = settings.XLSX_TEMPLATE_JSON_DIR
2 changes: 2 additions & 0 deletions backend/audit/intakelib/mapping_meta.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .constants import (
SECTION_NAME,
VERSION,
)

from .mapping_util import (
Expand All @@ -9,4 +10,5 @@

meta_mapping: FieldMapping = {
SECTION_NAME: (f"Meta.{SECTION_NAME}", _set_by_path),
VERSION: (f"Meta.{VERSION}", _set_by_path),
}
3 changes: 3 additions & 0 deletions backend/audit/intakelib/transforms/runners.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import logging
from copy import deepcopy

from .xform_clean_version_value import remove_equals_and_quotes

from .xform_resize_award_references import resize_award_reference

from .xform_all_amount_expended_need_to_be_integers import (
Expand Down Expand Up @@ -93,6 +95,7 @@ def run_all_secondary_auditors_transforms(ir):

general_transforms = [
convert_to_stripped_string,
remove_equals_and_quotes,
]

notes_to_sefa_transforms = general_transforms + [
Expand Down
20 changes: 20 additions & 0 deletions backend/audit/intakelib/transforms/xform_clean_version_value.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import logging
from audit.intakelib.intermediate_representation import (
get_range_by_name,
replace_range_by_name,
)

logger = logging.getLogger(__name__)


def remove_equals_and_quotes(ir):
versions = get_range_by_name(ir, "version")
new_values = list(
map(
lambda v: v.replace("=", "").replace('"', "") if v else v,
versions["values"],
)
)
new_ir = replace_range_by_name(ir, "version", new_values)

return new_ir
13 changes: 12 additions & 1 deletion backend/schemas/output/sections/AdditionalEINs.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,18 @@
"type": "string"
},
"version": {
"const": "1.1.3",
"enum": [
"1.0.0",
"1.0.1",
"1.0.2",
"1.0.3",
"1.0.4",
"1.0.5",
"1.1.0",
"1.1.1",
"1.1.2",
"1.1.3"
],
"type": "string"
}
},
Expand Down
13 changes: 12 additions & 1 deletion backend/schemas/output/sections/AdditionalUEIs.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,18 @@
"type": "string"
},
"version": {
"const": "1.1.3",
"enum": [
"1.0.0",
"1.0.1",
"1.0.2",
"1.0.3",
"1.0.4",
"1.0.5",
"1.1.0",
"1.1.1",
"1.1.2",
"1.1.3"
],
"type": "string"
}
},
Expand Down
13 changes: 12 additions & 1 deletion backend/schemas/output/sections/AuditFindingsText.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,18 @@
"type": "string"
},
"version": {
"const": "1.1.3",
"enum": [
"1.0.0",
"1.0.1",
"1.0.2",
"1.0.3",
"1.0.4",
"1.0.5",
"1.1.0",
"1.1.1",
"1.1.2",
"1.1.3"
],
"type": "string"
}
},
Expand Down
13 changes: 12 additions & 1 deletion backend/schemas/output/sections/CorrectiveActionPlan.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,18 @@
"type": "string"
},
"version": {
"const": "1.1.3",
"enum": [
"1.0.0",
"1.0.1",
"1.0.2",
"1.0.3",
"1.0.4",
"1.0.5",
"1.1.0",
"1.1.1",
"1.1.2",
"1.1.3"
],
"type": "string"
}
},
Expand Down
13 changes: 12 additions & 1 deletion backend/schemas/output/sections/FederalAwards.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,18 @@
"type": "string"
},
"version": {
"const": "1.1.3",
"enum": [
"1.0.0",
"1.0.1",
"1.0.2",
"1.0.3",
"1.0.4",
"1.0.5",
"1.1.0",
"1.1.1",
"1.1.2",
"1.1.3"
],
"type": "string"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8670,7 +8670,18 @@
"type": "string"
},
"version": {
"const": "1.1.3",
"enum": [
"1.0.0",
"1.0.1",
"1.0.2",
"1.0.3",
"1.0.4",
"1.0.5",
"1.1.0",
"1.1.1",
"1.1.2",
"1.1.3"
],
"type": "string"
}
},
Expand Down
13 changes: 12 additions & 1 deletion backend/schemas/output/sections/NotesToSefa.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,18 @@
"type": "string"
},
"version": {
"const": "1.1.3",
"enum": [
"1.0.0",
"1.0.1",
"1.0.2",
"1.0.3",
"1.0.4",
"1.0.5",
"1.1.0",
"1.1.1",
"1.1.2",
"1.1.3"
],
"type": "string"
}
},
Expand Down
13 changes: 12 additions & 1 deletion backend/schemas/output/sections/SecondaryAuditors.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,18 @@
"type": "string"
},
"version": {
"const": "1.1.3",
"enum": [
"1.0.0",
"1.0.1",
"1.0.2",
"1.0.3",
"1.0.4",
"1.0.5",
"1.1.0",
"1.1.1",
"1.1.2",
"1.1.3"
],
"type": "string"
}
},
Expand Down
6 changes: 3 additions & 3 deletions backend/schemas/source/sections/AdditionalEINs.schema.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ local Meta = Types.object {
section_name: Types.string {
enum: [Sheets.section_names.ADDITIONAL_EINS],
},
// FIXME: 2023-08-15 MSHD: The 'Version' is currently used here as a placeholder, and it is not being enforced at the moment.
// Once we establish a versioning pattern, we can update this and enforce it accordingly.
//Because we now pass the version to the SAC record,
//we want to make sure we allow backwards compatibility
version: Types.string {
const: Sheets.WORKBOOKS_VERSION,
enum: ["1.0.0", "1.0.1", "1.0.2", "1.0.3", "1.0.4", "1.0.5", "1.1.0", "1.1.1", "1.1.2", Sheets.WORKBOOKS_VERSION]
},
},
required: ['section_name'],
Expand Down
6 changes: 3 additions & 3 deletions backend/schemas/source/sections/AdditionalUEIs.schema.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ local Meta = Types.object {
section_name: Types.string {
enum: [Sheets.section_names.ADDITIONAL_UEIS],
},
// FIXME: 2023-08-07 MSHD: The 'Version' is currently used here as a placeholder, and it is not being enforced at the moment.
// Once we establish a versioning pattern, we can update this and enforce it accordingly.
//Because we now pass the version to the SAC record,
//we want to make sure we allow backwards compatibility
version: Types.string {
const: Sheets.WORKBOOKS_VERSION,
enum: ["1.0.0", "1.0.1", "1.0.2", "1.0.3", "1.0.4", "1.0.5", "1.1.0", "1.1.1", "1.1.2", Sheets.WORKBOOKS_VERSION]
},
},
required: ['section_name'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ local Meta = Types.object {
section_name: Types.string {
enum: [Sheets.section_names.AUDIT_FINDINGS_TEXT],
},
// FIXME: 2023-08-07 MSHD: The 'Version' is currently used here as a placeholder, and it is not being enforced at the moment.
// Once we establish a versioning pattern, we can update this and enforce it accordingly.
//Because we now pass the version to the SAC record,
//we want to make sure we allow backwards compatibility
version: Types.string {
const: Sheets.WORKBOOKS_VERSION,
enum: ["1.0.0", "1.0.1", "1.0.2", "1.0.3", "1.0.4", "1.0.5", "1.1.0", "1.1.1", "1.1.2", Sheets.WORKBOOKS_VERSION]
},
},
required: ['section_name'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ local Meta = Types.object {
section_name: Types.string {
enum: [Sheets.section_names.CORRECTIVE_ACTION_PLAN],
},
// FIXME: 2023-08-07 MSHD: The 'Version' is currently used here as a placeholder, and it is not being enforced at the moment.
// Once we establish a versioning pattern, we can update this and enforce it accordingly.
//Because we now pass the version to the SAC record,
//we want to make sure we allow backwards compatibility
version: Types.string {
const: Sheets.WORKBOOKS_VERSION,
enum: ["1.0.0", "1.0.1", "1.0.2", "1.0.3", "1.0.4", "1.0.5", "1.1.0", "1.1.1", "1.1.2", Sheets.WORKBOOKS_VERSION]
},
},
required: ['section_name'],
Expand Down
6 changes: 3 additions & 3 deletions backend/schemas/source/sections/FederalAwards.schema.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,10 @@ local Meta = Types.object {
section_name: Types.string {
enum: [Sheets.section_names.FEDERAL_AWARDS, Sheets.section_names.FEDERAL_AWARDS_EXPENDED],
},
// FIXME: 2023-08-07 MSHD: The 'Version' is currently used here as a placeholder, and it is not being enforced at the moment.
// Once we establish a versioning pattern, we can update this and enforce it accordingly.
//Because we now pass the version to the SAC record,
//we want to make sure we allow backwards compatibility
version: Types.string {
const: Sheets.WORKBOOKS_VERSION,
enum: ["1.0.0", "1.0.1", "1.0.2", "1.0.3", "1.0.4", "1.0.5", "1.1.0", "1.1.1", "1.1.2", Sheets.WORKBOOKS_VERSION]
},
},
required: ['section_name'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ local Meta = Types.object {
section_name: Types.string {
enum: [Sheets.section_names.FEDERAL_AWARDS_AUDIT_FINDINGS],
},
// FIXME: 2023-08-07 MSHD: The 'Version' is currently used here as a placeholder, and it is not being enforced at the moment.
// Once we establish a versioning pattern, we can update this and enforce it accordingly.
//Because we now pass the version to the SAC record,
//we want to make sure we allow backwards compatibility
version: Types.string {
const: Sheets.WORKBOOKS_VERSION,
enum: ["1.0.0", "1.0.1", "1.0.2", "1.0.3", "1.0.4", "1.0.5", "1.1.0", "1.1.1", "1.1.2", Sheets.WORKBOOKS_VERSION]
},
},
required: ['section_name'],
Expand Down
4 changes: 3 additions & 1 deletion backend/schemas/source/sections/NotesToSefa.schema.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ local Meta = Types.object {
section_name: Types.string {
enum: [Sheets.section_names.NOTES_TO_SEFA],
},
//Because we now pass the version to the SAC record,
//we want to make sure we allow backwards compatibility
version: Types.string {
const: Sheets.WORKBOOKS_VERSION,
enum: ["1.0.0", "1.0.1", "1.0.2", "1.0.3", "1.0.4", "1.0.5", "1.1.0", "1.1.1", "1.1.2", Sheets.WORKBOOKS_VERSION]
},
},
required: ['section_name'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ local Meta = Types.object {
section_name: Types.string {
enum: [Sheets.section_names.SECONDARY_AUDITORS],
},
// FIXME: 2023-08-07 MSHD: The 'Version' is currently used here as a placeholder, and it is not being enforced at the moment.
// Once we establish a versioning pattern, we can update this and enforce it accordingly.
//Because we now pass the version to the SAC record,
//we want to make sure we allow backwards compatibility
version: Types.string {
const: Sheets.WORKBOOKS_VERSION,
enum: ["1.0.0", "1.0.1", "1.0.2", "1.0.3", "1.0.4", "1.0.5", "1.1.0", "1.1.1", "1.1.2", Sheets.WORKBOOKS_VERSION]
},
},
required: ['section_name'],
Expand Down

0 comments on commit dc4958d

Please sign in to comment.