Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
4288026
[DEV-11770] - Add account_download create and load commands
zachflanders-frb Jan 31, 2025
3823122
[DEV-11771] - add generate spark download command
zachflanders-frb Feb 7, 2025
d7da705
[DEV-11771] - Update generate download job
zachflanders-frb Feb 10, 2025
06aa460
[DEV-11771] - Add empty lines at ends of files
zachflanders-frb Feb 10, 2025
c197697
[DEV-11770] - Add fields to account download table
zachflanders-frb Feb 11, 2025
451e4c9
[DEV-11770] - Add submission_id to account download.
zachflanders-frb Feb 11, 2025
44ba832
[DEV-11770] - Fix syntax error.
zachflanders-frb Feb 11, 2025
97a3932
[DEV-11770- - update account download table load query to remove fisc…
zachflanders-frb Feb 14, 2025
ad2839b
[DEV-11770] - update partition_column
zachflanders-frb Feb 14, 2025
393b79d
Merge branch 'ftr/dev-11770-unflitered-account-download-delta-table' …
zachflanders-frb Feb 14, 2025
ffe97c1
[DEV-11772] - Update load query to filter by year
zachflanders-frb Feb 14, 2025
5eea346
[DEV-11771] - Fix merge conflict and whitespace
zachflanders-frb Feb 18, 2025
cfc27c4
[DEV-11771] - Fix federal account sql
zachflanders-frb Feb 18, 2025
14d0e6c
Merge pull request #4270 from fedspendingtransparency/ftr/dev-11771-s…
zachflanders-frb Feb 19, 2025
71ee6d0
[DEV-11771] - Move filters to download query
zachflanders-frb Feb 24, 2025
e9691a8
[DEV-11770] - Fix white space
zachflanders-frb Feb 25, 2025
3160329
Merge branch 'qat' into ftr/dev-11770-unflitered-account-download-del…
zachflanders-frb Feb 25, 2025
7404903
Merge pull request #4265 from fedspendingtransparency/ftr/dev-11770-u…
zachflanders-frb Feb 25, 2025
ac480b3
[DEV-12234] - Update account_download schema and table spec
zachflanders-frb Apr 15, 2025
6f99dbc
[DEV-12234] - fix type in account download sql
zachflanders-frb Apr 16, 2025
5798b2f
[DEV-12235] - Add generate_postgres_download command
zachflanders-frb Apr 17, 2025
a2451b5
Merge branch 'qat' into ftr/dev-12235-table-based-account-download
zachflanders-frb Apr 17, 2025
c47003e
[DEV-12235] - Handle case where downloadjob is None]
zachflanders-frb Apr 17, 2025
3b1f256
Merge pull request #4365 from fedspendingtransparency/ftr/dev-12234-a…
zachflanders-frb Apr 22, 2025
7b78432
[DEV-12235] - code style fixes
zachflanders-frb May 7, 2025
689109b
[DEV-12235] - code style fixes
zachflanders-frb May 7, 2025
9298da9
Merge pull request #4389 from fedspendingtransparency/ftr/dev-12235-t…
zachflanders-frb May 19, 2025
30550f8
Merge branch 'poc/dev-11769-spark-downloads-from-table' into ftr/dev-…
zachflanders-frb Jun 3, 2025
505e247
[DEV-12574] - WIP - add AccountDownloadDataFrameBuilder
zachflanders-frb Jun 4, 2025
7cbda73
[DEV-12574] - update spark download dataframe builder
zachflanders-frb Jun 5, 2025
bb31aae
[DEV-12574] - adding dynamic filters for def codes, agency, account id
zachflanders-frb Jun 6, 2025
6e4434d
[DEV-12574] - cleanup
zachflanders-frb Jun 9, 2025
facdf9e
[DEV-12574] - Cleanup and refactoring
zachflanders-frb Jun 9, 2025
59b8392
Merge branch 'qat' into ftr/dev-12574-account-download-dynamic-filters
zachflanders-frb Jun 9, 2025
141db7a
[DEV-12574] - Fix table spec
zachflanders-frb Jun 9, 2025
2b2325f
[DEV-12574] - Adding tests
zachflanders-frb Jun 10, 2025
7f465c5
Merge branch 'qat' into poc/dev-11769-spark-downloads-from-table
zachflanders-frb Jun 10, 2025
142b7c3
Merge branch 'poc/dev-11769-spark-downloads-from-table' into ftr/dev-…
zachflanders-frb Jun 10, 2025
da8d9c7
[DEV-12574] - Move test file to integration tests
zachflanders-frb Jun 12, 2025
34a5706
[DEV-12574] - update source of select columns
zachflanders-frb Jun 12, 2025
961983b
[DEV-12574] - Update fixtures to ensure cleanup of delta tables
zachflanders-frb Jun 20, 2025
0c54c6a
[DEV-12574] - Update fixtures to ensure cleanup of delta tables pt. 2
zachflanders-frb Jun 21, 2025
dafa1b2
[DEV-12574] - Remove unused import
zachflanders-frb Jun 21, 2025
d5491a7
Merge pull request #4411 from fedspendingtransparency/ftr/dev-12574-a…
zachflanders-frb Jun 23, 2025
3e75bc5
[DEV-12772] - Adding treasury account downloads WIP
zachflanders-frb Jun 25, 2025
ba31127
Merge branch 'ftr/dev-12574-additional-dynamic-filter-work' into ftr/…
zachflanders-frb Jun 30, 2025
6a0fe2f
[DEV-12772] - WIP adding treasury account downloads
zachflanders-frb Jun 30, 2025
fcc6401
[DEV-12772] - WIP adding treasury account downloads - updating tests
zachflanders-frb Jul 1, 2025
4b50fc7
[DEV-12772] - WIP adding treasury account downloads - updating tests
zachflanders-frb Jul 1, 2025
e808e6e
[DEV-12772] - Removing treasury account download load sql
zachflanders-frb Jul 1, 2025
febccc5
[DEV-12772] - Removing treasury account download load sql
zachflanders-frb Jul 1, 2025
a523a3a
Merge branch 'qat' into ftr/dev-12772-treasury-account-download
zachflanders-frb Jul 2, 2025
7989bc5
[DEV-12772] - Update Flake8 rules to bring in alignment with Black
zachflanders-frb Jul 2, 2025
59a6321
[DEV-12772] - Update Flake8 rules to bring in alignment with Black
zachflanders-frb Jul 2, 2025
bf29fae
[DEV-12638] Update the S3 endpoint for starting local spark job
sethstoudenmier Jul 9, 2025
dcb869c
Merge pull request #4437 from fedspendingtransparency/mod/dev-12638-u…
sethstoudenmier Jul 10, 2025
92c5f76
Merge branch 'qat' into ftr/dev-12772-treasury-account-download
zachflanders-frb Jul 14, 2025
e8e4554
[DEV-12772] - Update filter to add submission types and command and b…
zachflanders-frb Jul 14, 2025
3ef8663
Merge branch 'ftr/dev-12772-treasury-account-download' of https://git…
zachflanders-frb Jul 14, 2025
93dc6fd
[DEV-12772] - Update patch path
zachflanders-frb Jul 14, 2025
41312d3
[DEV-12772] - Update patch path formatting
zachflanders-frb Jul 14, 2025
f4e70e7
[DEV-12873] Add recipient_id to spending_by_transaction
sethstoudenmier Jul 15, 2025
c28455e
Merge pull request #4429 from fedspendingtransparency/ftr/dev-12772-t…
zachflanders-frb Jul 17, 2025
c1d2626
[DEV-11765] Fix subaward zip bug
sethstoudenmier Jul 17, 2025
d601a90
[DEV-12878] Create delta table for File B custom account download
aguest-kc Jul 18, 2025
1eadc39
[DEV-12878] Add create_delta_table test for object_class_program_acti…
aguest-kc Jul 18, 2025
055f33b
[DEV-12878] Update delta model name
aguest-kc Jul 18, 2025
8dd14b2
Merge branch 'qat' into mod/dev-12873-add-recipient-id
sethstoudenmier Jul 18, 2025
d9de8d9
Merge pull request #4438 from fedspendingtransparency/mod/dev-12873-a…
sethstoudenmier Jul 18, 2025
b5c38c2
Merge branch 'qat' into fix/dev-11765-fix-subaward-zip-filter
sethstoudenmier Jul 18, 2025
ad5b073
Merge branch 'qat' into ftr/dev-12878-file-b-delta-table
aguest-kc Jul 18, 2025
8fcd382
Merge pull request #4439 from fedspendingtransparency/fix/dev-11765-f…
sethstoudenmier Jul 18, 2025
1024fbe
Merge branch 'qat' into ftr/dev-12878-file-b-delta-table
aguest-kc Jul 18, 2025
d751b79
[DEV-12878] Remove Code Climate from Github actions
aguest-kc Jul 22, 2025
de79ca6
Merge pull request #4443 from fedspendingtransparency/ftr/dev-12878-f…
aguest-kc Jul 23, 2025
81ec59e
Merge pull request #4445 from fedspendingtransparency/qat
aguest-kc Jul 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions .github/workflows/code-climate-before-build.yaml

