72 |
73 |

pyfpds

74 |

pyfpds is a basic python wrapper for accessing federal contracting data in the Federal Procurement Data System (FPDS). The only programmatic access to this data is via an ATOM feed that limits each request to 10 records. This can be quite frustrating if you want more than 10 records! This library will grab up to any number of records requested (the default being 100) and compile them into one data structure. Subsequently, the performance is not exemplary, as much of the processing time is spent in http transport. However, if you have the time, it makes life a bit easier :). Additionally, the ATOM feed does not support sorting. If you want to get complete data sorted by a field, you essentially have to pull down all records and sort them in python.

75 |

This project was created to assist with ETL tasks that are part of the Mirage project. If you have suggestions for features, open an issue, or consider contributing to the project yourself (see CONTRIBUTING).

76 |

Requirements

77 |

This project supports python 2.7+. To install the dependencies, use pip: 78 | pip install -r requirements.txt

79 | 80 | 86 |

Usage

87 |

The Contracts object can be used to fetch records filtered by several attributes using keyword arguments. The result returned is a list of OrderedDict objects.

88 |

Example:

89 |
from pyfpds import Contracts
 90 | 
 91 | c = Contracts()
 92 | 
 93 | #filter by a specific contract ID number
 94 | records = c.get(piid="FA865014M5002")
 95 | 
 96 | r = records[0]['content']['award']
 97 | 
 98 | #pretty print the first record
 99 | c.pretty_print(r)
100 | 
101 | 102 |

Possible Keyword Arguments:

103 |
    piid
104 |     idv_piid
105 |     idv_agency_id
106 |     modification_number     
107 |     contracting_agency_id     
108 |     contracting_agency_name
109 |     contracting_office_id
110 |     contracting_office_name
111 |     funding_agency_id
112 |     funding_office_id
113 |     funding_office_name
114 |     agency_code
115 |     agency_name
116 |     department_id
117 |     department_name
118 | 
119 |     last_modified_date
120 |     last_modified_by
121 |     award_completion_date
122 |     created_on
123 |     date_signed
124 |     effective_date
125 |     estimated_completion_date
126 | 
127 |     obligated_amount
128 |     ultimate_contract_value
129 |     contract_pricing_type
130 | 
131 |     award_status
132 |     contract_type
133 |     created_by
134 |     description
135 |     modification_reason
136 |     legislative_mandates
137 |     local_area_setaside
138 |     socioeconomic_indicators
139 |     multiyear_contract
140 |     national_interest_code
141 |     national_interest_description
142 | 
143 |     naics_code
144 |     naics_description
145 |     product_or_service_code
146 |     product_or_service_description
147 | 
148 |     place_of_performance_district
149 |     place_of_performance_country
150 |     place_of_performance_state
151 | 
152 |     vendor_city
153 |     vendor_district
154 |     vendor_country_code
155 |     vendor_country_name
156 |     vendor_duns
157 |     vendor_dba_name
158 |     vendor_name
159 |     vendor_state_code
160 |     vendor_state_name
161 |     vendor_zip
162 | 
163 |     piid
164 |     idv_piid
165 |     idv_agency_id
166 |     modification_number
167 | 
168 |     contracting_agency_id
169 |     contracting_agency_name 
170 |     contracting_office_id
171 |     contracting_office_name
172 |     funding_agency_id
173 |     funding_office_id
174 |     funding_office_name
175 |     agency_code
176 |     agency_name
177 |     department_id
178 |     department_name
179 | 
180 |     last_modified_date
181 |     last_modified_by
182 |     award_completion_date
183 |     created_on
184 |     date_signed
185 |     effective_date
186 |     estimated_completion_date
187 | 
188 |     obligated_amount
189 |     ultimate_contract_value
190 |     contract_pricing_type
191 | 
192 |     award_status
193 |     contract_type
194 |     created_by
195 |     description
196 |     modification_reason
197 |     legislative_mandates
198 |     local_area_setaside
199 |     socioeconomic_indicators
200 |     multiyear_contract
201 |     national_interest_code
202 |     national_interest_description
203 | 
204 |     naics_code
205 |     naics_description
206 |     product_or_service_code
207 |     product_or_service_description
208 | 
209 |     place_of_performance_district
210 |     place_of_performance_country
211 |     place_of_performance_state
212 | 
213 |     vendor_city
214 |     vendor_district
215 |     vendor_country_code
216 |     vendor_country_name
217 |     vendor_duns
218 |     vendor_dba_name
219 |     vendor_name
220 |     vendor_state_code
221 |     vendor_state_name
222 |     vendor_zip
223 | 
224 | 225 |

To find valid values for these arguments, please see the FPDS Data Dictionary which enumerates valid values for each attribute name.

226 | 227 |
228 |