Skip to content

[DEV-14890] - New Download/v2/search endpoint#4627

Open
DavidMikolaKC wants to merge 24 commits intoqatfrom
ftr/dev-14890-new-download-search-endpoint
Open

[DEV-14890] - New Download/v2/search endpoint#4627
DavidMikolaKC wants to merge 24 commits intoqatfrom
ftr/dev-14890-new-download-search-endpoint

Conversation

@DavidMikolaKC
Copy link
Copy Markdown
Contributor

@DavidMikolaKC DavidMikolaKC commented Apr 10, 2026

Description:

Currently the Advanced Search page allows for users to download either Awards with Subawards or Transactions with Subawards; never combining Awards and Transactions. A new endpoint is needed to support a new download modal that allows users to select which of the three they want. The /api/v2/download/search endpoint will power the downloads on the Advanced Search page and support Awards, Transactions, and Subawards.

Technical Details:

Requirements for PR Merge:

  1. Unit & integration tests updated
  2. API documentation updated (examples listed below)
    1. API Contracts
    2. API UI
    3. Comments
  3. Data validation completed (examples listed below)
    1. Does this work well with the current frontend? Or is the frontend aware of a needed change?
    2. Is performance impacted in the changes (e.g., API, pipeline, downloads, etc.)?
    3. Is the expected data returned with the expected format?
  4. Appropriate Operations ticket(s) created
  5. Jira Ticket(s)
    1. DEV-14890

Explain N/A in above checklist:

@DavidMikolaKC DavidMikolaKC added the do not merge [PR] shouldn't be merged label Apr 10, 2026
@DavidMikolaKC DavidMikolaKC changed the title [DEV-14890] - Created initial Search Endpoint Functionality [DEV-14890] - New Download/v2/search endpoint Apr 14, 2026
@DavidMikolaKC DavidMikolaKC marked this pull request as ready for review April 14, 2026 15:10
Copy link
Copy Markdown
Contributor

@zachflanders-frb zachflanders-frb left a comment

Choose a reason for hiding this comment

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

This is looking good to me. I just have one comment about finishing up the api docs by linking to where this filter object is already defined in our docs.

Comment thread usaspending_api/api_contracts/contracts/v2/download/search.md
@DavidMikolaKC DavidMikolaKC removed the do not merge [PR] shouldn't be merged label Apr 17, 2026
Copy link
Copy Markdown
Contributor

@zachflanders-frb zachflanders-frb left a comment

Choose a reason for hiding this comment

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

👍 LGTM

Copy link
Copy Markdown
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.

Looks good! My comments are all related to some cleanup.

+ `tsv`
+ `pstxt`
+ `limit` (optional, number)
+ `spending_level` (optional, enum[string])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
+ `spending_level` (optional, enum[string])
+ `spending_level` (optional, array[enum[string]])

I believe this will pass Dredd tests for the API blueprint. This spending_level filter is slightly different from other examples because it allows multiple selections instead of a single choice.

+ `subawards`
+ `transactions`
+ `awards`
+ Default: `transactions`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
+ Default: `transactions`
+ Default: `["transactions"]`

Not sure about this syntax, but this is also different because it is an array of values

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This default value is not accurate to the tinyshield model in the implementation: "default": ["awards", "transactions", "subawards"],

Comment on lines +79 to +88
"columns": [

],
"download_types": [

],
"file_format": "csv",
"filters": {

},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would update this to reflect the values in your example request above

|[/api/v2/download/disaster/recipients/](/api/v2/download/disaster/recipients/)|POST| Returns a zipped file containing Disaster Recipient Funding data |
|[/api/v2/download/idv/](/api/v2/download/idv/)|POST| Returns a zipped file containing IDV data |
|[/api/v2/download/status/](/api/v2/download/status/)|GET| gets the current status of a download job that that has been requested with the `v2/download/awards/` or `v2/download/transaction/` endpoint that same day |
|[/api/v2/download/search/](/api/v2/download/search/)|POST|Generates zip file for download of award data in CSV format, both awards and transactions |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Two things here:

  1. Can you move this above the /api/v2/download/status/ line for alphabetical order?
  2. I would call out in the description that this allows you to download data for Awards, Subawards, and Transactions


self._json_request["filters"] = final_award_filters

def _update_custom_award_filters(self, custom_award_filters: dict, filter_all_agencies: bool) -> list:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Won't block on this, but since this function specifically updates the filters for the purpose of agencies, I would have that reflected in the name.

Comment thread usaspending_api/download/v2/urls.py Outdated
re_path(r"^idv", views.RowLimitedIDVDownloadViewSet.as_view()),
re_path(r"^status", DownloadStatusViewSet.as_view()),
re_path(r"^transactions", views.RowLimitedTransactionDownloadViewSet.as_view()),
re_path(r"^search", views.SearchDownloadViewSet.as_view())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you add this above the status endpoint to preserve alphabetical order?

Comment thread usaspending_api/download/v2/views.py Outdated

class SearchDownloadViewSet(BaseDownloadViewSet):
"""
This route sends a request to begin generating a zip file that combines award and transaction data
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
This route sends a request to begin generating a zip file that combines award and transaction data
This route sends a request to begin generating a zip file that combines award, transaction, and subaward data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants