|
1250 | 1250 | } |
1251 | 1251 |
|
1252 | 1252 | # Subaward (prime/sub awards) |
1253 | | -SUBAWARD_SCHEMA: dict[str, FieldSchema] = { |
| 1253 | +# |
| 1254 | +# Mirrors awards.serializers.subawards.SubawardSerializer on the server. The |
| 1255 | +# top-level field list is the canonical `Meta.fields` plus the denormalized |
| 1256 | +# lookup fields the API exposes for filter parity (prime_awardee_*, |
| 1257 | +# recipient_*, usaspending_permalink). Expandable objects are modeled with |
| 1258 | +# `nested_model` so callers can request, e.g. `awarding_office(office_code)`. |
| 1259 | + |
| 1260 | +# `subaward_details` payload (action_date, amount, fiscal_year, ...). |
| 1261 | +SUBAWARD_DETAILS_SCHEMA: dict[str, FieldSchema] = { |
| 1262 | + "action_date": FieldSchema(name="action_date", type=date, is_optional=True, is_list=False), |
| 1263 | + "amount": FieldSchema(name="amount", type=Decimal, is_optional=True, is_list=False), |
| 1264 | + "description": FieldSchema(name="description", type=str, is_optional=True, is_list=False), |
| 1265 | + "fiscal_year": FieldSchema(name="fiscal_year", type=int, is_optional=True, is_list=False), |
| 1266 | + "number": FieldSchema(name="number", type=str, is_optional=True, is_list=False), |
| 1267 | + "type": FieldSchema(name="type", type=str, is_optional=True, is_list=False), |
| 1268 | +} |
| 1269 | + |
| 1270 | +# `fsrs_details` payload — provenance for the underlying FSRS submission. |
| 1271 | +FSRS_DETAILS_SCHEMA: dict[str, FieldSchema] = { |
1254 | 1272 | "id": FieldSchema(name="id", type=str, is_optional=True, is_list=False), |
1255 | | - "award_key": FieldSchema(name="award_key", type=str, is_optional=True, is_list=False), |
| 1273 | + "last_modified_date": FieldSchema( |
| 1274 | + name="last_modified_date", type=date, is_optional=True, is_list=False |
| 1275 | + ), |
| 1276 | + "month": FieldSchema(name="month", type=int, is_optional=True, is_list=False), |
| 1277 | + "year": FieldSchema(name="year", type=int, is_optional=True, is_list=False), |
| 1278 | +} |
| 1279 | + |
| 1280 | +# Subaward-specific place_of_performance — flat 4-key payload (city/state/zip/ |
| 1281 | +# country_code), distinct from the richer PLACE_OF_PERFORMANCE_SCHEMA used by |
| 1282 | +# contracts/IDVs/vehicles. |
| 1283 | +SUBAWARD_PLACE_OF_PERFORMANCE_SCHEMA: dict[str, FieldSchema] = { |
| 1284 | + "city": FieldSchema(name="city", type=str, is_optional=True, is_list=False), |
| 1285 | + "country_code": FieldSchema(name="country_code", type=str, is_optional=True, is_list=False), |
| 1286 | + "state": FieldSchema(name="state", type=str, is_optional=True, is_list=False), |
| 1287 | + "zip": FieldSchema(name="zip", type=str, is_optional=True, is_list=False), |
| 1288 | +} |
| 1289 | + |
| 1290 | +# `highly_compensated_officers` element shape (list-of-dict expansion). |
| 1291 | +HIGHLY_COMPENSATED_OFFICER_SCHEMA: dict[str, FieldSchema] = { |
1256 | 1292 | "amount": FieldSchema(name="amount", type=Decimal, is_optional=True, is_list=False), |
| 1293 | + "name": FieldSchema(name="name", type=str, is_optional=True, is_list=False), |
| 1294 | +} |
| 1295 | + |
| 1296 | +SUBAWARD_SCHEMA: dict[str, FieldSchema] = { |
| 1297 | + # Core identifiers |
| 1298 | + "key": FieldSchema(name="key", type=str, is_optional=True, is_list=False), |
| 1299 | + "award_key": FieldSchema(name="award_key", type=str, is_optional=True, is_list=False), |
| 1300 | + "piid": FieldSchema(name="piid", type=str, is_optional=True, is_list=False), |
| 1301 | + "usaspending_permalink": FieldSchema( |
| 1302 | + name="usaspending_permalink", type=str, is_optional=True, is_list=False |
| 1303 | + ), |
| 1304 | + # Denormalized prime-awardee lookup fields (mirrored from prime_awardee_uei) |
| 1305 | + "prime_awardee_name": FieldSchema( |
| 1306 | + name="prime_awardee_name", type=str, is_optional=True, is_list=False |
| 1307 | + ), |
| 1308 | + "prime_awardee_uei": FieldSchema( |
| 1309 | + name="prime_awardee_uei", type=str, is_optional=True, is_list=False |
| 1310 | + ), |
| 1311 | + # Denormalized subaward-recipient lookup fields (mirrored from recipient_uei) |
| 1312 | + "recipient_business_types": FieldSchema( |
| 1313 | + name="recipient_business_types", type=str, is_optional=True, is_list=True |
| 1314 | + ), |
| 1315 | + "recipient_dba_name": FieldSchema( |
| 1316 | + name="recipient_dba_name", type=str, is_optional=True, is_list=False |
| 1317 | + ), |
| 1318 | + "recipient_duns": FieldSchema( |
| 1319 | + name="recipient_duns", type=str, is_optional=True, is_list=False |
| 1320 | + ), |
| 1321 | + "recipient_name": FieldSchema( |
| 1322 | + name="recipient_name", type=str, is_optional=True, is_list=False |
| 1323 | + ), |
| 1324 | + "recipient_parent_duns": FieldSchema( |
| 1325 | + name="recipient_parent_duns", type=str, is_optional=True, is_list=False |
| 1326 | + ), |
| 1327 | + "recipient_parent_name": FieldSchema( |
| 1328 | + name="recipient_parent_name", type=str, is_optional=True, is_list=False |
| 1329 | + ), |
| 1330 | + "recipient_parent_uei": FieldSchema( |
| 1331 | + name="recipient_parent_uei", type=str, is_optional=True, is_list=False |
| 1332 | + ), |
| 1333 | + "recipient_uei": FieldSchema( |
| 1334 | + name="recipient_uei", type=str, is_optional=True, is_list=False |
| 1335 | + ), |
| 1336 | + # Expandable nested objects |
| 1337 | + "awarding_office": FieldSchema( |
| 1338 | + name="awarding_office", |
| 1339 | + type=dict, |
| 1340 | + is_optional=True, |
| 1341 | + is_list=False, |
| 1342 | + nested_model="AwardOffice", |
| 1343 | + ), |
| 1344 | + "funding_office": FieldSchema( |
| 1345 | + name="funding_office", |
| 1346 | + type=dict, |
| 1347 | + is_optional=True, |
| 1348 | + is_list=False, |
| 1349 | + nested_model="AwardOffice", |
| 1350 | + ), |
| 1351 | + "fsrs_details": FieldSchema( |
| 1352 | + name="fsrs_details", |
| 1353 | + type=dict, |
| 1354 | + is_optional=True, |
| 1355 | + is_list=False, |
| 1356 | + nested_model="FsrsDetails", |
| 1357 | + ), |
| 1358 | + "highly_compensated_officers": FieldSchema( |
| 1359 | + name="highly_compensated_officers", |
| 1360 | + type=list, |
| 1361 | + is_optional=True, |
| 1362 | + is_list=True, |
| 1363 | + nested_model="HighlyCompensatedOfficer", |
| 1364 | + ), |
| 1365 | + "place_of_performance": FieldSchema( |
| 1366 | + name="place_of_performance", |
| 1367 | + type=dict, |
| 1368 | + is_optional=True, |
| 1369 | + is_list=False, |
| 1370 | + nested_model="SubawardPlaceOfPerformance", |
| 1371 | + ), |
1257 | 1372 | "prime_recipient": FieldSchema( |
1258 | 1373 | name="prime_recipient", |
1259 | 1374 | type=dict, |
1260 | 1375 | is_optional=True, |
1261 | 1376 | is_list=False, |
1262 | 1377 | nested_model="RecipientProfile", |
1263 | 1378 | ), |
| 1379 | + "subaward_details": FieldSchema( |
| 1380 | + name="subaward_details", |
| 1381 | + type=dict, |
| 1382 | + is_optional=True, |
| 1383 | + is_list=False, |
| 1384 | + nested_model="SubawardDetails", |
| 1385 | + ), |
1264 | 1386 | "subaward_recipient": FieldSchema( |
1265 | 1387 | name="subaward_recipient", |
1266 | 1388 | type=dict, |
|
1403 | 1525 | "OTA": OTA_SCHEMA, |
1404 | 1526 | "OTIDV": OTIDV_SCHEMA, |
1405 | 1527 | "Subaward": SUBAWARD_SCHEMA, |
| 1528 | + "SubawardDetails": SUBAWARD_DETAILS_SCHEMA, |
| 1529 | + "FsrsDetails": FSRS_DETAILS_SCHEMA, |
| 1530 | + "SubawardPlaceOfPerformance": SUBAWARD_PLACE_OF_PERFORMANCE_SCHEMA, |
| 1531 | + "HighlyCompensatedOfficer": HIGHLY_COMPENSATED_OFFICER_SCHEMA, |
1406 | 1532 | # GSA eLibrary |
1407 | 1533 | "GsaElibraryContract": GSA_ELIBRARY_CONTRACT_SCHEMA, |
1408 | 1534 | "GsaElibraryIdvRef": GSA_ELIBRARY_IDV_REF_SCHEMA, |
|
0 commit comments