LibraryOfCongress / api.congress.gov

congress.gov API
664 stars 43 forks source link

(bill) sort by `updateDate+desc` returns out of order #231

Open ryparker opened 7 months ago

ryparker commented 7 months ago

The bill list API returns at least one item out of order when requested with the sort=updateDate+desc param.

e.g. Fetch HR bills for 118th congress, with offset of 540

curl --location 'https://api.congress.gov/v3/bill/118/hr?sort=updateDate+desc&offset=540&format=json&api_key=<API_KEY>'

Response:

{
    "bills": [
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-04-18",
                "text": "Received in the Senate."
            },
            "number": "4639",
            "originChamber": "House",
            "originChamberCode": "H",
            "title": "Fourth Amendment Is Not For Sale Act",
            "type": "HR",
            "updateDate": "2024-04-19",
            "updateDateIncludingText": "2024-04-19T12:30:15Z",
            "url": "https://api.congress.gov/v3/bill/118/hr/4639?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-04-09",
                "text": "Referred to the House Committee on Financial Services."
            },
            "number": "7902",
            "originChamber": "House",
            "originChamberCode": "H",
            "title": "Stop Onerous Surcharges Act",
            "type": "HR",
            "updateDate": "2024-04-19",
            "updateDateIncludingText": "2024-04-19T12:08:20Z",
            "url": "https://api.congress.gov/v3/bill/118/hr/7902?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-04-18",
                "text": "Received in the Senate and Read twice and referred to the Committee on Banking, Housing, and Urban Affairs."
            },
            "number": "6323",
            "originChamber": "House",
            "originChamberCode": "H",
            "title": "Iran Counterterrorism Act of 2023",
            "type": "HR",
            "updateDate": "2024-04-20",
            "updateDateIncludingText": "2024-04-20T12:19:28Z",
            "url": "https://api.congress.gov/v3/bill/118/hr/6323?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-04-17",
                "actionTime": "18:12:39",
                "text": "Motion to reconsider laid on the table Agreed to without objection."
            },
            "number": "5947",
            "originChamber": "House",
            "originChamberCode": "H",
            "title": "To provide for the rescission of certain waivers and licenses relating to Iran, and for other purposes.",
            "type": "HR",
            "updateDate": "2024-04-19",
            "updateDateIncludingText": "2024-04-19T12:06:28Z",
            "url": "https://api.congress.gov/v3/bill/118/hr/5947?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-04-17",
                "text": "Referred to the House Committee on Energy and Commerce."
            },
            "number": "8047",
            "originChamber": "House",
            "originChamberCode": "H",
            "title": "To support communities that host transmission lines and to promote conservation and recreation, and for other purposes.",
            "type": "HR",
            "updateDate": "2024-04-19",
            "updateDateIncludingText": "2024-04-19T04:05:43Z",
            "url": "https://api.congress.gov/v3/bill/118/hr/8047?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2023-06-09",
                "text": "Referred to the House Committee on Oversight and Accountability."
            },
            "number": "3970",
            "originChamber": "House",
            "originChamberCode": "H",
            "title": "LGBTQI+ Data Inclusion Act",
            "type": "HR",
            "updateDate": "2024-04-19",
            "updateDateIncludingText": "2024-04-19T04:05:42Z",
            "url": "https://api.congress.gov/v3/bill/118/hr/3970?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-02-12",
                "text": "Referred to the Subcommittee on Water Resources and Environment."
            },
            "number": "7204",
            "originChamber": "House",
            "originChamberCode": "H",
            "title": "Ensure Funding for Our Environment Act",
            "type": "HR",
            "updateDate": "2024-04-19",
            "updateDateIncludingText": "2024-04-19T04:05:42Z",
            "url": "https://api.congress.gov/v3/bill/118/hr/7204?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-04-17",
                "text": "Ordered to be Reported in the Nature of a Substitute (Amended) by the Yeas and Nays: 25 - 17."
            },
            "number": "5179",
            "originChamber": "House",
            "originChamberCode": "H",
            "title": "Anti-BDS Labeling Act",
            "type": "HR",
            "updateDate": "2024-04-19",
            "updateDateIncludingText": "2024-04-19T04:05:42Z",
            "url": "https://api.congress.gov/v3/bill/118/hr/5179?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-04-17",
                "text": "Referred to the Committee on Foreign Affairs, and in addition to the Committee on Financial Services, for a period to be subsequently determined by the Speaker, in each case for consideration of such provisions as fall within the jurisdiction of the committee concerned."
            },
            "number": "8046",
            "originChamber": "House",
            "originChamberCode": "H",
            "title": "To impose sanctions with respect to Rosatom, and for other purposes.",
            "type": "HR",
            "updateDate": "2024-04-19",
            "updateDateIncludingText": "2024-04-19T04:05:41Z",
            "url": "https://api.congress.gov/v3/bill/118/hr/8046?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-04-17",
                "text": "Referred to the House Committee on Foreign Affairs."
            },
            "number": "8043",
            "originChamber": "House",
            "originChamberCode": "H",
            "title": "To impose certain sanctions relating to the People's Republic of China and support for the Russian invasion of Ukraine, and for other purposes.",
            "type": "HR",
            "updateDate": "2024-04-19",
            "updateDateIncludingText": "2024-04-19T04:05:41Z",
            "url": "https://api.congress.gov/v3/bill/118/hr/8043?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2023-03-20",
                "text": "Referred to the Subcommittee on Disability Assistance and Memorial Affairs."
            },
            "number": "1191",
            "originChamber": "House",
            "originChamberCode": "H",
            "title": "Correcting Guam’s History in the PACT Act",
            "type": "HR",
            "updateDate": "2024-04-19",
            "updateDateIncludingText": "2024-04-19T04:05:41Z",
            "url": "https://api.congress.gov/v3/bill/118/hr/1191?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2023-04-06",
                "text": "Referred to the House Committee on Armed Services."
            },
            "number": "2537",
            "originChamber": "House",
            "originChamberCode": "H",
            "title": "BAH Restoration Act",
            "type": "HR",
            "updateDate": "2024-04-19",
            "updateDateIncludingText": "2024-04-19T04:05:41Z",
            "url": "https://api.congress.gov/v3/bill/118/hr/2537?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2023-09-14",
                "text": "Referred to the House Committee on the Judiciary."
            },
            "number": "5488",
            "originChamber": "House",
            "originChamberCode": "H",
            "title": "Protecting Our Courts from Foreign Manipulation Act of 2023",
            "type": "HR",
            "updateDate": "2024-04-19",
            "updateDateIncludingText": "2024-04-19T04:05:41Z",
            "url": "https://api.congress.gov/v3/bill/118/hr/5488?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2023-12-15",
                "text": "Referred to the Subcommittee on Health."
            },
            "number": "6743",
            "originChamber": "House",
            "originChamberCode": "H",
            "title": "WARM Act of 2023",
            "type": "HR",
            "updateDate": "2024-04-19",
            "updateDateIncludingText": "2024-04-19T04:05:41Z",
            "url": "https://api.congress.gov/v3/bill/118/hr/6743?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-04-17",
                "actionTime": "18:05:40",
                "text": "Motion to reconsider laid on the table Agreed to without objection."
            },
            "number": "4691",
            "originChamber": "House",
            "originChamberCode": "H",
            "title": "Iran Sanctions Relief Review Act of 2023",
            "type": "HR",
            "updateDate": "2024-04-19",
            "updateDateIncludingText": "2024-04-19T12:06:26Z",
            "url": "https://api.congress.gov/v3/bill/118/hr/4691?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2023-04-28",
                "text": "Referred to the Committee on the Judiciary, and in addition to the Committee on Oversight and Accountability, for a period to be subsequently determined by the Speaker, in each case for consideration of such provisions as fall within the jurisdiction of the committee concerned."
            },
            "number": "3005",
            "originChamber": "House",
            "originChamberCode": "H",
            "title": "Postal Police Reform Act of 2023",
            "type": "HR",
            "updateDate": "2024-04-19",
            "updateDateIncludingText": "2024-04-19T04:05:40Z",
            "url": "https://api.congress.gov/v3/bill/118/hr/3005?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-04-17",
                "text": "Ordered to be Reported in the Nature of a Substitute (Amended) by the Yeas and Nays: 25 - 17."
            },
            "number": "7986",
            "originChamber": "House",
            "originChamberCode": "H",
            "title": "To modify and reauthorize the Generalized System of Preferences, and for other purposes.",
            "type": "HR",
            "updateDate": "2024-04-19",
            "updateDateIncludingText": "2024-04-19T04:05:40Z",
            "url": "https://api.congress.gov/v3/bill/118/hr/7986?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2023-06-22",
                "text": "Referred to the House Committee on the Judiciary."
            },
            "number": "4285",
            "originChamber": "House",
            "originChamberCode": "H",
            "title": "Protect Vulnerable Immigrant Youth Act",
            "type": "HR",
            "updateDate": "2024-04-19",
            "updateDateIncludingText": "2024-04-19T04:05:40Z",
            "url": "https://api.congress.gov/v3/bill/118/hr/4285?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2023-05-24",
                "text": "Referred to the Committee on Foreign Affairs, and in addition to the Committees on the Judiciary, and Intelligence (Permanent Select), for a period to be subsequently determined by the Speaker, in each case for consideration of such provisions as fall within the jurisdiction of the committee concerned."
            },
            "number": "3654",
            "originChamber": "House",
            "originChamberCode": "H",
            "title": "Transnational Repression Policy Act",
            "type": "HR",
            "updateDate": "2024-04-19",
            "updateDateIncludingText": "2024-04-19T04:05:40Z",
            "url": "https://api.congress.gov/v3/bill/118/hr/3654?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2023-03-28",
                "text": "Referred to the Subcommittee on Economic Development, Public Buildings, and Emergency Management."
            },
            "number": "1814",
            "originChamber": "House",
            "originChamberCode": "H",
            "title": "FIRE STATION Act",
            "type": "HR",
            "updateDate": "2024-04-19",
            "updateDateIncludingText": "2024-04-19T04:05:40Z",
            "url": "https://api.congress.gov/v3/bill/118/hr/1814?format=json"
        }
    ],
    "pagination": {
        "count": 8091,
        "next": "https://api.congress.gov/v3/bill/118/hr?sort=updateDate desc&offset=560&limit=20&format=json",
        "prev": "https://api.congress.gov/v3/bill/118/hr?sort=updateDate desc&offset=520&limit=20&format=json"
    },
    "request": {
        "billType": "hr",
        "congress": "118",
        "contentType": "application/json",
        "format": "json"
    }
}

