API Documentation
The current functionality is limited to utilities related to the FAR, UEI, and USASpending.gov.
- class procurement_tools.FAR
Utilities for accessing the Federal Acquisition Regulation.
Current functionality is limited to looking up a section or a subpart, but it may eventually do other things. One cool thing is that now you can programmatically access a FAR section as a dict/in json.
Typical usage:
from procurement_tools import FAR FAR.get_section("17.502-1")
Note that the source of FAR data comes from https://github.com/gsa/GSA-Acquisition-FAR/.
- classmethod get_section(section_number: str) Clause
Lookup a FAR section.
- Parameters:
section_number – A FAR section number (e.g., “17.502-1”)
- Returns:
A FAR Clause.
- classmethod get_subpart(subpart_number: str) Subpart
Lookup a FAR subpart.
- Parameters:
subpart_number – A FAR subpart number (e.g. “17.5”).
- Returns:
A FAR Subpart.
- class procurement_tools.PeriodicTable
Utilities using the FAI Periodic Table of Acquisition Innovation.
Typical usage:
from procurement_tools import PeriodicTable PeriodicTable.get_random_innovation()
- classmethod get_random_innovation() dict
Gets a random innovation from the Table.
- Returns:
A dict with an innovation.
- class procurement_tools.SAM
A class representing SAM.gov’s entity and search capabilities
Typical usage:
from procurement_tools import SAM res = SAM.get_opportunities({"q":"Agile"}) opportunity = res.get_api_opportunity_by_id(res["opportunitiesData"][0]["noticeId"])
- get_api_opportunities() dict
Get a JSON of an opportunity from the SAM API.
Typical usage:
from procurement_tools import SAM res = SAM.get_api_opportunities({"postedFrom":"12/14/2023", "postedTo": "12/14/2023", "limit": 1000})
- Parameters:
params – A dict for the request parameters to the SAM API. As currently implemented, we use APIOpportunitiesRequestParams to check whether the parameters are valid.
- Returns:
A dict
- get_api_opportunity_by_id() dict
Get a JSON of a specific opportunity from the SAM API.
Typical usage:
from procurement_tools import SAM res = SAM.get_api_opportunity_by_id("f2483be142e64eeabcc5fba2f8992251")
- Parameters:
notice_id – The SAM notice unique identifier.
- Returns:
A dict
- get_entity() Entity
Get a pydantic model of an Entity from the SAM API.
Typical usage:
from procurement_tools import SAM res = SAM.get_entity({ueiSAM:"XRVFU3YRA2U5"})
- Parameters:
params – A dict for the request parameters to the SAM API. As currently implemented, we use EntityRequestParams to check whether the parameters are valid. This is limited to ueiSAM and includeSections
- Returns:
A pydantic Entity modle
- get_opportunities() dict
Get a list of opportunities from SAM.gov using keyword search.
Typical usage:
from procurement_tools import SAM res = SAM.get_opportunities({"q":"Agile"})
- Parameters:
params – A dict that includes a query (e.g., {“q”:”Agile”}) and optionally other search parameters.
- Returns:
A dict of the search results
- class procurement_tools.SBIR
Utilities for accessing information about SBIRs.
Typical usage:
from procurement_tools import SBIR SBIR.get_solicitations(keyword="water")
- classmethod get_awards(agency: str = None, company: str = None, year: int = None, research_institution: str = None) AwardList
Get awards from the SBIR API
- Parameters:
agency – the department/agency of record (e.g., “HHS”)
company – the company name to look up
year – the year of the award (e.g., 2023)
research_institution – the Research Institution (if any). E.g., (“California Institute of Technology)
- Returns:
A list of Firm pydantic models
- classmethod get_solicitations(keyword: str = None, agency: str = None, open: int = 1) SolicitationList
Get solicitations from the SBIR API
- Parameters:
keyword – a keyword to look up in the solicitation
agency – the department/agency of record
open – 1 or 0 (defaults to open)
- Returns:
A list of Solicitation pydantic models
- class procurement_tools.UEI
Utilities for working with Unique Entity Identifiers (UEIs).
Current functionality is limited to validating a UEI.
Typical usage:
from procurement_tools import UEI UEI.is_valid("J7M9HPTGJ1S9")
- classmethod is_valid(uei: str) bool
Checks validity of a UEI
This implements the UEI standard described here: https://www.gsa.gov/about-us/organization/federal-acquisition-service/technology-transformation-services/integrated-award-environment-iae/iae-systems-information-kit/uei-technical-specifications-and-api-information Credit to GSA TTS’s original implementation here: https://github.com/GSA-TTS/uei-js
- Parameters:
uei – A UEI (e.g., “J7M9HPTGJ1S9”)
- Returns:
True or False.
- class procurement_tools.USASpending
Utilities for working with USASpending.gov.
Current functionality is limited to converting a UEI to a USASpending.gov recipient profile hash and getting an entity’s URL from a URL.
Typical usage:
from procurement_tools import USASpending USASpending.convert_uei_to_hash("J7M9HPTGJ1S9")
- classmethod convert_uei_to_hash(uei: str, level: str = 'P') str
Convert a UEI into a Hash for USASpending.gov
- Parameters:
uei – A UEI for conversion
level – The entity level (i.e., a Parent “P” or a Child “C”). Defaults to Parent.
- Returns:
The USASpending recipient hash
- classmethod get_latest_recipient_awards(uei: str) dict
Gets the most recent 10 awards within the last 90 days from USASpending’s spending by award API endpoint.
- Parameters:
uei – The entity’s UEI
- Returns:
The USASpending.gov awards data
- classmethod get_recipient_profile(uei: str, level: str = 'P', year: int = None) dict
Gets a recipient profile from USASpending’s recipient API endpoint.
- Parameters:
uei – The entity’s UEI
level – The entity level (i.e., a Parent “P” or a Child “C”). Defaults to Parent.
- Returns:
The USASpending.gov recipient profile page data
- classmethod get_usaspending_URL(uei: str, level: str = 'P') str
Gets a USASpending.gov URL for an entity
- Parameters:
uei – The entity’s UEI
level – The entity level (i.e., a Parent “P” or a Child “C”). Defaults to Parent.
- Returns:
The USASpending.gov URL