Skip to content

Dev/ftr 10024 convert defc codes to upper #4382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
May 12, 2025

Conversation

loreleitrimberger
Copy link
Contributor

@loreleitrimberger loreleitrimberger commented Apr 25, 2025

Description:
DEFC codes need to be capitalized because they are case sensitive in USA Spending, but not within Broker where agencies can submit DEFC codes case insensitive. This is to fix the nightly pipeline from failing due to this

Technical details:
Convert DEFC codes to uppercase during the ETL process as well as other text coming over

Requirements for PR merge:

  1. Unit & integration tests updated
  2. N/A API documentation updated
  3. Necessary PR reviewers:
    • Backend
    • N/A Frontend
    • N/A Operations
    • N/A Domain Expert
  4. N/A Matview impact assessment completed
  5. N/A Frontend impact assessment completed
  6. Data validation completed
  7. Appropriate Operations ticket(s) created
  8. Jira Ticket DEV-10024:
    • Link to this Pull-Request
    • N/A Performance evaluation of affected (API | Script | Download)
    • N/A Before / After data comparison

Area for explaining above N/A when needed:

@loreleitrimberger
Copy link
Contributor Author

I'm not sure if I made the changes in the correct spot in the code. Also the ticket mentions there might be additional fields but only specifically mentions DEFC codes, I don't know what else might need to be upper case

@loreleitrimberger loreleitrimberger added the ready for review Desiring a code review, even if not ready to be merged label Apr 25, 2025
Copy link
Contributor

@sethstoudenmier sethstoudenmier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have the right idea for this ticket, but I believe you don't need to make any changes for File C and instead need to make them for File B.

disaster_emergency_fund_code = row["disaster_emergency_fund_code"]
if not disaster_emergency_fund_code:
return None
try:
return DISASTER_EMERGENCY_FUND_CODES[disaster_emergency_fund_code]
return DISASTER_EMERGENCY_FUND_CODES[disaster_emergency_fund_code.upper()]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stepping through the code more to re-familiarize myself I don't believe you need to make a change here. This method is only used when loading File C. Prior to calling this method a helper method is used to handle uppercasing all strings found in each File C row. See here

.

@@ -230,18 +230,18 @@ def setUp(self):
prior_year_adjustment
) (values
(1, 1, 1, '1010', 'D', 1111, null, 'x'),
(2, 1, 1, '1010', 'D', 2222, 'B', 'b'),
(2, 1, 1, '1010', 'D', 2222, 'b', 'b'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test data you have manipulated here is for loading File B. A good starting point for where you need to make a change is looking here:

group by account_num, program_activity_code, object_class, disaster_emergency_fund_code,

@@ -263,7 +263,7 @@ def setUp(self):
) (values
(1, 1, 1, '1010', 'D', 11111, 111110, -11, -111, null, 'x'),
(2, 1, 1, '1010', 'D', 22222, 222220, -22, -222, 'B', 'b'),
(3, 1, 1, '1010', 'D', 33333, 333330, -33, -333, 'L', 'p'),
(3, 1, 1, '1010', 'D', 33333, 333330, -33, -333, 'l', 'p'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you remove the change to usaspending_api/etl/submission_loader_helpers/disaster_emergency_fund_codes.py I believe this should still pass.

@loreleitrimberger loreleitrimberger merged commit 8fc64f7 into qat May 12, 2025
16 checks passed
@loreleitrimberger loreleitrimberger deleted the dev/ftr-convert-defc-codes-to-upper branch May 20, 2025 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review Desiring a code review, even if not ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants