Skip to content
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

/api/v2/subawards/ broken pagination #4165

Open
Ech0riginal opened this issue Aug 19, 2024 · 1 comment
Open

/api/v2/subawards/ broken pagination #4165

Ech0riginal opened this issue Aug 19, 2024 · 1 comment

Comments

@Ech0riginal
Copy link

This endpoint does not paginate as purported, always returning the first ten results in the database. The award_id field detailed here is not respected in regards to queries sent to the db, seemingly.

Example:

curl 'https://api.usaspending.gov/api/v2/subawards/' -X POST -H 'Accept: application/json' -H 'Content-Type: application/x-www-form-urlencoded' -d '{
           "page": 2,
           "limit": 10,
           "sort": "subaward_number",
           "order": "asc",
           "award_id": "0017"         
         }'
{
  "page_metadata": {
    "page": 1,
    "next": 2,
    "previous": null,
    "hasNext": true,
    "hasPrevious": false
  },
  "results": [
    {
      "id": 148401622,
      "subaward_number": "\u00a0\u00a0DLPH050233",
      "description": "PAINT ABATEMENT \u00a0LABOR",
      "action_date": "2017-04-20",
      "amount": 52260.0,
      "recipient_name": "IMIA, LLC"
    },
    {
      "id": 154994152,
      "subaward_number": "\u00a0MAKSPH-001-18",
      "description": "SUPPORTED THE SCALING OFF-GRID ENERGY (SOGE) OFF-GRID SOLAR HOME SYSTEMS AND STORAGE TECHNOLOGY MARKET ASSESSMENTS",
      "action_date": "2018-06-01",
      "amount": 72025.0,
      "recipient_name": "REGENTS OF THE UNIVERSITY OF CALIFORNIA, THE"
    },
    {
      "id": 148595490,
      "subaward_number": "\u00a0DLPH050607",
      "description": "SCAFFFOLDING",
      "action_date": "2017-05-09",
      "amount": 32493.0,
      "recipient_name": "TURN KEY SCAFFOLD LLC"
    },
    {
      "id": 149488398,
      "subaward_number": "\u00a0DLPH050232",
      "description": "CONTROLS ENGINEER - LABOR",
      "action_date": "2017-04-17",
      "amount": 49035.2,
      "recipient_name": "AEROTEK AFFILIATED SERVICES, INC."
    },
    {
      "id": 152602401,
      "subaward_number": "\u00a0ASUB00000454",
      "description": "PREPARING RESEARCHERS IN EARLY INTERVENTION FOR CHILDREN WITH DISABILITIES FROM MULTICULTURAL ENVIRONMENTS",
      "action_date": "2020-01-14",
      "amount": 234778.0,
      "recipient_name": "UNIVERSITY OF ARIZONA"
    },
    {
      "id": 149918994,
      "subaward_number": "ZZEMSP02",
      "description": "TO PROVIDE FINANCIAL ASSISTANCE IN MEETING THE TRANSPORTATION NEEDS OF SENIORS AND INDIVIDUALS WITH DISABILITIES WHERE PUBLIC TRANSPORTATION SERVICES ARE UNAVAILABLE, INSUFFICIENT OR INAPPROPRIATE. THE SECTION 5310 PROGRAM IS DESIGNED TO SUPPLEMENT FTA'S OTHER CAPITAL ASSISTANCE PROGRAMS BY FUNDING TRANSPORTATION PROJECTS FOR SENIORS AND INDIVIDUALS WITH DISABILITIES IN ALL AREAS - URBANIZED, SMALL URBAN, AND RURAL. THE PROGRAM INCLUDES NEW FREEDOM PROGRAM ACTIVITIES AS ELIGIBLE PROJECTS.",
      "action_date": "2021-09-23",
      "amount": 54115.0,
      "recipient_name": "EAST TENNESSEE HUMAN RESOURCE AGENCY, INC."
    },
    {
      "id": 151427852,
      "subaward_number": "ZZ8-K45",
      "description": "SUPPORT THE OBJECTIVES AND DELIVERABLES OF DE-FE0032131. THE FRONT END ENGINEERING DESIGN STUDY AND PUBLIC POLICY CONSIDERATIONS",
      "action_date": "2022-02-11",
      "amount": 228913.0,
      "recipient_name": "SOUTHERN COMPANY SERVICES, INC."
    },
    {
      "id": 150144222,
      "subaward_number": "ZZ-42-580",
      "description": "CAREER AND TECHNICAL EDUCATION -- BASIC GRANTS",
      "action_date": "2012-07-01",
      "amount": 19245.0,
      "recipient_name": "MARION COUNTY SCHOOL DISTRICT"
    },
    {
      "id": 150236946,
      "subaward_number": "ZZ2THS144",
      "description": "ENFORCEMENT OF TN DUI LAWS",
      "action_date": "2022-01-14",
      "amount": 36600.0,
      "recipient_name": "CITY OF JOHNSON CITY"
    },
    {
      "id": 150029039,
      "subaward_number": "ZZ2THS005",
      "description": "CHOICES MATTER",
      "action_date": "2021-12-29",
      "amount": 50000.0,
      "recipient_name": "ALLIANCE SPORT MARKETING LLC"
    }
  ]
}
curl 'https://api.usaspending.gov/api/v2/subawards/' -X POST -H 'Accept: application/json' -H 'Content-Type: application/x-www-form-urlencoded' -d '{
           "page": 2,
           "limit": 10,
           "sort": "subaward_number",
           "order": "asc",
           "award_id": "666666"
         }'

Returns:

{
  "page_metadata": {
    "page": 1,
    "next": 2,
    "previous": null,
    "hasNext": true,
    "hasPrevious": false
  },
  "results": [
    {
      "id": 148401622,
      "subaward_number": "\u00a0\u00a0DLPH050233",
      "description": "PAINT ABATEMENT \u00a0LABOR",
      "action_date": "2017-04-20",
      "amount": 52260.0,
      "recipient_name": "IMIA, LLC"
    },
    {
      "id": 154994152,
      "subaward_number": "\u00a0MAKSPH-001-18",
      "description": "SUPPORTED THE SCALING OFF-GRID ENERGY (SOGE) OFF-GRID SOLAR HOME SYSTEMS AND STORAGE TECHNOLOGY MARKET ASSESSMENTS",
      "action_date": "2018-06-01",
      "amount": 72025.0,
      "recipient_name": "REGENTS OF THE UNIVERSITY OF CALIFORNIA, THE"
    },
    {
      "id": 148595490,
      "subaward_number": "\u00a0DLPH050607",
      "description": "SCAFFFOLDING",
      "action_date": "2017-05-09",
      "amount": 32493.0,
      "recipient_name": "TURN KEY SCAFFOLD LLC"
    },
    {
      "id": 149488398,
      "subaward_number": "\u00a0DLPH050232",
      "description": "CONTROLS ENGINEER - LABOR",
      "action_date": "2017-04-17",
      "amount": 49035.2,
      "recipient_name": "AEROTEK AFFILIATED SERVICES, INC."
    },
    {
      "id": 152602401,
      "subaward_number": "\u00a0ASUB00000454",
      "description": "PREPARING RESEARCHERS IN EARLY INTERVENTION FOR CHILDREN WITH DISABILITIES FROM MULTICULTURAL ENVIRONMENTS",
      "action_date": "2020-01-14",
      "amount": 234778.0,
      "recipient_name": "UNIVERSITY OF ARIZONA"
    },
    {
      "id": 149918994,
      "subaward_number": "ZZEMSP02",
      "description": "TO PROVIDE FINANCIAL ASSISTANCE IN MEETING THE TRANSPORTATION NEEDS OF SENIORS AND INDIVIDUALS WITH DISABILITIES WHERE PUBLIC TRANSPORTATION SERVICES ARE UNAVAILABLE, INSUFFICIENT OR INAPPROPRIATE. THE SECTION 5310 PROGRAM IS DESIGNED TO SUPPLEMENT FTA'S OTHER CAPITAL ASSISTANCE PROGRAMS BY FUNDING TRANSPORTATION PROJECTS FOR SENIORS AND INDIVIDUALS WITH DISABILITIES IN ALL AREAS - URBANIZED, SMALL URBAN, AND RURAL. THE PROGRAM INCLUDES NEW FREEDOM PROGRAM ACTIVITIES AS ELIGIBLE PROJECTS.",
      "action_date": "2021-09-23",
      "amount": 54115.0,
      "recipient_name": "EAST TENNESSEE HUMAN RESOURCE AGENCY, INC."
    },
    {
      "id": 151427852,
      "subaward_number": "ZZ8-K45",
      "description": "SUPPORT THE OBJECTIVES AND DELIVERABLES OF DE-FE0032131. THE FRONT END ENGINEERING DESIGN STUDY AND PUBLIC POLICY CONSIDERATIONS",
      "action_date": "2022-02-11",
      "amount": 228913.0,
      "recipient_name": "SOUTHERN COMPANY SERVICES, INC."
    },
    {
      "id": 150144222,
      "subaward_number": "ZZ-42-580",
      "description": "CAREER AND TECHNICAL EDUCATION -- BASIC GRANTS",
      "action_date": "2012-07-01",
      "amount": 19245.0,
      "recipient_name": "MARION COUNTY SCHOOL DISTRICT"
    },
    {
      "id": 150236946,
      "subaward_number": "ZZ2THS144",
      "description": "ENFORCEMENT OF TN DUI LAWS",
      "action_date": "2022-01-14",
      "amount": 36600.0,
      "recipient_name": "CITY OF JOHNSON CITY"
    },
    {
      "id": 150029039,
      "subaward_number": "ZZ2THS005",
      "description": "CHOICES MATTER",
      "action_date": "2021-12-29",
      "amount": 50000.0,
      "recipient_name": "ALLIANCE SPORT MARKETING LLC"
    }
  ]
}
@collinwr
Copy link
Contributor

I'm unable to reproduce this issue. When I use the request bodies you supplied, I'm not actually getting any results, so I'm not exactly sure where the disconnect is there.

You are passing in an award_id of "0017". Here's the description of that request field in the API contract.

Either a "generated" natural award id (string) or a database surrogate award id (number). Generated award identifiers are preferred as they are effectively permanent. Surrogate award ids are retained for backward compatibility but are deprecated.

Because you're passing in "0017" as a string, we attempt to filter on unique_award_key, and no such key exists. I tried using the endpoint with valid unique_award_key (string) and award_id (integers), and the results match what we have in the database.

Please let me know if this helps and if you have any follow up questions.

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

No branches or pull requests

2 participants