This file was deleted.

52 changes: 0 additions & 52 deletions .github/workflows/code-climate-report-coverage.yaml

This file was deleted.

47 changes: 8 additions & 39 deletions .github/workflows/pull-request-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,95 +44,64 @@ jobs:
needs.Cancel-If-Draft-Pull-Request.result == 'skipped'
uses: ./.github/workflows/build-broker-docker-image-for-test.yaml

# Prepare Code Climate to receive coverage report
Code-Climate-Before-Build:
name: Code Climate Before Build
needs: Run-Code-Style-Checks
if: ${{ !failure() && !cancelled() }}
uses: ./.github/workflows/code-climate-before-build.yaml
with:
source-branch: ${{ github.head_ref }}
source-commit-sha: ${{ github.event.pull_request.head.sha }}
secrets:
cc_test_reporter_id: ${{ secrets.CC_TEST_REPORTER_ID }}

# The test suite is broken into multiple groups based on a combination of what is under test
# and the time that it takes to run tests for that group.
Run-Spark-Integration-Load-Transaction-FABS-and-FPDS-Tests:
name: Run Spark Integration Load Transactions FABS and FPDS Tests
needs:
- Code-Climate-Before-Build
- Run-Code-Style-Checks
- Build-Broker-Docker-Image
if: ${{ !failure() && !cancelled() }}
uses: ./.github/workflows/test-spark-integration-load-transactions-fabs-fpds.yaml

Run-Spark-Integration-Load-Transactions-Lookup-Tests:
name: Run Spark Integration Load Transactions Lookup Tests
needs:
- Code-Climate-Before-Build
- Run-Code-Style-Checks
- Build-Broker-Docker-Image
if: ${{ !failure() && !cancelled() }}
uses: ./.github/workflows/test-spark-integration-load-transactions-lookup.yaml

Run-Spark-Integration-Load-To-From-Delta-Tests:
name: Run Spark Integration Load To From Delta Tests
needs:
- Code-Climate-Before-Build
- Run-Code-Style-Checks
- Build-Broker-Docker-Image
if: ${{ !failure() && !cancelled() }}
uses: ./.github/workflows/test-spark-integration-load-to-from-delta.yaml

Run-Spark-Integration-Other-Tests:
name: Run Spark Integration Other Tests
needs:
- Code-Climate-Before-Build
- Run-Code-Style-Checks
- Build-Broker-Docker-Image
if: ${{ !failure() && !cancelled() }}
uses: ./.github/workflows/test-spark-integration-other.yaml

Run-Non-Spark-Integration-Tests:
name: Run Non-Spark Integration Tests
needs:
- Code-Climate-Before-Build
- Run-Code-Style-Checks
- Build-Broker-Docker-Image
if: ${{ !failure() && !cancelled() }}
uses: ./.github/workflows/test-non-spark-integration.yaml

Run-Non-Spark-Integration-Tests-With-Signal-Handling:
name: Run Non-Spark Integration Tests With Signal Handling
needs:
- Code-Climate-Before-Build
- Run-Code-Style-Checks
- Build-Broker-Docker-Image
if: ${{ !failure() && !cancelled() }}
uses: ./.github/workflows/test-non-spark-integration-signal-handling.yaml

Run-Unit-Tests:
name: Run Unit Tests
needs: Code-Climate-Before-Build
needs: Run-Code-Style-Checks
if: ${{ !failure() && !cancelled() }}
uses: ./.github/workflows/test-unit.yaml

Run-Unit-Tests-With-Signal-Handling:
name: Run Unit Tests With Signal Handling
needs: Code-Climate-Before-Build
needs: Run-Code-Style-Checks
if: ${{ !failure() && !cancelled() }}
uses: ./.github/workflows/test-unit-signal-handling.yaml

Code-Climate-Report-Coverage:
name: Code Climate Report Coverage
needs:
- Run-Spark-Integration-Load-Transaction-FABS-and-FPDS-Tests
- Run-Spark-Integration-Load-Transactions-Lookup-Tests
- Run-Spark-Integration-Load-To-From-Delta-Tests
- Run-Spark-Integration-Other-Tests
- Run-Non-Spark-Integration-Tests
- Run-Non-Spark-Integration-Tests-With-Signal-Handling
- Run-Unit-Tests
- Run-Unit-Tests-With-Signal-Handling
if: ${{ !failure() && !cancelled() }}
uses: ./.github/workflows/code-climate-report-coverage.yaml
with:
source-branch: ${{ github.head_ref }}
source-commit-sha: ${{ github.event.pull_request.head.sha }}
secrets:
cc_test_reporter_id: ${{ secrets.CC_TEST_REPORTER_ID }}
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[flake8]
select=C,E,F,W,B,B950
ignore=E501,W503,E203,F541
ignore=E501,W503,E203,F541,E704
exclude=.venv,build,usaspending_api.egg-info,usaspending_api/*/migrations/*
max-line-length=120
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ List of column names to request
- `NAICS`
- `PSC`
- `Primary Place of Performance`
- `recipient_id`
- `Recipient Location`
- `Recipient Name`
- `Recipient UEI`
Expand All @@ -415,6 +416,7 @@ List of column names to request
+ `internal_id`: `68856340` (required, string, nullable)
+ `generated_internal_id`: `CONT_AWD_00013U_7090_KJ88_4735` (required, string, nullable)
+ `Mod`: `P00206` (required, string, nullable)
+ `recipient_id`: `1e5032cf-11df-a3bf-4240-6dda5f6d45ff-C` (optional, string, nullable)
+ `Recipient Name`: `LEIDOS INNOVATIONS CORPORATION` (required, string, nullable)
+ `Transaction Amount`: `40000000.00` (required, string, nullable)

Expand All @@ -433,6 +435,7 @@ List of column names to request
+ `Last Date to Order` (required, string, nullable)
+ `Loan Value` (required, string, nullable)
+ `Mod` (required, string, nullable)
+ `recipient_id` (optional, string, nullable)
+ `Recipient Name` (required, string, nullable)
+ `Subsidy Cost` (required, string, nullable)
+ `Transaction Amount` (required, string, nullable)
+ `Transaction Amount` (required, string, nullable)
123 changes: 80 additions & 43 deletions usaspending_api/awards/v2/lookups/elasticsearch_lookups.py
Original file line number Diff line number Diff line change
@@ -1,51 +1,90 @@
"""
Look ups for elasticsearch fields to be displayed for the front end
Lookups for elasticsearch fields to be displayed for the front end
"""

from copy import deepcopy
from dataclasses import dataclass
from enum import Enum

from usaspending_api.awards.v2.lookups.lookups import all_award_types_mappings

TRANSACTIONS_LOOKUP = {
"Recipient Name": "recipient_name.keyword",
"Action Date": "action_date",
"Transaction Amount": "federal_action_obligation",
"Award Type": "type_description.keyword",
"Awarding Agency": "awarding_toptier_agency_name.keyword",
"Awarding Sub Agency": "awarding_subtier_agency_name.keyword",
"Funding Agency": "funding_toptier_agency_name",
"Funding Sub Agency": "funding_subtier_agency_name",
"Issued Date": "period_of_performance_start_date",
"Loan Value": "face_value_loan_guarantee",
"Subsidy Cost": "original_loan_subsidy_cost",
"Mod": "modification_number.keyword",
"Award ID": "display_award_id",
"awarding_agency_id": "awarding_agency_id",
"internal_id": "award_id",
"generated_internal_id": "generated_unique_award_id",
"Last Date to Order": "ordering_period_end_date",
"def_codes": "disaster_emergency_fund_codes",
"Transaction Description": "transaction_description.keyword",
"Action Type": "action_type",
"Recipient UEI": "recipient_uei.keyword",
"awarding_agency_slug": "awarding_toptier_agency_name.keyword",
"funding_agency_slug": "funding_toptier_agency_name.keyword",
"recipient_location_city_name": "recipient_location_city_name.keyword",
"recipient_location_state_code": "recipient_location_state_code",
"recipient_location_country_name": "recipient_location_country_name.keyword",
"recipient_location_address_line1": "recipient_location_address_line1.keyword",
"recipient_location_address_line2": "recipient_location_address_line2.keyword",
"recipient_location_address_line3": "recipient_location_address_line3.keyword",
"pop_city_name": "pop_city_name.keyword",
"pop_state_code": "pop_state_code",
"pop_country_name": "pop_country_name.keyword",
"naics_code": "naics_code.keyword",
"naics_description": "naics_description.keyword",
"product_or_service_code": "product_or_service_code.keyword",
"product_or_service_description": "product_or_service_description.keyword",
"cfda_number": "cfda_number.keyword",
"cfda_title": "cfda_title.keyword",
}

@dataclass
class ElasticsearchField:
"""
Represents a field that is searchable by an API endpoint and pairs it with the corresponding elasticsearch field.

Args:
field_name: The name of the field provided by the user when selecting fields and returned by the API
full_path: A complete path that may include additional field types such as ".keyword"
short_path: The full_path with any additional field types removed; may be 1:1 with full_path
"""

field_name: str
full_path: str
short_path: str


class TransactionField(str, Enum):
ACTION_DATE = ("Action Date", "action_date")
ACTION_TYPE = ("Action Type", "action_type")
AWARD_ID = ("Award ID", "display_award_id")
AWARD_TYPE = ("Award Type", "type_description.keyword")
AWARDING_AGENCY = ("Awarding Agency", "awarding_toptier_agency_name.keyword")
AWARDING_AGENCY_ID = ("awarding_agency_id", "awarding_agency_id")
AWARDING_AGENCY_SLUG = ("awarding_agency_slug", "awarding_toptier_agency_name.keyword")
AWARDING_SUB_AGENCY = ("Awarding Sub Agency", "awarding_subtier_agency_name.keyword")
CFDA_NUMBER = ("cfda_number", "cfda_number.keyword")
CFDA_TITLE = ("cfda_title", "cfda_title.keyword")
DEF_CODES = ("def_codes", "disaster_emergency_fund_codes")
FUNDING_AGENCY = ("Funding Agency", "funding_toptier_agency_name.keyword")
FUNDING_AGENCY_SLUG = ("funding_agency_slug", "funding_toptier_agency_name.keyword")
FUNDING_SUB_AGENCY = ("Funding Sub Agency", "funding_subtier_agency_name.keyword")
GENERATED_INTERNAL_ID = ("generated_internal_id", "generated_unique_award_id")
INTERNAL_ID = ("internal_id", "award_id")
ISSUED_DATE = ("Issued Date", "period_of_performance_start_date")
LAST_DATE_TO_ORDER = ("Last Date to Order", "ordering_period_end_date")
LOAN_VALUE = ("Loan Value", "face_value_loan_guarantee")
MOD = ("Mod", "modification_number.keyword")
NAICS_CODE = ("naics_code", "naics_code.keyword")
NAICS_DESCRIPTION = ("naics_description", "naics_description.keyword")
POP_CITY_NAME = ("pop_city_name", "pop_city_name.keyword")
POP_COUNTRY_NAME = ("pop_country_name", "pop_country_name.keyword")
POP_STATE_CODE = ("pop_state_code", "pop_state_code")
PSC_CODE = ("product_or_service_code", "product_or_service_code.keyword")
PSC_DESCRIPTION = ("product_or_service_description", "product_or_service_description.keyword")
RECIPIENT_ID = ("recipient_id", "recipient_agg_key")
RECIPIENT_LOCATION_ADDRESS_LINE_1 = ("recipient_location_address_line1", "recipient_location_address_line1.keyword")
RECIPIENT_LOCATION_ADDRESS_LINE_2 = ("recipient_location_address_line2", "recipient_location_address_line2.keyword")
RECIPIENT_LOCATION_ADDRESS_LINE_3 = ("recipient_location_address_line3", "recipient_location_address_line3.keyword")
RECIPIENT_LOCATION_CITY_NAME = ("recipient_location_city_name", "recipient_location_city_name.keyword")
RECIPIENT_LOCATION_COUNTRY_NAME = ("recipient_location_country_name", "recipient_location_country_name.keyword")
RECIPIENT_LOCATION_STATE_CODE = ("recipient_location_state_code", "recipient_location_state_code")
RECIPIENT_NAME = ("Recipient Name", "recipient_name.keyword")
RECIPIENT_UEI = ("Recipient UEI", "recipient_uei.keyword")
SUBSIDY_COST = ("Subsidy Cost", "original_loan_subsidy_cost")
TRANSACTION_AMOUNT = ("Transaction Amount", "federal_action_obligation")
TRANSACTION_DESCRIPTION = ("Transaction Description", "transaction_description.keyword")

def __new__(cls, field_name: str, full_path: str) -> "str":
obj = str.__new__(cls, field_name)
obj._value_ = field_name
short_path = full_path.split(".")[0]
obj._es_field = ElasticsearchField(field_name, full_path, short_path)
return obj

@property
def field_name(self) -> str:
return self._es_field.field_name

@property
def full_path(self) -> str:
return self._es_field.full_path

@property
def short_path(self) -> str:
return self._es_field.short_path


base_mapping = {
"Award ID": "display_award_id",
Expand Down Expand Up @@ -145,8 +184,6 @@
},
}

TRANSACTIONS_SOURCE_LOOKUP = {key: value.replace(".keyword", "") for key, value in TRANSACTIONS_LOOKUP.items()}

CONTRACT_SOURCE_LOOKUP = {key: value.replace(".keyword", "") for key, value in contracts_mapping.items()}
IDV_SOURCE_LOOKUP = {key: value.replace(".keyword", "") for key, value in idv_mapping.items()}
NON_LOAN_ASST_SOURCE_LOOKUP = {key: value.replace(".keyword", "") for key, value in non_loan_assist_mapping.items()}
Expand Down
2 changes: 1 addition & 1 deletion usaspending_api/common/helpers/download_csv_strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def download_to_csv(
raise e
finally:
Path(temp_file_path).unlink()
return CSVDownloadMetadata([destination_path], row_count)
return CSVDownloadMetadata([str(destination_path)], row_count)


class SparkToCSVStrategy(AbstractToCSVStrategy):
Expand Down
Loading