Notice HR6323 has an updateDate of 2024-04-20 and is sorted between two items with an updateDate of 2024-04-19

{
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-04-09",
                "text": "Referred to the House Committee on Financial Services."
            },
            "number": "7902",
            "originChamber": "House",
            "originChamberCode": "H",
            "title": "Stop Onerous Surcharges Act",
            "type": "HR",
            "updateDate": "2024-04-19",
            "updateDateIncludingText": "2024-04-19T12:08:20Z",
            "url": "https://api.congress.gov/v3/bill/118/hr/7902?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-04-18",
                "text": "Received in the Senate and Read twice and referred to the Committee on Banking, Housing, and Urban Affairs."
            },
            "number": "6323",
            "originChamber": "House",
            "originChamberCode": "H",
            "title": "Iran Counterterrorism Act of 2023",
            "type": "HR",
            "updateDate": "2024-04-20",
            "updateDateIncludingText": "2024-04-20T12:19:28Z",
            "url": "https://api.congress.gov/v3/bill/118/hr/6323?format=json"
        },
        {
            "congress": 118,
            "latestAction": {
                "actionDate": "2024-04-17",
                "actionTime": "18:12:39",
                "text": "Motion to reconsider laid on the table Agreed to without objection."
            },
            "number": "5947",
            "originChamber": "House",
            "originChamberCode": "H",
            "title": "To provide for the rescission of certain waivers and licenses relating to Iran, and for other purposes.",
            "type": "HR",
            "updateDate": "2024-04-19",
            "updateDateIncludingText": "2024-04-19T12:06:28Z",
            "url": "https://api.congress.gov/v3/bill/118/hr/5947?format=json"
        },
apreiter18 commented 7 months ago

Thanks @ryparker - we are investigating. Please check the change log for any updates. Thanks for reporting this!

ryparker commented 7 months ago

Thanks!